This file contains 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
[user] | |
name = Tom Gidden | |
email = [email protected] | |
[alias] | |
unadd = reset HEAD | |
treelog = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d %C(bold blue)<%an>%Creset %s %Cgreen(%cr)' --abbrev-commit | |
cmplist = rev-list --cherry-mark --left-right --no-merges | |
cmplog = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d %C(bold blue)<%an>%Creset %s %Cgreen(%cr)' --abbrev-commit --cherry-mark --left-right --no-merges | |
cmpdiff = diff --cherry-mark --left-right --no-merges | |
[color] |
This file contains 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
#!/usr/bin/perl | |
while(<>) { | |
s/\s+$//s; | |
push @l,$_; | |
if(eof) { | |
($b=join("\n",@l))=~s/\s*(\?>)?\s*$/\n/s; | |
print $b; | |
undef @l; | |
} |
This file contains 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
Pebble.addEventListener('showConfiguration', function(e) { | |
var o = Pebble.openURL('data:text/html;base64,PGh0bWw+PGhlYWQ+PG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPTMyMCwgaW5pdGlhbC1zY2FsZT0xIj48c3R5bGU+bGFiZWwse2Rpc3BsYXk6YmxvY2t9bGFiZWx7Y2xlYXI6Ym90aDtoZWlnaHQ6NTBweH1pbnB1dHtmbG9hdDpyaWdodH08L3N0eWxlPjwvaGVhZD48Ym9keT48aDE+UGViYmxlSlMgYmxvYXRlZCBpbmxpbmUgSFRNTDwvaDE+PGZvcm0gaWQ9ImYiIG9uc3VibWl0PSJyZXR1cm4gcyh0aGlzKSI+PGxhYmVsPkZvbzxpbnB1dCB0eXBlPSJjaGVja2JveCIgbmFtZT0iZm9vIj48L2xhYmVsPjxsYWJlbD5CYXI8aW5wdXQgdHlwZT0iY2hlY2tib3giIG5hbWU9ImJhciI+PC9sYWJlbD48bGFiZWw+U2F2ZTxpbnB1dCB0eXBlPSJzdWJtaXQiPjwvbGFiZWw+PC9mb3JtPjxzY3JpcHQ+ZnVuY3Rpb24gcyhlKXtmb3Iobz17fSxpPTA7aTxlLmxlbmd0aDtpKyspKGo9ZVtpXS5uYW1lKSYmKG9bal09ZVtpXS5jaGVja2VkPzE6MCk7cmV0dXJuIHdpbmRvdy5sb2NhdGlvbi5ocmVmPSJwZWJibGVqczovL2Nsb3NlIyIrSlNPTi5zdHJpbmdpZnkobyksITF9PC9zY3JpcHQ+PC9ib2R5PjwvaHRtbD4K'); | |
} |
This file contains 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
sendToPC(host_win('windows_host'), "print", 'url_of_thing_to_print'); | |
my %wincache; | |
sub host_win | |
{ | |
my $hostname = shift; | |
return $wincache{$hostname}[0] | |
if($wincache{$hostname}[1] and (time() - $wincache{$hostname}[1]) < $wincache_timeout); | |
my $result = `nmblookup $hostname`; |
This file contains 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
var fs = require('fs'); | |
function mkdirp(fn, perms, cb) | |
// Make a directory and its ancestors if necessary. | |
{ | |
// 'perms' is optional, but callback is the last param | |
if(arguments.length === 2) { | |
cb = arguments[arguments.length-1]; | |
perms = 0x1fd/*0775*/; | |
} |
This file contains 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
#!/usr/bin/env zsh | |
LOGDIR=`pwd`/../log | |
# Log files start with... | |
LOGPREFIX=$LOGDIR/test | |
# Logs for days where at least part of the day is more than $ZIPAFTER hours ago will be zipped. | |
# Note the subtlety: if this is set to 24, then _all_ of yesterday will be zipped, not just the | |
# hours up until 24 hours before the current time. |
This file contains 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 | |
function geek_number_format($val, $withSpace=true, $suffix='') | |
{ | |
$val = intval($val); | |
$units = array('', 'k', 'M', 'G', 'T', 'P', 'E'); | |
while ($units and $val >= 1024) { | |
$val >>= 10; | |
array_shift($units); | |
} |
This file contains 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 | |
function approx_duration($duration, // time period in question, in seconds | |
$short=false, // single letter suffices (m=month and minute!) | |
$roundupdown=true, // round up/down rather than just down | |
$keepdays=false, // largest division is days, not years/months/weeks/days | |
$keepzeros=true, // keep (and count) zero values | |
$cutoff=2, // maximum number of fields | |
$blankzeros=true) // even if $keepzeros for cutoff, eliminate from display | |
{ |
This file contains 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
# file: filter_plugins/match_ip.py | |
from ansible import errors | |
import re | |
def match_ip(ips, pattern): | |
if type(ips) != list: | |
raise errors.AnsibleFilterError("|failed expects a list") | |
for ip in ips: |
This file contains 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 | |
# First, create a key pair: | |
# openssl genrsa -aes256 2048 > private.pem | |
# openssl rsa -in private.pem -pubout > public.pem | |
define('SALT', 'Confidential (but not really critically secret) string that should not change. Just to stop rainbow tabling.'); | |
define('PRIVATE_KEY_FILE', './private.pem'); | |
define('PUBLIC_KEY_FILE', './public.pem'); | |
define('DATA_DIR', '.'); |
OlderNewer