Skip to content

Instantly share code, notes, and snippets.

View chetan's full-sized avatar
🙌
like my work? sponsor me!

Chetan Sarva chetan

🙌
like my work? sponsor me!
View GitHub Profile
# Buildr project bootstrapper
# Chetan Sarva <csarva@pixelcop.net>
#
# Creates standard java project layout directories and files such as etc, src
# and README.
#
# USAGE
#
# buildr bootstrap
#
javascript:%20var%20x=%20$(".content").find("a").not(".thumbnail").each(function(){var%20href=$(this).attr("href");if((!$(this).hasClass("drowsapMorphed"))%20&&%20($(this).next(".drowsapMorphed").length==0)%20&&%20href%20&&%20(href.indexOf('imgur')>=0%20||%20href.indexOf('jpeg')>=0%20||%20href.indexOf('jpg')>=0%20%20||%20href.indexOf('png')>=0)){var%20ext%20=(href.indexOf('imgur')>=0%20&&%20href.indexOf('jpg')<0%20&&%20href.indexOf('png')<0)%20?%20'.jpg'%20:'';%20var%20img%20=%20$("<a%20class='drowsapMorphed'%20href='"+href+"'%20target='blank'%20style='display:block'><img%20style='display:block;max-width:780px;'%20src='"+href+%20ext+"'%20/></a>");$(this).after(img);}});
@chetan
chetan / add_jars_to_classpath.java
Created December 30, 2010 02:47
Utility methods for adding JARs located on HDFS to the classpath of a Map/Reduce job
/**
* Add the JAR at the given HDFS path to the Classpath
*
* @param conf
* @param path
*/
public static void addJarToJobClasspath(JobConf conf, String path) {
addJarsToJobClasspath(conf, new String[] { path });
}
#!/usr/bin/env ruby
# == Synopsis
#
# guidiff.rb [--no-compress] [file1] [file2] [...]
#
# == Usage
#
# -h, --help:
# show this help
@chetan
chetan / check_hadoop_dfs.sh
Created March 29, 2011 19:58
nagios check script for hadoop dfs
#!/bin/sh
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#!/usr/bin/env perl
=cut
browser_breakdown.pl
(c) 2011, Chetan Sarva <chetan@evidon.com>
Takes a list of User Agents via STDIN and prints out browser and platform summaries.
Example summary:
@chetan
chetan / csv_grep.pl
Created April 12, 2011 16:17
csv_grep.pl
#!/usr/bin/env perl
# csv_grep.pl
# (c) 2011, Chetan Sarva <chetan@evidon.com>
use Getopt::Long;
use Data::Dumper;
my($dump, $field, $exact, $str);
my $ret = GetOptions(
@chetan
chetan / elastic_ip_init.sh
Created May 9, 2011 02:33
init script for grabbing an EC2 elastic IP
#!/bin/bash
###############################################################################
# CONFIG
# paths to key & cert files
export EC2_PRIVATE_KEY=
export EC2_CERT=
# needed for moving the IP
@chetan
chetan / check_no_log.sh
Created May 11, 2011 20:46
A Nagios check for missing patterns in logs
#! /bin/bash
#
# This is an inverse of the original check_log script included with Nagios.
# This script will display a CRITICAL status when the given pattern is
# *NOT* found. Usage is otherwise identical to check_log.
#
# Modified by Chetan Sarva (chetan@evidon.com) 05-11-2011
#
#
@chetan
chetan / check_log_any.sh
Created May 11, 2011 21:20
A nagios check which will complain on *any* new lines in a file
#! /bin/bash
#
# This is a modification of the check_log script which will report *ANY*
# new lines written to the given file.
#
# This is useful, for example, for detecting kernel errors written to
# /var/log/kern.log on Ubuntu.
#
# Modified by Chetan Sarva (chetan@evidon.com) 05-11-2011
#