Skip to content

Instantly share code, notes, and snippets.

View dzderic's full-sized avatar

David Zderic dzderic

View GitHub Profile
@dzderic
dzderic / vpnc-script
Created December 14, 2012 11:11
A custom OpenConnect script to set DNS using `networksetup` on OSX, which makes it work with things that don't read from `/etc/resolv.conf`
#!/bin/sh
#
# Originally part of vpnc source code:
# © 2005-2012 Maurice Massar, Jörg Mayer, Antonio Borneo et al.
# © 2009-2012 David Woodhouse <dwmw2@infradead.org>
#
# 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 2 of the License, or
# (at your option) any later version.
import dpkt, pcap
pc = pcap.pcap('lo')
pc.setfilter('tcp and dst host 127.0.0.1 and port 8080 and tcp[tcpflags] & (tcp-push) != 0')
for timestamp, packet in pc:
print repr(dpkt.ethernet.Ethernet(packet))
import time
import os
import zipfile
N = 100000
archive = zipfile.ZipFile('something.zip', 'w')
print 'Generating messages'
messages = [os.urandom(1024) for i in range(N)]
import time
import pika
from pika.adapters import SelectConnection
N = 10000
channel = None
count = 0
start = None