Skip to content

Instantly share code, notes, and snippets.

set nonumber
syntax on
filetype plugin indent on
augroup myfiletypes
autocmd!
autocmd BufNewFile,BufRead *.jinja set filetype=jinja
autocmd BufNewFile,BufRead *.sql set filetype=psql
autocmd BufNewFile,BufRead *.migration set filetype=psql
autocmd BufNewFile,BufRead *.vcl set filetype=vcl
@russss
russss / gist:8aa174669b2b8345eaed
Last active August 29, 2015 14:09
keybase.md
### Keybase proof
I hereby claim:
* I am russss on github.
* I am russss (https://keybase.io/russss) on keybase.
* I have a public key whose fingerprint is BE75 264B 665E D97E A5DB EFD5 F52F C56D D906 FEB1
To claim this, I am signing this object:
@russss
russss / commands.cfg
Created May 17, 2015 09:22
Icinga plugin for IRCCat
define command {
command_name notify-host-by-irccat
command_line /usr/local/share/nagios-plugins/icinga-irccat.py $HOSTNAME$ $HOSTSTATE$ | /bin/nc -q0 irccat-host 12345
}
define command {
command_name notify-service-by-irccat
command_line /usr/local/share/nagios-plugins/icinga-irccat.py -s "$SERVICEDESC$" -o "$SERVICEOUTPUT$" $HOSTNAME$ $SERVICESTATE$ | /bin/nc -q0 irccat-host 12345
}
#0 0x00014883 in Resolver::dispatch (this=0xa06950, rq=@0xb0080424, local_only=false) at /Users/russ/playdar/playdar-daemon/src/resolvers/resolver.cpp:75
#1 0x0008a98b in playdar_request_handler::handle_rest_api (this=0xb0184ee4, qs=@0xb00806b4, req=@0x100b628, rep=@0x100b650) at /Users/russ/playdar/playdar-daemon/src/playdar/playdar_request_handler.cpp:173
#2 0x00091937 in playdar_request_handler::handle_request (this=0xb0184ee4, req=@0x100b628, rep=@0x100b650) at /Users/russ/playdar/playdar-daemon/src/playdar/playdar_request_handler.cpp:78
#3 0x00186b16 in moost::http::connection<playdar_request_handler>::handle_read (this=0x1009600, e=@0xa06950, bytes_transferred=477) at request_handler_base.hpp:27
#4 0x00160006 in boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, moost::http::connection<playdar_request_handler>, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<moost::http::connection
@russss
russss / mirrordir.py
Created January 19, 2011 12:34
Mirror new files in a directory to another machine
# usage: python mirrordir.py ./directory myuser@host:/path
import sys, pyinotify, subprocess
class Handler(pyinotify.ProcessEvent):
def process_IN_CLOSE_WRITE(self, event):
subprocess.call(("scp", event.pathname, sys.argv[2]))
if __name__ == '__main__':
wm = pyinotify.WatchManager()
notifier = pyinotify.Notifier(wm, default_proc_fun=Handler())
@russss
russss / build-tblk.rb
Created May 31, 2011 16:46
Easily generate a .tblk Tunnelblick package
#!/usr/bin/env ruby
require 'fileutils'
CA_DIR = '/path/to/ca/keys/'
HOST = '1.2.3.4'
if not ARGV[0]:
raise "Provide a certificate name as an argument"
end
@russss
russss / gist:1064891
Created July 5, 2011 14:04
Git post-receive hook to post commit details to an AMQP topic
#!/usr/bin/env python
""" Git post-receive hook to publish commit data to an AMQP topic.
apt-get install python-git python-amqplib
or:
easy_install amqplib gitpython
"""
import os, sys, json
from datetime import datetime
from git import *
@russss
russss / check_rabbitmq_messages
Created September 1, 2011 15:21
Nagios/Icinga plugin to get the number of un-acked messages in a number of RabbitMQ queues
#!/usr/bin/env python
# https://gist.github.com/gists/1186406
import httplib2, json, re, sys
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-w", "--warning", dest="warning", type="int",
default="50", help="warning threshold")
parser.add_option("-c", "--critical", dest="critical", type="int",
default="100", help="critical threshold")
# Listen to a CurrentCost monitor on the serial port and forward data to Graphite
import serial
import socket
import time
from lxml import etree
ser = serial.Serial('/dev/ttyUSB0', 57600)
def send_metric(value):
sock = socket.socket()
#!/usr/bin/ruby
# Download NASA MODIS imagery and use it as a desktop background.
# You'll need ImageMagick installed for this to work.
require 'date'
require 'net/http'
# Screen width/height
X = 2580
Y = 1024