diff --git a/README.md b/README.md deleted file mode 100644 index ab573db..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# _dump - -a pile of shell script too small to get their own repos \ No newline at end of file diff --git a/bak-current.sh b/bak-current.sh new file mode 100755 index 0000000..2f12537 --- /dev/null +++ b/bak-current.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env zsh + +BAK="/mnt/self-files" +if [ ! -z "$1" ]; then + BAK="$1" +fi + + +cd `realpath "$0" | xargs dirname` +./bak-home.sh "$BAK/Home_bak" + +cp /home/dym/.config/doublecmd/doublecmd.xml \ + /Cfg/doublecmd/ + +DIRS=( + _ + Apps + Cfg + home/dym/.privat +) +for DIR in "${DIRS[@]}"; do + echo "- +- +# '$DIR'" + sudo \ + rsync -zrhP --links --size-only --verbose --delete \ + --exclude '**/.Trash-1000' \ + --exclude '**/__sapper__/' \ + --exclude '**/node_modules/' \ + --exclude '**/target/' \ + "/$DIR/" \ + "$BAK/${DIR}" +done + +echo "- +- +# '.privat'" +sudo \ +rsync -zrhP --links --size-only --verbose --delete \ + "/home/dym/.privat/" \ + "$BAK/.privat" diff --git a/bak-current_to_archive.sh b/bak-current_to_archive.sh new file mode 100755 index 0000000..3f80991 --- /dev/null +++ b/bak-current_to_archive.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env zsh + +BAK="/Data/_bak" + + +# restic init '/home/dym/.privat' \ +# -p '/home/dym/.privat/restic/p.txt' \ +# -r "$BAK/.privat" + +restic backup '/home/dym/.privat' \ + -p '/home/dym/.privat/restic/p.txt' \ + -r "$BAK/.privat" + + +cd `realpath "$0" | xargs dirname` +./bak-home "$BAK/Home_nix" + + +sudo \ +rsync -zrhP --links --size-only --verbose --delete \ + --exclude '**/.Trash-1000' \ + --exclude '**/__sapper__/' \ + --exclude '**/node_modules/' \ + --exclude '**/target/' \ + "/Servers/self-files/My/" \ + "/Data/_my" + + +# sudo \ +# rsync -zrhP --links --size-only --verbose --delete \ +# --exclude '**/.Trash-1000' \ +# --exclude '**/__sapper__/' \ +# --exclude '**/node_modules/' \ +# --exclude '**/target/' \ +# "/Work/" \ +# "$BAK/work-CURRENT" + + +DIRS=( + Apps + Books + Cfg + Code + Img + Music + Ui +) +for DIR in "${DIRS[@]}"; do + echo "- +- +# '$DIR'" + sudo \ + rsync -zrhP --links --size-only --verbose --delete \ + --exclude '**/.Trash-1000' \ + --exclude '**/__sapper__/' \ + --exclude '**/node_modules/' \ + --exclude '**/target/' \ + "/Servers/self-files/$DIR/" \ + "$BAK/${DIR}" +done + + +echo "- +- +# '.fonts'" +sudo \ +rsync -zrhP --links --size-only --verbose --delete \ + --exclude '**/.Trash-1000' \ + --exclude '**/__sapper__/' \ + --exclude '**/node_modules/' \ + --exclude '**/target/' \ + "/home/dym/.fonts/" \ + "$BAK/Fonts" diff --git a/bak-data.sh b/bak-data.sh new file mode 100755 index 0000000..ffc419b --- /dev/null +++ b/bak-data.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env zsh + +BAK="/media/data_bak" +if [ ! -z "$1" ]; then + BAK="$1" +fi + +DIRS=( + Apps_andr + Apps_deb + Apps_wnd + Audio + Books + Bugs + Code + Drivers + Fonts + Img + Iso + Music + Posts + Texts + Video +) +for DIR in "${DIRS[@]}"; do + echo "- +- +# '$DIR'" + sudo \ + rsync -zrhP --links --size-only --verbose --delete \ + --exclude '**/.Trash-1000' \ + "/Data/${DIR}/" \ + "$BAK/${DIR}" +done diff --git a/bak-home.sh b/bak-home.sh new file mode 100755 index 0000000..d475758 --- /dev/null +++ b/bak-home.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env zsh + +# home.sh +BAK='/Data/_bak/Home_nix' +if [ ! -z "$1" ]; then + BAK="$1" +fi + +echo "BAK: backing up '$HOME' to '$BAK'" + +rsync -rhP --links --size-only --verbose --delete \ + --exclude '**/.Trash-1000/' \ + --exclude '**/*.log' \ + --exclude '**/*.part' \ + --exclude '**/*~' \ + --exclude '**/hyphen-data/' \ + --exclude '**/logs/' \ + --exclude '**/node_modules/' \ + --exclude '**/storage/default/' \ + --exclude '**/datareporting/' \ + --exclude '.android/' \ + --exclude '.bun/' \ + --exclude '.cabal/' \ + --exclude '.cache/' \ + --exclude '.cargo/' \ + --exclude '.cinnamon/' \ + --exclude '.config/agregore-browser/' \ + --exclude '.config/chromium/' \ + --exclude '.config/Code/Cache*' \ + --exclude '.config/Code/Crashpad/' \ + --exclude '.config/Code/Service Worker/' \ + --exclude '.config/Code/User/History/' \ + --exclude '.config/Code/User/workspaceStorage/' \ + --exclude '.config/google-chrome-unstable/' \ + --exclude '.config/google-chrome/' \ + --exclude '.config/vivaldi/' \ + --exclude '.config/xnviewmp/' \ + --exclude '.deno/' \ + --exclude '.docker/' \ + --exclude '.electron-gyp/' \ + --exclude '.figma/' \ + --exclude '.fonts/' \ + --exclude '.gnome/' \ + --exclude '.gnupg/' \ + --exclude '.gphoto/' \ + --exclude '.gradle/' \ + --exclude '.java/' \ + --exclude '.linuxmint/' \ + --exclude '.local/share/lutris' \ + --exclude '.local/share/Trash' \ + --exclude '.nix-defexpr' \ + --exclude '.nix-profile' \ + --exclude '.node/' \ + --exclude '.npm/' \ + --exclude '.nv/' \ + --exclude '.pipupgrade/' \ + --exclude '.pki/' \ + --exclude '.privat/' \ + --exclude '.Private/' \ + --exclude '.pub-cache/' \ + --exclude '.rustup/' \ + --exclude '.ssh' \ + --exclude '.steam*' \ + --exclude '.thunderbird' \ + --exclude '.zoom/' \ + --exclude 'Android/' \ + --exclude 'FontBase/' \ + --exclude 'Games/' \ + --exclude 'Cfg/' \ + --exclude 'Desktop/' \ + --exclude 'Inbox/' \ + --exclude 'My Games/' \ + --exclude 'go/' \ + --exclude 'Private/' \ + --exclude 'snap/' \ + --exclude 'Steam/' \ + --exclude 'Servers/' \ + --exclude 'tmp/' \ + "/home/dym/" \ + "$BAK" diff --git a/device-info.sh b/device-info.sh new file mode 100755 index 0000000..05d4a22 --- /dev/null +++ b/device-info.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env zsh + +# devices info +sudo apt install -y \ + hddtemp lm-sensors + + +sudo hddtemp /dev/sd* + +sudo sensors-detect +sudo sensors + + + +free -h + +sensors + +sudo hddtemp SATA:/dev/sda +sudo hddtemp SATA:/dev/sdb +sudo hddtemp SATA:/dev/sdc +sudo hddtemp SATA:/dev/sdd + + +# hdd details +iostat -dx /dev/sd* diff --git a/devices-report.sh b/devices-report.sh new file mode 100755 index 0000000..bb78b2d --- /dev/null +++ b/devices-report.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env zsh + +echo -e "Subject: server report on $(date -u '+%Y-%m-%d @ %H:%M:%S')\n\n" \ + > ~/devinfo.txt + +free -h \ + >> ~/devinfo.txt + +df -H \ + >> ~/devinfo.txt + +iostat -dx /dev/sd* \ + >> ~/devinfo.txt + +cat ~/devinfo.txt \ + | sendmail \ + -v server@dym.sh diff --git a/disable-power-button.sh b/disable-power-button.sh new file mode 100755 index 0000000..745f7d8 --- /dev/null +++ b/disable-power-button.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env zsh + +# power button +gsettings set org.gnome.settings-daemon.plugins.power button-sleep "nothing" +gsettings set org.gnome.settings-daemon.plugins.power button-suspend "nothing" +gsettings set org.gnome.settings-daemon.plugins.power button-hibernate "nothing" diff --git a/files_date_sort.sh b/files_date_sort.sh new file mode 100755 index 0000000..e28b5fc --- /dev/null +++ b/files_date_sort.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env zsh + +MONTHS=( 01 02 03 04 05 06 07 08 09 10 11 12 ) + +for Y in `( /bin/ls /Ui )`; do + cd /Ui/$Y/ + echo "'/Ui/$Y'" + + for M in $MONTHS; do + mkdir -p ./$M/ + echo "'/Ui/$Y/$M/'" + + mv ./*$Y-$M* ./$M/ + mv ./*$Y$M* ./$M/ + done + +done diff --git a/files_date_sort_ui_unsorted.sh b/files_date_sort_ui_unsorted.sh new file mode 100755 index 0000000..b503548 --- /dev/null +++ b/files_date_sort_ui_unsorted.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env zsh + +MONTHS=( 01 02 03 04 05 06 07 08 09 10 11 12 ) + +cd /Ui/_un/ + +for Y in `( /bin/ls /Ui )`; do + + for M in $MONTHS; do + mkdir -p "/Ui/$Y/$M/" + echo "'/Ui/$Y/$M/'" + + mv /Ui/_un/*$Y-$M* /Ui/$Y/$M/ + mv /Ui/_un/*$Y$M* /Ui/$Y/$M/ + done + +done diff --git a/heic.sh b/heic.sh new file mode 100755 index 0000000..d6ea17b --- /dev/null +++ b/heic.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env zsh + +for f in "$@" +do + echo "Converting $f ..." + heif-convert $f "$f-$(date +\%Y-\%m-\%d@\%H-\%M).jpg" +done \ No newline at end of file diff --git a/hourly-backup.sh b/hourly-backup.sh new file mode 100755 index 0000000..db4b279 --- /dev/null +++ b/hourly-backup.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash + +bpath="/backup_new" + +db_name='' +db_login='' +db_pass='' + +db_name2='' +db_login2='' +db_pass2='' + + +[ ! -d "$bpath/day" ] \ + && mkdir -p "${bpath}/day" +[ ! -d "$bpath/week" ] \ + && mkdir -p "${bpath}/week" +[ ! -d "$bpath/month" ] \ + && mkdir -p "${bpath}/month" +[ ! -d "$bpath/year" ] \ + && mkdir -p "${bpath}/year" + + +year=`date +"%Y"` +month=`date +"%m"` +day=`date +"%d"` +time=`date +"%H-00"` + +date="${year}-${month}-${day}" +tmp_short="b_${date}_${time}" +tmp_full="${bpath}/${tmp_short}" + +mkdir -p "$tmp_full" + + +mysqldump -u "$db_login" -p"$db_pass" --databases "$db_name" \ + > "${tmp_full}/bu_${db_name}__${date}_${time}.sql" + +mysqldump -u "$db_login2" -p"$db_pass2" --databases "$db_name2" \ + > "${tmp_full}/bu_${db_name2}__${date}_${time}.sql" + + +archive="${tmp_full}.tar.gz" +cd "$bpath" +tar -czf "$archive" "$tmp_short" + + +ln "$archive" "${bpath}/day/" + +if [ "$time" == "00-00" ] +then + ln "$archive" "${bpath}/week/" + + if [ "$day" == "01" ] + then + ln "$archive" "${bpath}/month/" + + if [ "$month" == "01" ] + then + ln "$archive" "${bpath}/year/" + fi + fi +fi + +if [ "$time" == "02-00" ] +then + scp -rp \ + -i ~/.ssh/backup+ \ + "$archive" \ + 'backup@:/b_incoming/' +fi + + +rm $archive +rm -rf "$tmp_full" + +find ${bpath}/day/* -mtime +1 -exec rm {} \; +find ${bpath}/week/* -mtime +7 -exec rm {} \; +find ${bpath}/month/* -mtime +365 -exec rm {} \; diff --git a/kk.sh b/kk.sh new file mode 100755 index 0000000..bd1e60f --- /dev/null +++ b/kk.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env zsh + +kill -9 `ps aux | grep "$1" | awk '{print $2}'` \ No newline at end of file diff --git a/off.sh b/off.sh new file mode 100755 index 0000000..6ff59cb --- /dev/null +++ b/off.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# off + +sudo systemctl stop mysql +sudo shutdown now diff --git a/opti.sh b/opti.sh new file mode 100755 index 0000000..eee9307 --- /dev/null +++ b/opti.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env zsh + +# optimize png and jpg files + +calc_reduction() +{ + SIZE_PRE="$1" + SIZE_POST="$2" + PERECENT=` echo "scale=2; 100 - (100 * $SIZE_POST / $SIZE_PRE)" | bc ` + RESULT="$(( $SIZE_PRE / 1000 ))-$(( ( $SIZE_PRE - $SIZE_POST ) / 1000 )) kb \ +($PERECENT%) +" + echo " $RESULT" +} + +for FILENAME in "$@" +do + FILETYPE=` file -b --mime-type "$FILENAME" ` + echo "$FILENAME : $FILETYPE" + + SIZE_PRE=` stat "$FILENAME" -c '%s' ` + + case "$FILETYPE" in + 'image/png') + mogrify "$FILENAME" + pngcrush -nolimits -s "$FILENAME" "$FILENAME.tmp.png" + if [ -f "$FILENAME.tmp.png" ] \ + && [ -s "$FILENAME.tmp.png" ] + then + mv "$FILENAME.tmp.png" "$FILENAME" + else + rm "$FILENAME.tmp.png" + fi + ;; + + 'image/jpeg') + jpegoptim "$FILENAME" -qsftp + ;; + esac + + SIZE_POST=` stat "$FILENAME" -c '%s' ` + [ $SIZE_PRE -gt $SIZE_POST ] \ + && echo ` calc_reduction "$SIZE_PRE" "$SIZE_POST" ` +done diff --git a/pdf-slice.sh b/pdf-slice.sh new file mode 100755 index 0000000..c5c6811 --- /dev/null +++ b/pdf-slice.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env zsh + +for PAGE in {1..25};do + gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \ + -dFirstPage=$PAGE -dLastPage=$PAGE \ + -sOutputFile=p_$PAGE.pdf all.pdf +done + +gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \ + -sOutputFile=crit_2.pdf \ + p_{5..7}.pdf + +gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \ + -sOutputFile=crit_3.pdf \ + p_{8..9}.pdf + +gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \ + -sOutputFile=crit_4.pdf \ + p_{11..16}.pdf diff --git a/prtwnd.sh b/prtwnd.sh new file mode 100755 index 0000000..ff9c873 --- /dev/null +++ b/prtwnd.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env zsh + +# print screen current window + +WND=`xprop -root \ + | grep '_NET_ACTIVE_WINDOW(WINDOW)' \ + | grep -oE '0x\w+' + ` + +import -window "$WND" \ + "/_/PrtWnd--$(date '+%Y%m%d@%H%M%S').png" diff --git a/purge.sh b/purge.sh new file mode 100755 index 0000000..926a31a --- /dev/null +++ b/purge.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env zsh + +# purge memory +free -h + +echo "clearing memory" +sudo sync +sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' +free -h + + +# clear logs +echo "clearing /var/log" +sudo du -hs /var/log +sudo find /var/log -type f -delete +sudo du -hs /var/log + +# remove temp things +rm -rf /var/lib/systemd/coredump/* + +echo "clearing /etc/apache2/logs" +sudo du -hs /etc/apache2/logs +sudo find /etc/apache2/logs -type f -delete +sudo du -hs /etc/apache2/logs + +rm ~/.xsession-errors* +rm ~/.config/doublecmd/doublecmd.err +rm ~/.mozilla/firefox/Crash\ Reports/ + +# empty trash +rm -rf ~/.local/share/Trash +sudo rm -rf /root/.local/share/Trash/* +sudo rm -rf /[A-Z]*/.Trash-1000 +sudo rm -rf /media/*/.Trash-1000 +sudo rm -rf /media/*/*/.Trash-1000 +sudo rm -rf /mnt/*/.Trash-1000 +sudo rm -rf /mnt/*/*/.Trash-1000 +# rm -rf /_servers/*/.Trash-1000 + +# vacuum firefox +kill -9 firefox +cd ~/.mozilla/firefox/dym/ +find -maxdepth 1 -type f \ + | xargs file -F "" \ + | awk '/SQLite/{print $1}' \ + | xargs -n 1 -I FILE bash -c \ + 'echo Vacuuming $1; sqlite3 $1 "vacuum;"' \ + bash FILE + +#Cleaning the old kernels +dpkg-query -l | grep 'linux-im*' +#dpkg-query -l | grep linux-im* | awk '{print $2}' + +sudo apt-get purge -y $(dpkg -l 'linux-*' \ + | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | head -n -1) \ + --assume-yes + +sudo apt-get install -y linux-headers-`uname -r \ + |cut -d'-' -f3`-`uname -r \ + |cut -d'-' -f4` diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..300e1d4 --- /dev/null +++ b/readme.md @@ -0,0 +1,4 @@ +# _dump + +> a pile of shell script too small to get their own repos + diff --git a/restart.sh b/restart.sh new file mode 100755 index 0000000..e03aaae --- /dev/null +++ b/restart.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env zsh + +# restart + +sudo systemctl stop mysql +sudo shutdown -r now diff --git a/save-cfg.sh b/save-cfg.sh new file mode 100755 index 0000000..1a96ee3 --- /dev/null +++ b/save-cfg.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +rm -rf /Site/config/desktop-ubuntu +sudo cp -r /Cfg /Site/config/desktop-ubuntu +sudo chown -R $USER:$USER /Site/config/desktop-ubuntu/ +cd /Site/config/desktop-ubuntu/ +git add . +shipit diff --git a/sort_out.sh b/sort_out.sh new file mode 100755 index 0000000..16c7837 --- /dev/null +++ b/sort_out.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env zsh + +Y=`date '+%Y'` +M=`date '+%m'` + + +UI_PATH="/Ui/$Y/$M/" +[ ! -d "$UI_PATH" ] \ + && mkdir -p "$UI_PATH" +mv /_/*\[footer*.(jpg|png|gif|webp|avif|svg) "$UI_PATH" +mv /_/*\[fold*.(jpg|png|gif|webp|avif|svg) "$UI_PATH" +mv /_/*\[full*.(jpg|png|gif|webp|avif|svg) "$UI_PATH" +mv /_/*\[menu*.(jpg|png|gif|webp|avif|svg) "$UI_PATH" +mv /_/*\[part*.(jpg|png|gif|webp|avif|svg) "$UI_PATH" +mv /_/*\[section*.(jpg|png|gif|webp|avif|svg) "$UI_PATH" + + +LOGO_PATH="/Img/identity/" +[ ! -d "$LOGO_PATH" ] \ + && mkdir -p "$LOGO_PATH" +mv /_/*\[logo*.(jpg|png|gif|webp|avif|svg) "$LOGO_PATH" + + +COVERS_PATH="/Img/covers/" +[ ! -d "$COVERS_PATH" ] \ + && mkdir -p "$COVERS_PATH" +mv /_/*\[poster*.(jpg|png|gif|webp|avif|svg) "$COVERS_PATH" +mv /_/*\[album*.(jpg|png|gif|webp|avif|svg) "$COVERS_PATH" +mv /_/*\[cover*.(jpg|png|gif|webp|avif|svg) "$COVERS_PATH" + + +IMG_PATH="/Img/$Y/$M/" +[ ! -d "$IMG_PATH" ] \ + && mkdir -p "$IMG_PATH" +mv /_/*.(jpg|png|gif|webp|avif|svg) "$IMG_PATH" + + +DUST_PATH='/Data/Video/yt/@watchdust/' +[ ! -d "$DUST_PATH" ] \ + && mkdir -p "$DUST_PATH" +mv /_/yt-Sci-Fi*.(mp4|webm|mkv) "$DUST_PATH" + + +VID_PATH="/Data/Video/$Y/$M/" +[ ! -d "$VID_PATH" ] \ + && mkdir -p "$VID_PATH" +mv /_/*.(mp4|webm|mkv|mov|3gp|avi|mp2) "$VID_PATH" diff --git a/ssh-keygen.sh b/ssh-keygen.sh new file mode 100755 index 0000000..13bdaf2 --- /dev/null +++ b/ssh-keygen.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +NEW_SSH_EMAIL="$1" + +[ -z "$NEW_SSH_EMAIL" ] \ + && NEW_SSH_EMAIL="rsa-key_$(date +\%Y\%m\%d\%H\%M)" + +ssh-keygen \ + -t rsa -b 4096 \ + -C "$NEW_SSH_EMAIL@dym.sh" \ + -f ~/.ssh/$NEW_SSH_EMAIL + +eval "$(ssh-agent -s)" +ssh-add ~/.ssh/$NEW_SSH_EMAIL diff --git a/to_dec.sh b/to_dec.sh new file mode 100755 index 0000000..8841c43 --- /dev/null +++ b/to_dec.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env zsh + +# convert hexadecimal to base10 + +# #TODO +# - whitespace-separated arguments to corresponding array of values +# (exluding -f/--flags) +# - convert hex-colors[with alpha] to rgb[a]() +# (i.e. "#00FFCC[80]" to "rgba(0, 255, 204[, 0.5])") + + +HEX=`echo "$1" | tr 'a-z' 'A-Z'` +DEC=`echo "obase=10; ibase=16; $HEX" \ + | bc + ` + +if [[ $@ =~ '-v' ]]; then + echo "HEX: '$HEX' +DEC: '$DEC' +" +else + echo "$DEC" +fi diff --git a/to_hex.sh b/to_hex.sh new file mode 100755 index 0000000..664c106 --- /dev/null +++ b/to_hex.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env zsh + +# convert base10 to hexadecimal + +# #TODO +# - whitespace-separated arguments to corresponding array of values +# (exluding -f/--flags) +# - multiple convert arguments to acco +# (i.e. "0 255 204" to "00 FF CC") + + +DEC="$1" +HEX=`echo "obase=16; ibase=10; $DEC" \ + | bc + ` + +if [[ $@ =~ '-v' ]]; then + echo "DEC: '$DEC' +HEX: '$HEX' +" +else + echo "$HEX" +fi diff --git a/to_mp3.sh b/to_mp3.sh new file mode 100755 index 0000000..c1a3547 --- /dev/null +++ b/to_mp3.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env zsh + +# convert to mp3 + +echo "to mp3: [ $@ ]" +for UNCOMPRESSED in "$@" +do + MP3=` echo "$UNCOMPRESSED" \ + | sd '\.\w+$' ' [conv].mp3' \ + ` + echo "'$UNCOMPRESSED'" + echo ">> '$MP3'" + + ffmpeg \ + -i "$UNCOMPRESSED" \ + -codec:a libmp3lame \ + -qscale:a 2 \ + -loglevel quiet \ + -y "$MP3" \ + && \ + rm "$UNCOMPRESSED" +done diff --git a/upd.sh b/upd.sh new file mode 100755 index 0000000..23ec742 --- /dev/null +++ b/upd.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env zsh + + +# oh-my-zsh +cd ~/.oh-my-zsh/ \ + && ./tools/upgrade.sh \ + && cd - + + +# rust & co +rustup update +cargo install-update -a + +# bun +bun upgrade + +# deno +deno upgrade + +# nix +sudo nix-channel --update +sudo nixos-rebuild switch -I nixos-config=$HOME/Cfg/configuration.nix