Skip to content

Instantly share code, notes, and snippets.

View richstokes's full-sized avatar
🐴

Rich Stokes richstokes

🐴
View GitHub Profile
@richstokes
richstokes / bump-sem-ver.sh
Created April 28, 2023 23:03
Bump app.json semantic version
#!/bin/bash
set -e
INCREMENT_LEVEL="patch" # Choose from "major", "minor", or "patch"
awk -v level="$INCREMENT_LEVEL" '
BEGIN {
FS = OFS = "\"";
}
{
if ($2 == "version") {
@richstokes
richstokes / git-switch-zsh-fzf.sh
Last active January 7, 2022 19:40
zsh git branch switcher
## Add this to your `~/.zshrc` file to have CTRL+G let you select your recent branches
## Open a new terminal, or run `source ~/.zshrc` after adding
## Requires: fzf (`brew install fzf`)
# Function to select recent branches
function gsl() {
git switch -q $(git for-each-ref refs/heads --format='%(refname)' --sort='committerdate' | cut -d'/' -f3- | fzf +s --tac --preview='git log --oneline {} | head -20')
zle reset-prompt
}
@richstokes
richstokes / create-convox-kube-config.sh
Last active April 28, 2021 19:38
Create KUBECONFIG for current convox rack
#!/bin/bash
set -e
RACKNAME=$(convox rack | grep Name | xargs | cut -d" " -f2)
echo "Creating kubeconfig for $RACKNAME"
convox rack kubeconfig > $HOME/.kube/$RACKNAME-config
export KUBECONFIG=$HOME/.kube/$RACKNAME-config
echo "Testing"
kubectl get nodes
@richstokes
richstokes / erb.sh
Last active March 2, 2022 17:11
git easy rebase script
#!/bin/bash
set -e
FEATURE_BRANCH=$(git branch --show-current)
if [ "$FEATURE_BRANCH" == "main" ]; then
echo "Looks like you're not on a feature branch 🌲, so we'll just update main 🔺"
git pull
exit
else
echo "Rebasing $FEATURE_BRANCH against main ⚾️"
@richstokes
richstokes / pyenv-install-latest.sh
Last active January 24, 2021 20:58
pyenv install latest Python version
#!/bin/bash
brew update
brew install pyenv || brew upgrade pyenv
pyenv install $(pyenv install --list | grep -v - | grep -v b | grep -v a | tail -1)
pyenv versions
eval "$(pyenv init -)"
echo "Set latest globally with e.g.: pyenv global 3.8.2"
@richstokes
richstokes / tether.md
Last active August 24, 2020 02:47
iPhone hotspot

Get emergency internet access on your Mac via your iPhone if you don't have a hotspot-enabled plan.

   

  1. Download iSH App: https://ish.app/, once opened set up the ssh server with:
adduser rich
apk add openssh nano