This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for d in "$@" ; do | |
echo | |
echo "${d}" | |
find "${d}" -type f -printf '%T+ %P\n' | sort | cat -n | tail -3 | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
JP2A=$(dirname "$0")/jp2a | |
declare -a jp2aopts | |
while [[ $# -gt 0 ]] ; do | |
case "$1" in | |
-) break ;; | |
--) shift ; break ;; | |
-*) jp2aopts+=( "$1" ) ; shift ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mirroring a Git repostory | |
The firm I recently stated working at just moved to Git and I am the only resource then knows Git. I get asked so many times a day on how to mirror a git repostory. | |
From the birds eyes very its very easy: | |
git clone --mirror [email protected]:project project | |
cd project | |
git remote add github [email protected]:username/project.git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import permutations | |
WORD_FILE = '.../words' | |
words = set(x.strip() for x in open(WORD_FILE).readlines()) | |
LETTERS = 'abcdefg' | |
perms = set((''.join(x).split())[0] for x in permutations(LETTERS+' ')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Mimic perl's gmtime function. | |
* | |
* From ctime(3): | |
* The members of the tm structure are: | |
* tm_sec The number of seconds after the minute, normally in the | |
* range 0 to 59, but can be up to 60 to allow for leap seconds. | |
* tm_min The number of minutes after the hour, in the range 0 to 59. | |
* tm_hour The number of hours past midnight, in the range 0 to 23. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Module-specific watchdog wrapper. | |
* | |
* Apply var_export to variables where key starts with '@@' or '%%'. | |
* (Keys in message should not have doubled sigils.) | |
*/ | |
function _mymodule_watchdog($message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) { | |
$vars = array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Log and run an external command | |
# Usage: Action [redirections] command arguments... | |
# Redirections: | |
# --stdin=file redirect input from file | |
# --stdout=file redirect output to file | |
# --stderr=file redirect error to file | |
function Action() { | |
if [[ $# -gt 0 ]] ; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
TIMEOUT=3600 | |
if [ $# -lt 1 ] ; then | |
cat >&2 <<EOF | |
Usage: $0 [SSH_OPTIONS] [user@]host | |
Background SSH connection, using -f and sleep $TIMEOUT | |
EOF | |
exit 1 | |
else | |
ssh -f "$@" sleep $TIMEOUT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
export PYTHONPATH=${HOME}/lib/python |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function expand_siblingless_child_nodes_listener( parent_node ) { | |
if ( parent_node.firstChild === parent_node.lastChild ) { | |
if ( parent_node.firstChild !== null ) { | |
parent_node.firstChild.expand(); | |
} | |
} | |
} | |
var the_store = Ext.create( | |
'Ext.data.TreeStore', |