Skip to content

Instantly share code, notes, and snippets.

View treeherder's full-sized avatar

Brendan Reddy-Best treeherder

View GitHub Profile
@treeherder
treeherder / ser_buf.ino
Last active December 21, 2015 19:59
serial buffer device for arduino
#include <SoftwareSerial.h>
SoftwareSerial serial_device(7, 8);
unsigned char buff[512]; /* buffer */
int index=0;
void setup()
{
serial_device.begin(19200); /* baud rate */
Serial.begin(19200); /* works better when they match*/
@treeherder
treeherder / my_turtle.py
Created August 30, 2013 21:08
a short example with turtles
import turtle
window = turtle.Screen() # set up the window color and title
window.bgcolor("black")
window.title("an educational exercise")
treeherder = turtle.Turtle() # create a turtle
treeherder.color("green") # make him draw a green line
treeherder.pensize(5)
@treeherder
treeherder / average.py
Created October 6, 2013 01:36
average a stream
streaam = []
P = 100
def SMA(N):
stream.append(N)
if len(stream) > P:
# Only average the last P elements of the stream
del(stream[:1])
elif len(stream) == 0:
average = 0
@treeherder
treeherder / keypad.ino
Created January 14, 2014 03:04
for darren's door
#include <SoftwareSerial.h>
const int rxpin = 2; // pin used to receive
const int txpin = 3; // pin used to send to
SoftwareSerial keypad(rxpin, txpin); // new serial port on given pins
void setup()
{
Serial.begin(9600);
@treeherder
treeherder / compile.sh
Last active August 29, 2015 13:56
a generic compile script for my type A 3d printer
#!/bin/bash
if [ -f ./$1.scad ]
then
openscad -o ${1}.stl ${1}.scad
fi
perl -I/home/debian/Slic3r /home/debian/Slic3r/slic3r \
--load /home/debian/Slic3r/slicer.ini \
--max-fan-speed 100 \
@treeherder
treeherder / a_g.c
Last active August 29, 2015 13:56
accelerometer structure for handling data in a way that might be sane
#include <stdio.h>
typedef struct ret ret;
struct ret {
char *id;
int accel_x;
int accel_y;
int accel_z;
int gyro_x;
@treeherder
treeherder / l298.ino
Last active August 29, 2015 13:56
control l298d breakout module
#include <stdint.h>
#define EN1A 9
#define M1A 8
#define EN1B 3
#define M1B 2
#define EN2A 4
#define M2A 5
#define EN2B 7
@treeherder
treeherder / returval.c
Last active August 29, 2015 13:56
trouble with dereferecing
#include <stdio.h>
struct ret
{
int c_1;
int c_2;
};
int main()
@treeherder
treeherder / kmler.py
Last active August 29, 2015 14:02
i went through a lot of work to format/fix this script i found for parsing kismet data from the OLDCORE kismet (versions before circa 2008), and didn't want to lose it.
#!/usr/bin/env python
# modified from http://www.larsen-b.com/Article/204.html
import sys
try:
from elementtree import ElementTree
except:
from xml.etree import ElementTree
try:
@treeherder
treeherder / bbb_rootfs.md
Last active July 1, 2023 21:36
how to expand the rootfs of the beagle bone black from a flashed eMMC onto the SD card

We have used the most recent beagleboard debian eMMC flasher image to flash the beagle bone black eMMC. As of this writing: wget http://debian.beagleboard.org/images/BBB-eMMC-flasher-debian-7.5-2014-05-14-2gb.img.xz After flashing is complete, erase the sd card, then reboot. Once booted, We can use fdisk -l to list our available devices, I found mine by checking the size and the partition table. After verfifying the card's address, we can reformat it to fit our needs. Of course, this can be done before plugging the card in, as well.

debian@beaglebone:~$ fdisk -l
Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes 
        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192    31116287    15554048    b  W95 FAT32