Skip to content

Instantly share code, notes, and snippets.

Ashrith Mekala ashrithr

Block or report user

Report or block ashrithr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ashrithr
ashrithr / dvare.sh
Created Jan 16, 2013
double variable expansion
View dvare.sh
#!/bin/bash
#expand cmd line variable hadoop and replace it with local var hadoop
hadoop=/home/hadoop
ls -al ${!1}
@ashrithr
ashrithr / .profile
Created Jan 29, 2013
my profile file
View .profile
# #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 Dec 11, 2015
manage create/manage rackspace virtual machines using command line api (nova client)
View rsc
#!/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/
View .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
View staticipcentos
## 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
View staticipubuntu
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 Dec 13, 2015
ruby random data generator based on probability used for analytics
View random_generator.rb
#!/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 Jun 13, 2019
check if port is open on a remote host
View port_open.rb
#!/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 Dec 17, 2015
Script to start hbase with ssh on mac
View start_hbase_mac.sh
#!/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
nagios plugin for hbase to check how many regions a region server is serving and throw critical if regions > 90
View check_hbase_onlineregions.sh
#!/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
You can’t perform that action at this time.