Skip to content

Instantly share code, notes, and snippets.

@mharsch
mharsch / VSpeedTeleOp.java
Created September 12, 2015 19:10
PRA's FTC TeleOp V1
package com.qualcomm.ftcrobotcontroller.opmodes;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.util.Range;
/**
* Created by mharsch on 9/12/15.
*/
public class VSpeedTeleOp extends OpMode {
@mharsch
mharsch / gist:1239436
Created September 24, 2011 15:11
randomly access memory within an allocated range
Random integer in range algorithm:
given that rand() produces a random number between 0 and RAND_MAX (defined in stdlib.h)
and we want a random integer (rand_index) between 0 and page_range where page_range = malloc_size / page_size
page_range = malloc_size / page_size;
if ( RAND_MAX > page_range ) {
rand_index = ( rand() % page_range ) * page_size;
} else {
@mharsch
mharsch / gist:1964199
Created March 3, 2012 03:39
create a pair of facebook test users and make them friends
var qs = require('querystring');
var request = require('request');
var fbapp = {
id: '<your fb app id>',
secret: '<your fb app secret>'
};
var fb_perm = 'email,user_birthday,user_interests,user_location,friends_birthday,friends_interests,friends_location,publish_stream,offline_access,sms';
@mharsch
mharsch / gist:2918235
Created June 12, 2012 15:34
notes on porting v8plus to linux
--- notes from my initial pass trying to get wesolows/v8plus to work on linux ---
Download source for both SPL (Solaris Portability Layer) and ZFS from
zfsonlinux.org. Build both SPL and ZFS packages. Now you have the libnvpair
library and the necessary solaris header files to build v8plus.
Modify v8plus Makefile.v8plus.defs as follows
add '-I' include directives to CPPFLAGS for /tmp/zfs/lib/libspl/include and
/tmp/zfs/include (assuming you downloaded the zfs on linux repo to /tmp)
add -DHAVE_IOCTL_IN_UNISTD_H to CPPFLAGS
@mharsch
mharsch / gist:3800817
Created September 28, 2012 16:34
install libnvpair on Ubuntu
libnvpair is available as a nice independent bundle from the ZFS on Linux project.
To install libnvpair (and it's dependencies) on Ubuntu:
sudo add-apt-repository ppa:zfs-native/stable
sudo apt-get update
sudo apt-get install libnvpair1
@mharsch
mharsch / gist:4039775
Created November 8, 2012 16:10
display resolution mismatch on chromebook
Connecting a 2012 samsung chromebook XE303C12 ($249 ARM-based model) to a Dell E2209W 22"
widescreen LCD monitor (using a DVI to HDMI cable) produces inconsistent resolution
detection for the external monitor. The E2209W reports it's optimal resolution
(when connected to the chromebook) to be 1680x1050@60Hz, but often syncs at 1788x1050@60Hz.
On my system, this produces a black stripe on the right side of the screen. The state of
the external monitor (on/off, connected/disconnected) at boot-time determines whether
or not the resolution will successfully sync to the optimal setting. Through
trial-and-error, I've determined that the following sequence always lands on the optimal
monitor resolution:
@mharsch
mharsch / gist:4260240
Created December 11, 2012 16:53
build PAPI 5.0.1 with cuda component on Ubuntu 12.04 with CUDA 5
mharsch@linbrook:~/tmp$ uname -a
Linux linbrook 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
mharsch@linbrook:~/tmp$ cd papi-5.0.1/
mharsch@linbrook:~/tmp/papi-5.0.1$ cd src/components/cuda
mharsch@linbrook:~/tmp/papi-5.0.1/src/components/cuda$ echo $LD_LIBRARY_PATH
/usr/local/cuda-5.0/lib64:/usr/local/cuda-5.0/extras/CUPTI/lib64:/lib:
mharsch@linbrook:~/tmp/papi-5.0.1/src/components/cuda$ echo $PATH
/home/mharsch/local/bin:/usr/local/cuda-5.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
mharsch@linbrook:~/tmp/papi-5.0.1/src/components/cuda$ ./configure --help|grep with-cu
--with-cuda_incdir=<path> Specify path to CUDA includes
@mharsch
mharsch / gist:5645674
Created May 24, 2013 18:47
generate list for ffmpeg concat
ls *.flv | awk '{ print "file '\''"$1"'\''" }'
Notes for final nodebots day organizer's meeting:
Chris will record his intro video and give to dshaw before Thursday
length will be 20min max
content will include 'get to blinking led' bootstrap sequence
dshaw recommends following up with all attendees this week to combat attrition
Medellín is considering streaming video toward the end of their event
@mharsch
mharsch / gist:5542211
Created May 8, 2013 17:53
raspbian config for unsecured ad-hoc wifi using edimax EW-7811UN usb wifi adapter 8192cu driver
pi@raspberrypi ~ $ cat /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet static
address 10.0.0.1
netmask 255.0.0.0