Skip to content

Instantly share code, notes, and snippets.

@themiurgo
themiurgo / ratelim.py
Created June 27, 2012 19:40
Rate limit decorator
import time
import datetime
class rate_limited(object):
def __init__(self, max_calls, time_interval):
assert max_calls > 0
assert time_interval > 0
self.__last_reset = None
self.__max_calls = max_calls
self.__time_interval = time_interval # seconds
@pthrasher
pthrasher / deck.md
Created May 29, 2012 18:24
GistDeck for Charlotte Python Meetup

Who am I?

Philip Thrasher

Web hacker at a private cyber security company.

What I Do

@idavis
idavis / Use-Impersonation.ps1
Created March 5, 2011 18:52
Impersonate a user and execute a script block as that user
param( [ScriptBlock] $scriptBlock )
<#
.SYNOPSIS
Impersonates a user and executes a script block as that user. This is an interactive script
and a window will open in order to securely capture credentials.
.EXAMPLE
Use-Impersonation.ps1 {Get-ChildItem 'C:\' | Foreach { Write-Host $_.Name }}
This writes the contents of 'C:\' impersonating the user that is entered.
#>
@suda
suda / gunicorn
Created December 20, 2010 14:49
Gunicorn init.d script (debian/ubuntu)
#!/bin/sh
### BEGIN INIT INFO
# Provides: gunicorn
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the gunicorn server
# Description: starts gunicorn using start-stop-daemon
@danmackinlay
danmackinlay / supervisord.sh
Created August 27, 2009 07:07
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.