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 / 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
//
// 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 / test.sh
Created August 16, 2015 01:21
Test gist to showcase on satckoverflow
# This is a test shell script
echo "Hello World"
@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 / 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 / build.gradle
Created October 30, 2015 19:54 — forked from ph0b/build.gradle
sample build.gradle for generating split APKs per ABI
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig{
minSdkVersion 14
targetSdkVersion 21
versionCode 101
@nisrulz
nisrulz / .gitignore
Last active November 22, 2015 06:44
.gitignore File for Android Studio
# [Android] ========================
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
@nisrulz
nisrulz / AndroidManifest.xml
Created February 15, 2016 06:36 — forked from billmote/AndroidManifest.xml
When pushing code from your IDE, wake the device and show the activity.
<?xml version="1.0" encoding="utf-8"?>
<!-- Add this as a debug manifest so the permissions won't be required by your production app -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
</manifest>
@nisrulz
nisrulz / build.gradle
Created February 26, 2016 04:31
Change name of apk via gradle property in android
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.company.packagename"
minSdkVersion 7
targetSdkVersion 23
versionCode 1
versionName "1.0.0"
@nisrulz
nisrulz / Activity.java
Last active March 11, 2016 09:48
RecyclerView implementation
// USAGE
// Data set
final ArrayList<ViewModel> viewModelArrayList = new ArrayList<>();
for (int i = 0; i < 100; i++) {
viewModelArrayList.add(new Order(i, "VM Name " + i));
}
// Recyclerview
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv);