I hereby claim:
- I am mpapi on github.
- I am mpapi (https://keybase.io/mpapi) on keybase.
- I have a public key whose fingerprint is 3C09 98F5 430D BAA5 04A7 3719 A5C6 24C8 3FA3 0ADB
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| #!/bin/bash | |
| # | |
| # Generates a random password, after http://xkcd.com/936/. | |
| # | |
| # -f [words file, one per line; default /usr/share/dict/words] | |
| # -w [number of words; default 3] | |
| # -n [min number of characters per word; default 6] | |
| # -x [max number of characters per word; default 10] | |
| # |
| #!/bin/sh | |
| # | |
| # Usage: whenever.sh [pattern] [command] | |
| # | |
| # Executes a command whenever files matching the pattern are closed in write | |
| # mode. "{}" in the command is replaced with the matching filename (via xargs). | |
| # Requires inotifywait from inotify-tools. | |
| # | |
| # For example, |
| #!/bin/bash | |
| LIMIT=${1:-1} | |
| FORMAT=${2:-"%Y-%m-%d"} | |
| if [[ $LIMIT -lt 0 ]] | |
| then | |
| SEQ=$(seq 0 -1 $(( $LIMIT + 1 ))) | |
| else | |
| SEQ=$(seq 0 $(( $LIMIT - 1 ))) |
| #!/bin/bash | |
| COMMAND=$1 | |
| PARALLEL=${2:-2} | |
| while read cmd | |
| do | |
| echo "'$(echo $COMMAND | sed "s/{}/$cmd/g")'" | |
| done | xargs -n1 -P$PARALLEL sh -c |
| from contextlib import closing, contextmanager | |
| from urllib2 import urlopen | |
| import hashlib | |
| import os | |
| import time | |
| @contextmanager | |
| def cached(url, expires=0, root='/tmp'): | |
| ''' | |
| Returns the contents of the URL through a file-based cache. If "expires" is |