This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Define functions inside functions, | |
recompile the correct function matching the | |
arg count and hand it back. | |
''' | |
from types import FunctionType | |
class Multi(object): | |
def __init__(self, fn): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am Foxboron on github. | |
* I am fox (https://keybase.io/fox) on keybase. | |
* I have a public key whose fingerprint is CDC1 F0D2 CE5F BB1D 8FC5 A660 7B00 1AE2 70CF B413 | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am Foxboron on github. | |
* I am fox (https://keybase.io/fox) on keybase. | |
* I have a public key whose fingerprint is C100 3466 7663 4E80 C940 FB9E 9C02 FF41 9FEC BE16 | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib, urllib2 | |
import threading | |
''' | |
''' | |
def main(nummer, text, n): | |
user_agent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.151 Safari/535.19' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is supposedly what CRIME by Juliano Rizzo and Thai Duong will do | |
# Algorithm by Thomas Pornin, coding by xorninja, improved by @kkotowicz | |
# http://security.blogoverflow.com/2012/09/how-can-you-protect-yourself-from-crime-beasts-successor/ | |
import string | |
import zlib | |
import sys | |
import random | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from bs4 import BeautifulSoup | |
import urllib | |
app = Flask(__name__) | |
def bs4_slice(web_source): | |
soup = BeautifulSoup(web_source) | |
soup.body.find(id="header").decompose() | |
soup.body.find(id="footer").decompose() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
# Copy the following and place it a file called Leiningen.sublime-build in the Sublime user packages folder (~/.config/sublime-text-2/Packages/User on Linux). | |
# Select this as the build system for the project using Tools/Build System/Leiningen. | |
# You can then bring up the Sublime Command Palette (ctrl+shift+P on Windows/Linux) and issue any of the commands # (build, documentation, clean, run, test, etc). By default, build is bound to ctrl+b and run to ctrl+shift+b. | |
{ | |
"cmd": ["lein", "compile", ":all"], | |
"working_dir": "$file", | |
"variants": [ | |
{ "cmd": ["lein", "marg", "-m", "-d", "docs"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# F=(9/5) * C +32 | |
def convert(): | |
c = int(raw_input('Enter celcius to convert: ')) | |
convertedC = (9/5.0) * c + 32 | |
print convertedC | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Python2 | |
import sys | |
f = lambda x: map(lambda i: sys.stdout.write(([str(i)+'\n',"Fizz\n"],["Buzz\n","FizzBuzz\n"])[not i % 3][not i % 5]), range(0,x)) and None | |
## Python3 | |
f = lambda x: list(map(lambda i: print(([str(i),"Fizz"],["Buzz","FizzBuzz"])[not i % 3][not i % 5]), range(0,x))) and None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lightning talk on PyCon 2013: | |
http://www.youtube.com/watch?feature=player_detailpage&v=1vui-LupKJI#t=975 | |
Boston Python Meetup (January 2013) | |
http://www.youtube.com/watch?v=ulekCWvDFVI | |
PyCon Canada 2013 | |
http://www.youtube.com/watch?v=n8i2f6X0SkU | |
PyCon France 2013 |
OlderNewer