Skip to content

Instantly share code, notes, and snippets.


David Truxall davetrux

View GitHub Profile
davetrux / SQLiteDebugADB
Created Mar 24, 2014
Verbose Logging of SQLite statements in Android
View SQLiteDebugADB
adb shell setprop log.tag.SQLiteLog V
adb shell setprop log.tag.SQLiteStatements V
adb shell stop
adb shell start
View Darkmode.js
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
// dark mode
console.log('dark mode')
davetrux /
Created Aug 23, 2019
SELinux allow Localhost for nginx to reverse proxy docker containers
sudo setsebool httpd_can_network_connect 1 -P
davetrux / build.gradle
Created Aug 3, 2016
Gradle-Openbakery BundleId Switch
View build.gradle
if(buildType == "AppStore") {
infoplist {
bundleIdentifier = "com.hpe.appstore"
signing {
mobileProvisionURI = 'file://' + currentPath + appStoreProfile
certificateURI = "file://" + currentPath + appStoreCert
certificatePassword = certPassword
davetrux / hideshow
Created Nov 29, 2017
Mac Hide/Show Hidden Files
View hideshow
## Put these in your .bash_profile found in your home directory
## in the terminal type source ~/.bash_profile to reload your profile to make them immediately usable or close and re-open Terminal
# Hide and show hidden files in Finder windows
alias showFiles='defaults write AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/'
alias hideFiles='defaults write AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/'
davetrux / hmac.swift
Last active Nov 8, 2016
HMAC algorithm for iOS
View hmac.swift
import Foundation
//You have to create a bridging header in your project containing:
// #import <CommonCrypto/CommonHMAC.h>
extension String {
func digestHMac256(key: String) -> String! {
let str = self.cStringUsingEncoding(NSUTF8StringEncoding)
View Enum.TryParse
/// Takes a string that represents an enum member
/// and returns the enum member
/// </SUMMARY>
/// <TYPEPARAM name="T">An Enum</TYPEPARAM>
/// <PARAM name="input">The string that is the enum member name, case does not matter</PARAM>
/// <PARAM name="returnValue">The value from the enum that matches the string, or the first value of the enum</PARAM>
/// <RETURNS>True when there is a match, false when not </RETURNS>
/// - When no match the first item in the enum is returned
davetrux / Android Dev Key
Created Apr 6, 2013
Command line call to get the Android dev key. Empty password.
View Android Dev Key
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -v -list
davetrux / Android Multi-API Preference Saving
Created Mar 28, 2013
Another static Android API example
View Android Multi-API Preference Saving
public class Settings extends PreferenceActivity {
public void onCreate(Bundle savedInstanceState) {
davetrux / Static Inner Class API
Last active Dec 15, 2015
Using newer Android APIs in an older version
View Static Inner Class API
* Handles Gingerbread crash due to implementation change
private static Point getDisplaySize(final Display display) {
return APIv11.getDisplaySize(display);
} else {
final Point point = new Point();
point.x = display.getWidth();