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
# dns server using dnslib and gevent | |
# based on https://bitbucket.org/paulc/dnslib/src/80d85555aae4/src/server/gevent_server.py | |
# set the key as | |
# set IP:name ip_addr | |
# set TXT:name txtfield | |
# fallback on gevent's dns resolver | |
# gleicon 2011 | |
import gevent |
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
#!/usr/bin/python | |
pos = [['0']*3,['1']*3,['A','B','C'],['D','E','F'], | |
['G','H','I'],['J','K','L'],['M','N','O'],['P','R','S'], | |
['T','U','V'],['W','X','Z']] | |
# number to list of digits | |
def int_to_list(i): | |
return [int(x) for x in str(i).zfill(len(str(i)))] |
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
#!/usr/bin/env python | |
import re | |
import sys | |
from subprocess import * | |
p = Popen("pylint -f parseable -r n --disable-msg-cat=C,R %s" % | |
sys.argv[1], shell = True, stdout = PIPE).stdout |
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
#!/usr/bin/env python | |
""" | |
A sample Mongo server that handles enough of the commands to connect | |
with the mongo shell. | |
Requires: https://github.com/chergert/mongo-async-python-driver | |
""" | |
from collections import OrderedDict |
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
#!/usr/bin/perl -w | |
# | |
# This script was developed by Robin Barker ([email protected]), | |
# from Larry Wall's original script eg/rename from the perl source. | |
# | |
# This script is free software; you can redistribute it and/or modify it | |
# under the same terms as Perl itself. | |
# | |
# Larry(?)'s RCS header: | |
# RCSfile: rename,v Revision: 4.1 Date: 92/08/07 17:20:30 |
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
#!/usr/bin/python | |
"""Stack tracer for multi-threaded applications. | |
Usage: | |
import stacktracer | |
stacktracer.start_trace("trace.html",interval=5,auto=True) # Set auto flag to always update file! | |
.... | |
stacktracer.stop_trace() |
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
#!/usr/bin/env python | |
""" | |
A simple echo server | |
""" | |
import gevent | |
from gevent import monkey; | |
monkey.patch_socket() |
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
# (unset) mask = 0xff - (1 << offset) if (nibble == 'lower') else 0xff - (4 << (4 - offset)); operation = & | |
# (set) mask = 1 << offset if (nibble == 'lower') else 4 << (4 - offset); operation = | | |
# | |
# (read) result = (current_values & 0x0F) if (nibble == 'lower') else (current_values & 0xF0) >> 4 | |
# (write) mask = (offset - 1) & 0xf0 if (nibble == 'lower') else 4 << (offset - 1) & 0x0f; operation = | | |
def getNibbles(int_type): | |
""" getNibbles() returns the byte nibbles for a given integer (upper, lower) """ | |
return((int_type & 0xF0) >> 4, (int_type & 0x0F)) |
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
#! /usr/bin/env python | |
# Released to the public domain, by Tim Peters, 03 October 2000. | |
"""reindent [-d][-r][-v] [ path ... ] | |
-d (--dryrun) Dry run. Analyze, but don't make any changes to, files. | |
-r (--recurse) Recurse. Search for all .py files in subdirectories too. | |
-n (--nobackup) No backup. Does not make a ".bak" file before reindenting. | |
-v (--verbose) Verbose. Print informative msgs; else no output. |
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 program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
*/ | |
#include <arpa/inet.h> | |
#include <linux/if_packet.h> | |
#include <stdio.h> |
OlderNewer