Skip to content

Instantly share code, notes, and snippets.

@advincze
advincze / docker-postgres.md
Created January 22, 2019 14:59
docker postgres

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
@advincze
advincze / Makefile
Created December 7, 2018 10:30
pipenv airlfow
init:
pip install --upgrade pip
pip install pipenv
install:
SLUGIFY_USES_TEXT_UNIDECODE=yes pipenv -v install
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 December 5, 2016 13:32
compare the bias of pearson and fnv hashes on bytes
package main
import (
"fmt"
"hash/fnv"
"testing"
"math/rand"
"time"
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
}

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:

#!/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
@advincze
advincze / raffle.go
Created June 7, 2016 03:25
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 January 13, 2016 07:28
unmarshal full subtree as element
package main
import (
"bytes"
"encoding/xml"
"io"
"log"
"testing"
)
,_---~~~~~----._
_,,_,*^____ _____``*g*\"*,
/ __/ /' ^. / \ ^@q f
[ @f | @)) | | @)) l 0 _/
\`/ \~____ / __ \_____/ \
| _l__l_ I
} [______] I
] | | | |
] ~ ~ |
| |