Skip to content

Instantly share code, notes, and snippets.

@kfatehi
kfatehi / rgbMatrix.js
Last active August 29, 2015 13:56
rgb888 print matrix w/ nodejs
// Could send base64 to browser and work on it there
// http://blog.danguer.com/2011/10/24/base64-binary-decoding-in-javascript/
// nice explanation of readable streams
// http://codewinds.com/blog/2013-08-04-nodejs-readable-streams.html
// official docs about it
// http://nodejs.org/api/stream.html#stream_class_stream_readable
// more jump off points
@kfatehi
kfatehi / app.js
Created March 11, 2014 23:24
basic backbone.js usage
var data = {
people: [
{
"id": "1",
"img": "1-dan.jpg",
"name": "Dan"
},
{
"id": "2",
"img": "2-ron.jpg",
@kfatehi
kfatehi / server.js
Created April 29, 2014 22:22
example of using cluster, domain, memwatch
var token = process.env.NOS_TOKEN;
var relayServer = process.env.RELAY_SERVER;
if (!token) { throw new Error("missing environment variable NOS_TOKEN"); }
if (!relayServer) { throw new Error("missing environment variable RELAY_SERVER"); }
(function() {
"use strict";
var config = {
@kfatehi
kfatehi / manifest.sh
Last active August 29, 2015 14:00
ubuntu manifest script
# curl https://gist.github.com/keyvanfatehi/ea54e9bcc663782562d6/raw/manifest.sh | bash
# i use this for VMs, will update as needed
sudo apt-get update && sudo apt-get install git tmux vim
git clone https://github.com/keyvanfatehi/config.git && cd config && bash manifest
@kfatehi
kfatehi / README.md
Last active August 29, 2015 14:00 — forked from jgeurts/install-graphite-ubuntu-12.04.sh
Graphite 0.9.12 Installer for Ubuntu 12.04

Graphite + Carbon

An all-in-one image running graphite and carbon-cache. Version: 0.9.12.

This script contains a sensible default configuration of graphite and carbon-cache. Starting this container will, by default, bind the the following host ports:

  • 80: the graphite web interface
  • 2003: the carbon-cache line receiver (the standard graphite protocol)
@kfatehi
kfatehi / 00-kernel-upgrade.sh
Last active August 29, 2015 14:00
Docker HTTP Host Manifest Ubuntu 12.04 LTS
apt-get -y update
apt-get -y install linux-image-generic-lts-raring linux-headers-generic-lts-raring
reboot
input {
lumberjack {
# The port to listen on
port => 32451
# The paths to your ssl cert and key
ssl_certificate => "path/to/ssl.crt"
ssl_key => "path/to/ssl.key"
# Set this to whatever you want.
@kfatehi
kfatehi / eggtimer.sh
Created July 4, 2014 20:59
Mac Egg Timer
# Usually the eggs are ready in 10 mins!
sleep $(echo "10*60" | bc) ; osascript -e 'display dialog "Eggs are ready"'
@kfatehi
kfatehi / gist:80a341f0a92445a41ef1
Created July 7, 2014 03:48
oh javascript, how you nest so deeply, so easily...
function createCardsViaProvider(req, res, next) {
var board = req.board;
var handler = providers[req.params.provider].cardHandler;
var promises = [];
Column.findOne({ board: board._id, role: 1 })
.exec(function (err, column) {
if (err) {
logger.error(err.message);
res.send(500);