Doodling in my bashrc.

This commit is contained in:
Julien Palard 2023-12-01 14:53:15 +01:00
parent dbe2ef1ba8
commit 78cf9887a5
Signed by: mdk
GPG Key ID: 0EFC1AC1006886F8
1 changed files with 22 additions and 3 deletions

25
.bashrc
View File

@ -145,7 +145,7 @@ urlencode()
# Removes *~ and #*# files in curent folder, for a depth limited to 3 folders. # Removes *~ and #*# files in curent folder, for a depth limited to 3 folders.
clean() clean()
{ {
find -maxdepth 3 \ find -maxdepth 4 \
\( -name '*~' -o -name '#*#' -o -name .tox -o -name .mypy_cache \) \ \( -name '*~' -o -name '#*#' -o -name .tox -o -name .mypy_cache \) \
-print0 | xargs -0 rm -vfr -print0 | xargs -0 rm -vfr
} }
@ -170,9 +170,16 @@ wyz()
curl https://wyz.fr/ -F"${1##*.}=@$1" curl https://wyz.fr/ -F"${1##*.}=@$1"
} }
code-block()
{
printf '```%s\n' "$1"
cat
printf '```\n'
}
paf() paf()
{ {
local SECRET="eek8sohxa1quaeghee1I" local SECRET="$(pass paf)"
local AUTH="-HAuthorization: Secret $SECRET" local AUTH="-HAuthorization: Secret $SECRET"
local INSTANCE="https://p.afpy.org/" local INSTANCE="https://p.afpy.org/"
@ -206,7 +213,8 @@ venv()
cat >.envrc <<EOF cat >.envrc <<EOF
if ! [[ -d .venv ]]; then if ! [[ -d .venv ]]; then
echo "Creating venv..." echo "Creating venv..."
python$1 -m venv .venv # --system-site-packages so from inside venv I access global pylint/flake8/...
python$1 -m venv --system-site-packages .venv
fi fi
PATH=$(pwd)/.venv/bin/:\$PATH PATH=$(pwd)/.venv/bin/:\$PATH
EOF EOF
@ -250,3 +258,14 @@ digns()
done done
dig "@$(dig NS "$SOA" +short | head -n 1)" "$@" dig "@$(dig NS "$SOA" +short | head -n 1)" "$@"
} }
compress-video()
{
local IFILE="$1"
local OFILE="${IFILE%.*}".m4v
HandBrakeCLI -Z "Fast 720p30" -i "$IFILE" -o "$OFILE"
ls -lah "$IFILE" "$OFILE"
cp -a --attributes-only "$IFILE" "$OFILE"
rm -i "$IFILE"
}