Skip to content

Instantly share code, notes, and snippets.

@artbikes
artbikes / coll.pl
Created December 3, 2012 22:17
Asterisk Queue Email
#!/usr/bin/perl
#
# coll.pl - This script queries asterisk for the members of the
# Collections Queue, finds the Agents' names from agents.conf,
# then mails the output.
#
my $TITLE = "Members of Collections Queue";
my $RECIPIENTS = "operations\@example.com,user\@example.com";
my $numberOfElements = 0;
my @agentlist = ();
@artbikes
artbikes / es_udpate.sh
Created December 17, 2012 03:34
Elasticsearch update - conary version with index flushing
#!/bin/bash
# esearch-update - Updates elasticsearch with various sanity checks
# blame: [email protected]
VERSION=0.18.6
NEWVERSION=0.19.0
CONFIG=/opt/elasticsearch/config/elasticsearch.yml
MONIT=/usr/bin/monit
LIMIT=20
#!/usr/bin/env ruby
require 'rubygems'
require 'RMagick'
captcha = "9277f49ecee"
#10.times { captcha << (rand(26)+65).chr }
canvas = Magick::Image.new(1280,800, Magick::HatchFill.new('#ffffff','#4169e1'))
text = Magick::Draw.new
#!/bin/bash
#---
# zap-pass.sh - reset user's password to random string
# move user to the disabled branch
#---
if [ r$1 = r ]; then
echo "usage: `basename $0` <username>"
exit 1
fi
@artbikes
artbikes / pinger.rb
Created January 29, 2013 17:29
Send response times from Google, Yahoo, and Heroku to Graphite.
#!/usr/bin/env ruby
require 'pp'
require 'rubygems'
require 'rest-client'
require 'json'
require 'optparse'
require 'ostruct'
class ParseOpts
def self.parse(args)
@artbikes
artbikes / gist:5223130
Created March 22, 2013 17:24
Human readable output of nginx configuration
nginx -V 2>&1 | sed 's/ --/\n --/g'
King & Peasant (is also known by other games) is a game of castes.
Required for the game:
* 5 or more participants (5-7 is about ideal)
* 1 or 2 decks of cards
* 1 or 2 dice (optional)
* Munchies in the middle of the table (important but not necessary)
*Ranks
o King
@artbikes
artbikes / retrieve-cert.sh
Created October 15, 2013 20:31
retrieve ssl cert info
#!/bin/sh │
# │
# usage: retrieve-cert.sh remote.host.name [port] │
# │
REMHOST=$1 │
REMPORT=${2:-443} │
echo |\ │
openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1
@artbikes
artbikes / check_endpoint.rb
Created February 3, 2014 21:20
Check URL's for link elements. #sensu
#!/usr/bin/env ruby
#
# Check Endpoint Plugin
# ===
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'sensu-plugin/check/cli'
require 'open-uri'
require 'openssl'
require 'json'
#!/bin/bash
EXPIRATION=$( echo |\
openssl s_client -connect $1:443 2>/dev/null |\
openssl x509 -noout -dates |\
tail -1 |\
sed 's/notAfter=\(.*\)/\1/' )
EXP_EPOCH=$(gdate --date="$EXPIRATION" +%s)
TODAY=$(gdate +%s)
# Days until expiration
echo $(( ($EXP_EPOCH - $TODAY )/(60*60*24) ))