This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Home monitoring CurrentCost monitors such as CC128 and EnviR | |
// | |
// Version specifically for Nanode, www.nanode.eu | |
// I am using with Arduino/Freeduino and EtherShield (ENC28J60 based) | |
// CC128 connected to pin 0 - UART Serial in and ground | |
// | |
// If using regular Arduino or clode with FTDI chip: | |
// PCB track between FTTDI chip and R11 is cut to disable USB/SERIAL. | |
// Just short gap to re-program | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# /etc/init.d/myapp | |
# | |
# Don't forget to reload init.d: | |
# update-rc.d myapp defaults | |
APP='myapp' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require("sys"), | |
fs = require("fs"); | |
function processImageDir(path, outFilename, cb) { | |
fs.readdir(path, function(err, files) { | |
var imgfiles = []; | |
// Check for images and push on the array if it's a match. | |
files.forEach(function(name) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Memory Monitor" | |
author "Joe McCann" | |
start on startup | |
stop on shutdown | |
script | |
if memory usage > 75% then exec killall node | |
end script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu). | |
In a nutshell, | |
1) nginx is used to serve static files (css, js, images, etc.) | |
2) node serves all the "dynamic" stuff. | |
So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node. | |
3) nginx listens on port 80. 4) node listens on port 8124 (for this example only. you can change this port for your node app). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.4 | |
import httplib, urllib, sys | |
twitter_handle = 'joemccann' | |
params = urllib.urlencode([ | |
('screen_name', twitter_handle) | |
]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
#Step 1 - Generate server certificates etc... (most of this code is horribly ripped off from nodejs docs currently -> http://nodejs.org/docs/latest/api/tls.html) | |
### | |
#Assuming your starting from a clean directory | |
mkdir server | |
cd server | |
#generate private key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
deleteObject: function (client, deleteParams) { | |
client.deleteObject(deleteParams, function (err, data) { | |
if (err) { | |
console.log("delete err " + deleteParams.Key); | |
} else { | |
console.log("deleted " + deleteParams.Key); | |
} | |
}); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.6"></script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var svg = d3.select("body").append("svg:svg") | |
.attr("width", 960) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"isActive": true, | |
"balance": "$2,504.16", | |
"age": 31, | |
"eyeColor": "green", | |
"name": "Mendez Gilmore", | |
"gender": "male", | |
"registered": "2014-07-20T04:47:48 -01:00", | |
"latitude": 79.452285, | |
"longitude": -163.151555 |
OlderNewer