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.
| # mkdir, cd into it | |
| mkcd () { | |
| mkdir -p -- "$@" && cd "$@" | |
| } |
| /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) |
| # 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) |
| [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' |
| #!/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 |
Had some questions at work about what handlers could do. So we built this playbook to test.
I hereby claim:
To claim this, I am signing this object:
| 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. |