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 / local.pp
Created February 12, 2014 11:01
puppet manifest as script
#!/usr/bin/env puppet apply --verbose
file { "/tmp/local":
content => "Test from puppet",
ensure => file
}
@ashrithr
ashrithr / rsync.sh
Last active August 29, 2015 13:56
rsync using ssh protocol and exclude flag
rsync -rav -e 'ssh -i /Users/ashrith/.ssh/aws.pem' --exclude=".git/*" ${SOURCE_PATH} root@${HOST}:${PATH}
# Copying to remote server with out root user:
# for this command to work make sure the 'Defaults requiretty' is commented on the remote server in '/etc/sudoers' file
rsync -rav -e 'ssh -i /root/to/key' --rsync-path="sudo rsync" /path/to/copy/* rsyncuser@${HOST}:/dest/path/
# From a fresh install of squeeze
apt-get install ruby rubygems # Need ruby to use fpm
gem1.8 install fpm --no-ri --no-rdoc
apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -zxvf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125
rm -rf /tmp/ruby193
@ashrithr
ashrithr / git_clone_private.md
Created April 2, 2014 23:53
Clone a git repository (to avoid 403 errors)
git clone https://<username>@github.com/xxx/yyy.git
@ashrithr
ashrithr / detach_process.md
Created April 5, 2014 01:11
Send foreground process to background

Using the Job Control of bash to send the process into the background:

  1. ctrl+z to stop (pause) the program and get back to the shell
  2. bg to run it in the background
  3. disown -h [job-spec] where [job-spec] is the job number (like %1 for the first running job; find about your number with the jobs command) so that the job isn't killed when the terminal closes
@ashrithr
ashrithr / pom.xml
Created April 16, 2014 23:40
YCSB Hbase CDH5 pom YCSB/hbase/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>root</artifactId>
<version>0.1.4</version>
</parent>
<artifactId>hbase-binding</artifactId>
@ashrithr
ashrithr / pm.scala
Last active August 29, 2015 14:00
scala pattern match on instances of the class
def test[T](t: T) = t match {
case _: Int => println("Got int" + t)
case _: String => println("Got string" + t)
case _ => println("I dont know what that is" + t)
}
@ashrithr
ashrithr / Usage.md
Last active August 29, 2015 14:00
i2cssh

Config file:

cat > ~/.i2csshrc <<EOF
---
version: 2
clusters:
  kafka_cluster:
    login: ec2-user
 hosts:
@ashrithr
ashrithr / Usage.md
Created April 21, 2014 19:57
csshx usage

config file:

cat > aws_hosts <<EOF
clusters = kafka_cluster spark_cluster cass_cluster all
kafka_cluster = ec2-54-219-114-64.us-west-1.compute.amazonaws.com ec2-204-236-188-149.us-west-1.compute.amazonaws.com ec2-54-193-135-104.us-west-1.compute.amazonaws.com
spark_cluster = ec2-54-219-87-178.us-west-1.compute.amazonaws.com ec2-204-236-137-42.us-west-1.compute.amazonaws.com ec2-54-219-117-253.us-west-1.compute.amazonaws.com
cass_cluster = ec2-50-18-10-150.us-west-1.compute.amazonaws.com ec2-54-219-230-45.us-west-1.compute.amazonaws.com ec2-50-18-12-57.us-west-1.compute.amazonaws.com
all = ec2-54-219-114-64.us-west-1.compute.amazonaws.com ec2-204-236-188-149.us-west-1.compute.amazonaws.com ec2-54-193-135-104.us-west-1.compute.amazonaws.com ec2-54-219-87-178.us-west-1.compute.amazonaws.com ec2-204-236-137-42.us-west-1.compute.amazonaws.com ec2-54-219-117-253.us-west-1.compute.amazonaws.com ec2-50-18-10-150.us-west-1.compute.amazonaws.com ec2-54-219-230-45.us-west-1.compute.amazonaws.com ec2-50-18-12-57.us-
@ashrithr
ashrithr / centos7_static_ip.bash
Last active August 29, 2015 14:04
Centos 7 Static IP
## Get a list of NIC names using `ifconfig -a` or `ip -a`
#
# vi /etc/sysconfig/network-scripts/ifcfg-en0xxxxxxx
NAME=en0xxxxxx
NM_CONTROLLED=no
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static