Skip to content

Instantly share code, notes, and snippets.

View joshado's full-sized avatar

Thomas Haggett joshado

View GitHub Profile
@joshado
joshado / nginx
Created July 1, 2011 12:24 — forked from mig/nginx
nginx init.d script
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d script for Ubuntu 8.10 and lesser versions.
# Description: nginx init.d script for Ubuntu 8.10 and lesser versions.
### END INIT INFO
@joshado
joshado / gist:1058433
Created July 1, 2011 12:26 — forked from dctanner/gist:4515
Graceful nginx init.d script
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
/var/log/nginx/access.log {
missingok
notifempty
delaycompress
sharedscripts
postrotate
test ! -f /var/run/nginx.pid || kill -USR1 `cat /var/run/nginx.pid`
endscript
}
@joshado
joshado / client.rb
Created January 9, 2012 01:03
AMQP latency test.
require "amqp"
AMQP_CONFIG = {
host: '<...>',
port: 5671,
username: '<...>',
password: '<...>',
ssl: true
}
@joshado
joshado / centos5.ks
Created March 1, 2012 16:50
CentOS 5 kickstart
install
text
reboot
url --url http://mirror.centos.org/centos/5/os/x86_64/
lang en_US.UTF-8
keyboard us
skipx
network --device eth0 --bootproto dhcp
rootpw password
firewall --disabled
@joshado
joshado / fa-logs
Created March 3, 2012 08:40
Simple log CLI tool
#!/usr/bin/env ruby
require 'rubygems'
require 'tire'
require 'yajl/json_gem'
require 'optparse'
require 'optparse/time'
require 'time'
@joshado
joshado / quagga.init.sh
Created July 17, 2012 11:07
Quagga SMF Files
#!/sbin/sh
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# This file is part of Quagga.
#
# Quagga 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 2, or (at your option) any
#
# From: Manuel Wolfshant <[email protected]>
#
install
text
poweroff
url --url http://mirror.centos.org/centos/5/os/x86_64/
lang en_US.UTF-8
keyboard us
skipx
@joshado
joshado / gist:6926408
Created October 10, 2013 22:07
A 10 minute ruby bit-torrent tracker :)
require 'sinatra'
require "sinatra/reloader"
PEER_DICT = Hash.new { |h,k| h[k] = {} }
class Hash
def bencode
[
"d",
@joshado
joshado / hooks.d
Last active December 26, 2015 04:09
DTrace / ruby method call visualisation. Forgive the hackiness, it was done over coffee :)
#pragma D option quiet
::rb_call0:function-entry {
/* copyinstr(arg0) = Object class
// copyinstr(arg1) = method
// copyinstr(arg2) = file
// arg3 = line
// arg4 ?*/