Skip to content

Instantly share code, notes, and snippets.

View jdforsythe's full-sized avatar

Jeremy Forsythe jdforsythe

View GitHub Profile
@jdforsythe
jdforsythe / git-rename-stash.sh
Created October 28, 2016 13:45
Rename Git Stash
#!/bin/bash
git stash list
echo "Enter stash number to rename"
read stash_number
echo "Enter new name"
read new_name
stash_name="stash@{${stash_number}}"
echo "$stash_name"
@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 / 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 / ProcessQueueAndExit.php
Created May 5, 2016 17:56
Laravel 5 Artisan Process Entire Queue and Exit Command
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Carbon\Carbon;
use Illuminate\Queue\Worker;
use Illuminate\Contracts\Queue\Job;
use Symfony\Component\Console\Input\InputOption;
version: 2.1
orbs:
docker-publish: circleci/docker-publish@0.1.6
workflows:
build:
jobs:
- docker-publish/publish:
deploy: false
@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 / 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
}
}
@jdforsythe
jdforsythe / test_laravel_crypt_lengths.php
Created April 14, 2016 17:37
Test Laravel Crypt::encrypt() result lengths
<?php
function random_bytes($bytes) {
$secure = true;
$buf = openssl_random_pseudo_bytes($bytes, $secure);
if ($buf !== false && $secure && strlen($buf) === $bytes) {
return $buf;
}
}
@jdforsythe
jdforsythe / .bashrc
Last active May 3, 2017 14:50
.bashrc Aliases
# .bashrc
# alias for "d2u <filename>" which converts line endings from dos to unix using sed
alias d2u='function _d2u(){ echo "Converting line endings from Dos2Unix."; sed -i "s/\r$//" "$1"; };_d2u'
# alias for "untar" which executes "tar -xvf" to extract a tarball
alias untar='tar -xvf'
# alias for "tarball" which executes "tar cvzf" to create a tarball
alias targz='tar cvzf'
@jdforsythe
jdforsythe / vscode-command-editor.sh
Created May 3, 2017 14:45
Use Visual Studio Code as long command editor in Git Bash on Windows
## Bash lets you use CTRL+X CTRL+E to edit-and-execute a command
## This will allow you to set up VS Code as the editor for this (and other Bash edit functions)
echo "export VISUAL=\"code -n -w\"" >> ~/.bashrc
source ~/.bashrc
## Then when you're typing a long command and need to change something or otherwise want better
## editing control over a command, simply hit CTRL+X CTRL+E and edit the command, then save
## and exit VS Code and the command will execute
## For Sublime Text