Skip to content

Instantly share code, notes, and snippets.

:shipit:
Typing, probably

Jason Feinstein jasonwyatt

:shipit:
Typing, probably
Block or report user

Report or block jasonwyatt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View versioninfo.gradle
import java.util.regex.Pattern
class VersionInfo {
private static Pattern VERSION_NAME_PATTERN = Pattern.compile("versionName='([0-9]+(\\.[0-9]+)+)'", Pattern.MULTILINE)
private static Pattern VERSION_CODE_PATTERN = Pattern.compile("versionCode='([0-9]+)'", Pattern.MULTILINE)
public File apkFile;
public String versionName;
public int versionCode;
public VersionInfo(File apkFile, String aaptOutput) {
View getVersionInfo.groovy
def getVersionInfo = { File apkFile ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine getAaptPath(), "dump", "badging", apkFile.absoluteFile
standardOutput = stdout
}
return new VersionInfo(apkFile, stdout.toString())
}
View getAaptPath.groovy
def getAaptPath = { ->
def sdkDir = android.sdkDirectory
def buildToolsDir = new File(sdkDir, "build-tools")
def versions = buildToolsDir.list()
def latestBuildToolsDir = new File(buildToolsDir, versions[-1])
return "${new File(latestBuildToolsDir, "aapt").absoluteFile}"
}
View VersionInfo.groovy
import java.util.regex.Pattern
class VersionInfo {
private static Pattern VERSION_NAME_PATTERN = Pattern.compile("versionName='([0-9]+(\\.[0-9]+)+)'", Pattern.MULTILINE)
private static Pattern VERSION_CODE_PATTERN = Pattern.compile("versionCode='([0-9]+)'", Pattern.MULTILINE)
public File apkFile;
public String versionName;
public int versionCode;
public VersionInfo(File apkFile, String aaptOutput) {
@jasonwyatt
jasonwyatt / VersionInfo.groovy
Created Aug 2, 2017
Get versionName and versionCode from APK file.
View VersionInfo.groovy
class VersionInfo {
public static Pattern VERSION_NAME_PATTERN = Pattern.compile("versionName='([0-9]+(\\.[0-9]+)+)'", Pattern.MULTILINE)
public static Pattern VERSION_CODE_PATTERN = Pattern.compile("versionCode='([0-9]+)'", Pattern.MULTILINE)
public File apkFile;
public String versionName;
public int versionCode;
public VersionInfo(File apkFile, String versionName, int versionCode) {
this.apkFile = apkFile;
this.versionName = versionName
@jasonwyatt
jasonwyatt / build.gradle
Created May 14, 2017
Android DebugPort 2.0 root build.gradle
View build.gradle
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
@jasonwyatt
jasonwyatt / build.gradle
Created May 14, 2017
Android DebugPort 2.0 App build.gradle
View build.gradle
dependencies {
debugCompile 'com.github.jasonwyatt.Android-DebugPort:lib:2.0.0'
releaseCompile 'com.github.jasonwyatt.Android-DebugPort:lib-noop:2.0.0'
}
@jasonwyatt
jasonwyatt / themes-debug.xml
Last active Jan 29, 2016 — forked from dlew/themes-debug.xml
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
View themes-debug.xml
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>
@jasonwyatt
jasonwyatt / buttdialed-privacy.md
Created Nov 6, 2013
Butt Dialed Privacy Policy
View buttdialed-privacy.md

Privacy Policy

Butt Dialed, and its creator, will NOT transmit your contact information or call log anywhere. It's that simple.

@jasonwyatt
jasonwyatt / salted_passwords.py
Created Jan 10, 2013
Functions for hashing passwords, generating salts, and testing input passwords.
View salted_passwords.py
import base64
import uuid
import hashlib
def hash_password(password, salt=None):
if salt is None:
salt = uuid.uuid4().hex
hashed_password = hashlib.sha512(password + salt).hexdigest()
You can’t perform that action at this time.