Skip to content

Instantly share code, notes, and snippets.

View YuanLiou's full-sized avatar
:octocat:
a museum enthusiast.

Jui Yuan Liu (Ray) YuanLiou

:octocat:
a museum enthusiast.
View GitHub Profile
@YuanLiou
YuanLiou / IntelliJ IDEA.app.vmoptions
Created January 31, 2023 08:34 — forked from gaplo917/IntelliJ IDEA.app.vmoptions
IntelliJ IDEA Java 17 ZGC VM Options
# Personal Feeling: using the following jvm config is smoother than default
# My Machine: Macbook pro M1max 64GB
# More Info: https://github.com/FoxxMD/intellij-jvm-options-explained
# Prerequisite (Intellij < 2022.2)
# 1. Install JetBrain Runtime 17 osx-aarch64 for Apple Silicon, https://github.com/JetBrains/JetBrainsRuntime/releases
# 2. Switch the runtime from JetBrain Runtime 11 to 17, https://www.jetbrains.com/help/idea/switching-boot-jdk.html
# JetBrain Toolbox
@YuanLiou
YuanLiou / jetbrains.vmoptions
Created September 19, 2022 08:06
Ray's VM Options
-Xms1024m
-Xmx4096m
-XX:ReservedCodeCacheSize=512m
-XX:+IgnoreUnrecognizedVMOptions
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:CICompilerCount=2
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-ea
@YuanLiou
YuanLiou / optimizeVideo.sh
Last active September 17, 2022 12:52
FFMPEG optimize video file
# Optimize mp4
# Usage: optimizeVideo video_file
optimizeVideo() {
ffmpeg -i "${1}" -vcodec h264 -acodec mp2 "${1}".mp4
}
@YuanLiou
YuanLiou / videoToGif.sh
Created September 11, 2022 07:43
FFMPEG convert video to gif
# Convert video to gif file.
# Usage: video2gif video_file (scale) (fps)
video2gif() {
ffmpeg -y -i "${1}" -vf fps=${3:-10},scale=${2:-320}:-1:flags=lanczos,palettegen "${1}.png"
ffmpeg -i "${1}" -i "${1}.png" -filter_complex "fps=${3:-10},scale=${2:-320}:-1:flags=lanczos[x];[x][1:v]paletteuse" "${1}".gif
rm "${1}.png"
}
@YuanLiou
YuanLiou / .zshrc
Last active September 23, 2024 09:49
Ray's zsh config 1.0.2
# Function
function showLogs {
git log --pretty=format:'- %s' --since="$1" --author="$2"
}
# Convert video to gif file.
# Usage: video2gif video_file (scale) (fps)
video2gif() {
ffmpeg -y -i "${1}" -vf fps=${3:-10},scale=${2:-320}:-1:flags=lanczos,palettegen "${1}.png"
ffmpeg -i "${1}" -i "${1}.png" -filter_complex "fps=${3:-10},scale=${2:-320}:-1:flags=lanczos[x];[x][1:v]paletteuse" "${1}".gif
@YuanLiou
YuanLiou / hilt_scope_sample05.kt
Created April 28, 2022 10:52
Hilt Scope Sample 05
@InstallIn(SingletonComponent::class)
@Module
abstract class MyModule {
@Singleton
@Binds
abstract fun bindingFunction(myImpl: MyInterfaceImpl) : MyInterface
}
@YuanLiou
YuanLiou / hilt_scope_sample04.kt
Created April 28, 2022 10:51
Hilt Scope Sample 04
@Module
@InstallIn(SingletonComponent::class)
object NetworkModule {
@Provides
@Singleton
fun provideRetrofit(): Retrofit {
return Retrofit.Builder()
.baseUrl("https://sample.com")
.build()
}
@YuanLiou
YuanLiou / hilt_scope_sample03.kt
Created April 28, 2022 10:51
Hilt Scope Sample 03
@Module
@InstallIn(SingletonComponent::class)
object NetworkModule {
@Provides
fun provideRetrofit(): Retrofit {
return Retrofit.Builder()
.baseUrl("https://sample.com")
.build()
}
}
@YuanLiou
YuanLiou / hilt_scope_sample02.kt
Created April 28, 2022 10:50
Hilt scope sample 02
@Singleton
class MyCustomManager @Inject constructor() {
// 省略內容
}
@YuanLiou
YuanLiou / hilt_scope_sample.kt
Created April 28, 2022 10:49
hilt scope sample
class MyCustomManager @Inject constructor() {
// 省略內容
}