Compare commits

...

10 Commits

8 changed files with 94 additions and 46 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.venv

View File

@@ -50,7 +50,7 @@ docker images --format='{{.Repository}};{{.Tag}};{{.ID}}' | grep '<none>;<none>'
# Get all used images tag in dir $PATH_ANALYSE
find $PATH_ANALYSE -name 'Dockerfile*' | while read file; do cat $file; echo ''; done | grep -e FROM | cut -d ' ' -f 2 | sed $'s/[^[:print:]\t]//g' | sort -u | xargs -n1 docker pull
# Calculate total docker images size
docker images --format {{.ID}} | xargs -n1 docker inspect | jq '.[0]["Size"]' | paste -sd + | bc | format_bytes_str
docker images --format {{.ID}} | xargs -n1 docker inspect | jq '.[0]["Size"]' | paste -sd + | bc | format_bytes
```
## Remove every user R packages

View File

@@ -1,6 +1,9 @@
#!/usr/bin/env bash
set -e
# Print out escape sequences usable for coloured text on tty.
# shellcheck disable=2016
printf 'Colour escapes are %s\n' '\e[${value};...;${value}m'
printf 'Values 30..37 are \e[33mforeground colours\e[m\n'
printf 'Values 40..47 are \e[43mbackground colours\e[m\n'
@@ -17,17 +20,58 @@ for fgc in {30..37}; do
fgc=${fgc#37} # white
bgc=${bgc#40} # black
vals="${fgc:+$fgc;}${bgc}"
vals="${fgc:+$fgc};${bgc}"
vals=${vals%%;}
seq0="${vals:+\e[${vals}m}"
printf " %-9s" "${seq0:-(default)}"
echo -e -n " ${seq0}TEXT\e[m"
echo -e -n " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
echo -e -n " \e[${vals:+${vals+$vals;}}2mDIM\e[m"
echo -e -n " \e[${vals:+${vals+$vals;}}3mITA\e[m"
echo -e -n " \e[${vals:+${vals+$vals;}}4mUND\e[m"
echo -e -n " \e[${vals:+${vals+$vals;}}5mBLI\e[m"
echo -en " ${seq0}TEXT\e[m"
echo -en " \e[${vals:+${vals+$vals}};1mBOLD\e[m"
echo -en " \e[${vals:+${vals+$vals}};2mDIM\e[m"
echo -en " \e[${vals:+${vals+$vals}};3mITA\e[m"
echo -en " \e[${vals:+${vals+$vals}};4mUND\e[m"
echo -en " \e[${vals:+${vals+$vals}};5mBLI\e[m"
done
echo; echo
done
rainbowColor() {
local h=$(($1 / 43))
local f=$(($1 - 43 * h))
local t=$((f * 255 / 43))
local q=$((255 - t))
if [ $h -eq 0 ]
then
echo "255 $t 0"
elif [ $h -eq 1 ]
then
echo "$q 255 0"
elif [ $h -eq 2 ]
then
echo "0 255 $t"
elif [ $h -eq 3 ]
then
echo "0 $q 255"
elif [ $h -eq 4 ]
then
echo "$t 0 255"
elif [ $h -eq 5 ]
then
echo "255 0 $q"
else
# execution should never reach here
echo '0 0 0'
fi
}
rf(){ echo "$1" 0 0; }; gf(){ echo 0 "$1" 0; }; bf(){ echo 0 0 "$1"; }
for f in rf gf bf rainbowColor; do
for s in "$(seq 0 127)" "$(seq 255 -1 128)"; do
for i in $s; do
# shellcheck disable=2183,2046
printf '\x1b[48;2;%s;%s;%sm ' $($f "$i")
done
echo -en "\x1b[0m\n"
done
done

9
compare_world.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
set -e
rsync mainpc:/var/lib/portage/world /tmp/mainpc
rsync streampc:/var/lib/portage/world /tmp/streampc
cp /var/lib/portage/world /tmp/framework
exec nvim -d /tmp/framework /tmp/mainpc /tmp/streampc

View File

@@ -44,7 +44,7 @@ if ! rc-service docker status > /dev/null; then
return 1
fi
build /home/_aspil0w/git/3d-playground
build /home/_aspil0w/git/Byron
build /home/_aspil0w/git/CoverLetter
build /home/_aspil0w/git/CurriculumVitae
build /home/_aspil0w/git/dotfiles
@@ -52,7 +52,6 @@ build /home/_aspil0w/git/ESP32Manager
build /home/_aspil0w/git/haskell_playground
build /home/_aspil0w/git/IntershipReport
build /home/_aspil0w/git/notebook
build /home/_aspil0w/git/workspace/personnal_projects/ollama-webui
build /home/_aspil0w/git/portfolio no_ssl
build /home/_aspil0w/git/portfolio_ivo no-ssl
build /home/_aspil0w/git/SimpleGradientDescent

View File

@@ -1,5 +1,7 @@
#!/bin/sh
set -e
__r__(){
end="$1"
for _ in $(seq 1 "$end"); do

View File

@@ -1,5 +1,7 @@
#!/bin/sh
set -e
__r__(){
end="$1"
for _ in $(seq 1 "$end"); do

View File

@@ -1,40 +1,31 @@
#!/bin/sh
set -e
repeat_char(){
end="$1"
for _ in $(seq 1 "$end") ; do
printf '%s' "$2";
done
}
header(){
env printf "$(repeat_char 150)┐\n"
env printf '│ %-148s │\n' "$1"
env printf "$(repeat_char 150 '─')┘\n"
}
VENV_PATH='./.venv'
update(){
fd requirements.txt ~ | while read -r filename; do
echo "Updating : $filename"
python -m venv --upgrade-deps "$VENV_PATH"
if [ -f "$VENV_PATH"/Scripts/activate ]; then . "$VENV_PATH"/Scripts/activate
elif [ -f "$VENV_PATH"/bin/activate ]; then . "$VENV_PATH"/bin/activate
else exit 1; fi
grep -e '^[^#]' "$filename" | cut -d = -f 1 | xargs pip install -U
TEMP_FILE=$(mktemp)
pip freeze | grep -E "($(grep -e '^[^#]' "$filename" | cut -d = -f 1 | paste -sd \|))=" > "$TEMP_FILE"
nvim -d "$filename" "$TEMP_FILE"
deactivate
rm -rf "$VENV_PATH" "$TEMP_FILE"
done
}
download(){
python -m venv --upgrade-deps "$VENV_PATH"
if [ -f "$VENV_PATH"/Scripts/activate ]; then . "$VENV_PATH"/Scripts/activate
elif [ -f "$VENV_PATH"/bin/activate ]; then . "$VENV_PATH"/bin/activate
else exit 1; fi
fd requirements.txt ~ | while read -r filename; do
echo "Downloading : $filename"
grep -e '^[^#]' "$filename" | cut -d = -f 1 | xargs pip download
rm *.whl
done
deactivate
rm -rf "$VENV_PATH"
}
update
python -m venv --upgrade-deps "$VENV_PATH"
# shellcheck disable=1091
if [ -f "$VENV_PATH"/Scripts/activate ]; then . "$VENV_PATH"/Scripts/activate
elif [ -f "$VENV_PATH"/bin/activate ]; then . "$VENV_PATH"/bin/activate
else exit 1; fi
pip install --disable-pip-version pur
fd requirements.txt ~ | while read -r filename; do
header "$(realpath "$filename" | sed "s,$HOME,~,")"
pur -r "$filename"
done
deactivate
rm -rf "$VENV_PATH"