Skip to content

Instantly share code, notes, and snippets.

@e000
e000 / font.py
Created March 31, 2011 23:10
Fun :0
ascii_dict = {
' ': ['..............','..............','..............','..............','..............','..............','..............'],
'!': ['.......','.......','..!!!..','.!!:!!.','.!:::!.','.!:::!.','.!:::!.','.!:::!.','.!:::!.','.!:::!.','.!:::!.','.!:::!.','.!!:!!.','..!!!..','.......','..!!!..','.!!:!!.','..!!!..','.......'],
'#': ['............................','......######....######......','......#::::#....#::::#......','......#::::#....#::::#......','.######::::######::::######.','.#::::::::::::::::::::::::#.','.######::::######::::######.','......#::::#....#::::#......','......#::::#....#::::#......','.######::::######::::######.','.#::::::::::::::::::::::::#.','.######::::######::::######.','......#::::#....#::::#......','......#::::#....#::::#......','......######....######......','............................'],
'$': ['....................','........$$$$$.......','........$:::$.......','....$$$$$:::$$$$$$..','..$$::::::::::::::$.','.$:::::$$$$$$$::::$.','.$::::$.......$$$$$
[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- +--------------------------+----------------+
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()
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
@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,
[01:32:55] <Sandman> 2000 api calls
[01:32:55] -Zalgo- Attempting to calculate using Wolfram Alpha...
[01:32:56] -Zalgo- Calculation complete in 1.217716 seconds.
[01:32:56] -Zalgo- Input interpretation:
[01:32:56] -Zalgo- Fight Club (movie) | The Shawshank Redemption (movie)
[01:32:56] -Zalgo- Basic information:
[01:32:56] -Zalgo- +--------------------------------+--------------------------------+--------------------------------+
[01:32:56] -Zalgo- | | Fight Club | The Shawshank Redemption |
[01:32:56] -Zalgo- +--------------------------------+--------------------------------+--------------------------------+
[01:32:56] -Zalgo- | title | Fight Club | The Shawshank Redemption |
<e> !wa nobel prize
-Zalgo- Attempting to calculate using Wolfram Alpha...
-Zalgo- Calculation complete in 1.543207 seconds.
-Zalgo- Input interpretation:
-Zalgo- Nobel Prize
-Zalgo- Result:
-Zalgo- +------+---------------------------+------------+------------------------+------------------+
-Zalgo- | year | recipient | field | country of achievement | country of birth |
-Zalgo- +------+---------------------------+------------+------------------------+------------------+
-Zalgo- | 2010 | Akira Suzuki | chemistry | Japan | Japan |
[00:42:21] <e> !wa the matrix revolutions, men in black II
[00:42:22] -Zalgo- Attempting to calculate using Wolfram Alpha...
[00:42:23] -Zalgo- Calculation complete in 1.833927 seconds.
[00:42:23] -Zalgo- Input interpretation:
[00:42:23] -Zalgo- The Matrix Revolutions (movie) | Men in Black II (movie)
[00:42:23] -Zalgo- Basic information:
[00:42:23] -Zalgo- +--------------+-------------------------------------------+---------------------------------------+
[00:42:23] -Zalgo- | | The Matrix Revolutions | Men in Black II |
[00:42:23] -Zalgo- +--------------+-------------------------------------------+---------------------------------------+
[00:42:23] -Zalgo- | title | The Matrix Revolutions | Men in Black II |
[00:26:38] <Zalgo> Input interpretation:
[00:26:38] <Zalgo> The Matrix Revolutions (movie) | Men in Black II (movie)
[00:26:38] <Zalgo> Basic information:
[00:26:38] <Zalgo> +--------------+-------------------------------------------+---------------------------------------+
[00:26:38] <Zalgo> | | The Matrix Revolutions | Men in Black II |
[00:26:38] <Zalgo> +--------------+-------------------------------------------+---------------------------------------+
[00:26:38] <Zalgo> | title | The Matrix Revolutions | Men in Black II |
[00:26:38] <Zalgo> +--------------+-------------------------------------------+---------------------------------------+
[00:26:38] <Zalgo> | directors | Andy Wachowski | Lana Wachowski | Barry Sonnenfeld |
[00:26:38] <Zalgo> +--------------+-------------------------------------------+----------------------------------
from texttable import Texttable
import re
_ignParens = re.compile('\(.*?\)')
def countDelim(text, delim = ' | '):
text = _ignParens.sub('', text) # get rid of the stuff inside of parens when searching for ' | '
return text.count(delim)
def renderTable(input, sub = False):
input = input[:] # make a copy of the input, so it doesn't eat the one in the cache.