Skip to content

Instantly share code, notes, and snippets.

View wrouesnel's full-sized avatar

Will Rouesnel wrouesnel

View GitHub Profile
@wrouesnel
wrouesnel / sshtunnel.py
Created January 6, 2015 23:06
Creating an SSH tunnel that can be used in a larger program with Paramiko.
#!/usr/bin/env python
# Modified by: William Rouesnel (w.rouesnel@gmail.com)
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
@wrouesnel
wrouesnel / queryParamParser.js
Created June 16, 2015 03:32
Javascript Query Parameter Parsing
/* http://www.jquerybyexample.net/2012/06/get-url-parameters-using-jquery.html */
// Modified to include the default value line.
function getUrlParameter(sParam, default_value)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
@wrouesnel
wrouesnel / humanizeIntArray
Created September 29, 2015 05:27
Turn a sorted list of ints into number ranges in Go
package main
import (
"fmt"
)
func main() {
var statusCodes []int = []int{100,101,102,103,104,105,106,107,110,111,112,115,119,120,121,124}
var output []string
@wrouesnel
wrouesnel / make-libvirt-lxc
Created November 19, 2012 12:18
A script to automate the setup of Debian-like LXC containers.
#!/bin/bash
# LXC test environment builder for libvirt.
# Libvirt uses a different environment to the Ubuntu implementation, since
# cgroups are a rather general purpose protocol.
# The virsh manipulation stuff is pretty brute-force and inelegant. This whole
# thing really demands a GUI of some such, but it's a script which got out of
# hand really.
# Usage: make-libvirt-lxc [ROOT] <HOSTNAME>
@wrouesnel
wrouesnel / Gulpfile.js
Last active November 22, 2015 02:51
cerebral/browserify example case
/**
* Created by will on 6/09/15.
*/
var gulp = require('gulp');
var gutil = require('gulp-util');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var babelify = require('babelify');
@wrouesnel
wrouesnel / sshttpd-sites.conf
Last active December 21, 2015 17:38
sshttp daemon starter upstart script
description "Start all sshttpd instances on boot"
author "iain"
start on (local-filesystems and net-device-up)
task
script
for file in `ls /etc/sshttp.d/*.conf` ; do
filename=`basename ${file%.*}`
@wrouesnel
wrouesnel / getmail-idler
Last active December 24, 2015 16:38
A daemon script for watching watching IMAP accounts with IDLE and invoking getmail. Works with GetMail config files.
#!/usr/bin/env python
import imaplib2
import time
import threading
import subprocess
import argparse
import signal
import psutil
import sys
@wrouesnel
wrouesnel / gist:7151548
Created October 25, 2013 08:46
Backtrace of KeePass when xsel and Cinnamon have locked up.
Thread 16 (Thread 0x7f28234f2700 (LWP 13790)):
#0 pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
No locals.
#1 0x00000000005e6573 in GC_wait_marker () at pthread_support.c:1863
No locals.
#2 0x00000000005e0905 in GC_help_marker (my_mark_no=70) at mark.c:1116
local_mark_stack = {{mse_start = 0x7f2816c70240, mse_descr = 24}, {mse_start = 0x7f2812ce1360, mse_descr = 24}, {
mse_start = 0x7f2816d282e8, mse_descr = 24}, {mse_start = 0x7f2816c9c738, mse_descr = 24}, {
mse_start = 0x7f282478d4f8, mse_descr = 24}, {mse_start = 0x7f282478d5d0, mse_descr = 24}, {
mse_start = 0x7f2816d2e588, mse_descr = 24}, {mse_start = 0x7f2816d34e58, mse_descr = 24}, {
on.task:methods.run.9f7fb951-ac72-449a-97d9-cc0e5821b2d6:4ynliVuS-Fe 0
on.task-graph-runner:methods.defineTask:NJVsNdSZtl 0
on.task:methods.cancel.367b2191-0c02-4f33-a0ca-5ec47b69addf:N1wej4Or-Ye 0
on.task:ipmi.command.sel.result.aa7f3485-6271-4f90-b6da-ad7571d9d597:4ywGj4_Sbtx 0
on.task:metric.*.result.aa7f3485-6271-4f90-b6da-ad7571d9d597:Vk9fiVOSWtl 0
on.scheduler:schedule:E1YiVuSbYl 0
on.task:methods.cancel.40777f26-22d4-45b4-870a-e493808bf30f:N1WeoVuSZFe 0
on.task-graph-runner:methods.getActiveTaskGraph:4JWsVOBZte 0
on.task:ipmi.command.sel.aa7f3485-6271-4f90-b6da-ad7571d9d597:4JJmiVuH-Fe 0
on.events:task.finished.643f2357-bd9d-40d6-834f-09c77ca591c4:4kRWiEOSWFl 0
@wrouesnel
wrouesnel / issue-graph.py
Last active February 15, 2016 23:51
Github Issue Relation downloader
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import requests
import keyring
import getpass