Skip to content

Instantly share code, notes, and snippets.

View morristech's full-sized avatar
🔴
"What I cannot create, I do not understand"

Wade morristech

🔴
"What I cannot create, I do not understand"
View GitHub Profile
1. To increase inotify watches on Watchman, run:
echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances && watchman shutdown-server
2. If a watchman crawl fails, run:
watchman shutdown-server; WATCHMAN_CONFIG_FILE=~/watchman watchman --foreground --logfile=/dev/stdout --no-save-state --statefile=/dev/null
@morristech
morristech / build.gradle
Created October 28, 2021 21:37 — forked from khernyo/build.gradle
Gradle Android configuration with .so hack
// This hack works with com.android.tools.build:gradle:0.2, won't work in later version without modification
apply plugin: 'android'
targetCompatibility = 1.6
sourceCompatibility = 1.6
android {
target = 'android-14'
@morristech
morristech / android-backup-apk-and-datas.md
Created October 28, 2021 08:22 — forked from AnatomicJC/android-backup-apk-and-datas.md
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Fetch application APK

To get the list of your installed applications:

/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@morristech
morristech / User - HtmlCodeGenerator.kt
Created September 18, 2021 15:14 — forked from amirraza/User - HtmlCodeGenerator.kt
Composite Design Pattern to generate html code
fun main() {
val html = HtmlParentElement("<html>", "</html>")
val head = HtmlParentElement("<head>", "</head>")
val body = HtmlParentElement("<body>", "</body>")
val title = HtmlElement("<title>", "</title>", "Auto Generated Html title")
head.addElement(title)
val firstHeding = HtmlElement("<h1>", "</h1>", "this is first heading")
val firstPara = HtmlElement("<p>", "</p>", "this is first paragraph")
@morristech
morristech / Cryptography.kt
Created September 17, 2021 16:14 — forked from amirraza/Cryptography.kt
Cryptography - An object class for cryptography that encrypt/decrypt using AndroidKeyStore for Android 18+
package com.example.securitypractice
import android.annotation.TargetApi
import android.content.Context
import android.content.SharedPreferences
import android.os.Build
import android.security.KeyPairGeneratorSpec
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties
import android.util.Base64
@morristech
morristech / gist:328db103a969fef176007f153898b6b7
Created August 11, 2021 08:46 — forked from dseerapu/gist:b768728b3b4ccf282c7806a3745d0347
Android app inactivity timeout | Android Logout timer
public class LogOutTimerUtil {
public interface LogOutListener {
void doLogout();
}
static Timer longTimer;
static final int LOGOUT_TIME = 600000; // delay in milliseconds i.e. 5 min = 300000 ms or use timeout argument
public static synchronized void startLogoutTimer(final Context context, final LogOutListener logOutListener) {
@morristech
morristech / DateUtils.java
Created August 10, 2021 23:29 — forked from mraccola/DateUtils.java
Android DateUtils for RFC 1123 dates and ISO 8601 dates
package org.wta.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
public final class DateUtils {
@morristech
morristech / datetime.java
Created August 10, 2021 23:17 — forked from salomvary/datetime.java
Java 8 Date and Time Parsing and Formatting Microtutorial
import java.time.format.DateTimeFormatter;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
Instant.now();
// java.time.Instant = 2015-08-13T09:28:27.141Z
DateTimeFormatter.ISO_INSTANT.format(Instant.now());
@morristech
morristech / 1_FragmentViewBindingBoilerplate.kt
Created August 8, 2021 17:25 — forked from dancing-koala/1_FragmentViewBindingBoilerplate.kt
Reduce boilerplate for view binding in fragments
// Just for customizing the name