Change indentation of all blocks.
Use (setq org-src-preserve-indentation t) for Emacs.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#+PROPERTY: header-args:bash :comments both :mkdirp yes
|
||||
#+PROPERTY: header-args:bash+ :shebang "#!/usr/bin/env bash"
|
||||
#+PROPERTY: header-args:bash+ :tangle-mode (identity #o555)
|
||||
|
||||
* =remote-desktop= - Remote Desktop Connect
|
||||
:PROPERTIES:
|
||||
@@ -10,28 +11,28 @@
|
||||
:END:
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/remote-desktop
|
||||
computer=$(echo -e 'RNICE\nPCMEL1\nPCNASS1\nPCMEG01' | dmenu -p 'Computer:' -l 20);
|
||||
computer=$(echo -e 'RNICE\nPCMEL1\nPCNASS1\nPCMEG01' | dmenu -p 'Computer:' -l 20);
|
||||
|
||||
dunstify --replace=89891 'Rdesktop' "Connection to ${computer}..."
|
||||
dunstify --replace=89891 'Rdesktop' "Connection to ${computer}..."
|
||||
|
||||
case $computer in
|
||||
PCMEL1)
|
||||
xfreerdp /u:dehaeze /d:ESRF /clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /p:$(pass ssl.esrf.fr/dehaeze | sed -n 1p) /v:PCMEL1.esrf.fr;
|
||||
;;
|
||||
PCMEG01)
|
||||
xfreerdp /u:dehaeze /d:ESRF /clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /p:$(pass ssl.esrf.fr/dehaeze | sed -n 1p) /v:PCMEG01.esrf.fr;
|
||||
;;
|
||||
PCNASS1)
|
||||
xfreerdp /u:dehaeze /d:ESRF /clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /p:$(pass ssl.esrf.fr/dehaeze | sed -n 1p) /v:PCNASS1.esrf.fr;
|
||||
;;
|
||||
RNICE)
|
||||
xfreerdp /u:dehaeze /d:ESRF /clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /p:$(pass ssl.esrf.fr/dehaeze | sed -n 1p) /v:rnice.esrf.fr;
|
||||
;;
|
||||
,*)
|
||||
echo "Not existing" && \
|
||||
dunstify --replace=89891 --urgency=critical 'Rdesktop' "No config for $computer";
|
||||
;;
|
||||
esac
|
||||
case $computer in
|
||||
PCMEL1)
|
||||
xfreerdp /u:dehaeze /d:ESRF /clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /p:$(pass ssl.esrf.fr/dehaeze | sed -n 1p) /v:PCMEL1.esrf.fr;
|
||||
;;
|
||||
PCMEG01)
|
||||
xfreerdp /u:dehaeze /d:ESRF /clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /p:$(pass ssl.esrf.fr/dehaeze | sed -n 1p) /v:PCMEG01.esrf.fr;
|
||||
;;
|
||||
PCNASS1)
|
||||
xfreerdp /u:dehaeze /d:ESRF /clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /p:$(pass ssl.esrf.fr/dehaeze | sed -n 1p) /v:PCNASS1.esrf.fr;
|
||||
;;
|
||||
RNICE)
|
||||
xfreerdp /u:dehaeze /d:ESRF /clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /p:$(pass ssl.esrf.fr/dehaeze | sed -n 1p) /v:rnice.esrf.fr;
|
||||
;;
|
||||
,*)
|
||||
echo "Not existing" && \
|
||||
dunstify --replace=89891 --urgency=critical 'Rdesktop' "No config for $computer";
|
||||
;;
|
||||
esac
|
||||
#+end_src
|
||||
|
||||
* =print-rnice= - Print on Rnice
|
||||
@@ -40,18 +41,18 @@
|
||||
:END:
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/print-rnice
|
||||
nbpage=$(echo -e '1\n2\n4' | dmenu -p 'Number of pages per sheet' -l 20);
|
||||
sides=$(echo -e 'one-sided\ntwo-sided-long-edge\ntwo-sided-short-edge' | dmenu -p 'Two Sided:' -l 20);
|
||||
media=$(echo -e 'A4\nA3' | dmenu -p 'Size:' -l 20);
|
||||
nbpage=$(echo -e '1\n2\n4' | dmenu -p 'Number of pages per sheet' -l 20);
|
||||
sides=$(echo -e 'one-sided\ntwo-sided-long-edge\ntwo-sided-short-edge' | dmenu -p 'Two Sided:' -l 20);
|
||||
media=$(echo -e 'A4\nA3' | dmenu -p 'Size:' -l 20);
|
||||
|
||||
# First copy the file to Rnice
|
||||
if sshpass -p "$(pass ssl.esrf.fr/dehaeze | sed -n 1p)" scp $1 dehaeze@rnice:~/Downloads/; then
|
||||
# Then print on Rnice
|
||||
sshpass -p "$(pass ssl.esrf.fr/dehaeze | sed -n 1p)" ssh dehaeze@rnice "lpr -o media=$media -o sides=$sides -o number-up=$nbpage -P ctb110c1u ~/Downloads/$1";
|
||||
# Finally, delete the file
|
||||
else
|
||||
echo "Command Failed"
|
||||
fi
|
||||
# First copy the file to Rnice
|
||||
if sshpass -p "$(pass ssl.esrf.fr/dehaeze | sed -n 1p)" scp $1 dehaeze@rnice:~/Downloads/; then
|
||||
# Then print on Rnice
|
||||
sshpass -p "$(pass ssl.esrf.fr/dehaeze | sed -n 1p)" ssh dehaeze@rnice "lpr -o media=$media -o sides=$sides -o number-up=$nbpage -P ctb110c1u ~/Downloads/$1";
|
||||
# Finally, delete the file
|
||||
else
|
||||
echo "Command Failed"
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
* =tmp14= - Mount/Umount tmp_14_days folder
|
||||
@@ -60,19 +61,19 @@
|
||||
:END:
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/tmp_14_days
|
||||
if [ $1 == "mount" ]; then
|
||||
if sshfs -o allow_other,default_permissions -p 5022 dehaeze@firewall.esrf.fr:/tmp_14_days/ ~/mnt/ESRF; then
|
||||
dunstify --replace=58249 'ESRF TMP ' 'Successfully mounted'
|
||||
else
|
||||
dunstify --replace=58249 --urgency=critical 'ESRF TMP ' 'Error while mounted'
|
||||
fi
|
||||
elif [ $1 == "umount" ]; then
|
||||
if umount /home/thomas/mnt/ESRF/; then
|
||||
dunstify --replace=58249 'ESRF TMP ' 'Successfully unmounted'
|
||||
else
|
||||
dunstify --replace=58249 --urgency=critical 'ESRF TMP ' 'Error while unmounted'
|
||||
fi
|
||||
fi
|
||||
if [ $1 == "mount" ]; then
|
||||
if sshfs -o allow_other,default_permissions -p 5022 dehaeze@firewall.esrf.fr:/tmp_14_days/ ~/mnt/ESRF; then
|
||||
dunstify --replace=58249 'ESRF TMP ' 'Successfully mounted'
|
||||
else
|
||||
dunstify --replace=58249 --urgency=critical 'ESRF TMP ' 'Error while mounted'
|
||||
fi
|
||||
elif [ $1 == "umount" ]; then
|
||||
if umount /home/thomas/mnt/ESRF/; then
|
||||
dunstify --replace=58249 'ESRF TMP ' 'Successfully unmounted'
|
||||
else
|
||||
dunstify --replace=58249 --urgency=critical 'ESRF TMP ' 'Error while unmounted'
|
||||
fi
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
|
||||
@@ -83,23 +84,23 @@
|
||||
|
||||
As an alternative, =sshfs= can be used:
|
||||
#+begin_src bash :tangle no
|
||||
sshfs -o allow_other,default_permissions nas:/Data ~/mnt/NAS
|
||||
sshfs -o allow_other,default_permissions nas:/Data ~/mnt/NAS
|
||||
#+end_src
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/nas
|
||||
if [ $1 == "mount" ]; then
|
||||
if mount /home/thomas/mnt/NAS/; then
|
||||
dunstify --replace=58249 'NAS ' 'Successfully mounted'
|
||||
else
|
||||
dunstify --replace=58249 --urgency=critical 'NAS ' 'Error while mounted'
|
||||
fi
|
||||
elif [ $1 == "umount" ]; then
|
||||
if umount /home/thomas/mnt/NAS/; then
|
||||
dunstify --replace=58249 'NAS ' 'Successfully unmounted'
|
||||
else
|
||||
dunstify --replace=58249 --urgency=critical 'NAS ' 'Error while unmounted'
|
||||
fi
|
||||
fi
|
||||
if [ $1 == "mount" ]; then
|
||||
if mount /home/thomas/mnt/NAS/; then
|
||||
dunstify --replace=58249 'NAS ' 'Successfully mounted'
|
||||
else
|
||||
dunstify --replace=58249 --urgency=critical 'NAS ' 'Error while mounted'
|
||||
fi
|
||||
elif [ $1 == "umount" ]; then
|
||||
if umount /home/thomas/mnt/NAS/; then
|
||||
dunstify --replace=58249 'NAS ' 'Successfully unmounted'
|
||||
else
|
||||
dunstify --replace=58249 --urgency=critical 'NAS ' 'Error while unmounted'
|
||||
fi
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
* =torrent-add= - Download Torrent
|
||||
@@ -108,9 +109,9 @@ As an alternative, =sshfs= can be used:
|
||||
:END:
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/torrent-add
|
||||
transmission-remote ***REMOVED***:9091 --auth tdehaeze:$(pass nas/transmission | sed -n 1p) -a $1 && \
|
||||
dunstify 'Torrent' 'Successfully added' || \
|
||||
dunstify 'Torrent' 'Error'
|
||||
transmission-remote ***REMOVED***:9091 --auth tdehaeze:$(pass nas/transmission | sed -n 1p) -a $1 && \
|
||||
dunstify 'Torrent' 'Successfully added' || \
|
||||
dunstify 'Torrent' 'Error'
|
||||
#+end_src
|
||||
|
||||
* =dl-add= - Direct Download with Aria2
|
||||
@@ -119,7 +120,7 @@ As an alternative, =sshfs= can be used:
|
||||
:END:
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/dl-add
|
||||
aria2p --port 6800 --host http://dl.tdehaeze.xyz --secret $(pass dl.tdehaeze.xyz/tdehaeze | sed -n 1p) add $1
|
||||
aria2p --port 6800 --host http://dl.tdehaeze.xyz --secret $(pass dl.tdehaeze.xyz/tdehaeze | sed -n 1p) add $1
|
||||
#+end_src
|
||||
|
||||
* =note-extract-fig= - Extract Figure from note file
|
||||
@@ -130,13 +131,13 @@ As an alternative, =sshfs= can be used:
|
||||
Script used to convert a figure drawn on my Boox note2 to a png file that can then be imported into a document.
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/note-extract-fig
|
||||
# First check that the first argument is a pdf file
|
||||
if [[ -f $1 && $1 == *.pdf ]]; then
|
||||
pngfile=$(echo $1 | cut -f 1 -d '.' | sed 's/$/.png/')
|
||||
# First check that the first argument is a pdf file
|
||||
if [[ -f $1 && $1 == *.pdf ]]; then
|
||||
pngfile=$(echo $1 | cut -f 1 -d '.' | sed 's/$/.png/')
|
||||
|
||||
# Convert to png and crop png
|
||||
pdf2png $1 && convert -trim "$pngfile" "$pngfile"
|
||||
fi
|
||||
# Convert to png and crop png
|
||||
pdf2png $1 && convert -trim "$pngfile" "$pngfile"
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
* =share= - Share file with self-hosted =transfer.sh=
|
||||
@@ -145,13 +146,13 @@ Script used to convert a figure drawn on my Boox note2 to a png file that can th
|
||||
:END:
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/share
|
||||
if [ $TMUX ]; then
|
||||
tmux split -v -l 1 "curl --progress-bar -F\"file=@$1\" https://file.tdehaeze.xyz/ | xsel -ib && dunstify 'Upload' 'Successful' || dunstify --urgency=critical 'Upload' 'Failed';" && tmux select-pane -U
|
||||
else
|
||||
curl --progress-bar -F"file=@$1" https://file.tdehaeze.xyz/ | xsel -ib && \
|
||||
dunstify 'Upload' 'Successful' || \
|
||||
dunstify --urgency=critical 'Upload' 'Failed'
|
||||
fi
|
||||
if [ $TMUX ]; then
|
||||
tmux split -v -l 1 "curl --progress-bar -F\"file=@$1\" https://file.tdehaeze.xyz/ | xsel -ib && dunstify 'Upload' 'Successful' || dunstify --urgency=critical 'Upload' 'Failed';" && tmux select-pane -U
|
||||
else
|
||||
curl --progress-bar -F"file=@$1" https://file.tdehaeze.xyz/ | xsel -ib && \
|
||||
dunstify 'Upload' 'Successful' || \
|
||||
dunstify --urgency=critical 'Upload' 'Failed'
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
* =screen-select= - Xrandr pre-defined scripts
|
||||
@@ -160,27 +161,27 @@ Script used to convert a figure drawn on my Boox note2 to a png file that can th
|
||||
:END:
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/screen-select
|
||||
option=$(echo -e "Work\nXPS\nHome" | rofi -i -dmenu)
|
||||
option=$(echo -e "Work\nXPS\nHome" | rofi -i -dmenu)
|
||||
|
||||
case "$option" in
|
||||
"Work")
|
||||
xrandr --output eDP1 --off --output DP1 --off --output DP1-1 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output DP1-2 --off --output DP2 --off --output VIRTUAL1 --off
|
||||
;;
|
||||
"XPS")
|
||||
xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP1 --off --output DP1-1 --off --output DP1-2 --off --output DP2 --off --output VIRTUAL1 --off
|
||||
;;
|
||||
"Home")
|
||||
xrandr --output eDP1 --off --output DP2-1 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output DP1 --off --output VIRTUAL1 --off
|
||||
;;
|
||||
,*)
|
||||
echo "== ! missing or invalid argument ! =="
|
||||
exit 2
|
||||
esac
|
||||
case "$option" in
|
||||
"Work")
|
||||
xrandr --output eDP1 --off --output DP1 --off --output DP1-1 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output DP1-2 --off --output DP2 --off --output VIRTUAL1 --off
|
||||
;;
|
||||
"XPS")
|
||||
xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP1 --off --output DP1-1 --off --output DP1-2 --off --output DP2 --off --output VIRTUAL1 --off
|
||||
;;
|
||||
"Home")
|
||||
xrandr --output eDP1 --off --output DP2-1 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output DP1 --off --output VIRTUAL1 --off
|
||||
;;
|
||||
,*)
|
||||
echo "== ! missing or invalid argument ! =="
|
||||
exit 2
|
||||
esac
|
||||
|
||||
setbg && \ # Fix background if screen size/arangement has changed.
|
||||
polybar-msg cmd restart # restart polybar
|
||||
setbg && \ # Fix background if screen size/arangement has changed.
|
||||
polybar-msg cmd restart # restart polybar
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
#+end_src
|
||||
|
||||
* =color-picker= - Pick color and copy to clipboard
|
||||
@@ -189,5 +190,5 @@ Script used to convert a figure drawn on my Boox note2 to a png file that can th
|
||||
:END:
|
||||
|
||||
#+begin_src bash :tangle ~/.local/bin/color-picker
|
||||
xcolor | tr -d '\n' | xsel -b
|
||||
xcolor | tr -d '\n' | xsel -b
|
||||
#+end_src
|
||||
|
||||
Reference in New Issue
Block a user