Skip to content

Instantly share code, notes, and snippets.

@tylerflint
tylerflint / gist:9570175
Created March 15, 2014 16:41
Elixir dsl/macro discovery

dsl

In this experiment, I'm attempting to create a dsl that will allow me to

  • execute a dsl in the module definition
  • store data in the module (similar to Ruby's class instance variables)
  • fetch the data stored in the module from within a function defined inside of that module

Here is an example module that uses the dsl:

@tylerflint
tylerflint / app.config
Created March 19, 2014 04:35
erlang release config
[{lager,
[{error_logger_hwm,100},
{crash_log_count,5},
{crash_log_date,"$D0"},
{crash_log_size,10485760},
{crash_log_msg_size,65536},
{crash_log,"./log/crash.log"},
{colored,true},
{handlers,
[{lager_console_backend,info},
@tylerflint
tylerflint / hanoidb.schema
Last active August 29, 2015 13:57
hanoidb cuttlefish schema
%% -*- mode: erlang; tab-width: 4; indent-tabs-mode: 1; st-rulers: [70] -*-
%% vim: ts=4 sw=4 ft=erlang noet
%%%===================================================================
%%% hanoidb
%%%===================================================================
%% @doc hanoidb database directory
{mapping, "hanoidb.db_path", "hanoidb.data_root", [
{datatype, string},
@tylerflint
tylerflint / hypervisor-alert.json
Last active August 29, 2015 13:57
skynet payloads
{
"type": "alert",
"scope": "hypervisor",
"time": 1395205200000,
"tags": {
"hostname": "hypervisor1",
"organization": "53287e364feb6379d500000b"
},
"alert": "something bad happened"
}
@tylerflint
tylerflint / macro.ex
Last active August 29, 2015 13:57
playing around with elixir macros
#!/usr/bin/env elixir
defmodule Dsl do
defmacro __using__(_opts) do
quote do
import Dsl
@before_compile Dsl
@list Keyword.new
@tylerflint
tylerflint / myapp.conf
Created March 21, 2014 15:10
sample cuttlefish config file with hanoidb snippet
## hanoidb database directory
hanoidb.db_path = ./data/hanoidb
## Enable/disable on-disk compression.
hanoidb.compress = none
## Expire (automatically delete) entries after N seconds.
## When this value is 0 (zero), entries never expire.
hanoidb.expiry_secs = 0
@tylerflint
tylerflint / gist:3116831e7ba627401e73
Last active August 29, 2015 14:03
example output
PREPARING DEPLOY
______________________________________________________________
NAME :: devo
KIND :: Tinker App
URL :: devo.pagodabox.com
Your Deploy has been received and will begin shortly.
-> Boxfile.install was merged into Boxfile
@tylerflint
tylerflint / pagodabox-expectation-values.mk
Created August 25, 2014 17:09
Pagoda Box artisan expectations and values
## You are an artisan, not an engineer
An engineer makes something work. You are more than that, you are an artisan. Artisans practice a craft and may through experience and aptitude reach the expressive levels of an artist.
Approach your work as a master craftsman.
Demand perfection of yourself.
## Style matters
@tylerflint
tylerflint / cache.txt
Last active August 29, 2015 14:12
smartos zone create bottleneck
key min .-------------------. max | count
ps 262144 : █ : 68719476736 | 1
mktemp 262144 : ▂▆ ▁ : 68719476736 | 20
autopush 262144 : ▁▇▂ : 68719476736 | 20
isainfo 262144 : ▂▅▂▂ : 68719476736 | 20
m4 262144 : ▁▆▂▁▁ : 68719476736 | 20
hostname 262144 : ▂▆▁▁ : 68719476736 | 40
soconfig 262144 : ▃▅▂▁ : 68719476736 | 20
logger 262144 : ▅▃ ▂▁ : 68719476736 | 20
expr 262144 : ▂▆▂ ▁ : 68719476736 | 40
@tylerflint
tylerflint / gist:601a88756ab468fc5ce7
Last active August 29, 2015 14:13
SmartOS cleanup crufty zone datasets
#!/usr/bin/env bash
zfs_uuids=$(zfs list | /usr/xpg4/bin/grep -E -e 'zones/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$' | awk '{ print $1 }' | awk -F/ '{ print $2 }')
vmadm_uuids=$(vmadm list | tail -n +2 | awk '{ print $1 }')
imgadm_uuids=$(ls -1 /var/imgadm/images | sed 's/zones-//' | sed 's/\.json//')
symmetric_uuids=$(comm -3 <(echo "$zfs_uuids" | sort -) <(echo "$vmadm_uuids" | sort -))
symmetric_uuids=$(comm -3 <(echo "$symmetric_uuids" | sort -) <(echo "$imgadm_uuids" | sort -))
for uuid in $symmetric_uuids
do