Skip to content

Instantly share code, notes, and snippets.

View jdforsythe's full-sized avatar

Jeremy Forsythe jdforsythe

View GitHub Profile
@jdforsythe
jdforsythe / local-https-domains-dev-mac.sh
Last active August 10, 2020 20:18
Develop With Local HTTPs Domains
#!/bin/bash
## https://gist.github.com/jdforsythe/09e9fd0dc7f75e7468fc48c9bc8b1598
##
## This will:
##
## 1. Install `mkcert` and create a self-signed CA and certificates for fake domains and trust them
## with the system's trust store. This allows you to develop using the same SSL/TLS techniques you
## would in production, bringing dev-prod parity and allowing things like cross-sub-domain secure
@jdforsythe
jdforsythe / find-parent.sh
Created December 5, 2019 21:54
Git find parent branch
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
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 July 31, 2019 13:06
PostgreSQL JOINs as nested JSON objects
-- 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 August 3, 2020 15:01
Commit Signatures with GPG
#!/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 April 11, 2019 02:04
Kubernetes on Minikube
#!/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 March 13, 2019 15:37
Git rename stash alias
[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 February 1, 2023 07:05
Build pgmodeler on Mac with Homebrew-installed pg and openssl

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.

@jdforsythe
jdforsythe / encrypt-shell-script.sh
Created July 24, 2017 15:52
bash encrypt script
#!/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
}
}
#!/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