Skip to content

Instantly share code, notes, and snippets.

Avatar

Will Rouesnel wrouesnel

View GitHub Profile
@wrouesnel
wrouesnel / sshtunnel.py
Created Jan 6, 2015
Creating an SSH tunnel that can be used in a larger program with Paramiko.
View sshtunnel.py
#!/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 Jun 16, 2015
Javascript Query Parameter Parsing
View queryParamParser.js
/* 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 Sep 29, 2015
Turn a sorted list of ints into number ranges in Go
View humanizeIntArray
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 Nov 19, 2012
A script to automate the setup of Debian-like LXC containers.
View make-libvirt-lxc
#!/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 Nov 22, 2015
cerebral/browserify example case
View Gulpfile.js
/**
* 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 Dec 21, 2015
sshttp daemon starter upstart script
View sshttpd-sites.conf
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 Dec 24, 2015
A daemon script for watching watching IMAP accounts with IDLE and invoking getmail. Works with GetMail config files.
View getmail-idler
#!/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 Oct 25, 2013
Backtrace of KeePass when xsel and Cinnamon have locked up.
View gist:7151548
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}, {
View gist:588a95edd3e55769cf89
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 Feb 15, 2016
Github Issue Relation downloader
View issue-graph.py
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import requests
import keyring
import getpass