Skip to content

Instantly share code, notes, and snippets.

View dingram's full-sized avatar

Dave Ingram dingram

View GitHub Profile
@dingram
dingram / message.lua
Last active November 13, 2020 09:56
"message" effect for keyleds
-- Message effect for keyleds: lights up keys in order
--
-- Config:
--
-- color: the color that each key will use
-- group: the group of keys to light up, in order. Either this or "message"
-- must be set.
-- message: a string of space-separated key names to light up, in order. Each
-- key name may be followed by a colon and a number in ms to override the
-- time to light that key. For example, "t e s t:1000 i n g space t h i s"
#!/bin/zsh
SCREEN_SERIAL="1WSZMS2"
INPUT_DP1="0f"
INPUT_HDMI1="11"
if [[ ! -e "/dev/i2c-1" ]]; then
echo "Module i2c-dev is not loaded; loading..."
sudo modprobe i2c-dev
if [[ ! -e "/dev/i2c-1" ]]; then
@dingram
dingram / designer.html
Last active August 29, 2015 14:06
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../paper-input/paper-input.html">
<polymer-element name="imr-editor">
<template>
<style>
:host {
position: absolute;
### Keybase proof
I hereby claim:
* I am dingram on github.
* I am dmi (https://keybase.io/dmi) on keybase.
* I have a public key whose fingerprint is 3025 E303 2516 A646 5F0F 2588 63EF 3BE6 23DF A8AA
To claim this, I am signing this object:
@dingram
dingram / designer.html
Created August 7, 2014 00:59
designer
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
#core_scaffold {
position: absolute;
top: 0px;
right: 0px;
@dingram
dingram / whotime
Last active December 20, 2015 15:38
#!/bin/bash
#
# By Dave Ingram
export TZ="Europe/London"
case $( date +%I ) in
01) DOCTOR='William Hartnell' ;;
02) DOCTOR='Patrick Troughton' ;;
03) DOCTOR='Jon Pertwee' ;;
04) DOCTOR='Tom Baker' ;;
@dingram
dingram / js-sdk.min.js
Created September 10, 2012 14:34
A minimalist way of including social JavaScript SDKs into a page. Includes Google Analytics, Twitter widgets, Facebook, and Google +1
window.___gcfg={lang:'en-GB'};var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-123456-9']);_gaq.push(['_trackPageview']);!function(d,s){var st=d.getElementsByTagName(s)[0],j=function(i,u){if(d.getElementById(i))return;var js=d.createElement(s);js.id=i;js.async=true;js.src=u;st.parentNode.insertBefore(js,st)};setTimeout(function(){j("twitter-wjs","//platform.twitter.com/widgets.js");j("facebook-jssdk","//connect.facebook.net/en_GB/all.js#xfbml=1");j("gplusone-sdk","https://apis.google.com/js/plusone.js")}, 0);j("ga-sdk",('https:'==d.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js')}(document,'script');
@dingram
dingram / gist:2171573
Created March 23, 2012 15:10
vimrc sessions
"*****************************************************************************
" Vim Sessions
"*****************************************************************************
" ignore 'options' because of latex-suite (would be pointless to save that!)
set sessionoptions=blank,curdir,folds,help,resize,tabpages,winsize
if has('win32') || has('win64')
set sessionoptions+=slash,unix
map <leader>ss :mksession! ~/_vimsession<cr>
map <leader>sr :source ~/_vimsession<cr>
else
@dingram
dingram / gist:1405675
Created November 29, 2011 17:43
Date highlight script for Google Docs
function numToCol(c) {
var r = '';
if (c > 25) {
r = String.fromCharCode('A'.charCodeAt(0) + parseInt(c / 26, 10) - 1);
}
r = r + String.fromCharCode('A'.charCodeAt(0) + parseInt(c % 26, 10));
return r;
}
function getCellForDate_(d) {
@dingram
dingram / lipsum.pl
Created October 19, 2010 14:41
Lorem Ipsum (lipsum) generator, in Perl, using lipsum.com
#!/usr/bin/perl -w
use LWP::UserAgent;
use HTTP::Request::Common;
use HTML::Entities;
use Getopt::Long;
# Generate lipsum (courtesy of lipsum.com)
# probably needs neatening up here and there
# comments? who needs comments? perl is easy to understand...