- Install dependencies
$ npm install
If you have comments on this or disagree about rules then please reach out to me directly. I want to hear it!
Basics
| var serialport = require('node-serialport') | |
| var sp = new serialport.SerialPort("/dev/ttyO3", { | |
| parser: serialport.parsers.raw, | |
| baud: 9600 | |
| }) | |
| sp.on('data', function(chunk) { | |
| console.log(chunk.toString('hex'), chunk.toString(), chunk) | |
| }) |
| #!/bin/bash | |
| # n8.io daemon | |
| # chkconfig: 345 20 80 (NR: what is this???) | |
| # description: Nate's blog | |
| # processname: n8.io | |
| # original template from: http://werxltd.com/wp/2012/01/05/simple-init-d-script-template/ | |
| # working dir | |
| DAEMON_PATH="/home/pi/n8.io" |
These instructions work for the Raspberry Pi running Raspbian (hard float) and create a hardware optimized version of NodeJS for the Raspberry PI, (and include a working install and NPM!!!):
Install Raspbian - http://www.raspberrypi.org/downloads
Install the necessary dependecies:
sudo apt-get install git-core build-essential(If you just installed git then you need to administer your git identity first, else adding the patches below will fail!!!)
So, to get something like /etc/rc.local you can use the custom SMF import facility. (See the source
for more information about how this actually works.)
/opt is mounted out of zones/opt by default. You can create a directory /opt/custom/smf and populate it with SMF manifests. Any manifests you put in there will be imported by SmartOS when it boots. Below is an example SMF manifest that simply starts /opt/custom/bin/postboot, a self-explanatory shell script that you can use like /etc/rc.local.
Note that it would likely be better to customise and respin your own images, as putting a bunch of platform state in the zones pool undoes some of the benefits of the ramdisk platform architecture that SmartOS has.
| // Don't care much about inheritance at this point, but I'll probably attempt it at | |
| // some point via cloning ancestor schema's | |
| var mongoose = require('mongoose'), | |
| Schema = mongoose.Schema; | |
| var Contact = new Schema({ | |
| _type: String, | |
| name: String | |
| }); |
| ## Prepare ################################################################### | |
| # Remove RVM | |
| rvm implode | |
| # Ensure your homebrew is working properly and up to date | |
| brew doctor | |
| brew update | |
| ## Install ################################################################### |