Skip to content

Instantly share code, notes, and snippets.

View dennisfaust's full-sized avatar

Dennis Faust dennisfaust

View GitHub Profile
@dennisfaust
dennisfaust / etc_init_god.conf
Created November 8, 2012 19:37
Using Upstart to keep God process monitor up under RVM
# god upstart service
description "God process monitoring"
# When to start and stop the service
start on runlevel [2345]
stop on runlevel [016]
# Automatically restart process if crashed
kill timeout 20
respawn
@dennisfaust
dennisfaust / DesEncrypter.scala
Created February 23, 2012 22:08
Triple DES (3DES) Encryption for Scala - adapted from exampledepot java
import com.sun.org.apache.xml.internal.security.utils.Base64
import javax.crypto._
import javax.crypto.spec._
import java.security.spec._
import java.io._
import java.security.{NoSuchAlgorithmException, InvalidAlgorithmParameterException}
import javax.management.openmbean.InvalidKeyException
import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException
import play.api.Logger
@dennisfaust
dennisfaust / apache_basic_rewrite
Created July 26, 2011 23:07
Apache Basic Authentication for a Rewrite Condition Not a Directory
# Apache Basic Authentication for A Rewrite Condition not a Directory
#
# NOTE: Locations work off of URLs not directories
#
# Put this in your virtualhost block
#
<Location /YOUR_URL_PATH/>
AuthType Basic
AuthName "Authorization Required."
AuthUserFile /etc/httpd/conf/htpasswd
@dennisfaust
dennisfaust / Mongodb_secondary_lag
Created July 15, 2011 00:08
Script to create a MongoDB Collectd Plugin - Works with RightScale's monitoring and alerts
#!/bin/bash -ex
#
# Description: Graph how old the last sync was between primary and secondary mongo instances.
#
# Base code and idea thanks to: Edward M. Goldberg
#
# any mistakes courtesy of: Dennis Faust
#
if [ $RS_DISTRO = ubuntu ]; then
plugin_dir="/etc/collectd/conf"
@dennisfaust
dennisfaust / Pingdom_http_custom_check
Created April 14, 2011 20:53
Pingdom supports http custom checks via XML. This is a ruby code snippet which checks a file's timestamp and returns OK if it's recent enough. http://royal.pingdom.com/2008/07/14/new-pingdom-feature-custom-monitoring-type/
#!/usr/bin/ruby
# Pingdom_http_custom_check
# DFF - 2011
# put this in {Apache Files}/cgi-bin/
# make sure to chmod +x the file
# Your ruby interpreter might not be where mine is. Check the above.
#
require 'cgi'
too_old=360