Skip to content

Instantly share code, notes, and snippets.

View docker-postgres.md

run postgres in docker

docker run -it --rm --name pg -e POSTGRES_PASSWORD=pgp -e POSTGRES_USER=pgu -e POSTGRES_DB=pgdb -p 5432:5432 postgres

connect to postgres from psql:

PGPASSWORD=pgp psql --dbname pgdb --host=localhost --username=pgu
View Makefile
init:
pip install --upgrade pip
pip install pipenv
install:
SLUGIFY_USES_TEXT_UNIDECODE=yes pipenv -v install
View aws_sts.sh
ROLE_NAME=arn:aws:iam::123456789123:role/my_role_to_assume
AWS=$(aws sts assume-role --role-arn $ROLE_NAME --role-session-name foo --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' --output text | awk '{print "AWS_ACCESS_KEY_ID=" $1,"AWS_SECRET_ACCESS_KEY=" $2, "AWS_SESSION_TOKEN=" $3}')
env -S $AWS aws s3 ls
@advincze
advincze / compare_pearson_fnv_hash.go
Created Dec 5, 2016
compare the bias of pearson and fnv hashes on bytes
View compare_pearson_fnv_hash.go
package main
import (
"fmt"
"hash/fnv"
"testing"
"math/rand"
"time"
View pearson.go
func pearson(msg, iv []byte, bytecount int) []byte {
var h byte
hh := make([]byte, bytecount)
for j := 0; j < bytecount; j++ {
h = iv[(int(msg[0])+j)%256]
for i := 1; i < len(msg); i++ {
h = iv[h^msg[i]]
}
hh[j] = h
}
View keybase.md

Keybase proof

I hereby claim:

  • I am advincze on github.
  • I am advincze (https://keybase.io/advincze) on keybase.
  • I have a public key whose fingerprint is D1A3 6CAB C057 47E7 8453 C502 CBDF BE2C 2627 AE2E

To claim this, I am signing this object:

View terraformw
#!/bin/bash
#set -e
TERRAFORM_CMD="terraform"
TERRAFORM_VERSION="0.6.16" #"0.7.0-rc2"
if [ -z ${TERRAFORM_BIN_PATH+x} ]; then
TERRAFORM_BIN_PATH="$HOME/.terraform";
fi
View raffle.go
package main
import "fmt"
import "math/rand"
import "time"
func init() {
rand.Seed(time.Now().Unix())
}
@advincze
advincze / main_test.go
Last active Jan 13, 2016
unmarshal full subtree as element
View main_test.go
package main
import (
"bytes"
"encoding/xml"
"io"
"log"
"testing"
)
View gist:a1b8d460868d6a045bb0
,_---~~~~~----._
_,,_,*^____ _____``*g*\"*,
/ __/ /' ^. / \ ^@q f
[ @f | @)) | | @)) l 0 _/
\`/ \~____ / __ \_____/ \
| _l__l_ I
} [______] I
] | | | |
] ~ ~ |
| |