Skip to content

Instantly share code, notes, and snippets.

Matthew Gilliard mjg123

Block or report user

Report or block mjg123

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mjg123
mjg123 / timestamper.sh
Created May 9, 2014
tiny shell script for adding timestamps to lines piped in from stdin
View timestamper.sh
while read f; do
date +"%H:%M:%S " | tr -d '\n';
echo $f;
done
View main.go
package main
import (
"github.com/elazarl/goproxy"
"io/ioutil"
"log"
"net/http"
)
func main() {
@mjg123
mjg123 / mc.py
Created Dec 1, 2014
classes using a decorator to store methods will be dependent on decorator ordering
View mc.py
import pprint
import six
captured_methods = {}
class MjgClass(object):
@classmethod
def decorated(cls):
global captured_methods
def decorator(f):
@mjg123
mjg123 / gist:cb544f2f6853df8d866c
Last active Aug 29, 2015
Diagnosing a gate failure using logstash.openstack.org
View gist:cb544f2f6853df8d866c

Recently we noticed that the "check-tempest-dsvm-multinode-full" job, which is non-voting in nova's check jobs, was failing in a new way.

Some notes about how the failure was diagnosed:

  1. Job is failing
  2. why? find a signature for the failure, eg
File "tempest/api/compute/admin/test_live_migration.py", line 116, in test_live_block_migration"
@mjg123
mjg123 / gist:956051
Created May 4, 2011
my 13 LOC chat server for node.js
View gist:956051
var http = require('http');
var url = require('url');
var messages = ["welcome to nodeChat"];
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var query = url.parse(req.url, true).query;
if ( query.message ){
messages.push( query.message );
res.end("thanks");
} else {
@mjg123
mjg123 / SortedRespectDue.java
Created Jul 10, 2011
Testing the behaviour of mergesort in Java's core implementation
View SortedRespectDue.java
import java.util.Arrays;
import java.util.Random;
/**
* Created by Matthew Gilliard
* Date: 10/07/11
* Time: 18:22
*/
public class SortedRespectDue {
@mjg123
mjg123 / MergeSort.java
Created Jul 10, 2011
Source of mergesort from Java 6
View MergeSort.java
/**
* Src is the source array that starts at index 0
* Dest is the (possibly larger) array destination with a possible offset
* low is the index in dest to start sorting
* high is the end index in dest to end sorting
* off is the offset to generate corresponding low, high in src
*/
private static void mergeSort(Object[] src,
Object[] dest,
@mjg123
mjg123 / SortedRespectDue.java
Created Jul 10, 2011
Testing the behaviour of mergesort in Java's core implementation
View SortedRespectDue.java
import java.util.Arrays;
import java.util.Random;
/**
* Created by Matthew Gilliard
* Date: 10/07/11
* Time: 18:22
*/
public class SortedRespectDue {
@mjg123
mjg123 / hello.cljs
Created Jul 21, 2011
Hello World in ClojureScript
View hello.cljs
(ns hello)
(defn ^:export greet [n]
(str "Hello " n))
@mjg123
mjg123 / hello.js
Created Jul 21, 2011
hello.cljs compiled
View hello.js
function b(c){throw c;}var f=null;function aa(){return function(c){return c}}function i(c){return function(){return this[c]}}function j(c){return function(){return c}}var k;
function n(c){var a=typeof c;if(a=="object")if(c){if(c instanceof Array)return"array";else if(c instanceof Object)return a;var d=Object.prototype.toString.call(c);if(d=="[object Window]")return"object";if(d=="[object Array]"||typeof c.length=="number"&&typeof c.splice!="undefined"&&typeof c.propertyIsEnumerable!="undefined"&&!c.propertyIsEnumerable("splice"))return"array";if(d=="[object Function]"||typeof c.call!="undefined"&&typeof c.propertyIsEnumerable!="undefined"&&!c.propertyIsEnumerable("call"))return"function"}else return"null";
else if(a=="function"&&typeof c.call=="undefined")return"object";return a}function ba(c){return typeof c=="string"}Math.floor(Math.random()*2147483648).toString(36);var ca={"\000":"\\0","\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\u000b":"\\x0B",'"':'\\"',"\\":"\\\\"},da={"'":"\\'"};
fun
You can’t perform that action at this time.