Minor changes

This commit is contained in:
Thomas Dehaeze 2021-10-25 14:31:23 +02:00
parent b511e86af2
commit e522c366db
5 changed files with 184 additions and 162 deletions

View File

@ -1316,7 +1316,7 @@ https://github.com/schollz/croc
** Trash
=trash-cli= is used to manage the trash.
It is integrated with Ranger.
It is integrated with =ranger= and =pcmanFM=.
#+begin_src bash
yay -S trash-cli

View File

@ -106,6 +106,11 @@ Converts MATLAB figures to TikZ ([[https://github.com/matlab2tikz/matlab2tikz][l
addpath([toolboxes_path 'matlab2tikz/src'])
#+end_src
Working with Tensors ([[https://www.tensorlab.net/][link]]).
#+begin_src matlab
addpath([toolboxes_path 'tensorlab'])
#+end_src
MATLAB toolbox for exporting publication quality figures ([[https://github.com/altmany/export_fig][link]]).
#+begin_src matlab
addpath([toolboxes_path 'export_fig'])

View File

@ -180,67 +180,55 @@ alias travel scout -aefiklst
#+END_SRC
** Some Custom Keybindings
Extract
Extract:
#+BEGIN_SRC conf
map ,x shell ~/.config/ranger/scripts/extract.sh %f
#+END_SRC
Compress
Compress:
#+BEGIN_SRC conf
map ,z shell ~/.config/ranger/scripts/compress.sh %f
#+END_SRC
Get Bibtex from PDF
Get Bibtex from PDF:
#+BEGIN_SRC conf
map ,b shell pdf2bib %f
#+END_SRC
Delete first page of pdf
#+BEGIN_SRC conf
map ,d shell pdf-delete-first-page %f
#+END_SRC
Convert images/pdf/...
Convert images/pdf/...:
#+BEGIN_SRC conf
map ,c shell convert-file %f
#+END_SRC
Magit Status
#+BEGIN_SRC conf
map ,gs shell emacsclient -create-frame --alternate-editor="" -n --eval '(magit-status)'
#+END_SRC
Open SXIV on current directory
Open SXIV on current directory:
#+BEGIN_SRC conf
map ,s shell nohup sxiv -t %d &
#+END_SRC
Upload with 0x0 / self hosted Tansfer.sh
Upload to https://0x0.st/:
#+BEGIN_SRC conf
map ,t shell upload %f
map ,T shell share %f
#+END_SRC
Open current folder with PCManFM
Open current folder with PCManFM:
#+begin_src conf
map ,o shell nohup pcmanfm %d &
#+end_src
Open with Emacs
#+begin_src conf
map ,e shell emacsclient -create-frame --alternate-editor="" -n %f
#+end_src
Print on Rnice
Print on Rnice:
#+BEGIN_SRC conf
map ,p shell print-rnice %f &
#+END_SRC
Backup to NAS
Backup to NAS:
#+BEGIN_SRC conf
map ,B shell ~/.config/ranger/scripts/backup-to-nas.sh %s &
#+END_SRC
#+begin_src conf
map ,y shell ~/.config/ranger/scripts/copy-content.sh %s &
#+end_src
** Scripts
*** Extract Script
:PROPERTIES:
@ -271,7 +259,17 @@ fi
#+end_src
*** Backup to NAS
*** Copy File Content
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/scripts/copy-content.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
xclip -sel c < $1 && dunstify "Ranger" "Copied to clipboard"
#+end_src
*** TODO [#B] Backup to NAS
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/scripts/backup-to-nas.sh
:header-args+: :comments both :mkdirp yes
@ -282,9 +280,9 @@ fi
#+begin_src bash
if [ $TMUX ]; then
tmux split -v -l 2 rsync -a --inplace --info=progress2 --rsh='ssh -p10022' "$@" nas:/volume1/Data/Downloads/Backup/ && tmux select-pane -U
tmux split -v -l 2 rsync -a --inplace --info=progress2 --rsh='ssh ' "$@" homelab:/srv/storage/Backups/ && tmux select-pane -U
else
rsync -a --info=progress2 --inplace --rsh='ssh -p10022' "$@" nas:/volume1/Data/Downloads/Backup/
rsync -a --info=progress2 --inplace --rsh='ssh' "$@" homelab:/srv/storage/Backups/
fi
#+end_src
@ -396,7 +394,7 @@ map gh cd ~/
map gb cd ~/Cloud/brain
map gm cd ~/Cloud/thesis
map gp cd ~/Pictures
map gP cd ~/Cloud/personal
map gP cd ~/Cloud/pictures/phone
map gT cd ~/.local/share/Trash/files
map gd cd ~/Downloads
map gc cd ~/Cloud
@ -512,8 +510,11 @@ map <C-f> fzf_select
#+BEGIN_SRC conf
cmap <tab> eval fm.ui.console.tab()
cmap <s-tab> eval fm.ui.console.tab(-1)
cmap <ESC> eval fm.ui.console.close()
cmap <CR> eval fm.ui.console.execute()
cmap <C-l> redraw_window
copycmap <ESC> <C-c>
@ -526,8 +527,6 @@ cmap <up> eval fm.ui.console.history_move(-1)
cmap <down> eval fm.ui.console.history_move(1)
cmap <left> eval fm.ui.console.move(left=1)
cmap <right> eval fm.ui.console.move(right=1)
cmap <home> eval fm.ui.console.move(right=0, absolute=True)
cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
#+END_SRC
*** Line Editing
@ -542,11 +541,13 @@ copycmap <end> <C-e>
* Rifle
:PROPERTIES:
:CUSTOM_ID: rifle
:header-args: :tangle ~/.config/ranger/rifle.conf
:header-args+: :comments both :mkdirp yes
:END:
#+BEGIN_SRC conf
** Documentation
#+BEGIN_SRC conf :tangle no
# This is the configuration file of "rifle", ranger's file executor/opener.
# Each line consists of conditions and a command. For each line the conditions
# are checked and if they are met, the respective command is run.
@ -594,160 +595,139 @@ copycmap <end> <C-e>
# implementation may differ.
# Note: When using rifle in ranger, there is an additional flag "c" for
# only running the current file even if you have marked multiple files.
#+END_SRC
#-------------------------------------------
# Websites
#-------------------------------------------
# Rarely installed browsers get higher priority; It is assumed that if you
# install a rare browser, you probably use it. Firefox/konqueror/w3m on the
# other hand are often only installed as fallback browsers.
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
ext x?html?, has firefox, X, flag f = firefox -- "$@"
ext x?html?, has elinks, terminal = elinks "$@"
ext x?html?, has links2, terminal = links2 "$@"
ext x?html?, has links, terminal = links "$@"
ext x?html?, has lynx, terminal = lynx -- "$@"
ext x?html?, has w3m, terminal = w3m "$@"
#Spreadsheets for scim
ext sc|csv|sxc|xlsx?|xlt|xlw|gnm|gnumeric, = sc-im -- "$@"
#-------------------------------------------
# Misc
#-------------------------------------------
ext org = emacsclient -c "$1"
# Define the "editor" for text files as first action
** Text Files
Define the =$EDITOR= for text files as first action:
#+BEGIN_SRC conf
mime ^text, label editor = $EDITOR -- "$@"
mime ^text, label pager = "$PAGER" -- "$@"
#+END_SRC
Favorite editors:
#+begin_src conf
mime ^text, has nvim, flag f = nvim "$@"
mime ^text, has emacsclient, X, flag f = emacsclient -c "$@"
#+end_src
Org mode files
#+BEGIN_SRC conf
ext org, has emacsclient, X, flag f = emacsclient -c "$@"
#+END_SRC
#+BEGIN_SRC conf
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@"
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
ext 1 = man "$1"
ext s[wmf]c, has zsnes, X = zsnes "$1"
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
ext nes, has fceux, X = fceux "$1"
ext exe = wine "$1"
name ^[mM]akefile$ = make
#--------------------------------------------
# Code
#-------------------------------------------
ext py = python -- "$1"
ext pl = perl -- "$1"
ext rb = ruby -- "$1"
ext js = node -- "$1"
ext sh = sh -- "$1"
ext php = php -- "$1"
#+END_SRC
#--------------------------------------------
# Video/Audio with a GUI
#-------------------------------------------
mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
mime ^video, has mpv, X, flag f = mpv --loop -- "$@"
** PDF, Epub and jdvu
#+BEGIN_SRC conf
ext pdf, has zathura, X, flag f = zathura -- "$@"
ext pdf, has mupdf, X, flag f = mupdf "$@"
ext pdf, X, flag f = "$BROWSER" "$@"
#+END_SRC
#--------------------------------------------
# Audio without X
#-------------------------------------------
mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@"
mime ^audio|ogg$ = tag "$@"
mime ^audio|ogg$, terminal, has mpv = mpv -- "$@"
#+BEGIN_SRC conf
ext epub, has zathura, X, flag f = zathura -- "$@"
ext epub, has mupdf, X, flag f = mupdf "$@"
#+END_SRC
#--------------------------------------------
# Video without X:
#-------------------------------------------
mime ^video, terminal, !X, has mpv = mpv -- "$@"
mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@"
mime ^video, terminal, !X, has mplayer = mplayer -- "$@"
#+BEGIN_SRC conf
ext djvu, has zathura, X, flag f = zathura -- "$@"
ext djvu, has evince, X, flag f = evince -- "$@"
ext djvu, has atril, X, flag f = atril -- "$@"
#+END_SRC
#-------------------------------------------
# Documents
#-------------------------------------------
ext pdf, has zathura, X, flag f = zathura -- "$@"
ext pdf, has llpp, X, flag f = llpp "$@"
ext pdf, has mupdf, X, flag f = mupdf "$@"
ext pdf, has mupdf, X, flag f = mupdf -I "$@"
ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@"
ext pdf, has apvlv, X, flag f = apvlv -- "$@"
ext pdf, has xpdf, X, flag f = xpdf -- "$@"
ext pdf, has evince, X, flag f = evince -- "$@"
ext pdf, has atril, X, flag f = atril -- "$@"
ext pdf, has okular, X, flag f = okular -- "$@"
ext pdf, has epdfview, X, flag f = epdfview -- "$@"
ext pdf, has qpdfview, X, flag f = qpdfview "$@"
** Archives
#+BEGIN_SRC conf
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool -- "$@" | "$PAGER"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool -- "$@" | "$PAGER"
ext epub, has zathura, X, flag f = zathura -- "$@"
ext epub, has mupdf, X, flag f = mupdf "$@"
ext docx?, has wps, X, flag f = wps "$@"
ext docx?, has onlyoffice, X, flag f = onlyoffice "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has wpp, X, flag f = wpp "$@"
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@"
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@"
ext djvu, has zathura,X, flag f = zathura -- "$@"
ext djvu, has evince, X, flag f = evince -- "$@"
ext djvu, has atril, X, flag f = atril -- "$@"
#-------------------------------------------
# Image Viewing:
#-------------------------------------------
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
mime ^image/svg, has display, X, flag f = display -- "$@"
mime ^image/gif, has mpv, X, flag f = mpv --loop -- "$@"
mime ^image/gif, has viewnior, X, flag f = viewnior -- "$@"
mime ^image/gif, has qutebrowser, X, flag f = qutebrowser -- "$@"
ext xcf, X, flag f = gimp -- "$@"
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
mime ^image, has feh, X, flag f = feh --scale-down --auto-zoom --image-bg black -- "$@"
mime ^image, has feh, X, flag f = feh --scale-down --auto-zoom -- "$@"
mime ^image, has mirage, X, flag f = mirage -- "$@"
mime ^image, has ristretto, X, flag f = ristretto "$@"
mime ^image, has eog, X, flag f = eog -- "$@"
mime ^image, has eom, X, flag f = eom -- "$@"
mime ^image, has gimp, X, flag f = gimp -- "$@"
mime ^image, has pinta, X, flag f = pinta -- "$@"
mime ^image, has mypaint, X, flag f = mypaint -- "$@"
mime ^image, has kolourpaint, X, flag f = kolourpaint -- "$@"
#-------------------------------------------
# Archives
#-------------------------------------------
# This requires atool
ext jar = java -jar "$@"
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has als = als -- "$@" | "$PAGER"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has als = als -- "$@" | "$PAGER"
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has aunpack = aunpack -- "$@"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack = aunpack -- "$@"
# Fallback:
ext tar|gz, has tar = tar vvtf "$@" | "$PAGER"
ext tar|gz, has tar = tar vvxf "$@"
#+END_SRC
#-------------------------------------------
# Misc
#-------------------------------------------
label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1"
label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1"
label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
** Websites
#+BEGIN_SRC conf
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
ext x?html?, has firefox, X, flag f = firefox -- "$@"
ext x?html?, has elinks, terminal = elinks "$@"
ext x?html?, has w3m, terminal = w3m "$@"
#+END_SRC
** Word, Excel and Presentation files
#+BEGIN_SRC conf
ext docx?, has onlyoffice, X, flag f = onlyoffice "$@"
ext docx?, has wps, X, flag f = wps "$@"
ext docx?, has libreoffice, X, flag f = libreoffice "$@"
#+END_SRC
#+begin_src conf
ext pptx?, has onlyoffice, X, flag f = onlyoffice "$@"
ext pptx?, has wps, X, flag f = wps "$@"
ext pptx?, has libreoffice, X, flag f = libreoffice "$@"
#+end_src
#+begin_src conf
ext csv|xlsx?, has sc-im = sc-im -- "$@"
ext csv|xlsx?, has onlyoffice, X, flag f = onlyoffice "$@"
ext csv|xlsx?, has wps, X, flag f = wps "$@"
ext csv|xlsx?, has libreoffice, X, flag f = libreoffice "$@"
#+end_src
** Images
#+BEGIN_SRC conf
mime ^image/svg, has inkview, X, flag f = inkview -- "$@"
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
mime ^image/svg, has display, X, flag f = display -- "$@"
#+END_SRC
#+BEGIN_SRC conf
mime ^image/gif, has mpv, X, flag f = mpv --loop -- "$@"
mime ^image/gif, has qutebrowser, X, flag f = qutebrowser -- "$@"
#+END_SRC
#+BEGIN_SRC conf
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
mime ^image, has feh, X, flag f = feh --scale-down --auto-zoom -- "$@"
#+END_SRC
** Audio
#+BEGIN_SRC conf
mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@"
mime ^audio|ogg$, X, flag f, has vlc = vlc -- "$@"
#+END_SRC
** Video
#+BEGIN_SRC conf
mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video, has vlc, X, flag f = vlc -- "$@"
#+END_SRC
** Misc
#+BEGIN_SRC conf
ext 1 = man "$1"
ext s[wmf]c, has zsnes, X = zsnes "$1"
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
ext nes, has fceux, X = fceux "$1"
ext exe = wine "$1"
name ^[mM]akefile$ = make
#+END_SRC
#+BEGIN_SRC conf
# Define the editor for non-text files + pager as last action
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@"
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
ext blend, has blender, X, flag f = blender -- "$@"
has dragon-drag-and-drop, X, flag f = dragon-drag-and-drop -a -x "$@"
#+END_SRC
@ -795,3 +775,4 @@ class fzf_select(Command):
else:
self.fm.select_file(fzf_file)
#+end_src

View File

@ -294,7 +294,7 @@ Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/usr/bin/vdirsyncer --verbosity "ERROR" sync
ExecStart=/home/thomas/.local/bin/vdirsyncer --verbosity "ERROR" sync
Type=oneshot
#+end_src
@ -377,3 +377,39 @@ Restart=on-failure
[Install]
WantedBy=default.target
#+end_src
* =trash-empty= - Empty the trash for files older than 30 days
** Service
:PROPERTIES:
:header-args: :tangle ~/.config/systemd/user/trash-empty.service
:header-args+: :comments both :mkdirp yes
:END:
#+begin_src conf
[Unit]
Description=Empty the trash for files older than 30 days
Documentation=https://github.com/andreafrancia/trash-cli
[Service]
ExecStart=/home/thomas/.local/bin/trash-empty 30
Type=oneshot
#+end_src
** Timer
:PROPERTIES:
:header-args: :tangle ~/.config/systemd/user/trash-empty.timer
:header-args+: :comments both :mkdirp yes
:END:
#+begin_src conf
[Unit]
Description=Empty trash
[Timer]
OnCalendar=*-*-* 16:00:00
Persistent=true
Unit=trash-empty
[Install]
WantedBy=timers.target
#+end_src

View File

@ -77,7 +77,7 @@ svc %1 %2 %U -o create_dir_umask=000 -o create_file_umask=111 -o umask=000
Then, to mount the network drive using =sshfs=:
#+begin_src bash
net use X: \\sshfs.kr\thomas@192.168.1.150\srv\storage /persistent:yes
net use X: \\sshfs.kr\thomas@192.168.1.21\srv\storage /persistent:yes
#+end_src
To un-mount it: