Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:tools:linux:misc-tools [2023/09/30 14:05] crunchyslimeen:tools:linux:misc-tools [2024/01/28 12:44] (current) – [Download youtube vidéo from clipboard] crunchyslime
Line 8: Line 8:
     * [[man>swappy]]     * [[man>swappy]]
     * [[man>flameshot]]     * [[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 ==== ==== screenshots ====
Line 25: Line 54:
 </code> </code>
  
-==== File sort using extensions ==== + 
-Moves files to folders based on their extension : +====Update time and date from network clock==== 
 <code bash> <code bash>
-#!/bin/sh+#!/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 
 +</code>
  
-cd ~/Downloads +====Update timezone====
-pwd+
  
-## Image +<code bash> 
-echo "+ moving images"+timedatectl list-timezones 
 +timedatectl set-timezone Europe/Paris 
 +</code> 
 +====access grub2====
  
-find . -maxdepth 1 -type f \ +press on ''shift'' during the boot phase
--name "*jpg" -o -name "*JPG"+
--o -name "*jpeg" -o -name "*JPEG"+
--o -name "*png" -o -name "*PNG"+
-| xargs -I '{}mv {} images+
  
  
-## Document +====yaourt==== 
-echo "+ moving documents"+[[https://wiki.archlinux.fr/yaourt|ArchWiki]] 
 +<code bash> 
 +#!/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 
 +</code>
  
-find . -maxdepth 1 -type f \ +====Thèmes Kvantum==== 
--name "*pdf" -o -name "*PDF"+[[https://github.com/tsujan/Kvantum/blob/master/Kvantum/INSTALL.md|source]] 
--o -name "*.doc" -o -name "*.DOC" \ +''sudo pacman -S kvantum-qt5''
--o -name "*.docx" -o -name "*.DOCX"+
--o -name "*.ppt" -o -name "*.PPT"+
--o -name "*.pptx" -o -name "*.PPTX"+
--o -name "*.xls" -o -name "*.XLS"+
--o -name "*.xlsx" -o -name "*.XLSX"+
--o -name "*odt" -o -name "*ODT"+
--o -name "*ods" -o -name "*ODS"+
--o -name "*odp" -o -name "*ODP"+
-| xargs -'{}mv {} documents+
  
 +- 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).
  
-## CAO +to install a theme, download the archive and copy the folder containing the ''.kvconfig'' and the ''.svg'' into ''/usr/share/Kvantum/$THEME_NAME/''.
-echo "+ moving CAO files"+
  
-find -maxdepth 1 -type f \ +[[https://store.kde.org/p/1294013/|source sweet]] 
--name "*stl" -o -name "*STL"+[[https://github.com/EliverLara/firefox-sweet-theme|source sweet ff]]
--o -name "*dwg" -o -name "*DWG"+
--o -name "*dxf" -o -name "*DXF"+
-xargs -I '{}' mv {} CAO+
  
  
-## Vidéo +====Kill process in 1 line====
-echo "+ moving videos"+
  
-find . -maxdepth 1 -type f \ +show the process :
--name "*mov" -o -name "*MOV"+
--o -name "*mp4" -o -name "*MP4"+
--o -name "*avi" -o -name "*AVI"+
--o -name "*mkv" -o -name "*MKV"+
-| xargs -I '{}' mv {} videos+
  
 +''ps axf | grep <process name> | grep -v grep | awk '{print "kill -9 " $1}'''
  
-## Div execs / data / archives +pipe to sh to kill it
-echo "+ moving the rest"+
  
-find . -maxdepth 1 -type f \ +''ps axf | grep <process name> | grep -v grep | awk '{print "kill -$1}' | sh''
--name "*txt" -o -name "*TXT" \ +
--o -name "*iso" -o -name "*ISO"+
--o -name "*csv" -o -name "*CSV"+
--o -name "*ics" -o -name "*ICS"+
--o -name "*sh" -o -name "*SH"+
--o -name "*py" -o -name "*PY"+
--o -name "*exe" -o -name "*EXE"+
--o -name "*AppImage"+
--o -name "*msi" -o -name "*MSI"+
--o -name "*deb" -o -name "*DEB"+
--o -name "*rpm" -o -name "*RPM"+
--o -name "*zip" -o -name "*ZIP"+
--o -name "*rar" -o -name "*RAR"+
--o -name "*.tar" -o -name "*.TAR"+
-| xargs -I '{}mv {} div-data-exe-archives+
  
-## remove ext +[[https://stackoverflow.com/questions/17440585/how-to-get-pid-of-process-by-specifying-process-name-and-store-it-in-a-variable|source]]
-echo "- removing exts" +
-rm *.ext 2>/dev/null+
  
-## End information +====Bookmarks==== 
-echo "" +A quick bookmarking script first seen in this video ([[https://invidious.fdn.fr/watch?v=d_11QaTlf1I|invidous link]]). 
-echo "unsorted files" +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]].
-ls -al | grep '^-| wc -l +
-echo "" +
-echo "Size on disk " +
-du -sh +
-echo ""+
  
-echo "done"+<code bash> 
 +#!/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
 </code> </code>
 +Then in my ''.config/i3/config'' i have the following shortcuts
 +<code>
 +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)"
 +</code>
 +
 +//⚠️ 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) : 
 +<code bash>
 +#!/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
 +</code>
 +
 +====bash tools====
 +
 +<code bash>
 +# 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
 +</code>
 +
 +<code bash>
 +# 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
 +</code>
 +
 +<code bash>
 +# 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)
 +</code>
 +
  • en/tools/linux/misc-tools.1696075531.txt.gz
  • Last modified: 2023/09/30 14:05
  • by crunchyslime