This file contains hidden or 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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| from time import sleep | |
| def sleep(*a): | |
| pass | |
| class BlackBox(object): | |
| def __init__(self, name): | |
| self.name = name | |
| self._in = dict() |
This file contains hidden or 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
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| #WTFPL | |
| """Trying lame cosinus on text | |
| to create the mysoginie and troll input text file | |
| you need *nix | |
| fortunes / fortunes-fr | |
| and then | |
| fortune mysoginie -m '' | egrep -v -r "^%" | egrep -v '\-\+\-' > myso-fr.txt | |
| fortune tribune-linuxfr -m '' | egrep -v -r "^%" | egrep -v '\-\+\-' > troll.txt |
This file contains hidden or 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 collections import MutableMapping | |
| from json import dumps | |
| class Merger(dict): | |
| def merge(self, to_merge): | |
| """Merging to dict, to_merge dict keys being prioritar on initial dict | |
| """ | |
| if not isinstance(to_merge,MutableMapping): | |
| raise Exception("What Did I just read?") | |
| for k, v in to_merge.items(): |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
| execve("/home/gaffer/py27/bin/py.test", ["py.test", "-v"], [/* 30 vars */]) = 0 | |
| brk(0) = 0x12b5000 | |
| mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fed186c6000 | |
| access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) | |
| open("/etc/ld.so.cache", O_RDONLY) = 3 | |
| fstat(3, {st_mode=S_IFREG|0644, st_size=61688, ...}) = 0 | |
| mmap(NULL, 61688, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fed186b6000 | |
| close(3) = 0 | |
| open("/lib64/libpthread.so.0", O_RDONLY) = 3 | |
| read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\\\0z5\0\0\0"..., 832) = 832 |
This file contains hidden or 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
| ============================= test session starts ============================== | |
| platform linux2 -- Python 2.7.3 -- pytest-2.3.5 -- /home/gaffer/py27/bin/python2.7 | |
| collecting ... collected 178 items / 2 skipped | |
| test/test_channel.py:13: test_basic PASSED | |
| test/test_channel.py:41: test_process_events PASSED | |
| test/test_channel.py:67: test_stats PASSED | |
| test/test_controller.py:45: test_basic PASSED | |
| test/test_controller.py:73: test_basic_error PASSED | |
| test/test_controller.py:85: test_command_not_found PASSED |
This file contains hidden or 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
| (py27)[gaffer@playground3 gaffer]$ py.test | |
| ============================================================== test session starts =============================================================== | |
| platform linux2 -- Python 2.7.3 -- pytest-2.3.5 | |
| collected 178 items / 2 skipped | |
| test/test_channel.py ... | |
| test/test_controller.py ..................... | |
| test/test_docopt.py ....................................... | |
| test/test_events.py ........ | |
| test/test_http.py ............. |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """Small utility only useful for people able to understand the web front and back | |
| that are bored of actually bloated web pages and only want to see what they | |
| think is useful. | |
| It is not intended as an adblock except if as I, you hate advertisement and | |
| think ads are noise so I tend to not fetch them. | |
| Not intended as an antivirus, but I also tend to not load virus because | |
| there is nothing interesting in them. |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # version 2 here https://gist.github.com/jul/200d3a5895a437e20df6 | |
| from cmath import polar, rect, pi as PI, e as E, phase | |
| rad_to_deg = lambda r : r/2/PI*360.0 | |
| deg_to_rad = lambda r : r*2*PI/360.0 | |
| identity = lambda r: r | |
| class Point(complex): |
This file contains hidden or 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 croniter import croniter as ci | |
| import os | |
| from datetime import datetime as dt | |
| from time import time | |
| from itertools import takewhile | |
| from functools import reduce | |
| from os import walk | |
| before = 3600.0 | |
| after = 3600.0 | |
| import re |
This file contains hidden or 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
| def ift(p, vt, vf): | |
| return lambda val: (ift(*vt)(val) if isinstance(vt, tuple) else vt) \ | |
| if p(val) else (ift(*vf)(val) if isinstance(vf, tuple) else vf) | |
| compile = lambda f: sum([ int(bool(f(x)))<<x for x in range(0, 256) ] ) | |
| interpret = lambda code: lambda val: int((1<<(val))&code != 0) | |
| code_by3=compile( lambda x: (x%3)==0) | |
| print bin(code_by3) | |
| evaluate=interpret(code_by3) | |
| sign = ift(lambda x:x>0, 1, (lambda y: y==0, 0, (lambda z:z<0, -1, 1))) |