Skip to content

Instantly share code, notes, and snippets.

View dfhack_workflow.txt
# enable the plugin
workflow enable drybuckets auto-melt
# farming
workflow amount FOOD 120 30
workflow amount DRINK 300 50
workflow amount THREAD//GRASS_TAIL_PIG:THREAD 30 20
workflow count LIQUID_MISC//POD_SWEET:EXTRACT 20 10
# storage
View hipchat-extension.rb
#!/usr/bin/env ruby
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'sensu-handler'
require 'hipchat'
require 'timeout'
require 'oj'
module Sensu::Extension
class Hipchat < Handler # Sub-class the appropriate extension type
View hipchat.rb
#/usr/bin/env ruby
# Sends events to hipchat for wonderful chatty notifications
#
# This extension requires the hipchat gem
#
# The reason I wrote this instead of using the normal hipchat handler, is that with Flapjack
# all events are handled unless you do crazy filtering stuff. Also with a large number of events
# and checks the sensu server can get overloaded with forking stuff. So anyway, hipchat extension :)
#
View gist:68b988dfca138ca6fab0
$ /opt/chef/embedded/bin/sensu-cli client history XYZ
-------
check: sensu-redis-metrics
history: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
last_execution: 1413319524
last_status: 0
-------
check: check-aws-maintenance
history: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
last_execution: 1413319467
@jhmartin
jhmartin / gist:12209f78a592eaf98cfd
Last active Aug 29, 2015
Submitting a Docker container w/a Consul service name to Mesos/Marathon >= 0.20
View gist:12209f78a592eaf98cfd
curl -v -X POST http://localhost:8080/v2/apps \
-H Content-Type:application/json -d '{
"id": "some-nginx",
"container": {
"docker": {
"parameters" : {
"env": "SERVICE_NAME=nginx-xyz"
},
"image": "nginx",
"network": "BRIDGE",
View gist:06e67c8aa9c917bc01be
### Keybase proof
I hereby claim:
* I am jhmartin on github.
* I am toger (https://keybase.io/toger) on keybase.
* I have a public key whose fingerprint is 295E 910B 42C5 3CE3 683C CD17 B1E3 6C1C E754 A822
To claim this, I am signing this object:
View gist:cc5582ea767581eabfcf
// Based on https://github.com/noelportugal/AmazonEchoApi.git, watches for 'goodnight' and sets a Z-Way scene.
public static void main(String[] args) throws InterruptedException, IOException {
AmazonEchoApi amazonEchoApi = new AmazonEchoApi("https://pitangui.amazon.com","jhmartin@toger.us", "SNIP");
if (amazonEchoApi.httpLogin()){
while (true) {
String output = amazonEchoApi.httpGet("/api/cards?type=TASK&size=1");
//String output = amazonEchoApi.httpGet("/api/cards?type=TASK&size=1");
//String output = amazonEchoApi.httpGet("/api/todos?type=TASK&size=1");
// Parse JSON
View gist:a8a95ec8b0954c322f8d
if (request.type == 'LAUNCH_REQUEST')
# Process your Launch Request
# Call your methods for your application here that process your Launch Request.
response.add_speech('House Control online')
response.add_hash_card( { :title => 'My House', :subtitle => 'House Control activated.' } )
end
if (request.type == 'INTENT_REQUEST')
# Process your Intent Request
p "#{request.slots['helper']['value']}"
View SSLPoke.java
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {
View gist:6253330
I pass these options to the varnishncsa daemon (this line is from my /etc/init.d/varnishncsa)...
DAEMON_OPTS="-a -F "\''%h "%{X-Forwarded-For}i" %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i" %{Varnish:time_firstbyte}x %{Varnish:handling}x'\'" -c -w ${LOGFILE} -D -P $PIDFILE"
I parse that with the following grok pattern...
VARNISHNCSALOG %{IPORHOST:remoteip} %{QUOTEDSTRING:xforwardedfor} %{USER:auth} \[%{HTTPDATE:timestamp}\] "%{WORD:verb} %{NOTSPACE:request} HTTP/%{NUMBER:httpversion}" (?:%{NUMBER:status}|\(null\)) (?:%{NUMBER:bytes}|-) "(?:%{NOTSPACE:referrer}|-)" %{QUOTEDSTRING:agent} %{BASE10NUM:berespms} %{WORD:cache}
You can’t perform that action at this time.