Skip to content

Instantly share code, notes, and snippets.

View ashwanthkumar's full-sized avatar

Ashwanth Kumar ashwanthkumar

View GitHub Profile
package chaser.hadoop;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.TreeSet;
import java.util.UUID;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
#!/bin/bash
set -e
function find_and_replace_dirs_recursively {
FIND=$1
REPLACE=$2
ls -d */ | xargs -IDIR egrep -lRZ "$FIND" DIR | xargs -IFILE sed -i "" -e "s/${FIND}/${REPLACE}/g" FILE
}
import in.ashwanthkumar.slack.webhook.Slack
import in.ashwanthkumar.slack.webhook.SlackMessage
def webhookUrl = args[0]
new Slack(webhookUrl)
.icon(":smiling_imp:") // Ref - http://www.emoji-cheat-sheet.com/
.sendToChannel("z_development")
.displayName("slack-java-client")
.push(new SlackMessage("Text from my ").bold("Slack-Java-Client"));
@ashwanthkumar
ashwanthkumar / PDFTextExtractor.scala
Last active July 16, 2016 03:39
Simple PDFTextExtractor
import java.io.File
import org.apache.pdfbox.cos.COSDocument
import org.apache.pdfbox.io.{RandomAccessBuffer, RandomAccessFile}
import org.apache.pdfbox.pdfparser.PDFParser
import org.apache.pdfbox.pdmodel.PDDocument
import org.apache.pdfbox.text.PDFTextStripper
object PDFTextExtractor extends App {
//val reader = new PDFReader(new File("my.pdf"))
@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.

@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 / 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
#!/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
#!/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
@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