Skip to content

Instantly share code, notes, and snippets.

loop do
begin
Timeout::timeout(0.2) {
parsed_data = parser.parse_line(ARGF.readline)
/(?<section>(http:\/\/\w+\.?\w*)?(\/[\w0-9]*))/ =~ parsed_data[:request]
sections["#{section}"] ||= 0
sections["#{section}"] += 1
hits += 1
}
rescue Timeout::Error
#!/bin/bash
HOST="http://www.google.com"
CURL="/usr/bin/curl" # Assuming this is installed
NUM=$(sed '1q;d' current.txt);
INT=$(sed '3q;d' current.txt);
# Matt - switch to curl with a HEAD request so you're not sucking down
# actual html. This still checks the network without pulling much data.
# Make the failure happen in 20s longer than it would take for an SSH
#!/bin/bash
createTunnel() {
autossh -f -M 0 -q \
-o "TCPKeepAlive no" \
-o "ServerAliveInterval 15" \
-o "ServerAliveCountMax 4" \
-t -t -D 9999 root@localhost -p 2222
if [[ $? -eq 0 ]]; then
#!/bin/bash
# Changes - Matt:
# Fail in 60s instead of 3m. Less downtime & AutoSSH will take care of the reconnect.
# Look for (pidof) the autossh master process instead of *any* ssh process.
# Turn TCPKeepAlive off as it's redundant, can interfere, and SSH is already sending keepalives.
EXT=$(sed '2q;d' current.txt)
echo "ip is $EXT";
package Crowdtilt::Internal::StatsClient;
# Abstraction for statsd client that handles things like prefixing
use Dancer qw( debug );
use DataDog::DogStatsd;
use Function::Parameters;
use Moose;
use Time::HiRes qw( time );
@mago0
mago0 / .vimrc
Last active July 14, 2016 14:02
" Gist Plugin
let g:gist_open_browser_after_post = 1
@mago0
mago0 / vimrc
Last active July 14, 2016 13:44
set autoindent " always set autoindenting on set autowrite " auto saves changes when quitting and swiching buffer
set background=dark
set clipboard=unnamed
set encoding=utf-8
set expandtab
set foldmethod=marker " use typed folding
set history=500
set hlsearch " highlight searches
set ignorecase " ignore case when searching
set incsearch " do incremental searching
--- stress-campaigns.sh 2015-12-09 15:45:47.647177342 +0000
+++ stepping-stress-campaigns.sh 2016-07-06 20:59:01.047093230 +0000
@@ -86,19 +86,19 @@
fi
echo "Running ..."
-CMD="echo "\""GET ${URL}"\"" | vegeta attack -rate=${RATE} -duration=${DURATION} -output=vegeta-`uname -n`.bin"
-
-echo $CMD
-
{
"viz": "change",
"requests": [
{
"q": "sum:postgresql.database_size{$env,$db_role} by {host}",
"compare_to": "day_before",
"change_type": "absolute",
"order_by": "change",
"order_dir": "desc",
"extra_col": "present",
[ mattw@staging-webhooks-459eccc2:/opt/datadog-agent ]$ sudo su - dd-agent
$ dd-agent check api_gpg
2016-05-12 14:28:05,608 | INFO | dd.collector | checks.collector(collector.py:535) | Running check api_gpg
Metrics:
[]
Events:
[]
Service Checks:
[{'check': 'api_gpg',
'host_name': 'staging-webhooks-459eccc2',