This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class KahnsAlgorithm { | |
public static void main(String[] args) { | |
// Graph representation (adjacency list) | |
List<List<Integer>> adjList = new ArrayList<>(); | |
for (int i = 0; i < 4; i++) { | |
adjList.add(new ArrayList<>()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Map; | |
public class TemplateStringReplacer { | |
public static String createStringFromTemplate(Map<String, Integer> map, String template) { | |
StringBuilder stringBuilder = new StringBuilder(); | |
String[] elements = template.split("%"); | |
for (String element : elements) { | |
if (element.equals("_")) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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<>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tasks.withType<Test>().all { | |
testLogging { | |
events("passed", "skipped", "failed") | |
outputs.upToDateWhen { false } | |
showStandardStreams = true | |
} | |
maxParallelForks = Runtime.getRuntime().availableProcessors().div(2).coerceAtLeast(1) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
liou.rayyuan.ebooksearchtaiwan.debug | |
https://taiwan-ebook-lover.github.io/searches/mA8m91o8ylnY9hIGzQDL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |