Skip to content

Instantly share code, notes, and snippets.

View binarytemple's full-sized avatar

Bryan Hunt binarytemple

  • The mountains of mourne
View GitHub Profile
@binarytemple
binarytemple / dynamic_dns_updater.py
Last active February 22, 2019 04:19
Route 53 dyndns zone updating script taken from Taylor Burnham post
#!/usr/bin/python
# route 53 dyndns script taken from Taylor Burnhams original post :
# https://www.vnucleus.com/blog/2014/6/15/4-using-amazon-route53-for-dynamic-dns
# modified to perform UPSERT rather than DELETE,CREATE
# modified to use a configuration file /etc/dyndns.config to store config values
import boto
from boto.route53.record import ResourceRecordSets
import urllib2
@binarytemple
binarytemple / gist:6c2fa45b0f194401720a
Last active August 29, 2015 14:26 — forked from mfournier/gist:5883828
example collectd processes plugin
<Plugin "processes">
ProcessMatch "carbon-cache" "python.+carbon-cache"
ProcessMatch "carbon-aggregator" "python.+carbon-aggregator"
</Plugin>
@binarytemple
binarytemple / rrdtool.markdown
Last active August 29, 2015 14:26
rrdtool, collectd, and jarmon

I needed to understand rrdtool so I could evaluate collectd, specicially I needed to visualize the RRD files in which it stores it's measurements.

Prerequisites

Install collectd

brew install rrdtool
brew install collectd --with-java
v /usr/local/Cellar/collectd/5.4.2/etc/collectd.conf
#! /bin/bash
echo Creating Combined console.log
for I in *-riak-debug; do NODE=${I//-riak-debug/}; echo " Processing ${NODE}..."; for J in $I/logs/platform_log_dir/console.lo*; do sed -n -e '/^2015/!{H;d;};/^2015/{x;s/\n/ /g;p;};${x;s/\n/ /g;p;}' $J | awk '!/^$/{print $1"T"$2,"'${NODE}'",$0}' | sed 's/\([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\) \(.*\)/\1 \2 \5/' >> temp.log ; done; done; sort temp.log > combined_console.log;rm temp.log;
echo Creating Combined error.log
for I in *-riak-debug; do NODE=${I//-riak-debug/}; echo " Processing ${NODE}..."; for J in $I/logs/platform_log_dir/error.lo*; do sed -n -e '/^2015/!{H;d;};/^2015/{x;s/\n/ /g;p;};${x;s/\n/ /g;p;}' $J | awk '!/^$/{print $1"T"$2,"'${NODE}'",$0}' | sed 's/\([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\) \(.*\)/\1 \2 \5/' >> temp.log ; done; done; sort temp.log > combined_error.log;rm temp.log;
echo Checking for LevelDB Compaction Errors
find . -name "LOG" -exec grep -l 'Compaction error' {} \;
This gist captures what needs to be done to add a new field to Riak's Yokozuna
search index.
Sources:
- https://github.com/basho/yokozuna/issues/130
- http://riak-users.197444.n3.nabble.com/How-to-update-existed-schema-td4032143.html
The code below is for illustration purposes only. Use at your own risk.
1. Create/Update new schema file
@binarytemple
binarytemple / erlang_notes.markdown
Last active July 30, 2018 15:13 — forked from hcs42/erlang_notes
Csaba's Erlang notes

Loading modules

Purging = removing the old version of the module (so that it will only have a new version).

erlang:check_old_code(mymodule).

Return if the module has an old version loaded.

code:load_file(mymodule).

@binarytemple
binarytemple / python.difflib.markdown
Created July 1, 2015 10:21
simple example of using python difflib
from difflib import *

hd=HtmlDiff()

l1= open("/tmp/foo.md",'rb').readlines()
l2= open("/tmp/foo2.md",'rb').readlines()

out = hd.make_file(l1,l2,"before","after")
open('/tmp/res.html','wb').write(out)
@binarytemple
binarytemple / gbr.txt
Last active August 29, 2015 14:23 — forked from viktorklang/gbr.txt
alias gbr='git for-each-ref --sort="-authordate:iso8601" --format=" %(color:green)%(authordate:iso8601)%09%(color:white)%(refname:short)" refs/heads'
%% riak_dt_map: OR-Set schema based multi CRDT container
M = riak_dt_map:new(),
%% Braxton adds key and val fields
{ok, M1B} = riak_dt_map:update({update, [
{add, {key, riak_dt_lwwreg}},
{add, {val, riak_dt_pncounter}}
]}, braxton, M),
%% Braxton sets key to 'a' and increments val by 1
{ok, M2B} = riak_dt_map:update({update, [
{update, {key, riak_dt_lwwreg}, {assign, a}},