Skip to content

Instantly share code, notes, and snippets.

View amuraru's full-sized avatar
:octocat:
Focusing

Adrian Muraru amuraru

:octocat:
Focusing
View GitHub Profile
@amuraru
amuraru / create-hadoop-ext4.sh
Created December 13, 2014 14:23
Hadoop EXT4 formatting options
mkfs.ext4 -m 1 -T largefile -O dir_index,extent,sparse_super /dev/sdb
import java.util.concurrent.locks.ReentrantReadWriteLock;
class CachedData {
Object data;
volatile boolean cacheValid;
final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
Object loadData() throws Exception {
throw new Exception("Load Failed");
}
rpmrebuild -e -p --notest-install jdk-8u25-linux-x64.rpm
@amuraru
amuraru / cron-tomcat-thread-dump
Last active August 29, 2015 14:06
tomcat stacktrace dumper
*/5 * * * * tomcat bash -c "/usr/java/latest/bin/jstack -l `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | tr -s ' ' | cut -f2 -d' '` >> `ls -d /var/log/tomcat[6-9] | head -1`/stacktrace.log"
@amuraru
amuraru / create_jira.py
Last active August 29, 2015 14:04
JIRA Command Line
#!/usr/bin/env python
import sys
import jira.client as j
import getpass
JIRA_SERVER="https://issues.adobe.com"
print "Creating an issue on %s" % JIRA_SERVER
@amuraru
amuraru / iptables-port-traffic.sh
Created June 5, 2014 18:59
Monitor port bandwidth
iptables -F
iptables -X
/sbin/iptables -N INET_IN
/sbin/iptables -N INET_OUT
/sbin/iptables -A OUTPUT -j INET_OUT
/sbin/iptables -A INPUT -j INET_IN
/sbin/iptables -A INET_IN -s 10.2.122.0/24
/sbin/iptables -A INET_OUT -d 10.2.122.0/24
iptables -n -v -x -L INET_IN
iptables -n -v -x -L INET_OUT
@amuraru
amuraru / hthrift-balancer-healthcheck.sh
Last active August 29, 2015 14:00
Thrift Balancer Check
# Capture Thrift hex method call on a box running HBase ThriftServer
strace -f -xx -e recvfrom -s2048 -p$(jps | grep ThriftServer | cut -f1 -d' ') 2>&1
#getColumnDescriptor .META.
echo -en "\x80\x01\x00\x01\x00\x00\x00\x14\x67\x65\x74\x43\x6f\x6c\x75\x6d\x6e\x44\x65\x73\x63\x72\x69\x70\x74\x6f\x72\x73\x00\x00\x00\x00\x0b\x00\x01\x00\x00\x00\x06\x2e\x4d\x45\x54\x41\x2e\x00" | nc localhost 9090
#getTableNames thrift call
echo -en "\x80\x01\x00\x01\x00\x00\x00\x0d\x67\x65\x74\x54\x61\x62\x6c\x65\x4e\x61\x6d\x65\x73\x00\x00\x00\x00\x00" | nc localhost 9090
@amuraru
amuraru / strace_java_process.sh
Created April 19, 2014 18:20
Sniff network traffic java process
strace -e recvfrom -s2048 -p$(ps -L -p `jps | grep ThriftServer | cut -f1 -d' '` | cut -f2 -d' ' | xargs | sed -e 's/ / -p /g') 2>&1
@amuraru
amuraru / Check GC times
Last active August 29, 2015 13:57
HBase GC Configuration
egrep 'CMS-(re|ini)' `ls -1tr /var/log/hbase/gc.regionserver.201* | tail -1` | cut -d'=' -f4 | sort -n
grep -r ParNew `ls -1tr /var/log/hbase/gc.regionserver.201* | tail -1` | cut -d'=' -f4 | sort -n | tail -10