Skip to content

Instantly share code, notes, and snippets.

@taka-wang
taka-wang / install_node.sh
Last active December 11, 2015 03:19
Install nodejs on ubuntu
# Install packages
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
 
# Run the following commands:
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install
var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');
@taka-wang
taka-wang / nginx.conf
Created April 19, 2014 14:08
nginx to reverse proxy websockets
upstream my_websocket {
server localhost:443;
}
server {
listen 444;
server_name _;
location / {
proxy_pass http://my_websocket ;
@taka-wang
taka-wang / nginx.conf
Last active August 29, 2015 14:00
ngnix ssl for node.js application
upstream nodejs {
server 127.0.0.1:3000;
}
server {
listen 443;
ssl on;
server_name localhost;
ssl_certificate /etc/nginx/certs/server.crt;
ssl_certificate_key /etc/nginx/certs/server.key;
@taka-wang
taka-wang / nginx.conf
Created April 20, 2014 04:45
nginx load balancer for node.js application
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
server_names_hash_bucket_size 64; # multiple domains
upstream app_a {
@taka-wang
taka-wang / haproxy.cfg
Last active August 29, 2015 14:00
haproxy load balancer for node.js application
global
log 127.0.0.1 local0 notice
maxconn 2000
user haproxy
group haproxy
defaults
log global
mode http
option dontlognull
retries 3
@taka-wang
taka-wang / setup.sh
Last active August 29, 2015 14:00
Install HA+SSL+Node.js
#install node.js
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install python-software-properties python g++ make nodejs
#install haproxy
sudo apt-get install haproxy
#install stunnel
@taka-wang
taka-wang / stunnel.conf
Created May 2, 2014 07:17
stunnel config
pid = /home/ubuntu/key/stunnel.pid
cert = /home/ubuntu/key/cert.key_pem
CAfile = /home/ubuntu/key/ca.crt
fips = no
[https]
accept = 443
connect = 9000
verify=2
@taka-wang
taka-wang / app.js
Last active August 29, 2015 14:00
naive node app
var express = require('express');
var app = express();
app.get('/', function(req, res){
console.log("get /");
res.send('hello world');
});

#Install Debian on the Beaglebone Black, along with Go 1.4

##Ingredients:

  1. Internet connected computer running Mac OS X (you may substitute some other Unix/Linux box---you'll need enough disk space to hold the Debian image (about 2GB), the ability to fetch content from the Internet, uncompress xz files, and the ability to write the image to a connected MicroSD card)

  2. MicroSD card (> 4GB recommended)