Skip to content

Instantly share code, notes, and snippets.

jhrr

  • Paradise
Block or report user

Report or block jhrr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View prettier-diff.sh
$ PATH=$(npm bin):$PATH; git diff-tree --no-commit-id --name-only -r HEAD | xargs prettier --write
View artists-example.xml
<?xml version="1.0" encoding="UTF-8"?>
<artists>
<artist>
<images>
<image height="450" type="primary" uri="" uri150="" width="600" />
<image height="771" type="secondary" uri="" uri150="" width="600" />
</images>
<id>1</id>
<name>The Persuader</name>
<realname>Jesper Dahlbäck</realname>
View docker-postgres-restore.sh
$ docker exec -i $CONTAINER pg_restore --dbname=$DATABASE --verbose --clean -U $USER < pg_dump --format custom $DATABASE
View Elasticsearch install and uninstall.txt
#!/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
View .style.yapf
# .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
@jhrr
jhrr / merge-repos.sh
Created May 20, 2019
Methods to merge two git repos into one.
View merge-repos.sh
# 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.
@jhrr
jhrr / restore.sh
Created Mar 18, 2019 — forked from jgillman/restore.sh
pg_restore a local db dump into Docker
View restore.sh
# 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
View docker-dangling.sh
$ docker-compose down
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker rm $(docker ps -a -q)
View macos-init-postgres.sh
$ brew install postgresql
$ brew services start postgresql
$ initdb /usr/local/var/postgres -E utf8 --locale=en_GB.UTF-8
$ psql -h localhost -d postgres
View emacs-daemon-stuff.sh
# 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 .
You can’t perform that action at this time.