Skip to content

Instantly share code, notes, and snippets.

@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:1579856
Created January 8, 2012 21:57
Python Gmail Checker
#!/usr/bin/python2
# Author: Will Price
# Date: Jan 2011
# Import statements:
# - Feedparser - needed to extract mailcount
# - Serial - needed to send command to Arduino
# - Time - waiting for gmail to be read
import feedparser, serial, time
@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 / 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 / .travis.yml
Last active June 15, 2024 04:29
How to set up TravisCI for projects that push back to github
# Ruby is our language as asciidoctor is a ruby gem.
lang: ruby
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
@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/*"]