Skip to content

Instantly share code, notes, and snippets.

@pk13610
pk13610 / timeout.py
Last active August 29, 2015 14:22 — forked from baojie/timeout.py
from functools import wraps
import errno
import os
import signal
import time
# timeout any function in given seconds
# solution from http://stackoverflow.com/questions/2281850/timeout-function-if-it-takes-too-long-to-finish
class TimeoutError(Exception):
@pk13610
pk13610 / firewall.sh
Created December 10, 2013 06:39 — forked from x1a0/firewall.sh
#! /bin/bash
# Set the default policies to allow everything while we set up new rules.
# Prevents cutting yourself off when running from remote SSH.
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
# Flush any existing rules, leaving just the defaults
iptables -F