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
/*
* Modified from WiFlyHQ Example httpclient.ino
*
* This sketch implements a simple Web client that connects to a
* web server, sends a GET, and then sends the result to the
* Serial monitor.
*
* This sketch is released to the public domain.
*
*/
@tcr
tcr / gist:5166129
Last active December 14, 2015 23:29
/** A low-level look at an HTTP API */
// Make the GET request to the Facebook API.
Facebook.get("me/notifications?limit=1", access_token);
Facebook.match(onNotification, "data", JSON_ARRAY, "title"); // "data" key, find ARRAY, identify each "title" key
Facebook.match(onError, "error");
Facebook.request();
// Make the GET request to the Facebook API.
Facebook.post("me/feed", access_token);
@tcr
tcr / gist:5339126
Created April 8, 2013 18:16
Rem over Tor
var rem = require('rem');
var SocksAgent = require('socksified').SocksAgent;
var tor = rem.createClient({
base: 'http://....onion'
agent: new SocksAgent({
socks_host: '127.0.0.1',
socks_port: 9050
}),
key: 'null'
@tcr
tcr / Test.md
Last active December 22, 2015 07:48

In your computer / Node.js

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain', 'Content-Length': 'Hello World\n'.length});
  res.end('Hello World\n');
}).listen(4444);
console.log('Server running at http://localhost:4444/');
#!/usr/bin/env ruby
# checkout the readme from the master branch
`git checkout gh-pages; git checkout master README.md`
path = `pwd`.gsub(/\n/, "")
readme_path = File.join(path, "README.md")
index_path = File.join(path, "index.md")
# write the index readme file
for(Iterator<String> it = my2Do; it.hasNext();) {
String elem = it.next();
if (elem.equals(work2)) {
it.remove();
}
}
@tcr
tcr / gist:8445503
Created January 15, 2014 21:53
Install node-gyp support on Windows
cinst python VisualStudio2012WDX
@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 / dist_static_lib.sh
Created February 10, 2014 05:26
Creating distributable, flattened static libraries for distribution with gyp
#!/bin/bash
set -e
cd out/ARM
node -e "console.log('CREATE ' + process.argv[1]); console.log('ADDLIB', 'obj/lib' + process.argv.slice(2).join('.a\nADDLIB obj/lib') + '.a'); console.log('SAVE\nEND')" $@
node -e "console.log('CREATE ' + process.argv[1]); console.log('ADDLIB', 'obj/lib' + process.argv.slice(2).join('.a\nADDLIB obj/lib') + '.a'); console.log('SAVE\nEND')" $@ | arm-none-eabi-ar -M
@tcr
tcr / README.md
Last active August 29, 2015 14:03 — forked from kevinmehall/README.md

Setup

  1. Install OpenOCD. You need version >= 0.8.0.
  1. Acquire a configuration script for your Bus Blaster. Included in the firmware repo is tools/tessel-busblaster.cfg.

  2. Plug the JTAG cable into the Bus Blaster's adapter board and the Tessel. Pin one is towards the USB port; the cable goes over the center of the board.

  3. Run