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 / build.gradle
Created August 11, 2023 14:43 — forked from huuphuoc1396/build.gradle
Config your output file name in Gradle Kotlin DSL
import com.android.build.gradle.api.ApplicationVariant
import com.android.build.gradle.api.BaseVariantOutput
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
android {
//...
applicationVariants.all(ApplicationVariantAction())
}
@tw-Frey
tw-Frey / convert_binary_file_to_base64.ps1
Created March 15, 2023 13:42 — forked from jdmallen/convert_binary_file_to_base64.ps1
Powershell script to convert a binary file to/from a base64 text file
Param(
$filePath,
[switch]$reverse = $false
)
## Usage
#
# From binary to UTF8 base-64 file with "b64" extension:
# .\convert_binary_file_to_base64.ps1 path\to\file.bin
#
/* Copyright 2020 Seanghay Yath (@seanghay)
SPDX-License-Identifier: Apache-2.0 */
sealed class ResultOf<out T> {
data class Success<out R>(val value: R): ResultOf<R>()
data class Failure(
val message: String?,
val throwable: Throwable?
): ResultOf<Nothing>()
}
@tw-Frey
tw-Frey / ffmpeg.md
Created December 29, 2022 14:01 — forked from protrolium/ffmpeg.md
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@tw-Frey
tw-Frey / mobile-hls-video.html
Created November 15, 2022 14:13 — forked from ufologist/mobile-hls-video.html
Web 前端如何播放 HLS(.m3u8) 视频
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Mobile HLS video</title>
</head>
<body>
<h1>Mobile HLS video</h1>
@tw-Frey
tw-Frey / SignatureCheck.java
Created September 19, 2022 14:59 — forked from scottyab/SignatureCheck.java
Simple Android signature check. Please note: This was created in 2013, not actively maintained and may not be compatible with the latest Android versions. It's not particularly difficult for an attacker to decompile an .apk, find this tamper check, replace the APP_SIGNATURE with theirs and rebuild (or use method hooking to return true from `vali…
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
public class TamperCheck {
//we store the hash of the signture for a little more protection
private static final String APP_SIGNATURE = "1038C0E34658923C4192E61B16846";
@tw-Frey
tw-Frey / jQuery.getScript.Cached.md
Last active September 8, 2022 22:01 — forked from steveosoule/README.md
jQuery.getScript Cached

jquery.getScriptCached.js

jQuery's $.getScript function is a quick and easy way to include external JavaScript files into a website. However, its default implimentation will not cache the script file for the client.

The following information describes how you can itilize cached versions of $.getScript

Usage

  1. Include jquery, if it's not already.
@tw-Frey
tw-Frey / GPLv3.md
Created June 15, 2022 12:46 — forked from kn9ts/GPLv3.md
GPLv3 explained

GPL3 LICENSE SYNOPSIS

TL;DR* Here's what the license entails:

1. Anyone can copy, modify and distribute this software.
2. You have to include the license and copyright notice with each and every distribution.
3. You can use this software privately.
4. You can use this software for commercial purposes.
5. If you dare build your business solely from this code, you risk open-sourcing the whole code base.
@tw-Frey
tw-Frey / gist:ba171f43ea16624a93d6adf8967076f1
Created May 20, 2022 12:48 — forked from minas1/gist:f920c037e511f71a1d06c9261f3307be
Exclude your own Activity from Activity.startActivity(Intent) chooser
/**
* Attempts to start an activity to handle the given intent, excluding activities of this app.
* <ul>
* <li>If the user has set a default activity (which does not belong in this app's package), it is opened without prompt.</li>
* <li>Otherwise, an intent chooser is displayed that excludes activities of this app's package.</li>
* </ul>
*
* @param context context
* @param intent intent to open
* @param chooserTitle the title that will be displayed for the intent chooser in case one needs to be displayed.
@tw-Frey
tw-Frey / MainActivity.kt
Created April 1, 2022 12:56 — forked from pich4ya/MainActivity.kt
Android: Preventing Sensitive Information From Appearing In Background Screenshot (Recent App)
/*
@author longcat (Pichaya Morimoto)
This code snippet can be used to resolve BOT (Bank Of Thailand) mobile security requirement "insecure background"
without hurting user experience in mobile app.
Briefly, when the app is pushed into background mode (user presses the Home button)
Android phone will create screenshot of the current Activity for displaying it in recent apps menu
The recent's app screenshots will be stored at: