Skip to content

Instantly share code, notes, and snippets.

View wizardishungry's full-sized avatar
🐫
Copyright 1987-2013, Larry Wall

Jon Williams wizardishungry

🐫
Copyright 1987-2013, Larry Wall
View GitHub Profile
@wizardishungry
wizardishungry / puns.txt
Created October 29, 2013 15:29
Puns that my boss makes about UNIX commands.
"Suffering from Cron's disease"
"That's what she sed"
@wizardishungry
wizardishungry / 2013-10-23-sitebag.md
Last active December 26, 2015 06:59
notes for sitebag dump1090 talk
@wizardishungry
wizardishungry / sunrise.php
Created September 4, 2013 17:14
sunrise sunset calculations for the north pole are surprising
<?php
date_default_timezone_set('GMT');
$tim = strtotime("December 21");
$fmt = SUNFUNCS_RET_STRING;
$lat = 90;
$lng = 0;
for($i = 0; $i<182; $i++) {
echo date(DATE_RFC822, $tim), "\t",
date_sunrise($tim, $fmt, $lat, $lng), " ",
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wizardishungry
wizardishungry / crap.sh
Last active December 20, 2015 21:28
hugo bot stuff
find ~/Projects/www.hugoschwyzer.net/ -type f \! -iname \*replyto\* -iname \*.html -exec lynx -nolist -dump {} \; > ~/hugo.corpus.txt
sed -e 's/http[^ ]*//g' -e 's/@[^ ]*//g' -e 's/^rt //i' ~/Projects/download-tweets/hugoschwyzer_tweets.csv >> ~/hugo.corpus.txt
//
// Using CoreLocation on Mac OS X with command-line
// $ clang CoreLocationTest.m -framework cocoa -framework CoreLocation
// $ ./a.out
// location service enabled
// 2011-12-01 21:03:01.839 a.out[10214:903] latitude,logitude : 35.606647, 140.695538
// 2011-12-01 21:03:01.842 a.out[10214:903] timestamp : 2011-12-01 21:01:36 +0900
// tmiz moo@tmiz.net
//
#import <cocoa/cocoa.h>
<?php
/**
* A controller plugin for protecting forms from CSRF
*
* Works by looking at the response and adding a hidden element to every
* form, which contains an automatically generated key that is checked
* on the next request against a key stored in the session
*
* @author Jani Hartikainen <firstname at codeutopia net>
*/
@wizardishungry
wizardishungry / transmission-turtle
Last active December 17, 2015 12:58
Make transmission turn on the alternate bandwidth limits (turtle mode) when you login over ssh and turn back on when you log out of the last ssh connection.
#!/bin/sh
# Usage: transmission-turtle [true|false]
ENDPOINT=http://localhost:9091
CRED='admin:coolpassword'
################################################################################
ENDPOINT=$ENDPOINT/transmission/rpc
HEADER=`curl -s -u "$CRED" -I $ENDPOINT | tr -d "\015" | egrep ^X-Transmission-Session-Id `
curl -s -H "$HEADER" -u "$CRED" \
$ENDPOINT -d "{\"method\": \"session-set\",\"arguments\":{\"alt-speed-enabled\":$1}}" | sed -e 's/.*:/ /g; s/["}]//g;'
@wizardishungry
wizardishungry / TestSuiteCoverage.php
Last active December 16, 2015 09:38
Are all the tests actually being run by your test suites?
<?php
define('TEST_BASE_PATH', realpath(realpath(dirname(__FILE__)) . '/../library/Mmf/Test/'));
define('SCRIPT_PATH', realpath(dirname(__FILE__)) . '/CommitTest.php');
echo SCRIPT_PATH,"\n";
echo "This is SLOW!\n";
$tmp = tempnam(sys_get_temp_dir(), "TestSuiteCoverage-");
$path = TEST_BASE_PATH;
$files = explode("\n",`find $path -type f`);
@wizardishungry
wizardishungry / ison.py
Last active December 14, 2015 14:59 — forked from kjordahl/garradd.py
#!/usr/bin/env python2.6
# -*- coding: iso-8859-15 -*-
"""Calculate position for comet
Author: Kelsey Jordahl
Time-stamp: <Sun Feb 26 12:28:17 EST 2012>
License: GPLv3
"""
import ephem