Skip to content

Instantly share code, notes, and snippets.


Nathan L Smith smith

View GitHub Profile
smith / extractor
Created Feb 14, 2014
Starter extractor example
View extractor
#!/usr/bin/env ruby
# As a possible replacement for a Chef Starter kit, we could download a single
# "bundle" that contains the user's custom knife.rb and keys and use a command
# to install it in ~/.chef. This is a prototype of such a command.
# The script takes a filename (we'll call it starter.rb) as an argument. The
# file consists of the following:
# * A knife.rb
View chef-stacktrace.out
Generated at 2014-02-20 23:35:12 +0000
TypeError: can't convert nil into String
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-6.18.0/lib/ohai/system.rb:134:in `join'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-6.18.0/lib/ohai/system.rb:134:in `block in all_plugins'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-6.18.0/lib/ohai/system.rb:131:in `each'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-6.18.0/lib/ohai/system.rb:131:in `all_plugins'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/client.rb:266:in `run_ohai'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/client.rb:478:in `do_run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/client.rb:199:in `block in run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/client.rb:193:in `fork'
smith / gem_make.out
Created May 21, 2014
Output of build of dep-selector-libgecode on CentOS 5.8
View gem_make.out
/opt/chef/embedded/bin/ruby extconf.rb
-> sh /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/dep-selector-libgecode-1.0.0/ext/libgecode3/vendor/gecode-3.7.3/configure --prefix=/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/dep-selector-libgecode-1.0.0/lib/dep-selector-libgecode/vendored-gecode --disable-doc-dot --disable-doc-search --disable-doc-tagfile --disable-doc-chm --disable-doc-docset --disable-qt --disable-examples --disable-flatzinc
checking for the host operating system... Linux
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++44 accepts -g... yes
  1. get a vm 4:11 - 4:14
  2. configure a resource 4:14 - 4:23
  • Running the terminal in a different window is weird, especially since it's a browser window and not my terminal and I have to keep context-switching in between the two.
  • It tells me to create a file and edit its contents and save it, which assumes that I know how to do all of these things from a unix shell or a linux desktop. If you're running in the console you can do gedit hello.rb & which gives a nice editor. Maybe we should make this the default.
  • It says, "From your terminal window, run chef-apply to apply what you've written.", but below it says to run "chef-apply hello.rb". If you just run chef-apply, you get "TypeError: no implicit conversion of nil into String", which isn't very friendly. The commands should match and the error output should say something that makes sense.
  1. configure a package and a service 4:24 - 4:30
  • Maybe the desktop should just have the icons for the things we're using on it
smith / version-manifest.txt
Created Mar 25, 2015
Example Supermarket Version Manifest
View version-manifest.txt
supermarket 1.7.0-alpha.0
Component Installed Version Version GUID Overridden From
berkshelf master git:3d4b5971f86dd7927d198a1acdaf13c33e867179
bundler 1.7.3 1.5.3
bzip2 1.0.6 md5:00b516f4704d4a7cb50a1d97e6e8e15b
cacerts 2014.08.20 md5:c9f4f7f4d6a5ef6633e893577a09865e 2014.09.03
curl 7.36.0 md5:643a7030b27449e76413d501d4b8eb57
dep-selector-libgecode 1.0.2
View jaxer-linux-vhost.template.httpd.conf
# This is a VirtualHost configuration for running Aptana Jaxer 1.0 with an
# existing installation of Apache 2.2 on Ubuntu 8.04 Server (or others.)
# Replace the #{...} content with the settings for your site.
# Uncomment this line if this is your only virtual host
# NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@#{}
View rc.jaxer.ubuntu
#! /bin/sh
# jaxer This file is used as an init script for Jaxer. It should saved as
# /etc/init.d/jaxer
# To enable, run:
# sudo chmod +x jaxer
# sudo update-rc.d jaxer defaults
# from /etc/init.d
View blog-in-a-browser.html
<!doctype html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Blog In A Browser</title>
body { font-family: Helvetica, Arial, sans-serif; margin: 0em; }
h1, h2, h3 { font-weight: normal; padding-left: 1em; }
textarea, a { display: block; }
#tabs { float: left; width: 100%; list-style: none; border-bottom: 1px solid; clear: both; }
View vimrc
" Nathan L Smith's .vimrc file. Based on
" John Lam's .vimrc file
" Use ruby syntax for capfiles
au BufNewFile,BufRead capfile setf ruby
syntax on
set nocompatible
set autoread
filetype on
smith / jsonschema.js
Created Jun 19, 2009
JSONSchema Validator
View jsonschema.js
* JSONSchema Validator - Validates JavaScript objects using JSON Schemas
* (
* Copyright (c) 2007 Kris Zyp SitePen (
* Licensed under the MIT (MIT-LICENSE.txt) licence.
To use the validator call JSONSchema.validate with an instance object and an optional schema object.
If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
that schema will be used to validate and the schema parameter is not necessary (if both exist,
both validations will occur).