Skip to content

Instantly share code, notes, and snippets.

set x,0
set y,0
:row
jsr getVal
set c,32
shl z,4
add c,z
bor c,0xf000
set a,y
set x,0 ;x = fib[n-1]
set y,1 ;y = fib[n]
set j,24;number of loops
:loop
set z,x; z = fib[n]+fib[n-1]
add z,y
set x,y;Set X to the new fib[n-1] (the old fib[n])
set y,z;set Y to the new fib[n] (calculated.)
@theepicsnail
theepicsnail / kaa.py
Created November 26, 2011 01:30 — forked from maxcountryman/kaa.py
A very simple non-blocking IRC bot using gevent
import gevent
from gevent import socket, queue
from gevent.ssl import wrap_socket
import logging
logger = logging.getLogger('irc')
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
@theepicsnail
theepicsnail / gist:899241
Created April 2, 2011 04:56
Google via mechanize
import mechanize
br = mechanize.Browser()
br.set_handle_equiv(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
def doSearch(term):
global br
import socket,threading
from time import sleep
port = 1235
class DMX(threading.Thread):
running = True
life = [0,0,0,0,0,0]
def activate(self,num):
if num < 0 or num > 5:
return
self.life[num]=10
import socket
server = ''
port = 1235
def run():
while True:
i = raw_input("Enter a number!")
s = socket.socket()
s.connect((server,port))
s.send("activate %s"%i)
s.close()
@theepicsnail
theepicsnail / gist:864466
Created March 10, 2011 17:05
Overriding += to make a call.
class Bar:
def __init__(self,inst,func,*args):
self.inst = inst
self.func = func
self.args = args
def __iadd__(self,*args,**kwargs):
return self.__call__(*args,**kwargs)
def __call__(self,*args,**kwargs):
self.func(self.inst,*(self.args+args),**kwargs)
USER = "your_twitter_user"
PASS = "your_twitter_pass"
if "your_twitter" in USER+PASS:
print "You didn't set your twitter username and password in the script!"
USER = raw_input("Username>")
PASS = raw_input("Password>")
import urllib2, json, base64, sys, os
@theepicsnail
theepicsnail / pass.py
Last active September 17, 2015 05:41
pass server
import BaseHTTPServer
from subprocess import Popen, PIPE
# What interface to listen on
# Don't change this unless you want to leak your passwords.
HOST = '127.0.0.1'
# What port to listen on. Change this if you'd like,
# you'll need to update the chrome extension's port too.
PORT = 9573