Skip to content

Instantly share code, notes, and snippets.

View prasanthj's full-sized avatar

Prasanth Jayachandran prasanthj

View GitHub Profile
@prasanthj
prasanthj / hack.sh
Created April 1, 2012 03:50 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@prasanthj
prasanthj / gist:3862471
Created October 10, 2012 00:47
Patch for making vertica getting installed on Ubuntu 12.04 (Precise)
--- /opt/vertica/oss/python/lib/python2.7/site-packages/vertica/network/SystemProfileFactory.py.orig 2012-10-09 20:43:30.154357382 -0400
+++ /opt/vertica/oss/python/lib/python2.7/site-packages/vertica/network/SystemProfileFactory.py 2012-10-09 20:39:10.490355807 -0400
@@ -149,7 +149,12 @@ class SystemProfileFactory:
opsys = DBinclude.OS_DEBIAN
return opsys, host
- raise UnsupportedOSException("(%s) This version of Debian is unsupported." % host)
+ (status, res) = ssh.execute("grep \"wheezy\" /etc/debian_version", hide=True)
+ if (res[0] == '0'):
+ opsys = DBinclude.OS_DEBIAN
@prasanthj
prasanthj / gist:3882592
Last active October 11, 2015 15:48
Console color and Bash prompt login@hostname color
#console colors
export CLICOLOR=1
export LSCOLORS=GaFxCxDxBxegedabagacad
# Custom bash prompt via kirsle.net/wizards/ps1.html
export PS1="\[$(tput bold)\]\[$(tput setaf 3)\][\[$(tput setaf 2)\]\u\[$(tput setaf 1)\]@\[$(tput setaf 6)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 3)\]\$(__git_ps1)]$ \[$(tput sgr0)\]"
# git completion
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
@prasanthj
prasanthj / gist:3992227
Created November 1, 2012 06:48
ignore .git while compressing
tar cvfz app.tar.gz --exclude ".git/*" --exclude ".git" app/
tar cvf ~/app.tar --exclude .git --exclude "*.log" .
http://stackoverflow.com/questions/3069522/tarballing-without-git-metadata
@prasanthj
prasanthj / gist:4102128
Created November 18, 2012 00:49
ruby snippets
*`which` in ruby*
http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
def which(cmd)
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
exts.each { |ext|
exe = "#{path}/#{cmd}#{ext}"
return exe if File.executable? exe
}
end
@prasanthj
prasanthj / gist:4981901
Last active December 13, 2015 22:08
EC2 - Cheat sheet
#List all public DNS from command line
ec2-describe-instances | cut -f 4 | grep ^ec2
@prasanthj
prasanthj / hadoop_tez_hive_bash_profile
Created December 11, 2014 08:32
Hadoop, tez, hive .bash_profile
export HADOOP_PREFIX="/work/hadoop/current"
export HADOOP_COMMON_HOME="/work/hadoop/current"
export HADOOP_HDFS_HOME="/work/hadoop/current"
export HADOOP_MAPRED_HOME="/work/hadoop/current"
export HADOOP_YARN_HOME="/work/hadoop/current"
export HADOOP_CONF_DIR="/work/hadoop/current-conf"
export TEZ_VERSION=0.5.2
export TEZ_PREFIX=/work/tez/current
export TEZ_DIST=$TEZ_PREFIX/tez-dist/target/tez-${TEZ_VERSION}
@prasanthj
prasanthj / hive-site.xml
Created December 11, 2014 08:34
hive configs
<configuration>
<!-- Metastore configs -->
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/apps/hive/warehouse</value>
</property>
<property>
<name>hive.metastore.cache.pinobjtypes</name>
<value>Table,Database,Type,FieldSchema,Order</value>
</property>
@prasanthj
prasanthj / browser-notification.js
Created December 15, 2014 19:57
Browser notification
function notifyMe(url) {
if (!Notification) {
alert('Notifications are supported in modern versions of Chrome, Firefox, Opera and Firefox.');
return;
}
if (Notification.permission !== "granted")
Notification.requestPermission();
var notification = new Notification('Site is up!', {
@prasanthj
prasanthj / jquery-test-url-with-retry.js
Created December 15, 2014 19:59
jQuery test liveness of URL
function testURL(url, retryInterval, maxRetryInterval) {
$.ajax({
url: url,
type: "GET",
timeout: 2000,
success: function(resp) {
console.log(url + " is alive!")
},
error: function(x, t, m) {
if (t == 'timeout') {