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 dpkt, pcap, socket | |
from ipaddr import IPv4Address, IPv6Address | |
import syslog | |
class HTTPRequest(): | |
def __init__(self, host, uri, ip = None, user_agent = None): | |
self.uri = uri | |
self.user_agent = user_agent | |
self.host = host |
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
# | |
# Find triangles in a graph stored as adjacency matrix | |
# | |
import itertools | |
import random | |
SIZE = 4 | |
# Generate graph in adjacency list format with random edges | |
# the random edges are sampled from all possible edges, |e| is random up to size |
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
# | |
# Generate random word list from Linux Dictionary | |
# | |
# Based on script seen at CCC talk 4494 <http://ftp.ccc.de/events/camp2011/video/cccamp11-4494-laptop_and_electronics_searches_at_the_us_border-en.mp4> at 25:30 | |
# (c) Electronic Fronteer Foundation (it's from the presentation) | |
import random, math | |
d = open('/usr/share/dict/words').readlines() | |
n = 5 | |
print ' '.join(random.choice(d).rstrip() for i in range(n)) | |
print n * math.log(len(d))/math.log(2), 'bits' |
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
""" | |
Decorator that retrieves the current user from app engine and sets it on the wrapped function | |
Usage: | |
@user | |
[function definition] | |
or | |
@user("userobj") | |
def func(userobj, bar, baz) |
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 namedtuple | |
class Resolution(namedtuple('_Resolution', ['width', 'height'])): | |
@property | |
def pixels(self): | |
return self.width * self.height |
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
#include <iostream> | |
#include <stdio.h> | |
#include <math.h> | |
#include <algorithm> | |
#include <vector> | |
#include <list> | |
#include <map> | |
#include <set> |
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
require 'formula' | |
class Bob < Formula | |
homepage '' | |
url 'https://www.idiap.ch/software/bob/packages/bob-1.1.4.zip' | |
sha1 'be4385daab4e11af3f91fb09d2d1d54629f1a59c' | |
# dependencies from <http://www.idiap.ch/software/bob/docs/nightlies/last/bob/sphinx/html/Dependencies.html> | |
# depends_on 'cmake' => :build | |
depends_on 'blitz' |
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 | |
# based on monitor-bluetooth | |
# Changes by Domen Puncer <[email protected]> | |
import gobject | |
import dbus | |
import dbus.mainloop.glib | |
import os, subprocess | |
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
#!/usr/bin/env python | |
""" | |
The libvirt API is much easier than my old kludge based on `virsh list` and sed… | |
""" | |
import libvirt | |
conn = libvirt.open(None) | |
for id in conn.listDomainsID(): | |
domain = conn.lookupByID(id) |
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
ssl_session_cache shared:SSL:10m; | |
server_name <name>; | |
ssl on; | |
ssl_certificate <path to concatenated certificate chain>; | |
ssl_certificate_key <path to certificate private key>; | |
ssl_dhparam <path to dh params>; | |
ssl_session_timeout 5m; |
OlderNewer