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 / musical_scales.java
Last active March 30, 2024 06:06
Musical scales
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MusicalScaleGenerator {
private final Map<Integer, List<Integer>> scaleTransitions = new HashMap<>();
private final int TARGET_SUM = 12;
private final List<List<Integer>> validScales = new ArrayList<>();
@YuanLiou
YuanLiou / apple_term_tmux.sh
Created February 17, 2024 08:51
use Tmux only if current term program is Apple Terminal
# use Tmux only if current term program is Apple Terminal
if [ "$TERM_PROGRAM" = 'Apple_Terminal' ]; then
tmux has -t hack &> /dev/null
if [ $? != 0 ]; then
tmux new -s hack
elif [ -z $TMUX ]; then
tmux attach -t hack
fi
fi
@YuanLiou
YuanLiou / .obsidien.vimrc
Created January 1, 2024 07:34
Ray's obsidien vimrc
" Have j and k navigate visual lines rather than logical ones
nmap j gj
nmap k gk
" I like using H and L for beginning/end of line
nmap H ^
nmap L $
" Quickly remove search highlights
nmap <F9> :nohl
@YuanLiou
YuanLiou / ray_wsl_fish.config
Created December 10, 2023 02:21
Ray WSL Fish Settings 1.0
if status is-interactive
# Commands to run in interactive sessions can go here
end
# Misc
set fish_greeting "Hello Fish!"
set TERM "xterm-256color"
# set EDITOR "nvim"
#export LANG=zh_TW.UTF-8
@YuanLiou
YuanLiou / mmpeg.fish
Created June 30, 2023 09:45
mmpeg fish shell
# Optimize mp4
# Usage: optimizeVideo video_file
function optimizeVideo
set video_file $argv[1]
ffmpeg -i "$video_file" -vcodec h264 -acodec mp2 "$video_file.mp4"
end
# Convert video to gif file.
# Usage: video2gif video_file
function video2gif
@YuanLiou
YuanLiou / build.gradle.kts
Created June 15, 2023 03:54
Speed up gradle run unit test
tasks.withType<Test>().all {
testLogging {
events("passed", "skipped", "failed")
outputs.upToDateWhen { false }
showStandardStreams = true
}
maxParallelForks = Runtime.getRuntime().availableProcessors().div(2).coerceAtLeast(1)
}
@YuanLiou
YuanLiou / sample
Created April 22, 2023 08:27
sample
liou.rayyuan.ebooksearchtaiwan.debug
https://taiwan-ebook-lover.github.io/searches/mA8m91o8ylnY9hIGzQDL
@YuanLiou
YuanLiou / disable_emu_sound.sh
Created March 13, 2023 06:46
Disable Emulator sound
#!/bin/bash
find ~/.android/avd -name "config.ini" | while read line
do
awk '!/audio/' $line > tmp
rm $line
mv tmp $line
echo "hw.audioInput = no" >> $line
echo "hw.audioOutput = no" >> $line
done
@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