Skip to content

Instantly share code, notes, and snippets.

View ashrithr's full-sized avatar
🎯
Focusing

Ashrith Mekala ashrithr

🎯
Focusing
View GitHub Profile
@ashrithr
ashrithr / dvare.sh
Created January 16, 2013 23:06
double variable expansion
#!/bin/bash
#expand cmd line variable hadoop and replace it with local var hadoop
hadoop=/home/hadoop
ls -al ${!1}
@ashrithr
ashrithr / .profile
Created January 29, 2013 23:40
my profile file
# #export PATH=$PATH:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin
# export HADOOP_HOME=/Users/Ashrith/HADOOP/hadoop-0.20.203.0/
# export JAVA_HOME=$(/usr/libexec/java_home)
# export PATH=$PATH:$HADOOP_HOME/bin
# export PATH=$PATH:/Users/Ashrith/HADOOP/elastic-mapreduce-cli/
# export PATH=$PATH:/Users/Ashrith/HADOOP/csshX-0.74/
#
# PATH="/Library/Frameworks/Python.framework/Versions/3.2/bin:${PATH}"
# PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
@ashrithr
ashrithr / rsc
Last active December 11, 2015 22:49
manage create/manage rackspace virtual machines using command line api (nova client)
#!/usr/bin/env bash
####################
#
# Wrapper script to manage virtual machines in rackspace using nova-client & rackspace api v2
# Author: Ashrith
#
####################
##NOVA AUTH VARIABLES
export OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/
@ashrithr
ashrithr / .bashrc
Created January 30, 2013 13:16
bashrc
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
#enable bash completion
[ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion
#enable git completion
[ -f ~/.git-completion.bash ] && source ~/.git-completion.bash
@ashrithr
ashrithr / staticipcentos
Created February 12, 2013 21:57
Centos Static IP
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@ashrithr
ashrithr / staticipubuntu
Created February 12, 2013 22:00
Ubuntu Static IP
sudo cp /etc/network/interfaces /etc/network/interfaces_backup
sudo vi /etc/network/interfaces
## leave this alone
## auto lo
## iface lo inet loopback
## edit the eth0 to have static ip address 192.168.1.11
auto eth0
@ashrithr
ashrithr / random_generator.rb
Last active December 13, 2015 17:48
ruby random data generator based on probability used for analytics
#!/usr/bin/env ruby
# ---
# => Script to generate random data required for data analytics
# Author: Ashrith
# ---
require 'rubygems'
require 'fileutils'
require 'benchmark'
require 'parallel' #gem install parallel
require 'ruby-progressbar' #gem install ruby-progressbar
@ashrithr
ashrithr / port_open.rb
Last active December 18, 2023 15:15
check if port is open on a remote host
#!/usr/bin/env ruby
require 'socket'
require 'timeout'
unless ARGV.length == 2
abort "Usage: ruby #{__FILE__} HOST PORT"
end
def port_open?(ip, port, seconds=1)
# => checks if a port is open or not on a remote host
Timeout::timeout(seconds) do
@ashrithr
ashrithr / start_hbase_mac.sh
Last active December 17, 2015 09:39
Script to start hbase with ssh on mac
#!/usr/bin/env bash
# ===
# Script to start hbase also handles starting/stopping osx's ssh as a dependecy
# Author: Ashrith
# ===
HBASE_START_SCRIPT="/Users/ashrith/HADOOP/hbase/bin/start-hbase.sh"
HBASE_STOP_SCRIPT="/Users/ashrith/HADOOP/hbase/bin/stop-hbase.sh"
@ashrithr
ashrithr / check_hbase_onlineregions.sh
Created May 20, 2013 17:54
nagios plugin for hbase to check how many regions a region server is serving and throw critical if regions > 90
#!/usr/bin/env bash
#Author: Ashrith
#Arrays to store hosts and their regionsOnLine respectively
declare -a HOSTS_ARRAY
declare -a REGIONS_ARRAY
message=""
EXIT_STATUS=0