Skip to content

Instantly share code, notes, and snippets.

View nisrulz's full-sized avatar
🌌
Coding in the MultiVerse

Nishant Srivastava nisrulz

🌌
Coding in the MultiVerse
View GitHub Profile
@nisrulz
nisrulz / task_gen_jar.gradle
Created October 2, 2015 17:08
Task to generate a JAR from an android library module
// Place this in the 'build.gradle' of the library module
// Task : Generate a JAR
// Usage : In the terminal, run './gradlew jar'
// Output : Get the jar at 'build/libs'
task jar(type: Jar, dependsOn: 'assembleRelease') {
from fileTree(dir: 'build/intermediates/classes/release')
}
@nisrulz
nisrulz / convert-png-to-webp
Last active August 29, 2015 14:27 — forked from jonjensen/convert-png-to-webp
Batch convert PNG files to WebP in 1 directory
#!/bin/bash
PATH=/usr/local/bin:/usr/bin:/bin
# cd to the directory of the image so we can work with just filenames
dir="$(dirname "$1")"
cd "$dir" || exit 1
base="$(basename "$1" .png)"
# create a WebP version of the PNG
@nisrulz
nisrulz / test.sh
Created August 16, 2015 01:21
Test gist to showcase on satckoverflow
# This is a test shell script
echo "Hello World"
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@nisrulz
nisrulz / create_maven_repo.sh
Last active June 18, 2020 12:10
Creating a maven repository
### Create Maven Repository
#Create a directory named mavenrepo
mkdir mavenrepo
#Move into the dir
cd mavenrepo
#Initialise with git
git init
@nisrulz
nisrulz / using_battery_historian.sh
Last active August 29, 2015 14:26
Using Google's Battery Historian 2.0
#Start battery historian
cd $GOPATH/src/github.com/google/battery-historian
go run cmd/battery-historian/battery-historian.go
#Setup device for data collection
./adb shell dumpsys batterystats --enable full-wake-history
./adb shell dumpsys batterystats --reset
#Capture bugreport
./adb bugreport > ./bugreports/android_device_bugreport.txt
@nisrulz
nisrulz / using_gnuplot.sh
Created August 3, 2015 08:20
Use gunplot in terminal to plot a graph
#For more info check : http://people.duke.edu/~hpgavin/gnuplot.html
#Install GnuPLot
brew install gnuplot
#Before ploting a graph, set the terminal into dumb mode
set terminal dumb
#To Plot a graph
plot cos(x+2) #for a function
#for a data set
@nisrulz
nisrulz / ellipsis.css
Created August 1, 2015 02:44
Truncate text if it overflows and put ellipsis
.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; // IE 6+, FF 7+, Op 11+, Saf 1.3+, Chr 1+
-o-text-overflow: ellipsis; // for Opera 9 & 10
}
@nisrulz
nisrulz / build_buildtypes.gradle
Created July 18, 2015 20:58
Standard build.gradle configurations for a gradle based android app, with build flavours
buildTypes {
debug {
minifyEnabled false
applicationIdSuffix '.debug'
versionNameSuffix '-debug'
}
release {
signingConfig signingConfigs.release
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
@nisrulz
nisrulz / get_public_ssh_key.sh
Last active August 29, 2015 14:23
Get SSH Public Key
#More info at : https://help.github.com/articles/generating-ssh-keys/
cat ~/.ssh/id_dsa.pub