Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am petehamilton on github.
  • I am petehamilton (https://keybase.io/petehamilton) on keybase.
  • I have a public key whose fingerprint is 7809 8DC6 825F 4184 8139 C43B 0621 AE2E 2952 C17E

To claim this, I am signing this object:

@petehamilton
petehamilton / gist:1341831
Created November 5, 2011 18:07
Nice way of viewing git branch in terminal
View gist:1341831
#Handy Git stuff
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
function git-track {
CURRENT_BRANCH=$(parse_git_branch)
git-config branch.$CURRENT_BRANCH.remote $1
git-config branch.$CURRENT_BRANCH.merge refs/heads/$CURRENT_BRANCH
}
@petehamilton
petehamilton / uta-helper.rb
Created October 19, 2012 12:55
Imperial College Computing UTA Helper Script
View uta-helper.rb
#! /usr/bin/ruby
# Recommend saving (or symlinking) as /usr/bin/uta-helper
################################################################################
#
# Simple ruby script to pull down student code for excercises from labranch
#
# Example: $ uta-helper pull -e html
# Will clone all the repos into a 'respositories' directory by default.
@petehamilton
petehamilton / sample_digest_email.yml
Created November 17, 2012 02:46
Sample email config for Digest Email gem
View sample_digest_email.yml
# sample_digest_email.yml
# Parses with the digest_email (http://peterhamilton.github.com/digest_email) gem
# See the result of running this file through the gem here: http://docsoc.s3.amazonaws.com/sample/sample_digest_email.html
header:
title: "Weekly Digest"
subtitle: November 12th 2012
subsubtitle:
items:
- list_title: New, Easy Email Digests
@petehamilton
petehamilton / digest_template.yaml
Created November 17, 2012 16:49
Imperial College Computing Digest Template
View digest_template.yaml
# Example of rendered digest: http://docsoc.s3.amazonaws.com/sample/sample_digest_email.html
# Github Repo for digest email generator: https://github.com/PeterHamilton/digest-email
# Instructions:
# 1. Download this file
# 2. Fill it in (minus image URL, unless you have one)
# 3. Send a 150px wide image + the file to me
- list_title: This text will go in the top list of posts
image: https://s3-eu-west-1.amazonaws.com/docsoc/sample/suitcase.jpg
@petehamilton
petehamilton / LeetSpeak.java
Created November 27, 2012 22:24
LeetSpeak Challenge for PPT Session
View LeetSpeak.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
/**
* A class to demonstrate finding potential passwords made from Leetspeak
*
* BACKSTORY:
* You overhear someone in the office mention their password out loud.
@petehamilton
petehamilton / bingo.rb
Created December 27, 2012 16:59
A quick and dirty game of bingo, written in ruby
View bingo.rb
#!/usr/env/ruby
mappings = {
1 => 'Kelly\'s Eye',
2 => 'One Little Duck',
3 => 'Cup of Tea',
4 => 'Knock at the Door',
5 => 'Man Alive',
6 => 'Tom Mix',
7 => 'Lucky',
8 => 'Garden Gate',
View useful_commands.sh
find . -name '*.git' -execdir sh -c 'cd {} && git gc' \; # Compress all git repos under current directory
@petehamilton
petehamilton / README.md
Last active December 16, 2015 22:19
Matrix Multiply Feedback
View README.md

Matrix Multiply Aggregated Feedback

Indentation

Many of you (understandably) applied a sort of nesting indentation to your assembly code something like this:

for_row: mov r9, 0
next_row:
 COMPARISON
@petehamilton
petehamilton / are_exam_results_up_yet.sh
Last active December 19, 2015 07:09
Are exams results online yet?
View are_exam_results_up_yet.sh
#!/bin/bash
EXAMS_URL="https://exams.doc.ic.ac.uk/"
echo "##############################################"
echo "# Exam Results Checker"
echo "##############################################"
echo -ne "Username: "
read username
stty -echo