Skip to content

Instantly share code, notes, and snippets.

View MBtech's full-sized avatar

M. Bilal MBtech

View GitHub Profile
@MBtech
MBtech / Storm-UI-REST-API.md
Created January 12, 2016 15:23
Storm UI Rest API Doc

Storm UI REST API

The Storm UI daemon provides a REST API that allows you to interact with a Storm cluster, which includes retrieving metrics data and configuration information as well as management operations such as starting or stopping topologies.

Data format

The REST API returns JSON responses and supports JSONP. Clients can pass a callback query parameter to wrap JSON in the callback function.

@MBtech
MBtech / UrlConnection.java
Created January 12, 2016 15:48
HttpURLConnection Example
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
@MBtech
MBtech / StormSetup.sh
Created January 12, 2016 16:18
Commands needed to start a local instance of Storm with zookeeper and Kafka
Starting up storm
$ZOOKEEPER_HOME/bin/zkServer.sh start
$KAFKA_HOME/bin/kafka-server-start.sh config/server.properties
$STORM_HOME/bin/storm nimbus
$STORM_HOME/bin/storm supervisor
$STORM_HOME/bin/storm ui
@MBtech
MBtech / GenerateFile.sh
Created January 19, 2016 10:32
Generating a file of arbitrary size
dd if=/dev/zero of=file1 bs=1024k count=1k #1Gb file
#Reading the same file
#dd if=file1 of=/dev/null bs=1024k
@MBtech
MBtech / stringToData.java
Created January 21, 2016 10:57
String to Date Conversion
//http://stackoverflow.com/questions/4216745/java-string-to-date-conversion
String string = "January 2, 2010";
DateFormat format = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH);
Date date = format.parse(string);
System.out.println(date); // Sat Jan 02 00:00:00 GMT 2010
@MBtech
MBtech / nearest_mirror.sh
Last active September 15, 2016 18:39
Getting URL of nearest apache mirror
curl 'https://www.apache.org/dyn/closer.cgi' | grep -o '<strong>[^<]*</strong>' | sed 's/<[^>]*>//g' | head -1 | xargs -I {} echo {}
@MBtech
MBtech / conf_count.sh
Created January 28, 2016 11:35
Storm configuration count
#Get total number of configurations
cat defaults.yaml | grep "^[^#]" | wc -l
#Get configurations that are topology related
cat defaults.yaml | grep "^topology" | wc -l
@MBtech
MBtech / Storm_deploy
Last active February 16, 2016 12:09
Storm configuration and deployment
#Downloading storm
mkdir bilal
cd bilal
mkdir app
mkdir app/storm
wget http://www.gtlib.gatech.edu/pub/apache/storm/apache-storm-0.9.3/apache-storm-0.9.3.tar.gz
tar xvzf apache-storm-0.9.3.tar.gz
mkdir storm
mv apache-storm-0.9.3/* storm/
@MBtech
MBtech / bash_commands.sh
Last active February 9, 2016 18:15
Set of useful bash commands
#Getting the line number of a file from an ls command
ls -l reports/*.csv | grep -n "RollingCount_metrics_1454467885562.csv"
#Port forwarding with ssh (Port 80 from user@example.com is forwarded to port 9000 of imgur.com)
#http://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html
ssh -L 9000:imgur.com:80 user@example.com
@MBtech
MBtech / netflix_sysperf.sh
Created February 7, 2016 20:19
Netflix's 10 commands for 60s performance evaluation
#http://techblog.netflix.com/2015/11/linux-performance-analysis-in-60s.html
uptime
dmesg | tail
vmstat 1
mpstat -P ALL 1
pidstat 1
iostat -xz 1
free -m
sar -n DEV 1
sar -n TCP,ETCP 1