Skip to content

Instantly share code, notes, and snippets.

@sturadnidge
sturadnidge / app.config
Created September 20, 2012 18:05
localhost only Riak app.config based on Joyent dataset 399e09fc-c448-11e1-b3c8-a3d517dfbb07 (smartos 2012-07-02 sdc:sdc:riak:1.6.1)
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ft=erlang ts=4 sw=4 et
[
%% Riak Core config
{riak_core, [
%% Default location of ringstate
{ring_state_dir, "/var/db/riak/ring"},
%% Raise the initial ring size
{ring_creation_size, 256 },
@sturadnidge
sturadnidge / gist:5403580
Created April 17, 2013 11:36
M101P week 2 solution in node.js
'use strict';
/*
* Homework assignment 2.2 for M101P, using node.js
*
* Notes: this only works because the student id
* increments by 1, and also because each student
* has more than 1 homework score. If either of
* those conditions weren't true, this code would
* be totally wrong (and dangerous!).
*
@sturadnidge
sturadnidge / gist:5541742
Created May 8, 2013 16:40
MongoDB shell tricks: add a 'created' field to documents long after the fact
db.test.find({}).forEach( function(obj) {
var _idTimestamp = obj._id.getTimestamp();
obj.created = _idTimestamp.getTime();
db.test.save(obj)
});
@sturadnidge
sturadnidge / 75-persistent-net-generator.rules
Created June 2, 2013 22:53
Debian Wheezy 75-persistent-net-generator.rules - for some reason it was missing from the last Raspbian build I did.
# These rules generate rules to keep network interface names unchanged
# across reboots and write them to /etc/udev/rules.d/70-persistent-net.rules.
# variables used to communicate:
# MATCHADDR MAC address used for the match
# MATCHID bus_id used for the match
# MATCHDRV driver name used for the match
# MATCHIFTYPE interface type match
# COMMENT comment to add to the generated rule
# INTERFACE_NAME requested name supplied by external tool
@sturadnidge
sturadnidge / cdh4-pseudo-distributed-everything
Last active December 20, 2015 22:39
CDH4 MRv1 install in pseudo-distributed mode, plus optional ZooKeeper, HBase, HttpFS. Assumes you have a Sun JDK installed and JAVA_HOME set for root if installed somewhere other than /usr/java/. This is all basically a summary of various parts of https://ccp.cloudera.com/display/CDH4DOC/CDH4+Documentation
# Add Cloudera RPM-GPG-KEY and repo
rpm --import http://archive.cloudera.com/cdh4/redhat/6/x86_64/cdh/RPM-GPG-KEY-cloudera
rpm -ivh http://archive.cloudera.com/cdh4/one-click-install/redhat/6/x86_64/cloudera-cdh-4-0.x86_64.rpm
# note: if you want to install a specific version,
# modify /etc/yum.repos.d/cloudera-cdh4.repo accordingly.
# For example, if you want to install 4.2.1, use the following baseurl:
# baseurl=http://archive.cloudera.com/cdh4/redhat/6/x86_64/cdh/4.2.1/
# Install CDH4 Base
@sturadnidge
sturadnidge / python-2.7-on-CentOS-6.x.txt
Last active December 23, 2015 02:29
python-2.7 on CentOS 6.x
# prereqs
yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
# python
curl -O http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
tar -C /usr/src -xzvf Python-2.7.5.tgz
cd /usr/src/Python-2.7.5/
./configure --prefix=/usr/local
@sturadnidge
sturadnidge / node-armv7l-builder.sh
Created October 7, 2013 22:51
Builds node on ARM chromebook. Slower than cross compiling, but what the hey!
git clone -b v0.10.20-release https://github.com/joyent/node.git
cd node
./configure --prefix=/ --without-snapshot
export BIN_NAME=node-v0.10.20-linux-armv7l-chromebook
mkdir ${BIN_NAME}
make install DESTDIR=${BIN_NAME} V=1 PORTABLE=1
@sturadnidge
sturadnidge / cdh4-httpfs-gateway
Last active December 26, 2015 00:09
Build out an HttpFS gateway. Assumes you have a Sun JDK installed and JAVA_HOME set for root.
# Add Cloudera RPM-GPG-KEY and repo
rpm --import http://archive.cloudera.com/cdh4/redhat/6/x86_64/cdh/RPM-GPG-KEY-cloudera
rpm -ivh http://archive.cloudera.com/cdh4/one-click-install/redhat/6/x86_64/cloudera-cdh-4-0.x86_64.rpm
# note: if you want to install a specific version,
# modify /etc/yum.repos.d/cloudera-cdh4.repo accordingly.
# For example, if you want to install 4.2.1, use the following baseurl:
# baseurl=http://archive.cloudera.com/cdh4/redhat/6/x86_64/cdh/4.2.1/
# Install CDH4 httpfs Base
@sturadnidge
sturadnidge / steamMarketWatch.js
Last active January 1, 2016 16:02
Watches an item in the Steam market place and highlights it if price drops below desired value
'use strict';
// npm install colors moment optimist
// builtins
var http = require('http'),
// 3rd party
colors = require('colors/safe'),
moment = require('moment');
@sturadnidge
sturadnidge / minipi.sh
Last active June 13, 2016 13:21
Minimal Raspbian image builder.
#!/bin/bash
# required build environment packages: binfmt-support qemu qemu-user-static debootstrap kpartx lvm2 dosfstools
# made possible by:
# Klaus M Pfeiffer (http://blog.kmp.or.at/2012/05/build-your-own-raspberry-pi-image/)
# Alex Bradbury (http://asbradbury.org/projects/spindle/)
deb_mirror="http://archive.raspbian.org/raspbian/"
deb_local_mirror=$deb_mirror
deb_release="wheezy"