Skip to content

Instantly share code, notes, and snippets.

View tw-Frey's full-sized avatar

Frey tw-Frey

  • Taipei, Taiwan
View GitHub Profile
$("<style id=OVER_API_23/>")
.append([23,24,25,26,27,28].map(api=>'[data-version-added="'+api+'"]').map(dom=>dom+dom+" *").join(","))
.append("{color:red!important}")
.appendTo("html")
@tw-Frey
tw-Frey / tw.idv.fy.kotlin.utils.UByteExtensions.kt
Last active December 25, 2018 09:02
一些轉換 Ble Comm (Hex Array) 可能有幫助的 Kotlin Extension
package tw.idv.fy.kotlin.utils
/**
Kotlin Extension used by Self
**/
// 16 進位表示文字 轉 UByte, 例如: "FF" → UByte(0xFF)
fun String.toUByteByRadix16() = toUByte(16)
// UByte 轉 16 進位表示文字, 例如: UByte(0x0F) → "0F"
@tw-Frey
tw-Frey / tw.idv.fy.kotlin.utils.LogExtensions.kt
Last active December 29, 2018 06:44
客製化 Log (Kotlin Extension used by Self)
package tw.idv.fy.kotlin.utils
import tw.idv.fy.kotlin.utils.LogLabel.Prefix
import tw.idv.fy.kotlin.utils.LogLabel.TAG
import kotlin.math.max
/**
* 客製化 Log
*/
fun Any.LogV(label: String = "", tag: TAG = TAG(), prefix: Prefix = Prefix(label)) = LogCat.v ("$tag", "$prefix $this")
@tw-Frey
tw-Frey / AndroidMethod.java
Created January 14, 2019 10:06 — forked from ishitcno1/AndroidMethod.java
Android methods to check the network connection.
public static boolean isWifiConn(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager
.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
return networkInfo.isConnected();
}
public static boolean isMobileConn(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager)
zaSyBjF7xvc4YgGP6ElabUjpxH0GGJGMYi3LA
@tw-Frey
tw-Frey / ChangePassword.java
Created August 15, 2019 02:15 — forked from zach-klippenstein/ChangePassword.java
The keystore password on Java keystore files is utterly pointless. You can reset it without knowing it, as shown by this code. Note that private keys are still secure, as far as I know. The JKS implementation is copyright Casey Marshall (rsdio@metastatic.org), and the original source is available at http://metastatic.org/source/JKS.java. I've in…
import java.util.*;
import java.io.*;
import java.security.*;
public class ChangePassword
{
private final static JKS j = new JKS();
public static void main(String[] args) throws Exception
{
@tw-Frey
tw-Frey / adb-screencap
Last active September 5, 2019 12:04
adb screencap used by exec-out
**民國版**
adb.exe exec-out screencap -p > screenshot-%date:~0,3%%date:~4,2%%date:~7,2%-%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%.png
PS:
%date% = 108/09/05
%time% = 17:09:15.21
ref:
https://stackoverflow.com/questions/13578416/read-binary-stdout-data-from-adb-shell/31401447#31401447
@tw-Frey
tw-Frey / Markdown Cheatsheet 中文版.md
Created September 26, 2019 03:30 — forked from billy3321/Markdown Cheatsheet 中文版.md
Markdown Cheatsheet 中文版
@tw-Frey
tw-Frey / compiler_params.properties
Created October 1, 2019 09:30
注入式 signing configs
-Pandroid.injected.signing.key.alias=
-Pandroid.injected.signing.key.password=
-Pandroid.injected.signing.store.password=
-Pandroid.injected.signing.store.file=
@tw-Frey
tw-Frey / DeCryptor.java
Created October 15, 2019 12:40 — forked from JosiasSena/DeCryptor.java
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/