Skip to content

Instantly share code, notes, and snippets.

@petehamilton
petehamilton / gist:1341831
Created November 5, 2011 18:07
Nice way of viewing git branch in terminal
#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
#! /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
# 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
# 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 / simple_crawler.rb
Last active June 1, 2016 20:27
Script to Crawl a Site for Links/Assets
# GEMFILE
# source 'https://rubygems.org'
#
# gem 'nokogiri'
# gem 'awesome_print'
#!/usr/bin/env ruby
require 'open-uri'
require 'optparse'
@petehamilton
petehamilton / LeetSpeak.java
Created November 27, 2012 22:24
LeetSpeak Challenge for PPT Session
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
#!/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',
@petehamilton
petehamilton / hashcrack.rb
Created February 11, 2013 17:16
Ruby md5 passw3ord cracker. Brute force, character product, recursive yielding and base-n techniques
#! /usr/env/ruby
require "benchmark"
require 'digest/md5'
# The password hash to crack
password_hash = "e1f3ecc31656795a128db19da490c9ec"
# Helper for hashing passwords
def md5(password)
Digest::MD5.hexdigest(password)
@petehamilton
petehamilton / metric_apps.md
Last active May 22, 2017 19:14
Useful Metric Dashboard Research Links

Dashboards

Charting

@petehamilton
petehamilton / README.md
Last active March 9, 2022 02:43
Set up a Raspberry Pi to load a web dashboard

Dashboards on Raspberry Pi

curl -L 'http://git.io/h1iuxQ' | sh