Skip to content

Instantly share code, notes, and snippets.

var express = require('express');
var oauth = require('oauth');
var app = express.createServer();
var key = "[api-key]";
var secret = "[api-secret]";
var request = new oauth.OAuth(null, null, key, secret, '1.0', null, 'HMAC-SHA1');
app.get('/api-request', function(req, res){
request.get(
"http://127.0.0.1:8000/api/1.0/data.json",
@tanpinsiang
tanpinsiang / gist:5039088
Created February 26, 2013 15:05
reverse ssh and connect 3g
cd /usr/bin
sudo ./sakis3g connect APN="uninet" APN_USER="APN_USER" APN_PASS="APN_PASS" --console; python startup_mailer.py
ssh -f -N -T -R22222:localhost:22 amazon
ssh -p 22222 pi@localhost
@tanpinsiang
tanpinsiang / gist:5013240
Created February 22, 2013 13:00
flow meter code
#include <SoftwareSerial.h>
#define rxpin 2
#define txpin 3
//add the soft serial library
//set the RX pin to pin 2
//set the TX pin to pin 3
SoftwareSerial myserial(rxpin, txpin);
//enable the soft serial port
String inputstring = "";
String sensorstring = "";
@tanpinsiang
tanpinsiang / gist:4728212
Created February 7, 2013 03:38
几点要注意,祝你成功
有几点在ubuntu要注意:
1:
在chrome里打 /etc/network/interfaces
应该看到:
auto lo
iface lo inet loopback
2:
在ubuntu connect wifi哪里 有一个Edit Connections
在wired tab
@tanpinsiang
tanpinsiang / gist:4256415
Created December 11, 2012 06:52
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
From 7341a316c38a61cc745ce04e618916677007883b Mon Sep 17 00:00:00 2001
From: Timothy Brom <[email protected]>
Date: Wed, 29 Feb 2012 11:29:55 -0500
Subject: [PATCH] Fixed error about strexh and strexb using the same register
---
example/libs_stm/inc/core_support/core_cm3.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/example/libs_stm/inc/core_support/core_cm3.c b/example/libs_stm/inc/core_support/core_cm3.c
@tanpinsiang
tanpinsiang / gist:3704092
Created September 12, 2012 03:21
mosquitto
#include <stdio.h>
#include <mosquitto.h>
void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message)
{
if(message->payloadlen){
printf("%s %s\n", message->topic, message->payload);
}else{
printf("%s (null)\n", message->topic);
}
@tanpinsiang
tanpinsiang / README.md
Created August 30, 2012 15:24 — forked from bergie/README.md
MQTT pub/sub example

This is a simple example of the MQTT protocol with Node.js. The client code has also been tested with a combination of C++ servers and clients.

@tanpinsiang
tanpinsiang / gist:3485659
Created August 27, 2012 04:48 — forked from annem/gist:3183536
Download, compile, and install the Broadcom BCM 2835 library for the Raspberry Pi
cd;
// wget http://www.open.com.au/mikem/bcm2835/bcm2835-1.5.tar.gz; // My Pi can't figure out this URL
wget http://67.192.60.197/mikem/bcm2835/bcm2835-1.8.tar.gz
tar xvfz bcm2835-1.8.tar.gz;
cd bcm2835-1.8;
./configure;
make;
sudo make install
@tanpinsiang
tanpinsiang / setup-statsd.sh
Created August 21, 2012 17:34 — forked from jasonroelofs/setup-statsd.sh
Turn an Ubuntu 10.10 EC2 into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use