This file contains 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
$ docker exec -i $CONTAINER pg_restore --dbname=$DATABASE --verbose --clean -U $USER < pg_dump --format custom $DATABASE |
This file contains 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 sh | |
# checks to see if running | |
launchctl list | grep elasticsearch | |
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist | |
launchctl remove homebrew.mxcl.elasticsearch | |
pkill -f elasticsearch |
This file contains 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
# .style.yapf | |
# | |
# DESCRIPTION | |
# Configuration file for the python formatter yapf. | |
# | |
# This configuration is based on the generic | |
# configuration published on GitHub. | |
# | |
# AUTHOR krnd | |
# VERSION v1.0 |
This file contains 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
# Brings over all tags/branches keeping history intact for the | |
# incoming remote data. | |
$ cd path/to/source-repo | |
$ git remote add target path/to/target | |
$ git fetch target --tags | |
$ git merge --allow-unrelated-histories target/some-branch | |
$ git remote remove target | |
# Or, to merge just the one branch this works but it loses all | |
# the extra history that the above method preserves. |
This file contains 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
# Assumes the database container is named 'db' | |
DOCKER_DB_NAME="$(docker-compose ps -q db)" | |
DB_HOSTNAME=db | |
DB_USER=postgres | |
LOCAL_DUMP_PATH="path/to/local.dump" | |
docker-compose up -d db | |
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}" | |
docker-compose stop db |
This file contains 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
$ docker-compose down | |
$ docker volume rm $(docker volume ls -qf dangling=true) | |
$ docker rm $(docker ps -a -q) |
This file contains 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
$ brew install postgresql | |
$ brew services start postgresql | |
$ initdb /usr/local/var/postgres -E utf8 --locale=en_GB.UTF-8 | |
$ psql -h localhost -d postgres |
This file contains 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
# Emacs daemon functions. | |
emacs_server_ok() { | |
emacsclient -a "false" -e "(boundp 'server-process)"; | |
} | |
# Open a file, in the current shell, using the emacs daemon. | |
e() { | |
if [[ "${1}" == '' ]]; then | |
emacsclient --tty . |
This file contains 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
TESTING-C(7) FreeBSD Miscellaneous Information Manual TESTING-C(7) | |
NAME | |
Testing C – a simple unit testing setup | |
DESCRIPTION | |
This is a simple approach to unit testing in C that I've used in a couple | |
projects. At the bottom of a C file with some code I want to test, I | |
add: |
This file contains 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
static double D[M]; /* initialized to zero */ | |
static long ptr=0; /* read-write offset */ | |
double delayline(double x) { | |
double y = D[ptr]; /* read operation */ | |
D[ptr++] = x; /* write operation */ | |
// *(ptr++) = x; ?? | |
if (ptr >= M) { | |
ptr -= M; /* wrap ptr */ | |
} |