Skip to content

Instantly share code, notes, and snippets.

Jeremy Forsythe jdforsythe

Block or report user

Report or block jdforsythe

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
@jdforsythe
jdforsythe / find-parent.sh
Created Dec 5, 2019
Git find parent branch
View find-parent.sh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
View config.yml
version: 2.1
orbs:
docker-publish: circleci/docker-publish@0.1.6
workflows:
build:
jobs:
- docker-publish/publish:
deploy: false
@jdforsythe
jdforsythe / join-json.sql
Created Jul 31, 2019
PostgreSQL JOINs as nested JSON objects
View join-json.sql
-- returns a child object with single parent as nested JSON object
--
-- {
-- "id": 155,
-- "name": "Stephen King",
-- "publisher": {
-- "id": 13,
-- "name": "Paladin Books"
-- }
-- }
@jdforsythe
jdforsythe / commit-siggy.sh
Last active Jul 26, 2019
Commit Signatures with GPG
View commit-siggy.sh
#!/usr/bin/env bash
## make sure /usr/local/sbin exists - it *should* be created by homebrew on install
if [ ! -d /usr/local/sbin ]; then
echo "Homebrew didn't create /usr/local/sbin - creating now..."
sudo mkdir /usr/local/sbin
sudo chown $(whoami):admin /usr/local/sbin
chmod 775 /usr/local/sbin
fi
@jdforsythe
jdforsythe / istio.sh
Last active Apr 11, 2019
Kubernetes on Minikube
View istio.sh
#!/usr/bin/env bash
##
## download minikube, kubectl, and istio and add istioctl to path
##
## these steps only need performed one time
##
brew install kubernetes-cli
brew cask install minikube
kubectl version
@jdforsythe
jdforsythe / .gitconfig
Created Mar 13, 2019
Git rename stash alias
View .gitconfig
[alias]
rename-stash = "!_() { if [ -z \"$1\" ] || [ -z \"$2\" ]; then echo \"git rename-stash 0 NewName\" && echo \"\" && git stash list && exit 1; else stash=\"stash@{$1}\"; rev=$(git rev-parse \"${stash}\"); git stash drop \"${stash}\" || exit 1; git stash store -m \"$2\" \"$rev\" || exit 1; git stash list; fi }; _"
@jdforsythe
jdforsythe / mac-build-pgmodeler.md
Last active Apr 2, 2020
Build pgmodeler on Mac with Homebrew-installed pg and openssl
View mac-build-pgmodeler.md

Building pgmodeler for Mac

Check requirements at https://pgmodeler.io/installation.

You will need Qt 5.9.x installed, full XCode installed, and homebrew installation of postgres and openssl.

The example below is v10.5 of PG and v5.9.6 of Qt, modify accordingly. Also, replace {{USERNAME}} with you Mac username.

The installation is the same as the instructions at the link above. There are a few path differences due to homebrew installation locations.

View encrypt-shell-script.sh
#!/bin/bash
scrypt(){
[ -n "$1" ] && {
echo '. <(echo "$(tail -n+2 $0 | base64 -d | mcrypt -dq)"); exit;' > $1.scrypt
cat $1 | mcrypt | base64 >> $1.scrypt
chmod +x $1.scrypt
}
}
View dd-tricks-copy-only-allocated-space.sh
#!/bin/bash
sudo fdisk -lu /dev/sdb
# Disk /dev/sdb: 14.9Gib, 1593153946 bytes, 31116288 sectors
# Units: sectors of 1 * 512 = 512 bytes
# Secor size (logical/physical): 512 bytes / 512 bytes
# I/O size (minimum/optimal): 512 bytes / 512 bytes
# Disklabel type: dos
# Disk identifier: 0x9c4e41cd
@jdforsythe
jdforsythe / write-offenders.sh
Created Jul 13, 2017
Highest disk usage offending processes
View write-offenders.sh
#!/bin/bash
## requires iotop to be installed
sudo iotop -botqqqk --iter=600 >> iotop.log
cat iotop.log \
## remove characters before write speed
| cut -c 41- \
## look for any write speed that is non-zero
You can’t perform that action at this time.