Skip to content

Instantly share code, notes, and snippets.

View ashwanthkumar's full-sized avatar

Ashwanth Kumar ashwanthkumar

View GitHub Profile

The Ying-Yang of CEOs and Engineers

All successful startups begin with two founders. One guy is the Engineer, and the other guy is the business dude. Over the years of working with various people, I've learned what makes a good engineer, and what makes a good business dude, and the two are complete opposites of each other.

CEO Engineer
@ashwanthkumar
ashwanthkumar / hadoop_hosts_diff.sh
Last active September 25, 2015 02:32
Useful to find the missing host, when you've 100s of machines on AWS running TT and DN process and their dns names are autogenerated
# This assumes that jq is installed on your machine
JT_MACHINE="jt-host"
NN_MACHINE="nn-host"
# Get all the TTs
curl "http://${JT_MACHINE}:50030/jmx?qry=hadoop:service=JobTracker,name=JobTrackerInfo" | jq -r .beans[].AliveNodesInfoJson | jq -r .[].hostname | sort > tasktrackers
# Get all the DNs
curl "http://${NN_MACHINE}:50070/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo" | jq -r .beans[].LiveNodes | jq -r 'keys | .[]' | sort > datanodes
@ashwanthkumar
ashwanthkumar / pipeline.xml
Created December 22, 2015 17:11
Sample pipeline configuration for running GoCD Janitor (https://github.com/ashwanthkumar/gocd-janitor)
<pipeline name="gocd-janitor" labeltemplate="cleanup-${COUNT}" isLocked="false">
<timer>0 30 5 ? * MON</timer>
<stage name="cleanup">
<approval type="manual" />
<jobs>
<job name="cleanup">
<tasks>
<exec command="wget">
<arg>https://github.com/ashwanthkumar/gocd-janitor/releases/download/v0.0.1/gocd-janitor-0.0.1-jar-with-dependencies.jar</arg>
</exec>
@ashwanthkumar
ashwanthkumar / matsya.conf
Last active January 21, 2016 12:53
Sample Matysa Configuration
matsya {
# Path on the local FS to write the Cluster states and Time series data we create
# ${working-dir}/state and ${working-dir}/history respectively for the same
working-dir = "local_run"
clusters = [{
# Unique Identifier - Please don't change once assigned
name = "Staging Hadoop Cluster"
# (Mandatory) AutoScaling group backing the spot machines
@ashwanthkumar
ashwanthkumar / build.sh
Created February 4, 2016 12:35
Build commands for GoLang project on SnapCI
GITHUB_USERNAME="ashwanthkumar"
GITHUB_REPO="marathonctl"
# Install Golang as part of the build - takes about 30 secs
sudo yum install --assumeyes golang
# Setup GOPATH conventions
mkdir -p /var/snap-ci/src/github.com/${GITHUB_USERNAME}/
# Create symlinks according to go's directory structure
ln -s /var/snap-ci/repo /var/snap-ci/src/github.com/${GITHUB_USERNAME}/${GITHUB_REPO}
# Run your make commands to test and build your project
#!/bin/bash
PACKER_LOG_FILE=$1
while read LINE; do
BUILDER_NAME=$(echo $LINE | awk -F, '{print $2}')
if [ "X$BUILDER_NAME" != "X" ]; then
echo "found $BUILDER_NAME on $LINE"
fi
done < $PACKER_LOG_FILE
#!/bin/bash
PACKER_LOG_FILE=$1
awk -F, '{if($2 != "") { print $0}}' $PACKER_LOG_FILE | while read LINE; do
BUILDER_NAME=$(echo $LINE | awk -F, '{print $2}')
if [ "X$BUILDER_NAME" != "X" ]; then
echo "found $BUILDER_NAME on $LINE"
fi
done
@ashwanthkumar
ashwanthkumar / docker-compose.yml
Created February 23, 2016 16:50
Docker compose setup to bring up a local marathon setup for testing / development
version: '2'
services:
zk:
image: jplock/zookeeper
network_mode: "host"
master:
image: mesosphere/mesos-master:0.27.0-0.2.190.ubuntu1404
network_mode: "host"
privileged: true
@ashwanthkumar
ashwanthkumar / snap-setup-golang.sh
Last active March 7, 2016 04:29
Setup golang on SnapCI. Version of Golang is based on GO_VERSION env variable or defaults to 1.6
#!/bin/bash
GO_VERSION="${GO_VERSION:-1.6}"
GO_BASE_PATH="/usr/local"
GOROOT="/usr/local/go"
rm -rf ${GOROOT}
curl -sSL https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz | tar -xzf - -C ${GO_BASE_PATH}
ln -s ${GO_BASE_PATH}/go/bin/go /usr/bin/
ln -s ${GO_BASE_PATH}/go/bin/gofmt /usr/bin/
ln -s ${GO_BASE_PATH}/go/bin/godoc /usr/bin/
@ashwanthkumar
ashwanthkumar / README.md
Created June 9, 2016 20:33
HTTP/2 - nghttp2 server and golang 1.6 client

You need to run the build.sh to build the server and start it with ./server 0.0.0.0 3000 1 server.key server.crt. Assuming you've generated server.key and server.crt. If not, follow the instructions on http://www.akadia.com/services/ssh_test_certificate.html.

Once you've the server started, you can either use curl (with http2 support) or run the client with go run client.go. If you want to see debug logs of the underlying http2 implementation, run it as GODEBUG=http2debug=2 go run client.go.