Skip to content

Instantly share code, notes, and snippets.

View DavidWittman's full-sized avatar

David Wittman DavidWittman

View GitHub Profile
@DavidWittman
DavidWittman / lsyncd.lua
Created June 21, 2012 00:14
Lsyncd alternate SSH key
settings = {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd-status.log",
statusInterval = 20
}
servers = {
"web02",
"web03"
}
@DavidWittman
DavidWittman / default.vcl
Created June 1, 2012 19:46
Varnish VCL to detect and redirect file uploads
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
@DavidWittman
DavidWittman / .bashrc
Created May 16, 2012 00:48
boot - openstack-compute/nova wrapper for building Cloud Servers
# 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
# %(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 / .vimrc
Created March 14, 2012 17:38
My .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
@DavidWittman
DavidWittman / youtube_couch_mode.user.js
Created January 9, 2012 19:38
Greasemonkey Script to add "Couch Mode" to YouTube
// ==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 / gist:1390013
Created November 23, 2011 21:46
Javascript Mixin
function mixInto(object, mixIn) {
forEachIn(mixIn, function(name, value) {
object[name] = value;
});
};
@DavidWittman
DavidWittman / hipchat-to-slack.go
Created July 9, 2015 03:17
Relay for posting messages from a HipChat room into a Slack room
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
"os"
@DavidWittman
DavidWittman / naglite.go
Last active August 29, 2015 14:16
Status.dat parser for Icinga in Go. I'm sorry.
package main
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"os"
"strconv"
"strings"
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Kevin Carter <kevin.carter@rackspace.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or