Skip to content

Instantly share code, notes, and snippets.

@sturadnidge
sturadnidge / zone.json
Created February 29, 2012 08:09
Just about the simplest zone creation JSON
{
"brand": "joyent",
"dataset_uuid": "templates/smartos64",
"max_physical_memory": 1024,
"nics": [
{
"nic_tag": "admin",
"ip": "dhcp"
}
]
@sturadnidge
sturadnidge / isoboot.ipxe
Created May 13, 2012 17:30
iPXE Boot an ISO
#!ipxe
echo
initrd http://webserver.fqdn/iso/firmware.iso
chain http://webserver.fqdn/memdisk/memdisk iso ||
echo
echo netboot failed, attempting to boot from local disk
echo
sanboot --no-describe --drive 0x80 ||
echo
echo local boot failed, booting ipxe shell
@sturadnidge
sturadnidge / node-fixuuid.js
Created June 19, 2012 22:51
Fix UUIDs incorrectly displayed by HP iLO
var rl = require('readline');
var fs = require('fs');
var i = rl.createInterface(process.stdin, process.stdout, null);
i.question("Enter the UUID to correct: ", function(answer) {
var uuidArray = answer.split("-");
// only the first half of the UUID is wrong, so iterate
@sturadnidge
sturadnidge / chromiumos.vmx
Created July 12, 2012 12:28
A better Chromium OS .vmx file...
.encoding = "UTF-8"
config.version = "8"
virtualHW.version = "4"
numvcpus = "2"
memsize = "2048"
ide0:0.present = "TRUE"
ide0:0.fileName = "ide.vmdk"
ethernet0.present = "TRUE"
ethernet0.virtualDev = "e1000"
svga.autodetect = "FALSE"
@sturadnidge
sturadnidge / zone.json
Created August 31, 2012 22:29
A new simple zone creation file
{
"brand": "joyent",
"dataset_uuid": "e8c41d40-f161-11e1-b839-a3631c115653",
"max_physical_memory": 1024,
"nics": [
{
"nic_tag": "admin",
"ip": "dhcp",
"gateway": "192.168.0.254"
}
@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 / tmux-1.8-on-CentOS-6.x.txt
Last active May 10, 2021 18:31
Install tmux 1.8 on CentOS 6.x minimal (64bit)
# download latest libevent2 and tmux sources, and extract them somewhere
# (thx bluejedi for tip on latest tmux URL)
#
# at the time of writing:
# https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
# http://sourceforge.net/projects/tmux/files/latest/download?source=files
#
# install deps
yum install gcc kernel-devel make ncurses-devel
@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 / 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"