Skip to content

Instantly share code, notes, and snippets.

@goozbach
goozbach / 10-mkcd.sh
Created February 2, 2012 20:36
mkcd
# mkdir, cd into it
mkcd () {
mkdir -p -- "$@" && cd "$@"
}
@goozbach
goozbach / less
Created February 3, 2012 03:18
Lockdown
/usr/bin/less
# history stuff
export HISTSIZE=10000000
# create the historydir if it doesn't exist
if [[ ! -d ${HOME}/.bash_history.d/ ]]
then
mkdir -p ${HOME}/.bash_history.d/
fi
# one history file per year
export HISTFILE=${HOME}/.bash_history.d/${HOSTNAME}.$(date +%Y)
@goozbach
goozbach / gist:7799077
Created December 5, 2013 02:11
historysharing
# history stuff
export HISTSIZE=10000000
# create the historydir if it doesn't exist
if [[ ! -d ${HOME}/.bash_history.d/ ]]
then
mkdir -p ${HOME}/.bash_history.d/
fi
# one history file per year
export HISTFILE=${HOME}/.bash_history.d/${HOSTNAME}.$(date +%Y)
@goozbach
goozbach / gist:7826332
Created December 6, 2013 15:18
hr usage
[2013-12-06:10:18:09 dcarter@hoth ~]
$ hr
---------------------------------------------------------------------------------------------------------------------------
[2013-12-06:10:18:12 dcarter@hoth ~]
$ type hr
hr is aliased to `for i in $(seq 1 $COLUMNS); do echo -n -; done'
@goozbach
goozbach / updateme.sh
Created February 16, 2014 10:57
updating a large tree of git submodules
#!/bin/bash
git submodule sync
git submodule update
git submodule foreach git submodule sync
git submodule foreach git submodule update
git submodule foreach git submodule foreach git submodule sync
git submodule foreach git submodule foreach git submodule update
while : ; do let "surprise = $RANDOM % 9"; [[ $surprise -eq 0 ]] && echo -e -n "\033[0;31m"; for i in r e d r u m ; do echo -n $i ; sleep .${RANDOM: -2}; done; echo -e -n "\013\033[0;39m"; done
@goozbach
goozbach / Ansible Handler Questions.md
Last active August 10, 2016 21:07
Ansible handler questions.

Had some questions at work about what handlers could do. So we built this playbook to test.

  • handlers can be called "dynamicly" ie called with variable name.
  • handlers can iterate over a list.

Keybase proof

I hereby claim:

  • I am goozbach on github.
  • I am goozbach (https://keybase.io/goozbach) on keybase.
  • I have a public key ASA93BLHOKZ_NdIE9N_0nkkyGi6RUCdnicbLzGIpQkOg9wo

To claim this, I am signing this object:

@goozbach
goozbach / gitcreate.sh
Last active January 19, 2017 07:28
gitcreate function
gitcreate() {
# usage: gitcreate <reponame> [--push]
# requires 'jq' to be installed
# Seed of this idea came from http://www.karan.org/blog/2017/01/13/create-a-new-github-com-repo-from-the-cli/
REPONAME=${1}
PUSH=${2}
# This function only works in a git repo.