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
| import treq | |
| from twisted.internet import defer, task | |
| URLS = [ | |
| "https://google.com", | |
| "https://github.com", | |
| "https://example.org", | |
| ] | |
| DONE = {} |
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
| [Unit] | |
| Description=Deluge Bittorrent Client Web Interface | |
| After=network-online.target | |
| [Service] | |
| Type=simple | |
| ExecStart=/usr/bin/deluge-web -l /home/tritium/torrent/web.log -L warning | |
| Restart=on-failure | |
| [Install] |
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
| import collections | |
| import functools | |
| import re | |
| import urllib.parse | |
| class Request(collections.Mapping): | |
| KEYS = '''REQUEST_METHOD SCRIPT_NAME PATH_INFO | |
| QUERY_STRING CONTENT_TYPE CONTENT_LENGTH | |
| SERVER_NAME SERVER_PORT SERVER_PROTOCOL wsgi.version |
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 make_route(route): | |
| type_map = {'int': r'\d+', 'str': '[^/]+'} | |
| in_arg = False | |
| in_arg_name = False | |
| value = '' | |
| pat = '' | |
| for c in route: | |
| if not in_arg and c != '<': | |
| pat += c | |
| continue |
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 python3 | |
| """ | |
| Generates a bash script to readd torrents to deluge | |
| (e.g. if you are moving machines) | |
| """ | |
| import argparse | |
| import collections | |
| import fnmatch | |
| import functools | |
| import itertools |
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
| import itertools | |
| def foo(it) | |
| source1, source2 = itertools.tee(it, 2) | |
| falses = (i for i in source1 if not bool(i)) | |
| trues = (i for i in source1 if bool(i)) | |
| return trues, falses |
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 foo(sequence, obj): | |
| for idx, item in enumerate(sequence): | |
| if obj in item: | |
| return idx | |
| return 0 |
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
| ; <<>> DiG 9.10.3-P4-Ubuntu <<>> carnage.sdamon.com +trace | |
| ;; global options: +cmd | |
| . 166570 IN NS f.root-servers.net. | |
| . 166570 IN NS m.root-servers.net. | |
| . 166570 IN NS k.root-servers.net. | |
| . 166570 IN NS e.root-servers.net. | |
| . 166570 IN NS i.root-servers.net. | |
| . 166570 IN NS j.root-servers.net. | |
| . 166570 IN NS h.root-servers.net. |
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
| ; <<>> DiG 9.10.3-P4-Ubuntu <<>> NS blogofthedead.org @a0.org.afilias-nst.info | |
| ;; global options: +cmd | |
| ;; Got answer: | |
| ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2768 | |
| ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 4, ADDITIONAL: 6 | |
| ;; WARNING: recursion requested but not available | |
| ;; OPT PSEUDOSECTION: | |
| ; EDNS: version: 0, flags:; udp: 4096 |
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
| # Run with python py_for_pi_day.py [number of rounds] [upper limit on random number] | |
| # Python 3.5+ | |
| import math | |
| import random | |
| import sys | |
| def main(rounds, limit): | |
| print(rounds, "Rounds") | |
| print(limit, "Sides") |