Skip to content

Instantly share code, notes, and snippets.

; -*- mode: clojure; -*-
; vim: filetype=clojure
(logging/init)
(repl-server {:host "127.0.0.1" :port 55554})
(let [host "0.0.0.0"]
(tcp-server {:host host :port 55555})
(udp-server {:host host :port 55555})
[appservers:children]
datacenter-1
datacenter-2
[datacenter-1]
appservers00[1:3].datacenter-1.example.com
[datacenter-2]
appservers00[1:3].datacenter-2.example.com
execve("/usr/bin/docker", ["docker", "pull", "java:latest"], [/* 38 vars */]) = 0
brk(0) = 0x1baa000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f18e08a7000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=46557, ...}) = 0
mmap(NULL, 46557, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f18e089b000
close(3) = 0
open("/lib64/libpthread.so.0", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340]\200\3112\0\0\0@\0\0\0\0\0\0\0\250/\2\0\0\0\0\0\0\0\0\0@\0008\0\t\0@\0)\0(\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\200\3112\0\0\0@\0\200\3112\0\0\0\370\1\0\0\0\0\0\0\370\1\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0000\30\1\0\0\0\0\0000\30\201\3112\0\0\0000\30\201\3112\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\200\3112\0\0\0\0\0\200\3112\0\0\0\360m\1\0\0\
irb> RUBY_VERSION
=> "1.9.3"
# it's 1.9.3-p374 if you wanna get picky..
> JSON::VERSION
=> "1.5.4"
# So I have some json, from the body of a RestClient response that looks something like this:
irb> json = "{\"name\":\"Centrale Laiti\\u00e8re\"}"
=> "{\"name\":\"Centrale Laiti\\u00e8re\"}"
@agile
agile / tmux.conf
Created November 19, 2015 15:44
my tmux config - nothing very special
# unbind C-b if you prefer using screen's ^a command sequence
# set -g prefix C-a
# alt-arrow bindings to switch windows
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# get visual notifications of activity from other windows
@agile
agile / dysfunctional.clj
Created November 17, 2015 22:31
trying to understand how to fix this.. only initial state change alerts.
; Wanting to pass events by host/service, if state changed and consistent for `len-run` events
; modified changed-state macro to use runs
(defmacro stable-changed-state
"Passes on changes in state for each distinct host and service."
[len-run & children]
`(by [:host :service]
(runs ~len-run
(changed :state ~@children))))
(def send-alert #(debug "WOULD ALERT ON" %))
@agile
agile / rate.sh
Created November 8, 2012 21:22
Determine modification rate for a file
#!/bin/bash
#
# Hack to extract stats for a file including the actual creation time
#
# Uses debugfs which includes the crtime value in it's output:
#
# Inode: 23072101 Type: regular Mode: 0664 Flags: 0x80000
# Generation: 1861227769 Version: 0x00000000:00000001
# User: 1000 Group: 1000 Size: 0
# File ACL: 0 Directory ACL: 0
@agile
agile / fork.rb
Created October 11, 2011 14:55
Example forking with signal handler and message pipe
#!/usr/bin/env ruby
#
# Forking example using pipes to communicate from child processes
def log(msg)
case msg
when Array then msg.each {|m| log(" #{m}") }
else
puts "[#{Time.now}][#{$$}] #{msg}"
end
@agile
agile / remote.rb
Created May 31, 2011 14:41
Make capistrano's scm_run limit the number of hosts
# re: capistrano-2.6.0/lib/capistrano/recipes/deploy/strategy/remote.rb
require 'capistrano/recipes/deploy/strategy/base'
module Capistrano
module Deploy
module Strategy
# An abstract superclass, which forms the base for all deployment
# strategies which work by grabbing the code from the repository directly
# from remote host. This includes deploying by checkout (the default),
@agile
agile / InsertTabComplete.vim
Created January 4, 2011 16:07
drop this in ~/.vim/plugins and you can complete in insert mode using the tab key
function InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper()<cr>