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/bash | |
# | |
# Source this to append the LD_FLAGS var with magic to set version info. | |
# | |
# Export GITCOMMIT and BUILDDATE to override the autodetection | |
# (and eschew the need to invoke git). | |
# | |
if [ -z "$(which git)" ]; then | |
GITCOMMIT=${GITCOMMIT:-'!!Unknown!!'} |
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/bash | |
set -euo pipefail | |
[ -z "${GOPATH:-}" ] && { | |
>&2 echo "GOPATH must be set" | |
exit 1 | |
} | |
# FIXME: Make less specific to this project | |
PROJECT_PATH='github.com/tripledogdare' |
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/bash | |
set -euo pipefail | |
# go get github.com/junegunn/fzf | |
BEFORE=10 | |
AFTER=10 | |
HEIGHT=$(expr $BEFORE + $AFTER + 3 ) # 2 lines for the preview box and 1 extra line fore the match | |
PREVIEW="$@ 2>&1 | grep --color=always -B${BEFORE} -A${AFTER} -F -- {}" |
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/bash | |
AUTH_LIST=$(gcloud --format=json auth list) | |
ACC_LIST=$(echo $AUTH_LIST | jq -r '.[].account') | |
if [ $(echo "${ACC_LIST}" | wc -l) -gt 1 ]; then | |
>&2 echo "Select account:" | |
select ACCOUNT in $(echo "${ACC_LIST}"); do | |
break | |
done |
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
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -tags netgo -installsuffix netgo main.go | |
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' main.go |
hash.Sum([]byte{})
does not do what I expected it to do. It prefixes the output with those bytes. I expected it to use it as a suffix for the hashing algorithm, but without actually affecting the underlying hash data. i.e. hash.Sum([]byte("foobar") -> "foobar<hash(written bytes)>" instead of "<hash(written bytes + "foobar">" https://play.golang.org/p/eCeUTlFCx4 Rereading the docs this makes sense now. But probably could use some additional examples.
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
#!/usr/bin/env python3 | |
# file: rewrite_ntfs_uuid.py | |
import sys | |
import random | |
import os | |
# partition file | |
fileName = sys.argv[1] # e.g. /dev/sdb1 | |
UUID_OFFSET = 72 # location of NTFS UUID |
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/bash | |
set -euo pipefail | |
python3 -m venv venv | |
source ./venv/bin/activate | |
pip install jupyter numpy matplotlib pandas scipy control |