Skip to content

Instantly share code, notes, and snippets.

View philipcristiano's full-sized avatar

Philip Cristiano philipcristiano

View GitHub Profile
@philipcristiano
philipcristiano / main.yml
Created January 20, 2017 17:00
Route53 Zones per Namespace
--
- name: Create DNS zone
route53_zone:
zone: "{{ item }}.{{ domain }}"
state: present
comment: Created with Ansible
with_items: "{{ dns_zone_namespaces }}"
register: dns_zones
@philipcristiano
philipcristiano / 0_reuse_code.js
Created October 28, 2016 15:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
try:
with util.ipmi(util.get_lom_ip(self.host))) as ipmi:
ipmi.foo()
except exceptions.IPMIError:
self._unwind("Failed to connect to IPMI", exceptions.IPMIError)
raise
-include_lib("riak_core/include/riak_core_vnode.hrl").
send_command(Pid, Request) ->
Ref = make_ref(),
gen_fsm:send_event(Pid, ?VNODE_REQ{request=Request,
sender={raw, Ref, self()}}),
{ok, Ref}.
get_response(Ref) ->
receive {Ref, M} -> {ok, M}
end_per_testcase(_, Config) ->
Pid = ?config(vnode, Config),
send_command(Pid, stop),
ok.
@philipcristiano
philipcristiano / gist:9f16cb30196383580e13
Last active August 29, 2015 14:12
Erlang vnode test init
init_per_testcase(_, Config) ->
{ok, Pid} = riak_core_vnode:start_link(etsdb_vnode, 0, []),
[{vnode, Pid}| Config].
@philipcristiano
philipcristiano / gist:3d306c0fd054934152ad
Created December 9, 2014 19:44
Python semver from git tag for PBR
if git describe --exact-match 2> /dev/null; then
VERSION=$(git describe)
else
VERSION=$(git describe | sed -E 's/([0-9]+)\.([0-9]+)-([0-9]+).*/\1.\2.\3/')
git tag -a "$VERSION" -m "Tagging version \"${VERSION}\""
fi
@philipcristiano
philipcristiano / first_value.py
Created September 2, 2013 20:51
Python parse first value
def first_value(l):
for (value, time) in l:
if value is not None:
return value
@philipcristiano
philipcristiano / first_value.erl
Created September 2, 2013 20:39
Retrieve the first non `null` value from Graphite datapoints
first_value([[null,Time]|T]) ->
first_value(T);
first_value([[Value, Time]|T]) ->
{ok, Value};
first_value(_)->
{error, no_value}.
@philipcristiano
philipcristiano / datapoints.erl
Created September 2, 2013 20:35
Graphite Datapoint Parsing
[[null,1378153440],
[1.0,1378153380],
[1.0|...],
[...]|...]