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
if ( window.addEventListener ) { | |
var pressed_keys = []; | |
var cheat = "38,38,40,40,37,39,37,39,66,65"; | |
window.addEventListener("keydown", function(e){ | |
pressed_keys.push( e.keyCode ); | |
if ( pressed_keys.toString().indexOf( cheat ) >= 0 ) { | |
// User entered the cheat - do something HILARIOUS | |
pressed_keys = []; // wipe the keys | |
} | |
}, true); |
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
ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]' | |
sudo kill -HUP `ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]' | awk '{print $2}'` |
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
[ec2-user@hop ~]$ curl --head http://people.com.cn/ | |
HTTP/1.0 200 OK | |
Server: nginx | |
Date: Mon, 14 Feb 2011 16:22:31 GMT | |
Content-Type: text/html | |
Content-Length: 152319 | |
Last-Modified: Mon, 14 Feb 2011 16:18:17 GMT | |
Vary: Accept-Encoding | |
Accept-Ranges: bytes | |
X-Cache: MISS from www21.people.com.cn |
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
HTTP GET URIs in the form of: | |
http://gdata.youtube.com/feeds/api/videos/-/{http://gdata.youtube.com/schemas/2007/keywords.cat}tag?author=username | |
Examples: | |
Videos uploaded by user BBCWorldwide with tag "wildlife": | |
http://gdata.youtube.com/feeds/api/videos/-/{http://gdata.youtube.com/schemas/2007/keywords.cat}wildlife?author=BBCWorldwide |
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 python | |
from optparse import OptionParser | |
import sys, csv, os.path, random | |
def main(): | |
usage = "usage: %prog [options] arg" | |
parser = OptionParser(usage) | |
parser.add_option("-t", "--template", dest="filename", | |
help="use FILENAME as CSV template") |
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 perl | |
sub toss( $ ); # prints coin toss results for $ coins | |
if( !defined($ARGV[0]) ) | |
{ | |
# If there was no command line argument | |
print "Number of coins not specified - using default number: 3\n\n"; | |
toss( 3 ); | |
} |
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
#!/bin/bash | |
function sleepsort() { | |
sleep "$1" | |
echo "$1" | |
} | |
while [ -n "$1" ]; do | |
sleepsort "$1" & shift | |
done | |
wait |
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
function format_time(date_obj) { | |
// formats a javascript Date object into a 12h AM/PM time string | |
var hour = date_obj.getHours(); | |
var minute = date_obj.getMinutes(); | |
var amPM = (hour > 11) ? "pm" : "am"; | |
if(hour > 12) { | |
hour -= 12; | |
} else if(hour == 0) { | |
hour = "12"; | |
} |
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
function GetPinboardTag(user, tag, count, handler) { | |
$.ajax({ | |
url:'http://feeds.pinboard.in/json/v1/u:'+user+'/t:'+tag+'?count='+count, | |
jsonp:"cb", | |
dataType:'jsonp', | |
success: handler | |
}); | |
} |
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
% See http://code.google.com/p/latex-makefile/ for a useful Makefile | |
% --- BEGIN HEADER | |
\documentclass[11pt]{article} | |
\usepackage{graphicx} | |
\topmargin -1.5cm % read Lamport p.163 | |
\oddsidemargin -0.04cm % read Lamport p.163 | |
\evensidemargin -0.04cm % same as oddsidemargin but for left-hand pages | |
\textwidth 16.59cm | |
\textheight 21.94cm |
OlderNewer