Skip to content

Instantly share code, notes, and snippets.

View JT5D's full-sized avatar
💭
Multiversing...

JT5D JT5D

💭
Multiversing...
View GitHub Profile
@jeremyBanks
jeremyBanks / fibchain.py
Created July 31, 2008 00:57
[2010-01] reddit fib thread cralwer, probably broken now
#!/usr/bin/env python
# Because I was unable to find the root of the Fibbonachi sequence post
# chain in the original story comments (it was nowhere to be found!) I made
# this little hacky script to go back, post by post, until it reache a post
# with no parent. For fun, it displays the users and values as it goes.
# The value isn't always accurate, but that doesn't really matter.
# The result of this (which didn't take very long) it stopped, not very
# far back, because someone deleted a post. Huh. Irritating.
# http://www.reddit.com/comments/2mg72/vote_up_if_you_love_pie/c02bfe6
@jeremyBanks
jeremyBanks / template.py
Created August 5, 2008 08:43
[2010-01] "There's a string.Template? What's that do?"
#!/usr/bin/env python
from string import Template
t = 45
s = "test"
print Template("We have $t ${s}s.").substitute(locals())
@jeremyBanks
jeremyBanks / lrr.py
Created August 7, 2008 06:23
[2010-01] script to wait for new LRR postcast episode and download
#!/usr/bin/env python
# encoding: utf-8
import sys, os
import time
try:
import urllib2 as urllib # Python 2.5
except ImportError:
import urllib.request as urllib # Python 3.0
def main():
@jeremyBanks
jeremyBanks / monitor.py
Created August 9, 2008 09:19
[2010-01] an lame sorta-functional network keyword monitor
#!/usr/bin/env python
# encoding: utf-8
from __future__ import division, with_statement
import sys, os
import subprocess
# This is a horrible little script written by someone who doesn't understand
# how to use tcpdumbp or subprocess well. It intends to display an allert
# whenever specified keywords (such as a password) are seen in network
# traffic. Along with the warning it sends 3 \x07 beeps to stdout, in case
@jeremyBanks
jeremyBanks / euler003.lisp
Created August 22, 2008 22:01
[2010-01] some project euler stuff in sbcl
#!/usr/bin/env sbclx
; I actually might want to use a function? Goodie!
(defun isPrime (n) ; a crude brute-force prime check
(do
(
(limit (ceiling (sqrt n))) ; maximum requred to determine if it is prime
(i 2 (1+ i))
)
@jeremyBanks
jeremyBanks / ghapitest.py
Created August 26, 2008 22:39
[2010-01] me trying out github's api
#!/usr/bin/env python
# encoding: utf-8
import demjson
from pprint import pprint
import urllib2
def main():
user = "jeremybanks"
userJSON = urllib2.urlopen("http://github.com/api/v1/json/%s/" % user).read()
user = demjson.decode(userJSON)["user"]
@jeremyBanks
jeremyBanks / gist:7940
Created August 29, 2008 08:49
[2010-01] me noobing it up with gpg and git
git # master $ git tag -v v0.99.1
object 78d9d414123ad6f4f522ffecbcd9e4a7562948fd
type commit
tag v0.99.1
tagger Linus Torvalds <torvalds@g5.osdl.org> 1121468952 -0700
The snail-paced race towards 1.0 is on!
gpg: Signature made Fri 15 Jul 19:09:53 2005 EDT using DSA key ID 76E21CBB
gpg: Can't check signature: public key not found
error: could not verify the tag 'v0.99.1'
@jeremyBanks
jeremyBanks / marijuana.reddit.css
Created August 31, 2008 21:02
[2010-01] old reddit trees theme
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td,iframe {
margin:0;
padding:0;
}
table { border-collapse:collapse; }
fieldset,img { border:0; }
address,caption,cite,code,dfn,em,strong,th,var { font-style:normal; font-weight:normal; }
@jeremyBanks
jeremyBanks / wgetOSX.sh
Created September 3, 2008 06:53
[2010-01] a few lines to install wget using curl
# It's just a basic ./configure; make; sudo make install.
curl -O http://ftp.gnu.org/gnu/wget/wget-latest.tar.gz # Irony?
tar xzf wget-latest.tar.gz
cd wget-*/
./configure
make
sudo make install
@jeremyBanks
jeremyBanks / slotDemo.py
Created September 4, 2008 18:52
[2010-01] an old example of how __slots__ works
#!/usr/bin/env python
# encoding: utf-8
from __future__ import division, with_statement
import sys, os
class StrictPerson(object):
__slots__ = ["first", "last", "age"]
def __str__(self):
return "%s %s (%s)" % (self.first, self.last, self.age)