Skip to content

Instantly share code, notes, and snippets.

View goncalopp's full-sized avatar

goncalopp

  • Stuck in a infinite loop
View GitHub Profile
@goncalopp
goncalopp / log_ping
Created October 15, 2013 15:13
ping periodically and print results
import subprocess
import sched
import threading
from functools import partial
import time
from datetime import datetime
def ping( host, count=1, timeout=5):
count, timeout= map(str, (count, timeout))
devnull= open("/dev/null","w")
@goncalopp
goncalopp / sendreceive.py
Created November 9, 2012 09:00
send and receive python objects through network with integrity and authentication
'''this module implements two functions, send() and receive(), capable
of sending arbitrary objects through the network (with pickle), with
authentication and integrity assurance'''
import socket
try:
import cPickle as pickle
except ImportError:
import pickle
import hmac