Skip to content

Instantly share code, notes, and snippets.

@jamesbjackson
jamesbjackson / express_csrf
Created August 3, 2012 13:38 — forked from pomidor24/express_csrf
nodejs express smart csrf pseudo code
User's session has a fixed size pool of tokens. New token is generated every X minutes and becomes invalid every Y minutes. You always return the most recent one and check against all tokens you have.
token_valid = 180 min
create_new_token_every = 60 min
size = 3
pool = [] // your session pool
current_version = '1'
getToken = function() {
@jamesbjackson
jamesbjackson / gist:3334807
Created August 12, 2012 22:00 — forked from iand/gist:2956833
Plotinum Example
package main
import (
"code.google.com/p/plotinum/plot"
"code.google.com/p/plotinum/vg"
"code.google.com/p/plotinum/vg/veceps"
"math/rand"
)
func main() {
@jamesbjackson
jamesbjackson / ti.socket.io.js
Created October 21, 2012 02:33 — forked from euforic/ti.socket.io.js
Socket.io-client Titanium
/*! Socket.IO.js build:0.9.6, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */
/**
* Originally Ported to titanium by Jordi Domenech <jordi@iamyellow.net>
* source: https://github.com/iamyellow/socket.io-client
*/
this.io = {};
module.exports = this.io;
/**

Building Riak on SmartOS, the hard way

Build Machine

Here is some information on the build machine I'm using for reference:

  1. Dataset

    $ dsadm list

UUID OS PUBLISHED URN

Building Riak on SmartOS, the hard way

Build Machine

Here is some information on the build machine I'm using for reference:

  1. Dataset

    $ dsadm list

UUID OS PUBLISHED URN

###############################################################################
## Monit control file
###############################################################################
##
## Comments begin with a '#' and extend through the end of the line. Keywords
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
##
## Below you will find examples of some frequently used statements. For
## information about the control file, a complete list of statements and
## options please have a look in the monit manual.

Building Riak on SmartOS, the hard way

Build Machine

Here is some information on the build machine I'm using for reference:

  1. Dataset

    $ dsadm list

UUID OS PUBLISHED URN

SmartOS albeit powerful, makes some easy things like figuring out a "version" of SmartOS very difficult and confusing. To someone like Basho who makes packages for SmartOS, it is enough to drive us (me) insane trying to figure out how to label the packages.

The problem lies in trying to define the version at all. Is the version you care about listed in uname -a? How about a file in /etc/ that tells you? The answer to bolth of those questions is "no". uname -v gives you a string like joyent_20130125T031721Z The only file in /etc/ that comes close is pkgsrc_version, but that is only sometimes available on the system. The real answer is a combination of the Global Zone snapshot version and the pkgsrc version in the guest zones.


So how do I label my packages for SmartOS?

With the uname -v example above, joyent_20130125T031721Z describes the global zone, and has some influence on how apps run, but not enough to determine which package will work on which system. Plus I d

If you prefer VirtualBox or aren't running OS X, here are some instructions and a script to help you get started with SmartOS under VirtualBox. If you use VirtualBox, skip the first section and read the section on how to get the Node.js SmartMachine up and running.

Running SmartOS under vmware Fusion

  1. Start by downloading the latest live image
  2. When you run the new VM wizard, select "Continue without disk" on the first screen of the wizard.
  3. Select Sun Solaris / Solaris 10 64-bit on the next screen.
  4. You're going to get dumped to a config screen when the live image starts up, choose DHCP for the networking and defaults for everything else.
  5. Pretty much the first thing you're going to want to do is figure out how to SSH into the box once it boots and creates its storage pools, because trying to do stuff in the virtual console is miserable. There's no cut and paste