Skip to content

Instantly share code, notes, and snippets.

@flags
flags / ircbot.py
Created May 28, 2012 05:33
IRC bot
#The majority of this code was taken from
# http://twistedmatrix.com/documents/current/core/howto/clients.html#auto5
#While the original code would have worked fine for a bot, I didn't like the
#way they handled logging. Why reinvent the wheel when Python has an
#excellent built-in module (`logging`) for doing just that?
#Anyway, this bot creates a "database" of registered users that it loads on
#run and saves on exit.
#
#python ircbot.py -build-db
#python ircbot.py
@flags
flags / ah100 notes
Created February 3, 2012 02:32
notes.md
Chapter 2 - Ancient Near East
===
Human-Headed Winged Lion (Lamassu)
---
* Guardian figure from Assyrian palace of Assumasirpal II (ruled 883-859 BC)
* Carved limestone, 10ft high
Gate of the Citadel of Sargon II
---
@flags
flags / pynote.py
Created October 27, 2011 01:35
Keeps track of my notes.py file
import re, sys
class note:
def __init__(self,fname):
self.notes = []
self.fname = fname
def parse(self):
_f = open(self.fname,'r')
@flags
flags / bresenhamalgorithm.py
Created August 8, 2011 18:26
Bresenham's line algorithm in Python
class bresenham:
def __init__(self, start, end):
self.start = list(start)
self.end = list(end)
self.path = []
self.steep = abs(self.end[1]-self.start[1]) > abs(self.end[0]-self.start[0])
if self.steep:
print 'Steep'
@flags
flags / imgblend.py
Created April 23, 2011 17:49
imgblend
import os, sys, Image
size = 328, 328
outdir='D:\\pics\\thumbs'
files = []
glob = None
try:
for root, dirs, files in os.walk("%s" % (sys.argv[1])):
@flags
flags / jane.py
Created February 11, 2011 15:12
Automatic survey reading
#!/usr/bin/python2.7
#Auto survey
import re,sys,os
class answer:
def __init__(self):
self.ans = []
def answer(self,a):
self.ans.append(a)