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
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
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
<script src="http://cdn.gethammer.co/hammerlib.min.js"></script> |
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
import socket | |
import time | |
import commands | |
soc = socket.socket() | |
soc.bind(('0.0.0.0', 9996)) | |
soc.listen(5) | |
while True: | |
client, address = soc.accept() |
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
<script src="/static/hammerlib.min.js"></script> | |
<script> | |
$.fn.on_enter = function (callback) { | |
var ENTER_KEY = 13; | |
return this.keypress(function (e){ | |
var key = e.charCode || e.keyCode || 0; | |
if (key != ENTER_KEY) return; | |
var value = $(this).val(); | |
if (value === "") return false; |
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
<script src="/static/hammerlib.min.js"></script> | |
<script> | |
$(function(){ | |
hammerlib.bind("hammerlib", "opened", function(data) { | |
hammerlib.subscribe("stock_ticker"); | |
}); | |
hammerlib.bind("stock_ticker", "updated", function(data) { | |
$.each(["hammer", "gamma", "spacemonkey", "unicorn"], function(i, stock) { | |
var key = stock + "_ticker"; |
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
tcp:::send | |
/args[1]->dport == 80/ | |
{ | |
printf( | |
"Packet sent: %s:%u -> %s:%u on behalf of %s (PID: %d, UID: %d)\n", | |
args[1]->ip_saddr, args[1]->sport, args[1]->ip_daddr, | |
args[1]->dport, execname, pid, uid); | |
} |
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
#import <Foundation/Foundation.h> | |
#import <Carbon/Carbon.h> | |
/*############################################################################### | |
# # | |
# changeInput # | |
# # | |
# author: Stefan Klieme (based on an idea by Craig Williams) # | |
# created: 2009-11-05 # | |
# Changes input language # | |
# Usage: changeInput prints current input language # |
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
en := DllCall("LoadKeyboardLayout", "Str", "00000409", "Int", 1) | |
Loop | |
{ | |
#IfWinActive | |
{ | |
w := DllCall("GetForegroundWindow") | |
pid := DllCall("GetWindowThreadProcessId", "UInt", w, "Ptr", 0) | |
l := DllCall("GetKeyboardLayout", "UInt", pid) |
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
var http = require('http'); | |
var spawn = require('child_process').spawn; | |
var dtrace = spawn("dtrace", ["-s", "dtrace.d", "-C"]); | |
var known_ports = {}; | |
var pending_requests = {}; | |
dtrace.stdout.on("data", function(data){ | |
var lines = data.toString().split("\n"); | |
for (i in lines) { |
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 amitu import d | |
# key advantages: | |
# 1. single file app | |
# 2. still fully compatible with existing django projects | |
# 3. auto matic url regex creation | |
# 4. all frequently used django functions/classes collected in d.* namespace | |
# Note: not yet sure if all of this is possible :-p | |
d( # callable modules are magic. some magic is good. |
OlderNewer