Skip to content

Instantly share code, notes, and snippets.

View jamiesun's full-sized avatar
🍇
On vacation

Jett Wang jamiesun

🍇
On vacation
View GitHub Profile
anonymous
anonymous / log_test11.py
Created November 19, 2011 22:15
Test script showing usage of a buffering SMTP handler.
#!/usr/bin/env python
#
# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of Vinay Sajip
# not be used in advertising or publicity pertaining to distribution
@jhorman
jhorman / twisted_sleep.py
Created March 29, 2011 02:38
Simple non-blocking sleep in twisted.
def sleep(secs):
d = Deferred()
reactor.callLater(secs, d.callback, None)
return d
@glacjay
glacjay / tun-ping-linux.py
Created September 18, 2010 04:49
Reading/writing Linux's TUN/TAP device using Python.
import fcntl
import os
import struct
import subprocess
# Some constants used to ioctl the device file. I got them by a simple C
# program.
TUNSETIFF = 0x400454ca
TUNSETOWNER = TUNSETIFF + 2