Skip to content

Instantly share code, notes, and snippets.

View pavi2410's full-sized avatar
:octocat:
Githubbing

Pavitra Golchha pavi2410

:octocat:
Githubbing
View GitHub Profile
@pavi2410
pavi2410 / AdSense2Slack.gs
Created November 14, 2017 00:14
Generate AdSense report and send it to Slack automatically
function doGet() {
getAdReports();
}
function getAdReports() {
var start = "today-6d"; //one week ago
var end = "today";
var clients = AdSense.Adclients.list().getItems();
@pavi2410
pavi2410 / jartf.bat
Last active December 24, 2017 16:21
Prints classes in a JAR file to *.jar.txt file
@echo off
for %%f in (*.jar) do echo %%f && jar tf %%f > %%f.txt
@pavi2410
pavi2410 / forloop.bat
Created January 13, 2018 18:57
Some useful batch codes examples
setlocal EnableDelayedExpansion
echo Searching for java files...
set JAVA_FILES=
for %%i in (java\*.java) do set JAVA_FILES=!JAVA_FILES! %%i && echo %%i
echo Found Java Files:%JAVA_FILES%
@pavi2410
pavi2410 / java2jar.bat
Last active January 24, 2018 19:15
This script compiles java files from java folder and puts class files into classes folder which are then compiled into a jar file in build folder.
:: This script compiles java files from
:: java folder and puts class files into
:: classes folder which are then compiled
:: into a jar file in build folder.
:: FILES HEIRARCHY
:: example
:: |_ build
:: | |_ compiled.jar (generated - Final packaged jar file)
:: |_ classes (generated - Contains compiled class files)
@pavi2410
pavi2410 / Android.java
Created December 29, 2017 20:22
Get the value of android:name attribute of all activities of an app.
public String getParentPackageName() {
PackageManager pm = context.getPackageManager();
String packageName = context.getApplicationContext().getPackageName();
PackageInfo pi;
try {
pi = pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
} catch (NameNotFoundException e) {
e.printStackTrace();
}
Press the black button😉
<⚫> 👈🏻 ‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎ ‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎ ‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎ ‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎ ‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎‏‎ ‎‏‎‏
@pavi2410
pavi2410 / OdeMessagesRegex
Last active August 1, 2018 12:39
Regex to find and format methods for OdeMessages.java. Use https://regexr.com/
// Find
symbol: +method (.+)
// Format
@DefaultMessage("")\n@Description("")\nString $1;\n\n
------------------------------------------------------
// or much powerful (but still needs to set component description manually)
// find
/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello World!" to the LCD
and shows the time.
import android.graphics.*;
import android.view.*;
import android.util.*;
round(n) {
return Math.round(n*100.0)/100.0;
}
WindowManager wm = (WindowManager) ctx.getSystemService("window");
dm = new DisplayMetrics();
@pavi2410
pavi2410 / KeyStore.java
Last active January 28, 2019 19:35
Get Keystore SHA1 from a keystore file programmatically in Java
package tk.pavi2410;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;