Skip to content

Instantly share code, notes, and snippets.

View tw-Frey's full-sized avatar

Frey tw-Frey

  • Taipei, Taiwan
View GitHub Profile
@tw-Frey
tw-Frey / credit-card-regex.md
Created December 16, 2019 11:54 — forked from michaelkeevildown/credit-card-regex.md
Credit Card Regex Patterns

Credit Card Regex

  • Amex Card: ^3[47][0-9]{13}$
  • BCGlobal: ^(6541|6556)[0-9]{12}$
  • Carte Blanche Card: ^389[0-9]{11}$
  • Diners Club Card: ^3(?:0[0-5]|[68][0-9])[0-9]{11}$
  • Discover Card: ^65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}|(622(?:12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|9[01][0-9]|92[0-5])[0-9]{10})$
  • Insta Payment Card: ^63[7-9][0-9]{13}$
  • JCB Card: ^(?:2131|1800|35\d{3})\d{11}$
  • KoreanLocalCard: ^9[0-9]{15}$

https://www.cnblogs.com/bao521/p/6275455.html

近些年DES使用越来越少,原因就在于其使用56位密钥,比较容易被破解,近些年来逐渐被AES替代,AES已经变成目前对称加密中最流行算法之一;AES可以使用128、192、和256位密钥,并且用128位分组加密和解密数据。本文就简单介绍如何通过JAVA实现AES加密。

@tw-Frey
tw-Frey / AES256.java
Last active February 6, 2020 20:43
(use PBEKeySpec) AES256 Password Encryption/Decryption Java
package com.wardana.sukma;
import java.security.SecureRandom;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
@tw-Frey
tw-Frey / studio64.exe.vmoptions
Created February 12, 2020 02:07
讓 Android Studio 的 console 顯示 UTF-8 (non-ASCII)
# custom Android Studio VM options, see https://developer.android.com/studio/intro/studio-config.html
-Dconsole.encoding=UTF-8
-Dfile.encoding=UTF-8
@tw-Frey
tw-Frey / HookWebView
Created October 29, 2020 01:23
For security reasons, WebView is not allowed in privileged processes ... It's a solution that hooks WebViewFactory first.
@android.annotation.SuppressLint({"DiscouragedPrivateApi", "PrivateApi"})
public static void HookWebView() {
int sdkInt = android.os.Build.VERSION.SDK_INT;
try {
Class<?> factoryClass = Class.forName("android.webkit.WebViewFactory");
java.lang.reflect.Field field = factoryClass.getDeclaredField("sProviderInstance");
field.setAccessible(true);
Object sProviderInstance = field.get(null);
if (sProviderInstance != null) {
android.util.Log.v("Faty", "sProviderInstance isn't null");
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
public class ${NAME} {
private static final String TAG = "${NAME}";
}
Branch Release type Version format
feature alpha #major.#minor.#revision-a#build#feature
develop beta #major.#minor.#revision-b#build
release release candidate #major.#minor.#revision-r#build
hotfix release candidate #major.#minor.#revision-r#build
master stable #major.#minor.#revision
Task Branch CI build number NuGet package version
Implement feature #1 feature-1 1 1.2.0-a1feature1
Implement feature #2 feature-2 2 1.2.0-a2feature2
Implement feature #1 feature-1 3 1.2.0-a3feature1
Complete feature #1 develop 4 1.2.0-b4
Complete feature #2 develop 5 1.2.0-b5
Stabilize release release-1.2.0 6 1.2.0-r6
Release to production master 7 1.2.0
Fix production issue hotfix-1.2.1 8 1.2.1-r8
Task Branch Semantic version NuGet version
Implement feature #1 feature/a-refactor-value-naming 2.3.0-a-refactor-value-naming.1 2.3.0-a-refactor-value0001
Implement feature #2 feature/a-update-documentation 2.3.0-a-update-documentation.1 2.3.0-a-update-documen0001
Implement feature #1 feature/a-refactor-value-naming 2.3.0-a-refactor-value-naming.2 2.3.0-a-refactor-value0002
Complete feature #1 develop 2.3.0-b.3 2.3.0-b0003
Complete feature #2 develop 2.3.0-b.7 2.3.0-b0007
Stabilize release release-2.3.0 2.3.0-rc.0 2.3.0-rc0000
Release to production master 2.3.0 2.3.0
Fix production issue hotfix-2.3.1 2.3.1-rc.1 2.3.1-rc0001
@tw-Frey
tw-Frey / git-amend.bat
Last active September 10, 2021 04:07
git amend commit and let author date and commit date that both are the same.
@setlocal
@if not [%1]==[] if not [%1]==[--] (
set GIT_AUTHOR_DATE=%1
set GIT_COMMITTER_DATE=%1
set git_date_params=--date=%1
)
@if not [%2]==[] if not [%3]==[] (
set GIT_AUTHOR_NAME=%2
set GIT_AUTHOR_EMAIL=%3
set GIT_COMMITTER_NAME=%2