Skip to content

Instantly share code, notes, and snippets.

View nasamuffin's full-sized avatar
💭
probably hanging out with dog

Emily Shaffer nasamuffin

💭
probably hanging out with dog
View GitHub Profile
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <iostream>
#define OE_ADDR 0x134
#define GPIO_DATAOUT 0x13C
#define GPIO_DATAIN 0x138
#define GPIO0_ADDR 0x44E07000
#define GPIO1_ADDR 0x4804C000
#define GPIO2_ADDR 0x481AC000
#define _BEAGLEBONE_GPIO_H_
#define GPIO1_START_ADDR 0x4804C000
#define GPIO1_END_ADDR 0x4804DFFF
#define GPIO1_SIZE (GPIO1_END_ADDR - GPIO1_START_ADDR)
#define GPIO_OE 0x134
#define GPIO_SETDATAOUT 0x194
#define GPIO_CLEARDATAOUT 0x190
#define USR0_LED (1<<21)
@nasamuffin
nasamuffin / gist:fd6687861851f7f2dbcf
Created March 18, 2015 03:16
gpio control registers
0: 50600801 0000001D 00000000 00000000
10: 00000000 00000000 00000000 00000000
20: 00000000 00000000 00000000 00000000
30: 00000000 00000000 00000000 00000000
40: 00000000 00000000 00000000 00000000
50: 00000000 00000000 00000000 00000000
60: 00000000 00000010 00000000 00000000
70: 00000000 00000000 00000000 00000000
80: 00000000 00000000 00000000 00000000
90: 00000000 00000000 00000000 00000000
@nasamuffin
nasamuffin / UPS Track
Last active August 29, 2015 13:56
Track a UPS package (so you don't have to do it yourself).
#!/bin/bash
RETVAL=1
while [ "$RETVAL" -eq "1" ]; do
sleep 1m
PAGECONTENT=$(wget "http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=$1" --quiet -O -)
RETVAL=$?
if [ "$RETVAL" -eq "0" ]; then
echo "$PAGECONTENT" | grep -q Delivered
RETVAL=$?
fi
@nasamuffin
nasamuffin / npp-rgrep
Created January 29, 2014 20:18
Finds files containing the search string and feeds them to Notepad++. Assumes 'npp' is aliased to the full path of notepad++.exe. Automagically sets focus in each file to the line where the search string matched!
echo $(grep -rIn "$@" | cut -d":" -f1-2 --output-delimiter=" -n" | rev | uniq -f1 | rev ) | xargs -n2 npp &