start new:
tmux
start new with session name:
tmux new -s myname
| var sys = require('sys'), | |
| http = require('http'), | |
| redis = require("./redisclient"); | |
| var queuedRes = {} | |
| var counter = 1; | |
| http.createServer(function (req, res) { | |
| pushOnQueue(req, res); | |
| }).listen(8000); |
| var express = require('express'); | |
| var sys = require('sys'); | |
| var oauth = require('oauth'); | |
| var app = express.createServer(); | |
| var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY"; | |
| var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET"; | |
| function consumer() { |
| /** | |
| * Simple outbound message launcher in Node.js | |
| * | |
| * You will need to have a Tropo scripting aplication set up | |
| * to use this. See sample code below: | |
| * | |
| * message(msg, { to:number, network:"SMS" }); | |
| * | |
| * Save this file in your Tropo account as message.js | |
| * |
| ;; ## Example of timeseries aggregation in cascalog. | |
| ;; | |
| ;; (copy paste all of this in at the REPL!) | |
| (use 'cascalog.api) | |
| (def tseries [["ndvi" 1 0 [1 2 3 4]] | |
| ["ndvi" 1 2 [2 3 4 5]] | |
| ["ndvi" 1 1 [4 3 2 1]] | |
| ["ndvi" 1 4 [1 2 3 4]] |
| # Workflow from https://github.com/necolas/dotfiles | |
| # Add the new submodule | |
| git submodule add git://example.com/remote/path/to/repo.git vim/bundle/one-submodule | |
| # Initialize the submodule | |
| git submodule init | |
| # Clone the submodule | |
| git submodule update | |
| # Stage the changes | |
| git add vim/bundle/one-submodule |
| var cluster = require('cluster'); | |
| if (cluster.isWorker) { | |
| console.log('Worker ' + process.pid + ' has started.'); | |
| // Send message to master process. | |
| process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'}) | |
| // Receive messages from the master process. |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| /* | |
| * parse_link_header() | |
| * | |
| * Parse the Github Link HTTP header used for pageination | |
| * http://developer.github.com/v3/#pagination | |
| */ | |
| function parse_link_header(header) { | |
| if (header.length == 0) { | |
| throw new Error("input must not be of zero length"); | |
| } |
| (defn clj->js | |
| "Recursively transforms ClojureScript maps into Javascript objects, | |
| other ClojureScript colls into JavaScript arrays, and ClojureScript | |
| keywords into JavaScript strings." | |
| [x] | |
| (cond | |
| (string? x) x | |
| (keyword? x) (name x) | |
| (map? x) (.-strobj (reduce (fn [m [k v]] |