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 / JDK-GC.md
Created August 16, 2023 09:56
JDK 18 GC垃圾回收机制比较

https://www.jdon.com/61051.html

从 JDK 18 开始,JDK 附带了四个垃圾收集器 (GC);串行 GC、并行 GC、G1 GC 和 ZGC。在大多数情况下,默认的 GC G1 GC 将是最佳选择。但是,了解 GC 的设计目标可能会有所帮助,并且可能会帮助您实现应用程序的性能目标。本文将对每个 GC 以及何时应该使用它们进行高级研究。

串行垃圾收集器

Serial GC 是 GC 中“最简单的”。它在单个线程上执行所有工作,因此它被命名为“串行”。 Serial GC 最适合在资源有限且 live set 不超过 100 MB 的环境中运行的应用程序。 可以使用 VM 标志启用串行 GC -XX:+UseSerialGC

并行垃圾收集器

@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 / CorountineScope_self_Cancel.md
Created January 16, 2023 12:01
自己開的 CoroutineScope, 要自己關 (cancel)
@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 / Safe_call_on_a_non-null_receiver_will_have_nullable_type_in_future_releases.md
Last active December 16, 2022 13:20
Safe call on a non-null receiver will have nullable type in future releases.

Safe call on a non-null receiver will have nullable type in future releases.

Right now safe call on non nullable receiver has not null type:

"hello"?.length has type Int

In future releases all safe calls will have nullable type:

"hello"?.length will have type Int?

@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 / fab_alpha.md
Last active October 23, 2022 21:59
FAB 設 半透明被景色時 中間 貌似 卡住 氣泡 (髒髒的)

現況

image

63014352-a090fa00-be8e-11e9-9b60-b4aad212cf7c

期許

63014365-a8e93500-be8e-11e9-959a-3e9748895254

@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";