Skip to content

Instantly share code, notes, and snippets.

Avatar

David Wittman DavidWittman

View GitHub Profile
View gist:1390013
function mixInto(object, mixIn) {
forEachIn(mixIn, function(name, value) {
object[name] = value;
});
};
@DavidWittman
DavidWittman / youtube_couch_mode.user.js
Created Jan 9, 2012
Greasemonkey Script to add "Couch Mode" to YouTube
View youtube_couch_mode.user.js
// ==UserScript==
// @name YouTube Couch Mode
// @author David Wittman <david@wittman.com>
// @namespace nowhere
// @description Adds a full-screen "Couch Mode" button to YouTube
// @include http://www.youtube.com/watch?*
// ==/UserScript==
// iframe detection
@DavidWittman
DavidWittman / notes.md
Created Feb 22, 2012
A Brief Introduction to Fabric
View notes.md

A Brief Introduction to Fabric

Fabric is a deployment management framework written in Python which makes remotely managing multiple servers incredibly easy. If you've ever had to issue a change to a group servers, this should look pretty familiar:

for s in $(cat servers.txt); do ssh $s service httpd graceful; done

Fabric improves on this process by providing a suite of functions to run commands on the servers, as well as a number of other features which just aren't possible in a simple for loop. While a working knowledge of Python is helpful when using Fabric, it certainly isn't necessary. This tutorial will cover the steps necessary to get started with the framework and introduce how it can be used to improve on administering groups of servers.

@DavidWittman
DavidWittman / hubot.conf
Created Mar 6, 2012
Hubot Upstart Script
View hubot.conf
# hubot
description "Hubot Campfire bot"
author "David Wittman <david@wittman.com>"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
# Path to Hubot installation
env HUBOT_DIR='/opt/hubot/'
View .vimrc
set t_Co=256
colors molokai
syntax on
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
set tabstop=4
set shiftwidth=4
set smarttab
set expandtab
set softtabstop=4
View gunicorn-upstart.conf.template
# %(mysite)s - run %(mysite)s instances (default is the prod instance)
#
# This runs gunicorn-django for %(mysite)s; to install:
# * sudo ln -s <this file> /etc/init/%(mysite)s
# * sudo initctl reload-configuration
#
# it expects the following directory layout:
#
# /home/%(mysite)s/public_html
# \-env -> virtualenv
@DavidWittman
DavidWittman / ms120-020.py
Created Apr 5, 2012
MS12-020/CVE-2012-0002 Vulnerability Tester
View ms120-020.py
#!/usr/bin/env python
"""
MS12-020/CVE-2012-0002 Vulnerability Tester
based on sleepya's version @ http://pastebin.com/Ks2PhKb4
"""
import socket
import struct
import sys
@DavidWittman
DavidWittman / http-get.nse
Created Apr 6, 2012
Nmap HTTP GET request script
View http-get.nse
description = [[
Issues an arbitrary HTTP GET request
]]
---
-- @usage
-- nmap --script http-get [--script-args http-get.path=/status] -p <port> <host>
-- @args http-get.path The path to request (defaults to /)
-- http-get.match String to match in the HTTP response (incl. headers)
-- @output
@DavidWittman
DavidWittman / .bashrc
Created May 16, 2012
boot - openstack-compute/nova wrapper for building Cloud Servers
View .bashrc
# boot
# openstack-compute/nova wrapper for building Cloud Servers
# usage: boot <image> <flavor> <name>
function boot() {
# API Credentials
local USERNAME=${OPENSTACK_COMPUTE_USERNAME-"username"}
local APIKEY=${OPENSTACK_COMPUTE_APIKEY-"8b843e51cecdae209efd541b6dd52c04"}
# Boot specifics
local FLAVOR=3
@DavidWittman
DavidWittman / default.vcl
Created Jun 1, 2012
Varnish VCL to detect and redirect file uploads
View default.vcl
backend default {
.host = "127.0.0.1";
.port = "8080";
}
backend master {
.host = "10.x.x.x";
.port = "80";
}
sub vcl_recv {
# Any uploads or restarts should go to the master backend
You can’t perform that action at this time.