Minor changes

This commit is contained in:
Thomas Dehaeze 2019-12-16 11:50:32 +01:00
parent e3fba965d1
commit 2364bd462c

View File

@ -1,11 +1,11 @@
#+TITLE: Binaries #+TITLE: Binaries
* Select Screen * Select Screen
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/bin/displayselect :header-args: :tangle ~/bin/displayselect
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
Script taken from Luke Smith. Script taken from Luke Smith.
#+begin_src bash #+begin_src bash
@ -73,17 +73,16 @@ Script taken from Luke Smith.
,*) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;; ,*) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
esac esac
# setbg # Fix background if screen size/arangement has changed.
$HOME/.config/polybar/scripts/launch.sh # restart polybar $HOME/.config/polybar/scripts/launch.sh # restart polybar
pgrep -x dunst >/dev/null && killall dunst && setsid dunst & # Restart dunst to ensure proper location on screen pgrep -x dunst >/dev/null && killall dunst && setsid dunst & # Restart dunst to ensure proper location on screen
#+end_src #+end_src
* getbib * getbib
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/bin/getbib :header-args: :tangle ~/bin/getbib
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
#+begin_src bash #+begin_src bash
[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit [ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
@ -101,11 +100,11 @@ Script taken from Luke Smith.
#+end_src #+end_src
* vpnToggle * vpnToggle
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/bin/vpntoggle :header-args: :tangle ~/bin/vpntoggle
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
#+begin_src bash #+begin_src bash
if [[ $(nordvpn status) == *"Connected"* ]]; then if [[ $(nordvpn status) == *"Connected"* ]]; then
@ -118,11 +117,11 @@ Script taken from Luke Smith.
#+end_src #+end_src
* bukurun * bukurun
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/bin/bukurun :header-args: :tangle ~/bin/bukurun
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
#+begin_src bash #+begin_src bash
_rofi () { _rofi () {
@ -457,11 +456,11 @@ getTagsFromId () {
mode=bookmarks main mode=bookmarks main
#+end_src #+end_src
* i3exit * i3exit
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/bin/i3exit :header-args: :tangle ~/bin/i3exit
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
#+begin_src bash #+begin_src bash
# with openrc use loginctl # with openrc use loginctl
@ -499,31 +498,31 @@ mode=bookmarks main
#+end_src #+end_src
* readbib * readbib
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/bin/readbib :header-args: :tangle ~/bin/readbib
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
#+begin_src bash #+begin_src bash
cd ~/Cloud/thesis/ressources/pdfs/ && ls | dmenu -l 20 | xargs -I {} zathura {} cd ~/Cloud/thesis/ressources/pdfs/ && ls | dmenu -l 20 | xargs -I {} zathura {}
#+end_src #+end_src
* readnotes * readnotes
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/bin/readnotes :header-args: :tangle ~/bin/readnotes
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
#+begin_src bash #+begin_src bash
cd ~/Cloud/thesis/ressources/notes/ && ls *.pdf | dmenu -l 20 | xargs -I {} zathura {} cd ~/Cloud/thesis/ressources/notes/ && ls *.pdf | dmenu -l 20 | xargs -I {} zathura {}
#+end_src #+end_src
* askpass * askpass
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/bin/askpass-rofi :header-args: :tangle ~/bin/askpass-rofi
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
Take password prompt from STDIN, print password to STDOUT. Take password prompt from STDIN, print password to STDOUT.
The sed piece just removes the colon from the provided prompt: =rofi -p= already gives us a colon The sed piece just removes the colon from the provided prompt: =rofi -p= already gives us a colon
#+BEGIN_SRC bash #+BEGIN_SRC bash
@ -533,29 +532,12 @@ The sed piece just removes the colon from the provided prompt: =rofi -p= already
-p "$(printf "$1" | sed s/://)" -p "$(printf "$1" | sed s/://)"
#+END_SRC #+END_SRC
* buku-dmenu
:PROPERTIES:
:header-args: :tangle ~/bin/buku-dmenu
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+BEGIN_SRC bash
if [ "$1" == "--help" ] ; then
echo "Run the script, start typing until the desired bookmark is selected."
echo "buku and dmenu must be installed."
exit 0
fi
#get all bmks | swap tabs for spaces | run dmenu | cut to ID | run buku if not empty
buku -p -f 3 | sed 's/\t/ /g' | dmenu -i -l 20 | cut -d ' ' -f 1 | xargs --no-run-if-empty buku -o
#+END_SRC
* Take Screenshot * Take Screenshot
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/bin/screenshot :header-args: :tangle ~/bin/screenshot
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
#+begin_src bash #+begin_src bash
status=$(echo -e "All\nGUI\nSelection\nCropped\nCopy\nShadow\nActive" | rofi -i -dmenu -p "Type") status=$(echo -e "All\nGUI\nSelection\nCropped\nCopy\nShadow\nActive" | rofi -i -dmenu -p "Type")
@ -587,11 +569,11 @@ The sed piece just removes the colon from the provided prompt: =rofi -p= already
#+end_src #+end_src
* Remote Desktop Connect * Remote Desktop Connect
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/bin/remote-desktop :header-args: :tangle ~/bin/remote-desktop
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
#+begin_src bash #+begin_src bash
computer=$(echo -e 'RNICE\nPCMEL1\nPCNASS1\nPCMEG01' | dmenu -p 'Computer:' -l 20); computer=$(echo -e 'RNICE\nPCMEL1\nPCNASS1\nPCMEG01' | dmenu -p 'Computer:' -l 20);
@ -616,11 +598,11 @@ The sed piece just removes the colon from the provided prompt: =rofi -p= already
#+end_src #+end_src
* Toggle Network * Toggle Network
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/bin/network-toggle :header-args: :tangle ~/bin/network-toggle
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
#+begin_src bash #+begin_src bash
result=$(nmcli device | sed '1d' | dmenu -l 20); result=$(nmcli device | sed '1d' | dmenu -l 20);
@ -657,28 +639,13 @@ The sed piece just removes the colon from the provided prompt: =rofi -p= already
#+end_src #+end_src
* Mount TMP14DAYS * Mount TMP14DAYS
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/bin/mnt_tmp_14_days :header-args: :tangle ~/bin/mnt_tmp_14_days
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
#+begin_src bash #+begin_src bash
sudo -A mkdir ~/tmp_14_days; sudo -A mkdir ~/tmp_14_days;
sudo -A mount -o rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=160.103.232.103,mountvers=3,mountport=597,mountproto=tcp,local_lock=none,addr=160.103.232.103 rnice:/hz/tmp_14_days ~/tmp_14_days; sudo -A mount -o rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=160.103.232.103,mountvers=3,mountport=597,mountproto=tcp,local_lock=none,addr=160.103.232.103 rnice:/hz/tmp_14_days ~/tmp_14_days;
#+end_src #+end_src
* Reboot to OS
:PROPERTIES:
:header-args: :tangle ~/bin/reboot-to-os
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
os_id=$(echo -e "0 Manjaro\n1 Windows10" | dmenu -i -l 20 | awk -F ' ' '{print $1}');
if [ -n "$os_id" ]; then
sudo -A grub-reboot $os_id && sudo -A reboot
fi
#+end_src