===== Various useful tools =====
==== Userfull list ====
* [[man>parallel]]
* [[en:tools:linux:misc-tools#screenshots|screenshots]]
* [[man>grim]]
* [[man>slurp]]
* [[man>wl-copy]]
* [[man>swappy]]
* [[man>flameshot]]
* [[en:tools:linux:file-handling|File Handling]]
* 3D-2D
* [[man>cura]]
* [[man>openscad]]
* [[man>freecad]]
* [[man>gimp]]
* [[man>inkscape]]
* Dev
* [[man>base-devel]]
* [[man>git]]
* [[man>cmake]]
* Network
* [[man>nethogs]]
* [[man>nmap]]
* [[man>mosh]]
* [[man>mtr]]
* [[man>freerdp2-wayland]] - [[man>freerdp2-x11]]
* [[man>openvpn]]
* Communication
* [[man>thunderbird]]
* [[man>discord]]
* [[man>noto-fonts-emoji]]
* Utilities
* [[man>yt-dlp]]
* [[man>unrar]]
* [[man>ncdu]]
* [[man>btop]]
* [[man>obs-studio]]
==== screenshots ====
My goto app is [[man>flameshot]] on X.
I've found it buggy on Wayland so I use the following combo with [[man>grim]], [[man>slurp]], [[man>wl-copy]] and [[man>swappy]] to achieve the same results :
#!/bin/bash
FILEDIR=~/Downloads/scrots/
IMG=$FILEDIR$(date +%F_%H-%M-%S).png
grim -g "$(slurp)" $IMG
wl-copy < $IMG
swappy -f $IMG
====Update time and date from network clock====
#!/bin/bash
curlinero=`curl https://savvytime.com/local/france 2>/dev/null | grep -i stLocationTimeM`
heure=`echo $curlinero | grep -oE '(([0-9]){2}:){2}([0-9]){2}'`
date=`echo $curlinero | grep -oE '([0-9]){4}-([0-9]){2}-([0-9]){2}'`
echo $date
echo $heure
sudo date +%F -s $date
sudo date -s $heure
====Update timezone====
timedatectl list-timezones
timedatectl set-timezone Europe/Paris
====access grub2====
press on ''shift'' during the boot phase
====yaourt====
[[https://wiki.archlinux.fr/yaourt|ArchWiki]]
#!/bin/bash
git clone https://aur.archlinux.org/package-query.git
cd package-query
makepkg -si
cd ..
git clone https://aur.archlinux.org/yaourt.git
cd yaourt
makepkg -si
cd ..
rm -rf package-query
rm -rf yaourt
====Thèmes Kvantum====
[[https://github.com/tsujan/Kvantum/blob/master/Kvantum/INSTALL.md|source]]
''sudo pacman -S kvantum-qt5''
- Select Kvantum from System Settings → Application Style → Widget Style and apply it.
- Select Kvantum from System Settings → Color → Scheme and click Apply. You could change the color scheme later if you choose another Kvantum theme with Kvantum Manager (see "Using Other Themes" below).
to install a theme, download the archive and copy the folder containing the ''.kvconfig'' and the ''.svg'' into ''/usr/share/Kvantum/$THEME_NAME/''.
[[https://store.kde.org/p/1294013/|source sweet]]
[[https://github.com/EliverLara/firefox-sweet-theme|source sweet ff]]
====Kill process in 1 line====
show the process :
''ps axf | grep | grep -v grep | awk '{print "kill -9 " $1}'''
pipe to sh to kill it
''ps axf | grep | grep -v grep | awk '{print "kill -9 " $1}' | sh''
[[https://stackoverflow.com/questions/17440585/how-to-get-pid-of-process-by-specifying-process-name-and-store-it-in-a-variable|source]]
====Bookmarks====
A quick bookmarking script first seen in this video ([[https://invidious.fdn.fr/watch?v=d_11QaTlf1I|invidous link]]).
The goal is to store the content of what was highlighted at the time (using [[man>xclip]]) in a file ''.bookmarks''. We then, read this file with [[man>dmenu]].
#!/bin/bash
bookmark=`xclip -o`
file="$HOME/.bookmarks"
if grep -q "^$bookmark" "$file"; then
notify-send "already exists"
else
notify-send "Bookmark added !" "$bookmark"
echo "$bookmark" >> "$file"
fi
Then in my ''.config/i3/config'' i have the following shortcuts
bindsym $mod+Shift+b exec ~/s/add-bookmark
bindsym $mod+b exec xdotool type "$(grep -v '^#' ~/.bookmarks | dmenu -i -l 50 | cut -f1)"
bindsym $mod+n exec xdotool type "$(grep -v '^#' ~/.bookmarks-ssh | dmenu -i -l 50 | cut -f1)"
//⚠️ this script was written for i3 under X, using Wayland you will need to replace ''xdotool type'' with ''wtype'' and ''xclip -o'' by a command base on [[https://github.com/bugaevc/wl-clipboard|wl-clipboard]]//
====Download youtube vidéo from clipboard====
Using X with [[man>xsel]] : ''yt-dlp --write-sub -f bestvideo+bestaudio `xsel -ob`''\\
Using wayland with [[man>wl-paste]] (seems that wl-type can't fully replace xsel in this situation, using a temp file as buffer) :
#!/bin/bash
cd "/path/to/download/folder"
wl-paste > /tmp/youtube-paste-to-dl
#launching in a detached terminal to make it work with shortcuts
xfce4-terminal -e 'yt-dlp --write-sub -f bestvideo+bestaudio -a /tmp/youtube-paste-to-dl'
rm /tmp/youtube-paste-to-dl
====bash tools====
# check for root access
SUDO=
if [ "$(id -u)" -ne 0 ]; then
# Si l'utilisateur est root, alors on utilise "SUDO" dans le script
SUDO=$(command -v sudo 2> /dev/null)
if [ ! -x "$SUDO" ]; then
echo "Error: Run this script as root"
exit 1
fi
fi
# check if command is available
check_cmd() {
command -v "$1" 2> /dev/null
}
if check_cmd curl; then
echo "curl is accessible"
fi
if ! check_cmd curl; then
echo "Curl is needed to proceed with the installation"
exit 1
fi
# execute script from URL
sh <(curl -sSf https://downloads.nordcdn.com/apps/linux/install.sh)
# if curl missing
sh <(wget -qO - https://downloads.nordcdn.com/apps/linux/install.sh)