Skip to content

Instantly share code, notes, and snippets.

@ianoxley
ianoxley / base58.py
Created March 11, 2011 14:00
base58 encoding in Python
""" base58 encoding / decoding functions """
import unittest
alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
base_count = len(alphabet)
def encode(num):
""" Returns num in a base58-encoded string """
encode = ''
[BITS 16]
[ORG 0x7C00]
jmp main
; Reads sectors
; bx == Low 16 bits of addr
; cx == High 12 bits of addr
; dx == Output buffer
; di == Number of sectors

Amp currency lacks scarcity so arbitrarily inflationary.

I am not sure how the Amp currency lacks scarcity. Perhaps I live in a different reality but, where I come from, computational resources are very much a finite resource. Around here, millions of people actually queue up to buy new devices!

Now, if you're lucky enough that computational devices are a free good in your reality, then please please please send me

@norman
norman / object.lua
Created April 11, 2011 13:51
ridiculously simple object oriented Lua
local class = {}
local methods = {}
function class.new()
local instance = {}
return setmetatable(instance, {__index = methods})
end
return class
@ignacio
ignacio / gist:974770
Created May 16, 2011 16:25
Redis table with __index metamethod
local fail_safe = {
__index = function(t, command)
error( ("No command defined for %q"):format(tostring(command)) )
end
}
setmetatable(fail_safe, fail_safe)
-- You add commands here (internally)
local commands = {
get = function(t, key)
@Arthraim
Arthraim / bottle_example.py
Created May 27, 2011 04:27
a python web framework bottle's example
#coding: utf-8
from bottle import route, error, post, get, run, static_file, abort, redirect, response, request, template
@route('/')
@route('/index.html')
def index():
return '<a href="/hello">Go to Hello World page</a>'
@route('/hello')
def hello():
string
xpcall
package
tostring
print
os
unpack
require
getfenv
setmetatable
@chandlerprall
chandlerprall / threaded_download.py
Created June 9, 2011 17:41
Small Python multi-threaded file downloader
import urllib2
import threading
from Queue import Queue
import sys, os, re
class ThreadedDownload(object):
REGEX = {
'hostname_strip':re.compile('.*\..*?/', re.I)
}
@scturtle
scturtle / ftpserver.py
Created June 20, 2011 16:03
simple ftp server by python
#!/usr/bin/env python2
# coding: utf-8
import os,socket,threading,time
#import traceback
allow_delete = False
local_ip = socket.gethostbyname(socket.gethostname())
local_port = 8888
currdir=os.path.abspath('.')
@hj91
hj91 / Tweepy_CLI_example.py
Created June 25, 2011 10:49
Example of using Twitter api with Tweepy library
#!/usr/bin/env python
#(c) Harshad Joshi, 2011
#firewalrus [AT] gmail DOT com
import sys
import tweepy
CONSUMER_KEY = ''
CONSUMER_SECRET = ''