Skip to content

Instantly share code, notes, and snippets.

View technovangelist's full-sized avatar

Matt Williams technovangelist

View GitHub Profile
@technovangelist
technovangelist / dcomp.zsh
Last active August 29, 2015 14:16
docker-compose zsh function
dcomp(){
local bdout=$(boot2docker status) 2>/dev/null
if [ $bdout = 'poweroff' ]; then
boot2docker up && $(boot2docker shellinit)
fi
docker-compose $*
}
@technovangelist
technovangelist / go_expvar.yaml
Created February 5, 2015 20:05
go_expvar.yaml Sample for Trivial Web App
init_config:
instances:
# Most memstats metrics are exported by default
# See http://godoc.org/runtime#MemStats for their explanation
- expvar_url: http://localhost:8000/debug/vars
tags:
- "application_name:myapp"
- "optionaltag2"
@technovangelist
technovangelist / webtest.sh
Last active July 18, 2016 00:38
ZSH script to visit a page over and over again with random seconds between visits
#!/bin/zsh
# use webtest.sh <url to visit>
zmodload -i zsh/mathfunc
for i in {1..1000}
do
sleep $(( rand48()*2 ))
curl $1
done
@technovangelist
technovangelist / http.go
Last active March 30, 2019 01:21
Trivial Expvar Sample Code
package main
import (
"expvar"
"github.com/paulbellamy/ratecounter"
"io"
"net/http"
"strconv"
"time"
)
@technovangelist
technovangelist / MyCustomCheck.yaml
Created November 9, 2014 22:35
MyCustomCheck.yaml
init_config:
instances:
- search: top
@technovangelist
technovangelist / MyCustomCheck.py
Last active August 29, 2015 14:09
MyCustomCheck.py
from checks import AgentCheck
import re
import psutil
class CheckProcessNotRunning(AgentCheck):
def check(self, instance):
search = instance['search']
running_names = [p.name().strip() for p in psutil.process_iter()]
matched = len([n for n in running_names if re.match(search, n)])
@technovangelist
technovangelist / tcp_check.yaml
Last active August 29, 2015 14:09
TCP Check
init_config:
instances:
- name: My service
host: datadog.com
port: 8080
window: 5
threshold: 3
@technovangelist
technovangelist / gist:4326e9adde324874f6a2
Created November 4, 2014 18:19
Simplest code to create a metric on Google App Engine using Python
from dogapi import dog_http_api as api
api.api_key = 'YOUR_API_KEY'
api.application_key = 'YOUR_APPLICATION_KEY'
# Submit a single point with a timestamp of `now`
api.metric('page.views', 1000)
#see more examples here: http://docs.datadoghq.com/api/
@technovangelist
technovangelist / slidertest.php
Created February 20, 2014 16:30
Using RoyalSlider with Placester Property Images
<?php
/**
* Template Name: SliderTest
*/
wp_enqueue_style( 'royal_slider_css', get_template_directory_uri() . "/royalslider/royalslider.css");
wp_enqueue_style( "royal_slider_default_skin_css", get_template_directory_uri() . "/royalslider/skins/default/rs-default.css" );
wp_enqueue_script( "royal_slider_js", get_template_directory_uri() . "/royalslider/jquery.royalslider.min.js");
get_header( );
@technovangelist
technovangelist / 1) HTML Block
Last active January 4, 2016 07:49
Shortcode Template for Area and Sub Area in Single Dropdown
<div class="search-item">
<label>Neighborhoods:</label>
<select id=hoodselect name='hood-select'>
<option value="">Any</option>
</select>
</div>
<div class="search-item">
<label>Min Beds:</label>[min_beds]
</div>
<div class="search-item">