Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
Slow to respond

eggplants

🐢
Slow to respond
View GitHub Profile
@eggplants
eggplants / ans.csv
Last active May 8, 2023 07:36
Shellgei Online Judge 回答 1~16 - https://shellgei-online-judge.com/
View ans.csv
problemNum shellgei
00000001 echo test
00000002 echo $(<input.txt)
00000003 seq 10
00000004 awk '{a=0;for(i=1;i<=NF;){a+=$(i++)}print a}' input.txt
00000005 j=1;for i in {0..10};do echo ${f:-0};((k=f+j,f=j,j=k));done
00000006 bc -l<<<'4*a(1)'|cut -b-12
00000007 bc -l<<<'scale=999;4*a(1)'|tr -d '\\\\\n'|cut -b-102
00000008 awk '{print x=$1-(y=$2/2-$1),y}' input.txt
00000009 sed -zr 's/([^\n])\n([^\n])/\1@\2/g' input.txt|sort -rV|while read i;do [ -n "$i" ]&&echo $i$'\n'|tr @ \\n;done|sed \$d
@eggplants
eggplants / ruby.sh
Last active April 14, 2023 04:32
ルビ
View ruby.sh
#!/usr/bin/env bash
if ! command -v mecab nkf &>/dev/null
then
echo "install: mecab nkf" >&1
exit 1
fi
read -r input
@eggplants
eggplants / awesome-2022-GB27001.md
Last active February 17, 2023 14:02
list of minis implementation
@eggplants
eggplants / setup-mac-minimal.sh
Last active February 2, 2023 04:49
2022/02/02
View setup-mac-minimal.sh
#!/usr/bin/env bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
curl -sSL https://install.python-poetry.org | python3 -
poetry completions zsh > ~/.zfunc/_poetry
brew tap homebrew/cask-fonts
brew install alacritty byobu pyenv starship nano font-hack-nerd-font
cat <<'A'>~/.zshrc
@eggplants
eggplants / nanorc_repos.md
Last active December 11, 2022 17:23
List of online `*.nanorc`-hosting repositories -- `*.nanorc` is a syntax-highlight configuration file for GNU Nano Editor
View nanorc_repos.md

Online *.nanorc-hosting repositories

Created: 2022-12-12

View baby.md
sequenceDiagram
    autonumber
    actor 男女
    participant suzume as スズメ
    participant kounotori as コウノトリ
    男女->>男女: セックス
    suzume->>男女: セックス確認
    suzume->>kounotori: 連絡
 kounotori-&gt;&gt;kounotori: セックス
@eggplants
eggplants / jgquery.sh
Last active July 13, 2022 22:09
常用漢字で、新字体の画数 < 異字体の画数のものを抽出 (元: https://gist.github.com/mandel59/8a7cd6cca228723e248d5fccbd41e69a )
View jgquery.sh
#!/usr/bin/env bash
if ! command -v awk git grep sed wget &> /dev/null; then
echo "install: awk, git, grep, sed, wget"
exit 1
fi
[ -f joyo2010.txt ] || wget https://raw.githubusercontent.com/cjkvi/cjkvi-tables/master/joyo2010.txt
[ -f ucs-strokes.txt ] || wget https://raw.githubusercontent.com/cjkvi/cjkvi-ids/master/ucs-strokes.txt
@eggplants
eggplants / learnNim.ja.nim
Last active July 3, 2022 12:31
Learn Nim in 5 minutes ( https://learnxinyminutes.com/docs/nim , accessed-at: 2022-06-26) の日本語訳
View learnNim.ja.nim
# 一行だけのコメントは `#` から始まります。
#[
これは複数行のコメントです。
Nimでは、複数行のコメントはネスト可能で、#[ に始まり
... ]# に終わります。
]#
discard """
これでも複数行のコメントとして機能します。
View obo
⢀⣀⣀⣀⣈⣿⣀⣀⠀⠀⠀⠀⠀⢀⣴⡿⠂⠀⠀⢶⠶⠶⢶⣶⠆
⠈⠉⠉⣩⡿⣿⠉⠉⠀⢀⣠⣤⡾⣿⠁⠀⠀⠀⠀⠀⠀⢀⣾⠏
⢀⣠⣾⠛⠀⣿⠀⠀⠀⠘⠋⠁⠀⣿⠀⠀⠀⠀⠀⢀⣴⡿⠻⢷⣄
⠈⠋⠀⠀⠀⠿⠀⠀⠀⠀⠀⠀⠀⠿⠀⠀⠀⠀⠸⠟⠁⠀⠀⠈⠻⠃
    ⣀⡤⠴⠔⠒⠚⠚⠚⠚⠚⠚⠒⠴⢄⡀
 ⢀⡴⠊⠁  ⠀⠀⠀⠀⠀⠀⠀⣀⣀ ⡀⠙⢦⡀
⣠⠋⠀ ⠀⠀ ⠀⠀⠀⠀⠀⣠⠞⠁⠁⠉⠙⢢⡀⠙⣄
⢰⠃⣰⠚⠉⠉⠉⠓⢦⡀⠀⠀⢰⠃⠀⠀⠀⠀⠀⠀⢹⠀⠈⢆
⢸⠀⡇⠀⠀⠀⠀⠀⠀⠙⣆⠀⠸⡄⠀⠀⠈⠀⠀⠀⠨⡇⠀⠘⣇⠀
⠘⡆⡇⠀⠀⠀⠈⠀⠀⠀⢸⠀⠀⠙⠦⣀⣀⢀⣀⣀⣨⠃⠀⠀⠸⡄
@eggplants
eggplants / dedent.bash
Created June 25, 2022 19:24
De-indent in Bash like Python's textwrap.dedent
View dedent.bash
#!/usr/bin/env bash
function dedent() {
local src min
src="$(expand -t 2 -)" # 1 tab = 2 spaces
if [ -z "$src" ]; then
echo "dedent: input is empty." >&2
return 1
fi
min="$(