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 /
Last active Oct 18, 2019
Set up kerberos on Redhat/CentOS 7

Installing Kerberos on Redhat 7

This installation is going to require 2 servers one acts as kerberos KDC server and the other machine is going to be client. Lets assume the FQDN's are (here is the domain name, make a note of the domain name here):

  • Kerberos KDC Server:
  • Kerberos Client:

Important: Make sure that both systems have their hostnames properly set and both systems have the hostnames and IP addresses of both systems in

ashrithr /
Created Feb 26, 2015
HDFS FileSystems API example
package com.cloudwick.mapreduce.FileSystemAPI;
ashrithr /
Last active Aug 7, 2019
ssh tunneling and port forwarding

###Single hop tunelling:

ssh -f -N -L 9906:


  • -f puts ssh in background
  • -N makes it not execute a remote command

Why I love zsh

  • Smarter completion. A few examples:
  • context sensitive -- if you have file "name1" and directory "name2", "cd nam<TAB>" completes to "name2/"
  • "tar xf <TAB>" completes to tarballs only. "unrar x <TAB>" completes to RARs only. etc.
  • rsync / scp completion: "rsync host:anything/<TAB>" shows you files on host under anything/
  • also works with rsync:// URLs
  • SSH host completion from ~/.ssh/config & ~/.ssh/known_hosts
  • lots of other smart completions: Rake tasks, git commands & SHAs, dpkg packages, dash-options for most commands, etc etc.
ashrithr /
Created Mar 8, 2015
YCSB stress test hbase commands
#!/usr/bin/env bash
# Simulates mixed workload on HBase using YCSB
# Author: Ashrith (ashrith at cloudwick dot com)
# Date: Wed, 16 2014
# You may want to tweak these variables to change the workload's behavior
ashrithr /
Last active Jun 14, 2019
kafka introduction

Introduction to Kafka

Kafka acts as a kind of write-ahead log (WAL) that records messages to a persistent store (disk) and allows subscribers to read and apply these changes to their own stores in a system appropriate time-frame.


  • Producers send messages to brokers
  • Consumers read messages from brokers
  • Messages are sent to a topic
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"
def port_open?(ip, port, seconds=1)
# => checks if a port is open or not on a remote host
Timeout::timeout(seconds) do
ashrithr /
Created May 20, 2013
bash function to compare if a file is older than 28 hours or not
#######BEGIN SCRIPT############
# This checks that the specified file is less than 28 hours old.
# returns 0 if younger than 28 hours.
# returns 1 if older than 28 hours.
#funtion arguments -> filename to comapre against curr time
function comparedate() {
if [ ! -f $1 ]; then
echo "file $1 does not exist"
ashrithr / kafka_twitter_producer.rb
Last active Apr 17, 2019
kafka twitter producer, dumps twitter firehose to kafka.
View kafka_twitter_producer.rb
require 'tweetstream'
require 'poseidon'
rescue 'LoadError'
raise "Requires tweetstream and poseidon libraries"
raise "Works only on 1.9" if RUBY_VERSION < "1.9"
raise "Requires Argument keyword to match from twitter firehose" if ARGV.length == 0
ashrithr /
Last active Apr 11, 2019
build java projects using maven

Intro to Maven

###Create a project from Maven Template:

To start a new maven project, use the maven archetype plugin from the command line using the archetype:generate goal.

The following command will tell maven to create a java project from maven-archetype-quickstart template, if you ignore the archetypeArtifactId argument, then a list of the templates will be listed for you to choose.

You can’t perform that action at this time.