Skip to content

Instantly share code, notes, and snippets.

View tomgco's full-sized avatar
☠️
Building stuff

Tom Gallacher tomgco

☠️
Building stuff
View GitHub Profile
[email protected] /private/tmp/terminal-codelearn
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
@tomgco
tomgco / gist:6107598
Created July 29, 2013 20:38
Git repo one week ago
WEEKDATE=`date -f "%Y-%m-%d 13:37" -d '1 week ago'` git checkout `git rev-list -n 1 --before=$WEEKDATE develop`
void
HMAC_SHA1_Init(HMAC_SHA1_CTX *ctx, const u_int8_t *key, u_int key_len)
{
u_int8_t k_ipad[SHA1_BLOCK_LENGTH];
int i;
if (key_len > SHA1_BLOCK_LENGTH) {
SHA1Init(&ctx->ctx);
SHA1Update(&ctx->ctx, key, key_len);
SHA1Final(ctx->key, &ctx->ctx);
@tomgco
tomgco / bench.sh
Created April 10, 2013 16:40
Apache-bench graphs
#!/bin/bash
NAME=$1
# node ../../PersonalSite/app.js &
pid=$!
bench() {
ab -n 6000 -c 40 -g out-$NAME.graph -H "Accept-Encoding: gzip" "http://127.0.0.1:3021/main/js/lib/v0.1.0/jquery-1.7.2.min.js"
}
sleep 2
{ "jshint_options":
{ "browser": true
, "curly": true
, "devel": true
, "eqeqeq": true
, "eqnull": true
, "es5": false
, "evil": false
, "immed": false
, "jquery": true
@tomgco
tomgco / raspberrypi.patch
Created May 10, 2012 12:33
Raspberry Pi V8 Patch
@@ -79,8 +79,8 @@
},
'gcc': {
'all': {
- 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
- 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'],
+ 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS', '-march=armv6'],
+ 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions', '-march=armv6'],
},
'visibility:hidden': {
@tomgco
tomgco / BULaTeX.bst
Created April 24, 2012 23:39
Bournemouth Uni LaTeX Reference style
%% File: `BULaTeX.bst'
%% A modification of `plain.bst' for use with natbib package by Tom Gallacher,
%% Orders by Last Name, with last name first.
%% Abbreviations for first names.
%% added last modified for urls
%% Reference: http://www.bournemouth.ac.uk/library/citing_references/docs/Citing_Refs.pdf
%%
%% Copyright 1993-2007 Patrick W Daly
%% Max-Planck-Institut f\"ur Sonnensystemforschung
%% Max-Planck-Str. 2
\documentclass[11pt,a4paper]{article}
% for images.
\usepackage{graphicx}
\usepackage{setspace}
% for code blocks
\usepackage{listings}
% referencing using surname first
\usepackage{natbib}
@tomgco
tomgco / gist:2029979
Created March 13, 2012 17:15
Match TV Show Pattern
.*((S)[0-9]{2,}(E)[0-9]{2,}|[0-9]{1,}(x)[0-9]{1,}).*