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 / disable-adb-timer.sh
Last active February 14, 2016 22:22
Sets the "Disable ADB Timer" to zero, which disables the timer.
#!/bin/bash
# Disables the adb timeout
set -e
ADB=${ADB:-adb}
$ADB wait-for-device
B2G_PREF_DIR=/system/b2g/defaults/pref
TMP_DIR=/tmp/adb-timeout-prefs
rm -rf $TMP_DIR
@dhylands
dhylands / remove-app.py
Created September 25, 2013 17:16
Removes an app from a directory tree, and also updates webapps.json to remove the app from there as well. Usage: remove-app.py <webapps-directory> webapp ... For example: remove-app.py gaia/profile/webapps uitest.gaiamobile.org cubevid.gaiamobile.org
#!/usr/bin/python
import json
import sys, string, os
import shutil
webapps_dir = sys.argv[1]
webapps_filename = os.path.join(webapps_dir, "webapps.json")
webapps = json.load(open(webapps_filename))
@dhylands
dhylands / install-busybox.sh
Last active December 19, 2015 23:18
Install BusyBox
#!/bin/sh
if [ ! -f busybox-armv6l ]
then
wget "http://busybox.net/downloads/binaries/1.19.0/busybox-armv6l"
fi
adb remount
adb push busybox-armv6l /system/bin/busybox
adb shell 'cd /system/bin; chmod 555 busybox; for x in `./busybox --list`; do ln -s ./busybox $x; done'
@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 / unlock-otoro.sh
Created October 31, 2012 01:43
Script which unlocks the otoro (with the slider at the bottom)
#!/system/bin/sh
#
# Constants from include/linux/input.h
EV_SYN=0
EV_ABS=3
SYN_REPORT=0
SYN_MT_REPORT=2
ABS_MT_TOUCH_MAJOR=48 # 0x30
@dhylands
dhylands / unlock.sh
Created October 31, 2012 01:11
Unlock the screen on sgs2 (early slide up version)
#!/system/bin/sh
#
# Constants from include/linux/input.h
EV_SYN=0
EV_ABS=3
SYN_REPORT=0
ABS_MT_TOUCH_MAJOR=48
ABS_MT_POSITION_X=53
@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 / enable-omtc
Created May 10, 2012 22:12
Enable OMTC for B2G
#!/bin/sh
# Script to enable/disable OMTC
# Make disable-omtc a symlink to enable-omtc
#set -x
script_name=$(basename $0)
ENABLE_OMTC=/tmp/enable-omtc
DISABLE_OMTC=/tmp/disable-omtc
LOCAL_PREFS_JS=/tmp/prefs.js
@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