This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
s := []string{3: "no error", 4: "Eio", 7: "invalid argument"} | |
fmt.Printf("%q", s) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis | |
import itertools | |
import random | |
# acquire redis client | |
r = redis.StrictRedis(host='dev.co', port=21845, db=0) | |
# emulate source |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
usage_error () { | |
echo 'Usage: sh migrator.sh <path to sqlite_to_postgres.py> <path to sqlite db file> <an empty dir to output dump files>' | |
echo | |
echo 'Example:' | |
echo '>sh migrator.sh sqlite_to_postgres.py ~/reviewboard.db /tmp/dumps' | |
echo | |
echo 'Tested on:' | |
echo 'Python 2.7.3' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS raw_dump ( | |
ID BIGSERIAL PRIMARY KEY NOT NULL, | |
UID INT NOT NULL, | |
ONLINE BOOLEAN NOT NULL, | |
FIRST_NAME VARCHAR(50) CONSTRAINT raw_dump_first_name_check CHECK (FIRST_NAME <> '') NOT NULL, | |
LAST_NAME VARCHAR(50) CONSTRAINT raw_dump_last_name_check CHECK (LAST_NAME <> '') NOT NULL, | |
GENDER INT CONSTRAINT raw_dump_gender_check CHECK (GENDER IN (1, 2)) NOT NULL, | |
DATETIME TIMESTAMP NOT NULL | |
); |