Skip to content

Instantly share code, notes, and snippets.

@rhowardiv
rhowardiv / Httpd Requests
Last active August 29, 2015 14:06
snap-kibana
{
"title": "Httpd Requests",
"services": {
"query": {
"list": {
"0": {
"id": 0,
"type": "topN",
"query": "*",
"alias": "",
@rhowardiv
rhowardiv / jake
Created October 21, 2014 13:04
Jake: run make and get a notification with the results from Jake the Dog (you provide jake.png...)
#!/bin/bash
[ -t 1 ]
ISTTY=$?
notify-send -i ~/Pictures/jake.png MAKE "$( (make $@ && echo "Good.") 2>&1 | ( if [[ $ISTTY -eq 0 ]]; then tee /dev/tty; else cat; fi ) )"
@rhowardiv
rhowardiv / Makefile
Last active August 29, 2015 14:17
generic Makefile for markdown work
export SHELL := /bin/bash
.PHONY: default pdf html view clean
SRC = $(wildcard *.txt)
PDFS=$(SRC:.txt=.pdf)
HTML=$(SRC:.txt=.html)
default: pdf html
pdf: $(PDFS)
%.pdf : %.txt
@rhowardiv
rhowardiv / oo.php
Created October 6, 2010 14:38 — forked from dhotson/oo.php
<?php
// You should make this something that is sensible for your application
namespace gist;
/**
* You can't set functions as callable properties on a normal generic
* object. You can on instances of this class.
*
* You can't use "$this," however, so the function will always receive a
@rhowardiv
rhowardiv / nargs
Created December 9, 2010 21:11
nargs -- a wrapper for xargs -d'\n' that cleans leading/trailing whitespace
#!/bin/bash
sed 's/^[ ]\+//' | sed 's/[ ]\+$//' | xargs -d'\n' $@
@rhowardiv
rhowardiv / pptail
Created January 7, 2011 20:05
Tail a file across multiple servers
#!/bin/bash
F=$1
shift
echo $@ | xargs -n1 -P4 ptail $F
@rhowardiv
rhowardiv / svn-list-tags
Created October 3, 2011 20:18
Fetch latest tags from a directory in a Subversion repository and show them with their source path and rev#
#!/bin/bash
#
# Fetch latest N tags and show from where and which revision they were copied
function usage()
{
echo "
Usage: $0 [-n N] URL [REGEX]
-n Number of tags to fetch
@rhowardiv
rhowardiv / contentCall.twitter.js
Created December 14, 2011 20:51
contentCall function for charCount plugin to take twitter URL-shortening into account
function contentWithTwitterURLShortening(c) {
// t.co URLs are currently max 20 chars, but since that is subject to
// expansion we're leaving some elbow room and assuming 25
return c.replace(/http(s?):\/\/[-\w]+(\.\w[-\w]*)+(:\d+)?(\/[^.!,?;"'<>()\[\]{}\s\x7F-\xFF]*(?:[.!,?]+[^.!,?;"'<>()\[\]{}\s\x7F-\xFF]+)*)?/g, "http$1://t.co/xxxxxxxxxxxxx");
}
@rhowardiv
rhowardiv / charCount.js
Created December 14, 2011 20:47
jQuery plugin for word / character counting
/*
* Character Count Plugin - jQuery plugin
* Dynamic character count for text areas and input fields
* written by Alen Grakalic
* http://cssglobe.com/post/7161/jquery-plugin-simplest-twitterlike-dynamic-character-count-for-textareas
* and Richard Howard, Roubini Global Economics
* http://www.roubini.com
*
* Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
@rhowardiv
rhowardiv / syncdaemon
Last active October 1, 2015 14:28
my bash wrapper around lsyncd; daemonize this
#!/bin/bash
# Just a wrapper around lsyncd
# Keep two places in sync
HERE=/home/rhoward/ayi/
THERE=rhoward-dev.ayisnap.com:/var/www/html/areyouinterested.com
# Check that no previously running syncs are still running;
# this causes boffo logging
CURRENT_SYNC=$(ps aux | grep "rsync.\+$HERE" | grep -v '0 grep')