Skip to content

Instantly share code, notes, and snippets.

View geekdada's full-sized avatar

Roy Li geekdada

View GitHub Profile
@geekdada
geekdada / delete_branches_older_than.sh
Last active December 3, 2018 05:45 — forked from redthor/delete_branches_older_than.sh
Script to delete branches older than a certain date, modification of 4586456
# Copy of https://gist.github.com/antonio/4586456
# With a modification to collect all the branch names so we can make one git request
# Set DRY_RUN=1 to get an echo of the command
# Format that works with `git log --since`, e.g. 2018-01-01
date=$1
branches=
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/remotes\///' | grep feature | grep -v 'master$'); do
if [[ "$(git log $branch --since $date | wc -l)" -eq 0 ]]; then
@geekdada
geekdada / get-keys-for-github-user.sh
Created February 13, 2017 15:50 — forked from rtlong/get-keys-for-github-user.sh
Put public keys for a github user in ~/.ssh/authorized keys with mucho ease
IFS="$(printf '\n\t')"
mkdir -p ~/.ssh
if ! [[ -f ~/.ssh/authorized_keys ]]; then
echo "Creating new ~/.ssh/authorized_keys"
touch ~/.ssh/authorized_keys
fi
user=$1