Skip to content

Instantly share code, notes, and snippets.

@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)
@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 / 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 / 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 / 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 / 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 / brainfuck.py
Created July 29, 2012 20:19
Brainfuck interpreter that isn't complete garbage and does not abuse OOP like every other version I found online
#flags - 2012
#wtfplv2
import sys
if not len(sys.argv)==2:
print 'Usage: brainfuck.py <file>'
sys.exit(1)
PROGRAM = bytearray(9999)
CELL = 0
@flags
flags / api_rev2.md
Created October 29, 2012 22:54
API reference for SwanBot

Gets and Sends

The two most basic operations are api-get and api-send, which are named simply based on their interaction with the node mesh. Simply put, api-get can only search and retrieve entries from the mesh, while api-send can modify the mesh in any way.

@flags
flags / gist:5161201
Last active December 14, 2015 22:49
if (x >= y) #A label
x=x-y;
else
y=y-x
.data
x: word;
y: word;
//Machine Code
import java.sql.*;
import java.util.*;
import java.io.*;
public class Database{
public static void main (String args []) throws SQLException, IOException {
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
String serverName = "csor6.bsu.edu";