Skip to content

Instantly share code, notes, and snippets.

@mridang
mridang / emr-master-ip.sh
Created October 19, 2021 17:00
Helper command to fetch the IP address of the master node of running EMR cluster
#!/bin/bash
aws emr describe-cluster --cluster-id @1 | jq --raw-output '.Cluster .MasterPublicDnsName | sub("ip-(?<ip1>[0-9]*)-(?<ip2>[0-9]*)-(?<ip3>[0-9]*)-(?<ip4>[0-9]*).*$"; "\(.ip1).\(.ip2).\(.ip3).\(.ip4)")'
aws emr create-cluster --auto-scaling-role production-emr-auto-scaling --applications Name=Hadoop Name=Hive Name=Spark --bootstrap-actions '[{"Path":"s3://nosto-emr-bootstrap/sshkeys.sh","Name":"Add ssh keys"}]' --ebs-root-volume-size 20 --ec2-attributes '{"KeyName":"mridang","InstanceProfile":"production-emr","ServiceAccessSecurityGroup":"sg-025cd99e844eb8ee9","SubnetId":"subnet-de214af5","EmrManagedSlaveSecurityGroup":"sg-0548dc804984f9cf8","EmrManagedMasterSecurityGroup":"sg-0f5fc3a1f9be29054"}' --service-role production-emr-service --enable-debugging --release-label emr-6.2.0 --log-uri 's3://nosto-emr-logs/' --name 'MridangTest' --instance-groups '[{"InstanceCount":1,"EbsConfiguration":{"EbsBlockDeviceConfigs":[{"VolumeSpecification":{"SizeInGB":32,"VolumeType":"gp2"},"VolumesPerInstance":2}]},"InstanceGroupType":"CORE","InstanceType":"c5a.xlarge","Name":"Core - 2"},{"InstanceCount":1,"EbsConfiguration":{"EbsBlockDeviceConfigs":[{"VolumeSpecification":{"SizeInGB":32,"VolumeType":"gp2"},"VolumesPerInstance
#!/bin/sh
sha=$(shasum -b "$1" | awk '{print $1}')
url="https://search.maven.org/solrsearch/select?q=1:%22${sha}%22&rows=1&wt=json"
if curl -s -o json -L "$url"; then
gav=$(jq -r '.response.docs[0].g + ":" + .response.docs[0].a + ":" + .response.docs[0].v' json)
if [ "$gav" != "null" ]; then
cat gav
fi
rm -f json
install coreutils
install findutils --with-default-names
install gnu-indent --with-default-names
install gnu-sed --with-default-names
install gnutls
install grep --with-default-names
install gnu-tar --with-default-names
install gawk
install tree
install icdiff
@mridang
mridang / ImageBuilder.java
Created March 19, 2016 15:10
Gasflow Notification Icon Generator
package com.mridang.dashbar;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Typeface;
import android.os.Environment;
@mridang
mridang / dhcout.smali
Created March 29, 2015 09:44
Enables HTTP debug logging to any decompiled APK
.method public static dhcout()V
.locals 2
.prologue
.line 63
const-string v0, "org.apache.http.wire"
invoke-static {v0}, Ljava/util/logging/Logger;->getLogger(Ljava/lang/String;)Ljava/util/logging/Logger;
move-result-object v0
@mridang
mridang / version.py
Last active August 29, 2015 14:04
Automatically increment version-number in the Android Manifest XML file.
#!/usr/bin/env python
"""
This script is used to compare the version-number and version-code in the the
manifest XML file of the Android project, with the number of the current tag of
the git branch.
The idea is that when the version-code in the XML file is 0.3, the tag of the
current branch is also at 0.3.
In the event the tag is one version behind the version-code, the script can
automatically increment the version-code and the version number.
The version-code is a decimal beginning from 0.0 with each release adding a 0.1
@mridang
mridang / barebones.sh
Last active December 28, 2015 21:09
Cleans up the useless applications from Cyanogenmod to barebone it.
adb root
adb remount
adb shell "rm -f /system/app/SoundRecorder.apk"
adb shell "rm -f /system/app/CMWallpapers.apk"
adb shell "rm -f /system/app/DSPManagerexit.apk"
adb shell "rm -f /system/app/Apollo.apk"
adb shell "rm -f /system/app/MagicSmokeWallpapers.apk"
adb shell "rm -f /system/app/VideoEditor.apk"
adb shell "rm -f /system/app/GenieWidget.apk"
adb shell "rm -f /system/app/VisualizationWallpapers.apk"