Skip to content

Instantly share code, notes, and snippets.

View kbingham's full-sized avatar

Kieran Bingham kbingham

View GitHub Profile
@kbingham
kbingham / Makefile
Last active April 1, 2024 11:38
My Generic Makefile.Useful for creating a simple build for a single target from a set of c files.This could extended to provide support for other languages, or cross compilations.Let me know if you find this useful, or make any useful (generic) updates that are worth sharing.
# Kierans Generic Makefile
# www.kieranbingham.co.uk
# Default to build with multiple instances for speed
MAKEFLAGS =+ -j
# Beware, This will create this application
# binary based on the current directory name.
TARGET := $(shell basename `pwd`)
@kbingham
kbingham / officespace
Last active January 29, 2016 10:41 — forked from anonymous/officespace
#!/bin/sh
launchonce() {
app=`basename $1`
pidof $app >/dev/null && echo "$app is already running" || $1 &
}
launchonce_alt() {
pidof $2 >/dev/null && echo "$1 is already running" || $1 &
}
@kbingham
kbingham / ignorelist
Last active August 30, 2015 08:48 — forked from rubo77/ignorelist
This ignorelist can be used to backup your home folder without useless folders and files, see http://askubuntu.com/a/545676/34298
#These directories may be excluded:
# contains mounted file systems
.gvfs
.local/share/gvfs-metadata
# contains the actual encrypted home directory
.Private
# session-specific
.dbus
.cache
#!/bin/sh
### WIMIP
### A helper script to easily report both local and public IP addresses of a device on commandline
### Kieran Bingham 2015
### www.kieranbingham.co.uk
IFACE=`route -n | grep ^0.0.0.0 | awk '{ print $8 }'`
@kbingham
kbingham / i2c-dt-refactor.cocci
Last active April 20, 2016 12:28
Coccinelle patch to refactor the I2C device tables throughout the linux kernel.
// Remove all I2C Device Tables, when there is an OF table present
//
// Aim to rename the probe function, and adapt its prototype, if:
// - The driver supports an OF table already
// - The driver is not currently using the 'id' variable in the probe
//
// First identify that we are in a suitable file, and assumptions met
//

Keybase proof

I hereby claim:

  • I am kbingham on github.
  • I am kbingham (https://keybase.io/kbingham) on keybase.
  • I have a public key whose fingerprint is A8AF ECF8 ECE5 5165 047E BB96 2386 3DC3 831D B2B1

To claim this, I am signing this object:

#!/bin/sh
FILENAME=screen_$(date +%Y%m%d_%H%M%S).png
echo "Attempting capture to $FILENAME"
adb shell screencap -p | sed 's/\r$//' > "$FILENAME"
My simple wordpress blogs run on heroku. Why? Because its free.
However, I recently got an e-mail from heroku informing me that I needed to upgrade from cedar-10 (based on ubuntu-10.04 LTS) to cedar-14 (based on ... ubuntu-14.04 LTS).
This seemed like a reasonable thing to do, and so I jumped in and executed the following as requested:
$ heroku stack:set cedar-14
$ git commit --allow-empty -m "Upgrading to Cedar-14"
$ git push heroku master
@kbingham
kbingham / dmesg-diff
Last active December 22, 2023 09:30
If you need to 'diff' two dmesg files, you will find that the timestamps cause diff-noise. Remove the timestamps so that you get to the underlying diff.
#!/bin/bash
# dmesg-diff
# Kieran Bingham 2016
# Public Domain
#
# Strip out Linux Kernel timestamps when performing a diff on two dmesg files
#
# Initial version as proof-of-concept, but already useful.
# This could be extended to parse extra flags for diff for example
#!/bin/bash
## Derived from : http://stackoverflow.com/questions/2108405/branch-descriptions-in-git
## answered May 23 '13 at 9:21 ## jsageryd
# Shows branches with bases
function gb() {
branches=$(git for-each-ref --format='%(refname)' refs/heads/ | sed 's|refs/heads/||')
head=$(git rev-parse --abbrev-ref HEAD)
for branch in $branches; do