Skip to content

Instantly share code, notes, and snippets.

@miy4
miy4 / botw-en-ja.tsv
Last active June 19, 2023 09:34
ゼルダの伝説 ブレス オブ ザ ワイルド 英日対訳表
??? 不思議な声
Acorn どんぐり
Agus パラガス
Aji アジテータ
Akrah オラク
Album アルバム
Aliza イライザ
Amali ハミラ
Amber コハク
Amber Earrings コハクの耳飾り
@miy4
miy4 / print_distro_logo.bash
Created December 22, 2022 00:57
Print a list of distro logos by neofetch
#!/bin/bash
source /usr/bin/neofetch 2>&1 >/dev/null
typeset -f get_distro_ascii | \
grep -E '^\s+".*)$' | \
grep -oP '".*?"' | \
while read -r line; do
printf '%s\n' "$line"
neofetch -L --ascii_distro "${line:1:-1}"
done
@miy4
miy4 / print-unicode-codepoint.bash
Created November 16, 2021 01:52
Print Unicode codepoint in Bash
#!/bin/bash
# http://mywiki.wooledge.org/BashFAQ/071
# > If the leading character is a single-quote or double-quote,
# > the value shall be the numeric value in the underlying codeset
# > of the character following the single-quote or double-quote.
printf 'U+%04x\n' "'a"
printf 'U+%04x\n' "'あ"
@miy4
miy4 / bash-join-elements.bash
Created November 16, 2021 01:23
Joining elements of an array in Bash
#!/bin/bash
fruits=('apple' 'orange' 'banana')
printf '%s\n' "${fruits[*]}"
@miy4
miy4 / no-more-param-expansion.md
Created November 14, 2021 17:09
ヒアドキュメントでパラメータ展開を避けたい

ヒアドキュメント内の$なんとかは展開してほしくない

下記のようになりがちだけど、展開してほしくない時はどうしようか。

$ cat > a.txt << _EOF_
$HOME
_EOF_
$ cat a.txt
/home/miy4

WSL2のディスクサイズを最適化する

クリーンアップ

不要なファイルは削除する。

% docker system prune
% podman system prune
% paru -Sc
@miy4
miy4 / main.go
Created November 5, 2021 00:54
FLAC metadata parsing in Go
package main
// https://xiph.org/flac/format.html
// https://www.xiph.org/vorbis/doc/v-comment.html
import (
"encoding/binary"
"errors"
"fmt"
"io"
@miy4
miy4 / hollow_knight_en_ja.txt
Last active August 31, 2021 09:23
Hollow Knight 対訳表
Charmed チャームビギナー
Enchanted チャームコレクター
Blessed チャームマスター
Protected 仮面の守り
Masked 仮面の化身
Soulful ソウルの守り
Worldsoul ソウルの化身
Falsehood 偽り
Test of Resolve 決意が問われるとき
Illumination イルミネーション
@miy4
miy4 / date_usage.bash
Last active April 29, 2021 22:45
List examples of GNU Coreutils date
#!/bin/bash
source_user_defined() {
readonly cmds=(
'date +%Y/%m/%d'
'date +"%Y/%m/%d %T"'
'date +"%Y/%-m/%-d (%a)"'
'LC_ALL=C date +"%Y/%-m/%-d (%a)"'
'LC_ALL=ja_JP.utf8 date +"%EY"'
"date --date @$(date +%s)"
@miy4
miy4 / timezone.bash
Created April 27, 2021 13:36
List all time zones and local times
#!/bin/bash
main() {
local -r now=$(date +%s)
find /usr/share/zoneinfo -type d -name right -prune \
-o -type d -name posix -prune \
-o -type f -print | while read -r f; do
if [[ $(head -c 4 "$f") != TZif ]]; then
continue
fi