Skip to content

Instantly share code, notes, and snippets.

@willprice
willprice / gen_stats.sh
Created May 7, 2015 14:14
Git analytics
#!/bin/bash
OUTPUT=stats.html
echo "Generating statistics"
gitinspector \
--hard=true \
--file-types=cshtml,coffee,cs \
--format=htmlembedded \
--grading=true \
--exclude=".*css" \
// Each process runs this code.
wants_to_enter[id] = true;
// Be polite and let them enter
turn = other_process_id;
while (wants_to_enter[other_process_id] == true && turn == other_process_id) {
// let them enter critical section
}
critical_section();
wants_to_enter[id] = false;
@willprice
willprice / Config.ini
Created July 13, 2015 22:24
Configuration file for bug.n setting XMonad like defaults (at least, like my XMonad config!)
# bug.n Configuration file.
# Vim-ish window movement commands
Config_hotkey=#+j::View_shuffleWindow(+1)
Config_hotkey=#+k::View_shuffleWindow(-1)
Config_hotkey=#j::View_activateWindow(+1)
Config_hotkey=#k::View_activateWindow(-1)
# Monitor commands
@willprice
willprice / .cvimrc
Last active September 15, 2015 15:18
cVim settings
let mapleader = ","
let barposition = "bottom"
let configpath = '/home/will/.cvimrc'
let hintcharacters = "asdfhjkl"
let locale = "uk"
let searchalias g = "google"
let blacklists = ["*://mail.google.com/*", "*://inbox.google.com/*", "@https://mail.google.com/mail/*"]
@willprice
willprice / gist:1575531
Created January 7, 2012 18:12
Gmail Checker
// Gmail Notifier
// Author: Will Price
// Date: Jan 2011
// Website: willprice94.blogspot.com
// Description:
//
// A simple sketch that waits for the number of unread messages to come over serial
// Use 'gmail_daemon' inconjunction for a physical mail notification system
// Macros
@willprice
willprice / gist:2863376
Created June 3, 2012 13:03
Chemistry - RPA review

ARENES:

The Kekule structure of benzene is wrong because:

  • Bond length between carbon atoms are all constant and it's somewhere between the length of a c-c bond and a c=c bond (c-c longer than c=c)
  • Enthalpy change of hydrogenation is less than expected => the structure is more stable than initially expected
  • Does not undergo typical alkene reactions => less reactive

These traits arise due to benzene's structure which is due to multiple p-orbitals overlapping forming a delocalised pi system of electrons (in this case, it contains 6 electrons as it has 6 p-orbitals).

  • Low reactivity is due to the spreading out of the electrons which decreases the electron density of the bonds and therefore reduces it's reactivity with electrophiles as they are less strongly attracted.
  • The lower enthalpy change of hydrogenation of benzene compared with the kekule structure is due to the greater stability of the delocalised pi system compared to the localised pi bonds (which are more electron dense), the greater t
@willprice
willprice / git_setup.sh
Created December 24, 2015 21:26
git setup
git config --global user.email "will.price94+dev@gmail.com"
git config --global user.name "Will Price"
git config --global core.editor viim
# Short commands
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.lg 'log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit'
@willprice
willprice / print_uint8_t
Created November 24, 2013 12:16
Print out the bits of a 'uint8_t' for debugging
void print_uint8_t(uint8_t n) {
int i;
for (i = BITSOF(n); i >= 0; i--)
printf("%d", (n & (1<<i)) >> i);
putchar('\n');
}
@willprice
willprice / BITSOF
Created November 24, 2013 12:16
Get the number of bits of a type
#define BITSOF(x) (sizeof(x) * 8)
@willprice
willprice / README.md
Last active January 9, 2016 15:46
Command to flash the Arduino Due GCode (CNC controller) software called G2 (a fork of TinyG) to an Arduino Due

Instructions

  1. Press 'Reset' on the Duet (RepRap Pro board)
  2. wait ~1 second
  3. Run ./g2_flash.sh