Skip to content

Instantly share code, notes, and snippets.

@e000
e000 / socks.py
Created March 14, 2011 20:21
socksipy + urllib2 handler
"""SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
from __future__ import division
import subprocess
import re, os
class pyize(object):
ffmpeg = 'ffmpeg.exe'
_videoRegex = re.compile('Video:.+ (\d+)x(\d+)')#, re.M)
_durationRegex = re.compile('Duration:\s+(\d+):(\d+):(\d+)\.(\d+)')#, re.M)
_defaultH = 320.0
_defaultW = 480.0
from Core.ZalgoBase.BaseModule import BaseModule
from Core.ZalgoUtil.CmdWraps import Handler, needsArg
import re
from Core.ZalgoHooks import Hooks
from operator import or_
from collections import deque, defaultdict
class Module(BaseModule):
c = Handler()
[22:19:10] -Zalgo- Attempting to calculate using Wolfram Alpha...
[22:19:19] -Zalgo- Calculation complete in 8.897099 seconds.
[22:19:19] -Zalgo- Input interpretation:
[22:19:19] -Zalgo- Apple (AAPL)
[22:19:19] -Zalgo- Latest trade:
[22:19:19] -Zalgo- $339.20(AAPL | NASDAQ | 1:59:59 pm MDT | 6 hrs 19 mins ago)
[22:19:19] -Zalgo- Fundamentals and financials:
[22:19:19] -Zalgo- +--------------------------+----------------+
[22:19:19] -Zalgo- | market cap | $312.6 billion |
[22:19:19] -Zalgo- +--------------------------+----------------+
@e000
e000 / font.py
Created March 31, 2011 23:10
Fun :0
ascii_dict = {
' ': ['..............','..............','..............','..............','..............','..............','..............'],
'!': ['.......','.......','..!!!..','.!!:!!.','.!:::!.','.!:::!.','.!:::!.','.!:::!.','.!:::!.','.!:::!.','.!:::!.','.!:::!.','.!!:!!.','..!!!..','.......','..!!!..','.!!:!!.','..!!!..','.......'],
'#': ['............................','......######....######......','......#::::#....#::::#......','......#::::#....#::::#......','.######::::######::::######.','.#::::::::::::::::::::::::#.','.######::::######::::######.','......#::::#....#::::#......','......#::::#....#::::#......','.######::::######::::######.','.#::::::::::::::::::::::::#.','.######::::######::::######.','......#::::#....#::::#......','......#::::#....#::::#......','......######....######......','............................'],
'$': ['....................','........$$$$$.......','........$:::$.......','....$$$$$:::$$$$$$..','..$$::::::::::::::$.','.$:::::$$$$$$$::::$.','.$::::$.......$$$$$
@e000
e000 / str2bin.js
Created April 7, 2011 03:39
so many shitty str -> binary converters out there. here's a decent one.
strToBin = (function() {
var binarr = [] // build an array to hold the binary form of 0-255
for(var i = 0; i < 256; i++) {
bins = ''
for(var j = 7; j >= 0; j--) {
c = Math.pow(2, j)
bins += (i & c) == c ? '1' : '0'
}
binarr.push(bins)
}
from Core.ZalgoUtil.CancellableClient import getPage
from twisted.python.util import OrderedDict
from urllib import quote
from hashlib import md5
from Core.ZalgoUtil.ModUtil import xhtml_unescape, utf8
import re
class AlreadyRunningError(Exception):
pass
@e000
e000 / lolambda.py
Created June 13, 2011 22:40
How not to use lambdas.
class Foo:
def __init__(self, a, b, c):
self._a = a
self._b = b
self._c = c
def getA(self):
return self._a
@e000
e000 / lambda.py
Created June 13, 2011 23:24
How to NOT use Lambdas
########################################################
# How to NOT use Lambdas. An inneficient and yet educa-#
# tonal guide to the proper misuse of the lambda const-#
# ruct in Python 2.x. DO NOT USE ANY OF THIS EVER #
# by: e000 (13/6/11) #
########################################################
## Part 1. Basic LAMBDA Introduction ##
# Well, it's worth diving straight into what lambdas are.
# Lambdas are pretty much annymous "one line" functions
@e000
e000 / donotuse.py
Created June 13, 2011 23:30
How to NEVER use lambdas.
##########################################################
# How to NEVER use Lambdas. An inneficient and yet educa-#
# tonal guide to the proper misuse of the lambda constru-#
# ct in Python 2.x. [DO NOT USE ANY OF THIS EVER] #
# by: e000 (13/6/11) #
##########################################################
## Part 1. Basic LAMBDA Introduction ##
# Well, it's worth diving straight into what lambdas are.
# Lambdas are pretty much anonymous "one line" functions