scripts : some script added

This commit is contained in:
2024-08-26 13:39:36 +09:00
parent 0df06aef69
commit 054cea8511
3 changed files with 40 additions and 0 deletions

16
scripts/color_test.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# Based on: https://gist.github.com/XVilka/8346728
awk -v term_cols="${width:-$(tput cols || echo 80)}" 'BEGIN{
s="/\\";
for (colnum = 0; colnum<term_cols; colnum++) {
r = 255-(colnum*255/term_cols);
g = (colnum*510/term_cols);
b = (colnum*255/term_cols);
if (g>255) g = 510-g;
printf "\033[48;2;%d;%d;%dm", r,g,b;
printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
printf "%s\033[0m", substr(s,colnum%2+1,1);
}
printf "\n";
}'

21
scripts/merge_all_files.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
if [ "$#" -ne 3 ]; then
echo "Usage : ./merge_all_files.sh [dir] [pattern] [file]"
exit
fi
pushd $1
find . -type f -name "*.$2" -exec sh -c 'cat "{}"' >> $3 \;
popd
# files=()
# while IFS= read -r -d $'\0'; do
# files+=("$REPLY")
# done < <(find . -type f -name "*.$1" -print0)
# echo $files
# for file in files; do
# echo $file
# done

3
scripts/take_screenshot.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
scrot -e 'xclip -selection clipboard -t image/png -i $f'