Skip to content

Instantly share code, notes, and snippets.

View dch's full-sized avatar
🛋️

Dave Cottlehuber dch

🛋️
View GitHub Profile
#!/usr/bin/env bash
echo "# sup markdown" > sup.md
cat sup.md | { _t=$(mktemp --suffix=\.html); curl -s -H "Content-type: text/plain" -d @/dev/stdin https://api.github.com/markdown/raw > $_t ; open $_t ; rm -f $_t; }
-module(user_default).
-author('[email protected]').
%% Compile this file and use this line in your ~/.erlang file (with
%% correct path, of course!) to where the user_default.beam file is stored.
%%
%% code:load_abs("/home/fritchie/erlang/user_default").
-export([help/0,dbgtc/1, dbgon/1, dbgon/2,
dbgadd/1, dbgadd/2, dbgdel/1, dbgdel/2, dbgoff/0,
defprotocol WhizBang do
def specific(_)
def common(_)
end
defrecord Foo, name: "foo"
defrecord Bar, name: "bar"
defmodule Common do
def common(arg), do: IO.puts "Common.common: #{inspect arg}"
(defn rates
"Computes rates."
[& children]
(let [sink (adjust [:service str " rate"]
(apply with {:state "ok"
:tags ["rate"]}
children))]
(with {:metric 1 :ttl 3600 :host nil}
; By-service rates
(by :service

SmartOS albeit powerful, makes some easy things like figuring out a "version" of SmartOS very difficult and confusing. To someone like Basho who makes packages for SmartOS, it is enough to drive us (me) insane trying to figure out how to label the packages.

The problem lies in trying to define the version at all. Is the version you care about listed in uname -a? How about a file in /etc/ that tells you? The answer to bolth of those questions is "no". uname -v gives you a string like joyent_20130125T031721Z The only file in /etc/ that comes close is pkgsrc_version, but that is only sometimes available on the system. The real answer is a combination of the Global Zone snapshot version and the pkgsrc version in the guest zones.


So how do I label my packages for SmartOS?

With the uname -v example above, joyent_20130125T031721Z describes the global zone, and has some influence on how apps run, but not enough to determine which package will work on which system. Plus I d

- hosts: all
tasks:
#- name: Create a group of all hosts by operating system
# action: group_by key=${ansible_distribution}-${ansible_distribution_version}
#- name: Create a group of all hosts by operating system
# action: group_by key=${ansible_distribution}-${ansible_distribution_version}
%% Initialize the luerl state
Lua0 = luerl:init(),
%% Create a new empty table
{HttpTable, Lua1} = luerl_emul:alloc_table(Lua0),
%% Set the empty table to the global key `http`
Lua2 = luerl_emul:set_global_key(<<"http">>, HttpTable, Lua1),
%% You can also set up the global table from Lua

Development box installation guide

This guide will show how to setup a VirtualBox similiar to an Ubuntu 12.04.1 server for use with Amazon EC2.

Covered in this guide:

  • VeeWee: Tool for building base boxes which will be used by vagrant
  • Vagrant: Tool for managing virtual machines with an easy to use CLI
  • Librarian: Bundler for chef cookbooks
  • Chef-solo & Knife solo: Tool for automating installing and management of servers
worker_processes 4;
events {
worker_connections 1024;
}
http {
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
-module (restricted_shell).
-export ([local_allowed/3, non_local_allowed/3]).
-export ([lock/0, unlock/0, is_locked/0]).
-define (APP, 'SuperCluster').
-define (IS_LOCKED, 'restricted.is_locked').
local_allowed (q, [], _State) ->
{not is_locked (), _State};
local_allowed ({init, stop}, [], _State) ->