Skip to content

Instantly share code, notes, and snippets.

View tcr's full-sized avatar
🚮
bad command or file name

Tim Ryan tcr

🚮
bad command or file name
View GitHub Profile
@tcr
tcr / code.css
Created October 28, 2011 09:36
What's a way to support "white-space: pre-wrap" (significant whitespace, but lines still break) across all browsers?
element {
white-space: pre; word-wrap: break-word; /* Internet Explorer 5.5+ */
white-space: pre-wrap; /* CSS3*/
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
}
@tcr
tcr / gist:4416956
Last active November 29, 2017 03:38
Make a callable() object in all browsers and Node.js
if (!Object.__proto__) {
var sandbox = function () {
// create an <iframe>
var iframe = document.createElement("iframe");
iframe.style.display = "none";
document.documentElement.appendChild(iframe);
return frames[frames.length - 1];
}
var iframe = sandbox();
processor 6502
include "vcs.h"
include "macro.h"
include "xmacro.h"
seg.u Variables
org $80
Temp byte
LoopCount byte
@tcr
tcr / gist:879012973b1e2122d321a45429ac360f
Last active September 21, 2016 18:59
Hacky tessel-rust deployment on T2

Run this somewhere:

wget https://s3.amazonaws.com/builds.tessel.io/t2/OpenWRT+SDK/OpenWrt-SDK-ramips-mt7620_gcc-4.8-linaro_uClibc-0.9.33.2.Darwin-x86_64.tar.bz2
tar -xf OpenWrt-SDK-ramips-mt7620_gcc-4.8-linaro_uClibc-0.9.33.2.Darwin-x86_64.tar.bz2

Change into that directory. Run mkdir -p ~/tessel/sdk/darwin/, then run cp -rf OpenWrt-SDK*/staging_dir/* ~/tessel/sdk/darwin/.

Save this as /usr/local/bin/t2-run-rust:

@tcr
tcr / t2-fix-windows.md
Last active August 19, 2016 10:54
Fix for Tessel 2 on Windows
@tcr
tcr / work.md
Last active July 19, 2016 18:17
TELEC Work

Special emissions testing build of T2

Using t2-build, we can generate a special version of kmod-rt2x00-lib.ipk and kmod-rt2800-lib.ipk that allows modification of testing parameters at runtime.

Explicitly run make package/kernel/mac80211/compile V=s -C openwrt or the full build process. Find the file by running

@tcr
tcr / 999-tim_did_a.patch
Last active July 19, 2016 17:58
999-tim_did_a.patch
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 1274b85..56b3d00 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -38,11 +38,141 @@
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/of.h>
+#include <linux/stat.h>
@tcr
tcr / beaglebone-instructions.md
Last active February 16, 2016 10:59
Creating a reusable Beaglebone Debian Image

BeagleBone Debian Image

Quick reference:

screen /dev/tty.usbmodem1d113 115200 (tty)
ssh debian@beaglebone.local (ethernet)
ssh debian@192.168.7.2 (usb0)
@tcr
tcr / gist:8460625
Last active January 3, 2016 12:09
coolio
import os
from os.path import join
"""find_tty_usb('067b', '2302') -> '/dev/ttyUSB0'"""
# Note: if searching for a lot of pairs, it would be much faster to search
# for the enitre lot at once instead of going over all the usb devices
# each time.
for dnbase in os.listdir('/sys/bus/usb/devices'):
dn = join('/sys/bus/usb/devices', dnbase)
if not os.path.exists(join(dn, 'idVendor')):
@tcr
tcr / gist:8445503
Created January 15, 2014 21:53
Install node-gyp support on Windows
cinst python VisualStudio2012WDX