Skip to content

Instantly share code, notes, and snippets.

View wrouesnel's full-sized avatar

Will Rouesnel wrouesnel

View GitHub Profile
@wrouesnel
wrouesnel / main.py
Last active May 23, 2021 12:52
Python argparse with config file fallback. This is great for scripting up daemon-like tools (note PyDev template syntax - replace as needed)
#!/usr/bin/env python
# encoding: utf-8
'''
${module}
'''
import sys
import os
from os import path
@wrouesnel
wrouesnel / .gitconfig
Last active August 29, 2022 09:55
MS Access git merging scripts
# Obviously you're appending these sections.
[core]
ignorecase = true
[merge]
renormalize = true
tool = msaccess-merge
[mergetool "msaccess-merge"]
cmd = $(git rev-parse --show-toplevel)/msaccess-merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
trustExitCode = true
@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 / 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 / Gulpfile.js
Last active October 19, 2016 19:42
webpack, react, golang self-contained gulpfile
var path = require('path');
var gulp = require('gulp');
var run = require('gulp-run');
var gutil = require('gulp-util');
var minimist = require('minimist');
var options = minimist(process.argv.slice(2), {
string: 'env',
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 / ansible-vm-base-image.yml
Created January 29, 2016 10:56
Ansible VM base image builder
---
# Provisions a Debian base-image
- hosts: local
connection: local
force_handlers: True
sudo: yes
tasks:
# - name: Check environment set
# fail: msg="Configuration incompletely specified!"
# when: (server_ip is defined|bool and netmask is defined|bool and gateway is defined|ipaddr and
@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
@wrouesnel
wrouesnel / gist:15d9359fc88b0937b6bf
Created February 21, 2016 23:49
Build command for totally static go images
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-s' -o main .