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 python2 | |
""" | |
Other Repositories of python-ping | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
* https://github.com/l4m3rx/python-ping supports Python2 and Python3 | |
* https://bitbucket.org/delroth/python-ping | |
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 time | |
import random | |
import struct | |
import select | |
import socket | |
def chk(data): | |
x = sum(x << 8 if i % 2 else x for i, x in enumerate(data)) & 0xFFFFFFFF | |
x = (x >> 16) + (x & 0xFFFF) |
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
# This is some butt ugly fuckery that basically chdirs to the | |
# directory that is parent to this source file, imports the | |
# test subject from the main script, then de-imports (not really | |
# cause Python doesn't support that) the stuff that it needed to | |
# do that as not to pollute the name space and cause tests to | |
# possibly fail because of that. | |
# | |
# In order for this to work it's imperative that you: | |
# - Have the main script on the parent directory to the one | |
# this script file is in. |
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 os import urandom | |
from base64 import b64encode | |
from string import ascii_letters, digits | |
def randkey(size=6, altchars=b'+.', ambiguous=b'IlO9GUS'): | |
key = '' | |
while len(key) < size: | |
chunk = b64encode(urandom(size*2), altchars) | |
key += str(bytes([c for c in chunk if c not in ambiguous]), encoding='utf-8') |
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 | |
""" | |
Tool to download conference information from Indico | |
""" | |
import json, argparse, sys, re, logging, os, importlib | |
logger = logging.getLogger(__name__) | |
logging.basicConfig(format='%(levelname)s: %(message)s') |
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 | |
import pickle | |
import argparse | |
import sys | |
def main(): | |
parser = argparse.ArgumentParser(description='Convert between pickle protocol versions.') | |
parser.add_argument('input_file') | |
parser.add_argument('output_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
#!/usr/bin/env python | |
# originally from johnl found at | |
# http://ubuntuforums.org/showthread.php?t=1604981&p=10024295#post10024295 | |
import subprocess | |
import re | |
class line_matcher: | |
def __init__(self, regexp, handler): |
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
# coding=utf-8 | |
""" | |
LICENSE http://www.apache.org/licenses/LICENSE-2.0 | |
""" | |
import datetime | |
import sys | |
import time | |
import threading | |
import traceback | |
import SocketServer |
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 -*- | |
""" | |
Written on 2013-02-04 by Philipp Klaus <philipp.l.klaus →AT→ web.de>. | |
Check <https://gist.github.com/4707775> for newer versions. | |
Uses dnspython: install with `pip install dnspython3` | |
""" |
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 python2.7 | |
# Matt's DNS management tool | |
# Manage DNS using DDNS features | |
# | |
# See http://planetfoo.org/blog/archive/2012/01/24/a-better-nsupdate/ | |
# | |
# Usage: dnsupdate -s server -k key -t ttl add _minecraft._tcp.mc.example.com SRV 0 0 25566 mc.example.com. | |
# -h HELP! | |
# -s the server | |
# -k the key |
OlderNewer