Skip to content

Instantly share code, notes, and snippets.

View bhavanki's full-sized avatar
💭
Flossing

Bill Havanki bhavanki

💭
Flossing
View GitHub Profile
@bhavanki
bhavanki / colorize-maven.sh
Created May 1, 2012 20:39 — forked from mike-ensor/colorize-maven.sh
Colorize Maven output
#!/bin/sh
# Written by Mike Ensor (mike@ensor.cc)
# Copyright 2012
# Use as needed, modify, have fun!
# This is intended to be used for Maven3 + Mac OSX
#
# To use:
# in your ".bashrc" or ".bash_profile" add the following line:
# source ~/<path to script>/colorize-maven.sh
@bhavanki
bhavanki / hbResultKeys.sh
Created May 3, 2012 18:07
Helper scripts for Hadoop and HBase
#!/bin/bash
# Extracts row IDs (keys) from HBase shell results
# Remove the header and footer lines
# Mark the first line of each row with # replacing the initial space
# Eliminate all but the first 26 characters in each line (COLUMN+CELL column)
# Eliminate blank lines
# Eliminate the first space in each line, but not marks
# Merge all results that span more than one line
@bhavanki
bhavanki / tamdate.sh
Created June 9, 2012 02:17
Bash script to report the date in the Tamrielic (Elder Scrolls) calendar
#!/bin/bash
# tamdate.sh - echoes the date in the Tamrielic calendar
# Calendar information from http://www.uesp.net/wiki/Lore:Calendar
usage() {
echo Usage: tamdate.sh [options]
echo Options:
echo -m = include Tamrielic month
echo -d = include Tamrielic weekday
@bhavanki
bhavanki / colorize-maven.sh
Created June 21, 2012 21:10 — forked from mike-ensor/colorize-maven.sh
Colorize Maven output
#!/bin/sh
# Written by Mike Ensor (mike@ensor.cc)
# Copywrite 2012
# Use as needed, modify, have fun!
# Modified by Bill Havanki
# This was intended to be used for Maven3 + Mac OSX, but it's been modified for Cygwin and Linux.
# Maybe it still works on OSX?
# Changes from original:
# - Cygwin support
@bhavanki
bhavanki / prompt_open_file_path.py
Created August 15, 2012 21:08
Sublime Text 2 plugin for emacs-like file open. Based on https://bitbucket.org/chrisguilbeau/cg-sublime.
import sublime, sublime_plugin
from os import listdir
from os.path import commonprefix
from os.path import isdir
#from os import getenv
from os import getcwd
from os import sep
class PromptOpenFilePathCommand(sublime_plugin.WindowCommand):
@bhavanki
bhavanki / glitchdate.py
Created November 4, 2012 03:24
Python script to report the current time in Ur, the world of Glitch.
#!/usr/bin/python
import calendar
from datetime import datetime
from optparse import OptionParser
import sys
# Define command line options: -D, -f, -F.
op = OptionParser()
op.add_option('-D', '--date', dest='date_to_use',
help='UTC date to use instead of now, as %Y%m%d%H%M')
@bhavanki
bhavanki / charesc.html
Created January 23, 2013 19:06
Page to emit character literal escape sequences in different programming languages.
<html>
<head><title>Character Escapes</title>
<style type="text/css">
body {
font-family: sans-serif;
margin-top: 1in;
}
p {
font-size: large;
text-align: center;
@bhavanki
bhavanki / cdpom.sh
Created August 9, 2013 19:12
Simple script to bounce you back up to the first parent directory with a Maven POM in it. Must be sourced to work as expected (so alias it).
#!/bin/bash
POMDIR=$(pwd)
while [[ "$POMDIR" != "/" && ! -f "$POMDIR/pom.xml" ]]; do
POMDIR=$(dirname "$POMDIR")
done
if [[ "$POMDIR" != "/" ]]; then
cd "$POMDIR"
else
@bhavanki
bhavanki / gojdk.sh
Created August 9, 2013 19:16
Script to swap environment to a different JDK. Must be sourced to work.
#!/bin/bash
echo Switching to Java $1
OLD_JAVA_HOME=$JAVA_HOME
if [ "$1" == "1.6" -o "$1" == "6" -o "$1" == "6.0" ]; then
export JAVA_HOME=/usr/lib/jvm/java-1.6.0
elif [ "$1" == "1.7" -o "$1" == "7" -o "$1" == "7.0" ]; then
export JAVA_HOME=/usr/lib/jvm/java-1.7.0
@bhavanki
bhavanki / httpd.py
Created August 12, 2013 20:55
Simple HTTP server in Python; serves the current directory.
import os
import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
pid = os.fork()
if pid != 0:
print "Server PID is", pid
sys.exit()