Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import math
crimes=[(5,4), (6,3), (5,3), (7,3)]
phi=5
f, g= 2, 2
b=3
a=0
for j in range(10):
for i in range(10):
Earthquake.init do
output do |item|
next unless item["_stream"]
if "#{item["user"]["screen_name"]}"!="leegeorg07"
notify "#{item["user"]["screen_name"]}: #{item["text"]}"
end
end
end
cd ruby-1.9.2-p180
./configure
make
sudo make install
cd ..
sudo ruby rubygems-1.8.2/setup.rb
cd ..
cd ruby-1.9.2-p180/ext/readline
ruby extconf.rb
make
Earthquake.init do
output do |item|
next unless item["_stream"]
if "#{item["text"]}".match(/^@jrgifford/)
notify "#{item["user"]["screen_name"]}: #{item["text"]}"
end
end
end
Earthquake.init do
output do |item|
next unless item["_stream"]
if "#{item["text"]}".match(/@leegeorg07/)
notify "#{item["user"]["screen_name"]}: #{item["text"]}"
end
end
end
@Telltak
Telltak / oh_hai_thur.py
Created May 21, 2011 08:35
A pointless script.
from sys import argv
if len(argv)>1 and argv[1].isdigit():
r = ''
for i in range(int(argv[1])):
r+='r'
print "oh hai thu{0}".format(r)
else:
print "Please supply a positive integer as an argument"
print "So you want to call a baby ugly?"
def parent(parent):
print "If the {0} strong or able to beat you up?".format(parent)
print "Say N if you're not sure"
answer=raw_input("Y or N: ")
if answer == "Y":
return True
else:
return False
father=parent("father")
print "Format Characters:"
print "d OR i: int"
print "o: octal"
print "x: lowercase hex"
print "X: uppercase hex"
print "f OR F: float"
print "c: single char"
print "r: String (using repr())"
print "s: String (using str())"
@Telltak
Telltak / 17.py
Created January 15, 2012 18:50
Trying to shorten exercise 17 to one line. (broken)
a=lambda f, m:open(__import__('sys').argv[f],m);if not raw_input("File %d bytes\nEnter continue, CTRL-C abort." % len(a(1, 'r').read())):a(2, 'w').write(a(1, 'r'))
@Telltak
Telltak / matrix_test.py
Created October 22, 2012 20:15
Testing Matrices in Python
matrix = [[0, 1, 2, 3], [1, 0, 5, 6], [2, 5, 0, 4], [3, 6, 4, 0]]
print "A to C"
print matrix[0][2]
print "D to B"
print matrix[3][1]
print " |A|B|C|D"
print "A|%d|%d|%d|%d" % (matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0])
print "B|%d|%d|%d|%d" % (matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1])
print "C|%d|%d|%d|%d" % (matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2])