Skip to content

Instantly share code, notes, and snippets.

Tyler Flint tylerflint

View GitHub Profile
@tylerflint
tylerflint / gist:9570175
Created Mar 15, 2014
Elixir dsl/macro discovery
View gist:9570175

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 Mar 19, 2014
erlang release config
View app.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 Aug 29, 2015
hanoidb cuttlefish schema
View hanoidb.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},
View hypervisor-alert.json
{
"type": "alert",
"scope": "hypervisor",
"time": 1395205200000,
"tags": {
"hostname": "hypervisor1",
"organization": "53287e364feb6379d500000b"
},
"alert": "something bad happened"
}
@tylerflint
tylerflint / macro.ex
Last active Aug 29, 2015
playing around with elixir macros
View macro.ex
#!/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 Mar 21, 2014
sample cuttlefish config file with hanoidb snippet
View myapp.conf
## 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
View gist:3116831e7ba627401e73
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 Aug 25, 2014
Pagoda Box artisan expectations and values
View pagodabox-expectation-values.mk
## 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 Aug 29, 2015
smartos zone create bottleneck
View cache.txt
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 Aug 29, 2015
SmartOS cleanup crufty zone datasets
View gist:601a88756ab468fc5ce7
#!/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
You can’t perform that action at this time.