Skip to content

Instantly share code, notes, and snippets.

JamesSwift / gist:7492869
Created Nov 15, 2013
NQC Code to alow a Lego RCX brick to stand on two wheels. I place this code in the public domain. No rights reserved.
View gist:7492869
task main()
int last_reading=SENSOR_2;
//start adjust_power;
JamesSwift / gist:5273325
Created Mar 29, 2013
I was having trouble initiating the `ssh-agent` on Git Bash (Git for Windows) in my `.bashrc` file using the example provided at: So I created a simple script that does the job. It initiates a ssh-agent when you open Git Bash, and kills it when you close the bash. Note, it doesn't…
View gist:5273325
#! /bin/bash
#Start ssh-agent
eval `ssh-agent`
#Uncomment the next line if you want to automatically load ssh-keys at startup
#Kill ssh-agent when we close the shell
trap "ssh-agent -k" EXIT
JamesSwift /
Created Aug 3, 2012
Sometimes you want to run an automated "git commit -a" (perhaps as a cron job), but you don't want to clog up your history if nothing has changed. I use the following script to run a commit only if changes have been made.
cd /path/to/your/git/repo/
if [ "$(git status -s)" ] ; then
echo "Changes detected. Commiting."
git add .
git commit -am "Your explanation here"
echo "No changes detected. Commit canceled."
You can’t perform that action at this time.