Skip to content

Instantly share code, notes, and snippets.

View dhylands's full-sized avatar

Dave Hylands dhylands

View GitHub Profile
@dhylands
dhylands / usbreset.c
Created March 24, 2016 20:44 — forked from x2q/usbreset.c
/* usbreset -- send a USB port reset to a USB device
*
* Compile using: gcc -o usbreset usbreset.c
*
*
* */
@dhylands
dhylands / GNUmakefile
Last active November 10, 2015 19:09
GNUmakefile I use for micropython
$(info Executing GNUmakefile)
#BOARD = STM32F7DISC
BOARD = STM32F429DISC
#BOARD = PYBV10
$(info BOARD = $(BOARD))
DFU_UTIL = dfu-util -s :leave
USE_PYDFU = 1
@dhylands
dhylands / arm.m
Created October 9, 2015 05:35
MATLAB code used for my ENG-03 ARM Project
% This code relies on the Arbotix class and the SerialLink class from the
% Robotics Toolbox, which can be found here:
% http://petercorke.com/Robotics_Toolbox.html
addpath(fullfile( fileparts(which('startup_rvc')), 'robot', 'interfaces'))
% This was using a direct USB to bioloid interface, so we run it at
% 1 Mbit/sec
arb = Arbotix('port', '/dev/ttyUSB0', 'baud', 1000000, 'nservos', 2);
@dhylands
dhylands / ls_upy.py
Last active August 29, 2015 14:24
Micropyton version of ls.py
import os
import stat # Install stat.py from micropython-lib
import sys
import time
SIX_MONTHS = 6 * 30 * 86400
MONTH_NAME = ('', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')
def ls(dir):
print('%s:' % dir)
@dhylands
dhylands / ls.py
Created July 8, 2015 18:22
Exercise to implement some recursive directory scaning
#!/usr/bin/env python3
import grp
import os
import pwd
import stat
import sys
import time
SIX_MONTHS = 6 * 30 * 86400
@dhylands
dhylands / GNUmakefile
Last active August 29, 2015 14:09
GNUmakefile for building micropython board.
$(info Executing GNUmakefile)
BOARD?=STM32F4DISC
$(info GNUmakefile: set BOARD to $(BOARD))
include Makefile
@dhylands
dhylands / run-mochitest.sh
Created September 2, 2014 14:54
Script I've used for running mochitests on the emulator
#!/bin/bash
# Get full path from where the script was executed, full path is needed to run emulator succesfully
B2G_HOME=$(cd $(dirname $BASH_SOURCE); pwd)
. $B2G_HOME/load-config.sh
export DISPLAY=:0
# Other steps to do:
@dhylands
dhylands / .userconfig
Created August 8, 2014 15:11
FirefoxOS .userconfig I use for my flame
B2G_DIR=${B2G_DIR:-$(cd $(dirname $0); pwd)}
echo "B2G_DIR = ${B2G_DIR}"
#GECKO_PATH=${B2G_DIR}/b2g-inbound
#GECKO_PATH=${B2G_DIR}/mozilla-inbound
GECKO_PATH=${B2G_DIR}/gecko
echo "GECKO_PATH = ${GECKO_PATH}"
#export MOZ_DMD=1
#echo "MOZ_DMD = ${MOZ_DMD}"
@dhylands
dhylands / get-repos.py
Created April 28, 2014 21:25
Fetch gaia-l10n repos
#!/usr/bin/python
import json
import subprocess
locales = json.load(open("/home/work/B2G-unagi/gaia/locales/languages_all.json"));
for key, val in locales.items():
cmd = ["hg", "clone", "http://hg.mozilla.org/gaia-l10n/" + key, key]
print " ".join(cmd)
@dhylands
dhylands / pins_PYBOARD4.c
Created February 18, 2014 02:03
Example generated pin file
// This file was automatically generated by make-pins.py
//
// --af boards/stm32f4xx-af.csv
// --board boards/PYBOARD4/pins.csv
// --prefix boards/stm32f4xx-prefix.c
// stm32fxx-prefix.c becomes the initial portion of the generated pins file.
#include <stdio.h>
#include <stdint.h>