Skip to content

Instantly share code, notes, and snippets.

@petrockblog
petrockblog / gist:3051568
Created July 5, 2012 05:39
Download, compile, and install the Broadcom BCM 2835 library for the Raspberry Pi
cd;
wget http://www.open.com.au/mikem/bcm2835/bcm2835-1.3.tar.gz;
tar xvfz bcm2835-1.3.tar.gz;
cd bcm2835-1.3;
./configure;
make;
sudo make install
@petrockblog
petrockblog / gist:3051580
Created July 5, 2012 05:43
Enable uinput kernel module
sudo modprobe uinput
@petrockblog
petrockblog / gist:3051588
Created July 5, 2012 05:46
Addition to programmers.txt to enable mzSmartUSB ISP in Arduino IDE
MysmartUSB.name=mySmartUSB
MysmartUSB.protocol=stk500v2
MysmartUSB.communication=serial
@petrockblog
petrockblog / gist:3051595
Created July 5, 2012 05:49
Matlab plugin for Sublime Text 2
import sublime
import sublime_plugin
import os
class OpenmatlabfunctionCommand(sublime_plugin.TextCommand):
def run(self, edit):
for sels in self.view.sel():
didFind = False
@petrockblog
petrockblog / gist:3051606
Created July 5, 2012 05:52
Exemplary Arduino sketch of a virtual keyboard with the V-USB library
#include "UsbKeyboard.h"
#define PIN_BUTTON 7 // the button is attached to pin 7
int lastState = LOW; // LOW is equivalent to 0
void setup() {
// button setup
pinMode(PIN_BUTTON, INPUT);
@petrockblog
petrockblog / gist:3051628
Created July 5, 2012 05:56
Rotating backup with rsync
#!/bin/bash
BACKUPPATHS=( "BACKUPUPDIR1" "BACKUPDIR2" "BACKUPDIR3" )
TARGETPATHS=( "TARGETOFBACKUPDIR1" "TARGETOFBACKUPDIR2" "TARGETOFBACKUPDIR3" )
for (( k=0 ; k < ${#BACKUPPATHS[@]} ; k++ ))
do
echo -e "Making backup of ${BACKUPPATHS[$k]}"
rsync -avz --delete --link-dest=${TARGETPATHS[$k]}/`date +%a -d "-1 day"` ${BACKUPPATHS[$k]} ${TARGETPATHS[$k]}/`date +%a`
done
@petrockblog
petrockblog / gist:3074683
Created July 9, 2012 06:53
Virtual keyboard demo for the Pancake Board
#include “UsbKeyboard.h”
#define PIN_BUTTON 7 // the button is attached to pin 7
int lastState = LOW; // LOW is equivalent to 0
void setup() {
// button setup
pinMode(PIN_BUTTON, INPUT);
@petrockblog
petrockblog / gist:3258621
Created August 4, 2012 16:17
Prepare Raspberry for RetroPie setup script
sudo apt-get update
sudo apt-get install -y git dialog
@petrockblog
petrockblog / gist:3258649
Created August 4, 2012 16:19
Install RetroPie script
cd
git clone git://github.com/petrockblog/RetroPie-Setup.git
@petrockblog
petrockblog / gist:3258677
Created August 4, 2012 16:26
Execute RetroPie script
cd RetroPie-Setup
chmod +x retropie_setup.sh
sudo ./retropie_setup.sh