config: helpful helpers
This commit is contained in:
parent
2221e21201
commit
747b50f2e3
|
@ -31,13 +31,15 @@ image/jpeg=org.kde.showfoto.desktop;
|
||||||
image/png=org.kde.showfoto.desktop;
|
image/png=org.kde.showfoto.desktop;
|
||||||
inode/directory=org.kde.dolphin.desktop;
|
inode/directory=org.kde.dolphin.desktop;
|
||||||
text/html=firefox.desktop;
|
text/html=firefox.desktop;
|
||||||
x-scheme-handler/discord-757737740241731714=discord-757737740241731714.desktop
|
x-scheme-handler/discord-757737740241731714=discord-757737740241731714.desktop;
|
||||||
x-scheme-handler/etcher=balena-etcher-electron.desktop
|
x-scheme-handler/etcher=balena-etcher-electron.desktop;
|
||||||
x-scheme-handler/ferdi=ferdi.desktop
|
x-scheme-handler/ferdi=ferdi.desktop
|
||||||
x-scheme-handler/http=firefox.desktop;
|
x-scheme-handler/http=firefox.desktop;
|
||||||
x-scheme-handler/https=firefox.desktop;
|
x-scheme-handler/https=firefox.desktop;
|
||||||
x-scheme-handler/jitsi-meet=Jitsi Meet.desktop
|
x-scheme-handler/jitsi-meet=Jitsi Meet.desktop;
|
||||||
x-scheme-handler/org-protocol=org-protocol.desktop
|
x-scheme-handler/org-protocol=org-protocol.desktop;
|
||||||
x-scheme-handler/sgnl=signal-desktop.desktop
|
x-scheme-handler/sgnl=signal-desktop.desktop;
|
||||||
x-scheme-handler/signalcaptcha=signal.desktop
|
x-scheme-handler/signalcaptcha=signal.desktop;
|
||||||
x-scheme-handler/tg=telegram.desktop
|
x-scheme-handler/tg=telegram.desktop;
|
||||||
|
video/mp4=vlc.desktop;
|
||||||
|
text/calendar=emacsclient.desktop;
|
||||||
|
|
|
@ -8,7 +8,7 @@ let g:firenvim_config = {
|
||||||
\ 'cmdline': 'firenvim',
|
\ 'cmdline': 'firenvim',
|
||||||
\ 'priority': 0,
|
\ 'priority': 0,
|
||||||
\ 'selector': 'textarea:not([readonly]):not([class="handsontableInput"]):not([wrap="off"]):not([rows="1"]):not([title="Replace"]):not([title="Search"]):not([name="message"]),
|
\ 'selector': 'textarea:not([readonly]):not([class="handsontableInput"]):not([wrap="off"]):not([rows="1"]):not([title="Replace"]):not([title="Search"]):not([name="message"]),
|
||||||
\ div[role="textbox"]:not([aria-label="Search"]), div[class="CodeMirror"]',
|
\ div[role="textbox"]:not([aria-label="Search"]):not([class="ProseMirror"]), div[class="CodeMirror"]',
|
||||||
\ 'takeover': 'always',
|
\ 'takeover': 'always',
|
||||||
\ },
|
\ },
|
||||||
\ '.*com.*': {
|
\ '.*com.*': {
|
||||||
|
|
|
@ -270,7 +270,7 @@ u() {
|
||||||
if command -v pacman >/dev/null; then
|
if command -v pacman >/dev/null; then
|
||||||
if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d'-' -f1-2)" != "$(date +%Y-%m)"
|
if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d'-' -f1-2)" != "$(date +%Y-%m)"
|
||||||
then
|
then
|
||||||
# TODO or if location changed significantly or very slow
|
# TODO also run if location changed significantly or mirror is slow
|
||||||
if command -v pacman-mirrors >/dev/null
|
if command -v pacman-mirrors >/dev/null
|
||||||
then sudo pacman-mirrors --geoip
|
then sudo pacman-mirrors --geoip
|
||||||
else sudo touch /etc/pacman.d/mirrorlist
|
else sudo touch /etc/pacman.d/mirrorlist
|
||||||
|
@ -282,7 +282,7 @@ u() {
|
||||||
fi
|
fi
|
||||||
if command -v topgrade >/dev/null
|
if command -v topgrade >/dev/null
|
||||||
then
|
then
|
||||||
topgrade --disable node emacs remotes
|
nice -10 topgrade --disable node emacs remotes
|
||||||
if test -d "$XDG_CONFIG_HOME/emacs"
|
if test -d "$XDG_CONFIG_HOME/emacs"
|
||||||
then
|
then
|
||||||
builtin cd $XDG_CONFIG_HOME/emacs
|
builtin cd $XDG_CONFIG_HOME/emacs
|
||||||
|
@ -371,6 +371,7 @@ alias pmd='pandoc -t markdown_strict-raw_html'
|
||||||
alias clr='diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33 | less -F'
|
alias clr='diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33 | less -F'
|
||||||
|
|
||||||
alias f='fossil'
|
alias f='fossil'
|
||||||
|
alias fl='fossil timeline --format "[%d] %h %c <%a>"'
|
||||||
alias fs='fossil status'
|
alias fs='fossil status'
|
||||||
alias fc='fossil commit -v'
|
alias fc='fossil commit -v'
|
||||||
fdf() {
|
fdf() {
|
||||||
|
|
|
@ -26,13 +26,14 @@ case "$OPTION" in
|
||||||
(v) set -eo xtrace;
|
(v) set -eo xtrace;
|
||||||
export PS4='+\#> ';;
|
export PS4='+\#> ';;
|
||||||
(h|?) echo "Usage: $(basename $0) [-$opts] <paths...>" && exit 2;;
|
(h|?) echo "Usage: $(basename $0) [-$opts] <paths...>" && exit 2;;
|
||||||
|
(--) break;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift "$(($OPTIND -1))"
|
shift "$(($OPTIND -1))"
|
||||||
|
|
||||||
checkperm() {
|
checkperm() {
|
||||||
checkaccess -r "$@" || elevate=sudo
|
checkaccess -r "$@" || elevate=sudo
|
||||||
mime="$(test -n "$shifted" || $elevate file --dereference --mime "$@")"
|
mime="$(test -n "$shifted" || $elevate file --dereference --mime -- "$@")"
|
||||||
}
|
}
|
||||||
fileinfo() {
|
fileinfo() {
|
||||||
tput setaf 4
|
tput setaf 4
|
||||||
|
@ -45,8 +46,7 @@ fileinfo() {
|
||||||
# TODO do not grep bitrate but extract properly
|
# TODO do not grep bitrate but extract properly
|
||||||
#probe="$($elevate ffprobe "$arg" 2>&1)"
|
#probe="$($elevate ffprobe "$arg" 2>&1)"
|
||||||
#echo $probe | grep -v -e '00:00:00.04' -e 'ansi' &&
|
#echo $probe | grep -v -e '00:00:00.04' -e 'ansi' &&
|
||||||
$inspect ||
|
{ ! $inspect && $elevate ffprobe -hide_banner "$arg" 2>&1 | grep "bitrate: ....\? " | sed 's/, start:[^,]\+,/,/'; } ||
|
||||||
$elevate ffprobe -hide_banner "$arg" 2>&1 | grep "bitrate: ....\? " | sed 's/, start:[^,]\+,/,/' ||
|
|
||||||
$elevate stat --format "%U:%G %A %s $(
|
$elevate stat --format "%U:%G %A %s $(
|
||||||
size="$($elevate unzip -l "$arg" 2>/dev/null | tail -1)" &&
|
size="$($elevate unzip -l "$arg" 2>/dev/null | tail -1)" &&
|
||||||
echo "(uncompressed $(echo $size | cut -d' ' -f1 | numfmt --to=iec-i --suffix=B))"
|
echo "(uncompressed $(echo $size | cut -d' ' -f1 | numfmt --to=iec-i --suffix=B))"
|
||||||
|
@ -59,7 +59,7 @@ prefix=/tmp/b
|
||||||
mkdir -p "$prefix"
|
mkdir -p "$prefix"
|
||||||
declare -a timg timga bat batplain ls
|
declare -a timg timga bat batplain ls
|
||||||
for arg; do
|
for arg; do
|
||||||
case "$arg" in (-*) flags="$flags $arg"; continue;; esac
|
test -z "$noflags" && case "$arg" in (--) noflags=true; continue;; (-*) flags="$flags $arg"; continue;; esac
|
||||||
checkperm "$arg"
|
checkperm "$arg"
|
||||||
if ! $elevate test -e "$arg"
|
if ! $elevate test -e "$arg"
|
||||||
then if test -h "$arg"
|
then if test -h "$arg"
|
||||||
|
@ -70,7 +70,7 @@ for arg; do
|
||||||
fi
|
fi
|
||||||
# amount of columns in a grid
|
# amount of columns in a grid
|
||||||
grid=$(expr $(tput cols) / \( 25 - \( $# / 2 \) \& $# \< 30 \| 5 \))
|
grid=$(expr $(tput cols) / \( 25 - \( $# / 2 \) \& $# \< 30 \| 5 \))
|
||||||
tmpfile="$prefix/$(basename "$arg")_$(dd "if=$arg" bs=512 count=10 2>/dev/null | md5sum | tr -d ' ' || true)"
|
tmpfile="$prefix/$(basename -- "$arg")_$(dd "if=$arg" bs=512 count=10 2>/dev/null | md5sum | tr -d ' ' || true)"
|
||||||
mkdir -p "$prefix"
|
mkdir -p "$prefix"
|
||||||
case "$mime" in
|
case "$mime" in
|
||||||
(*\ application/pdf\;*)
|
(*\ application/pdf\;*)
|
||||||
|
@ -97,7 +97,7 @@ for arg; do
|
||||||
suffix=_thumbs.jpg
|
suffix=_thumbs.jpg
|
||||||
mtn -q -i -t -W -r$(expr 5 - $# \& $# \< 4 \| 1) -D6 -b 0.6 -c $grid -w $(expr $(tput cols) '*' 20) \
|
mtn -q -i -t -W -r$(expr 5 - $# \& $# \< 4 \| 1) -D6 -b 0.6 -c $grid -w $(expr $(tput cols) '*' 20) \
|
||||||
-O "$prefix" -o "$suffix" "$arg" &&
|
-O "$prefix" -o "$suffix" "$arg" &&
|
||||||
timg -W "$prefix/$(basename "${arg%.*}")$suffix"
|
timg -W "$prefix/$(basename -- "${arg%.*}")$suffix"
|
||||||
;;
|
;;
|
||||||
(*\ image/*)
|
(*\ image/*)
|
||||||
timg+=("$arg")
|
timg+=("$arg")
|
||||||
|
@ -171,7 +171,7 @@ if test "$timg"; then
|
||||||
for img in "${timg[@]}"
|
for img in "${timg[@]}"
|
||||||
do case $img in (*.gif) continue;; esac
|
do case $img in (*.gif) continue;; esac
|
||||||
ident="$(identify -ping -precision 3 -format "%wx%h %b %m %[bit-depth]-bit %[colorspace]" "$img")"
|
ident="$(identify -ping -precision 3 -format "%wx%h %b %m %[bit-depth]-bit %[colorspace]" "$img")"
|
||||||
printf "%11s %-30s %s\n" "${ident%% *}" "$(basename "$img")" "${ident#* }"
|
printf "%11s %-30s %s\n" "${ident%% *}" "$(basename -- "$img")" "${ident#* }"
|
||||||
done
|
done
|
||||||
tput sgr0
|
tput sgr0
|
||||||
fi
|
fi
|
||||||
|
@ -195,8 +195,8 @@ if test "$bat" -o "$batplain"; then
|
||||||
then case $TERM in (*kitty)
|
then case $TERM in (*kitty)
|
||||||
declare -a timgtxt
|
declare -a timgtxt
|
||||||
for file in "${bat[@]}"
|
for file in "${bat[@]}"
|
||||||
do txt="$prefix/$(basename "$file").txt"
|
do txt="$prefix/$(basename -- "$file").txt"
|
||||||
cp "$file" "$txt"
|
cp -- "$file" "$txt"
|
||||||
timgtxt+=("$txt")
|
timgtxt+=("$txt")
|
||||||
done
|
done
|
||||||
timg -V --grid="$(expr 4 \& ${#bat[@]} \> 5 \| ${#bat[@]})" --title="%b" --frames=3 "${timgtxt[@]}" ||
|
timg -V --grid="$(expr 4 \& ${#bat[@]} \> 5 \| ${#bat[@]})" --title="%b" --frames=3 "${timgtxt[@]}" ||
|
||||||
|
@ -236,11 +236,11 @@ if test "$ls" -o $# -le $(echo "$flags" | wc -w); then
|
||||||
# TODO listing sometimes doubles as exa prints partial listings while working
|
# TODO listing sometimes doubles as exa prints partial listings while working
|
||||||
timeout .6s sh -c "
|
timeout .6s sh -c "
|
||||||
if test '$tree'
|
if test '$tree'
|
||||||
then $elevate tree -a --dirsfirst --du -h -C -L 3 $flags $(printf "'%s' " "${ls[@]:-.}")
|
then $elevate tree -a --dirsfirst --du -h -C -L 3 $flags -- $(printf "'%s' " "${ls[@]:-.}")
|
||||||
elif which exa 2>/dev/null >&2
|
elif which exa 2>/dev/null >&2
|
||||||
then $elevate exa --icons --color=always --long --group --classify --all --all --sort=modified --reverse $flags $(printf "'%s' " "${ls[@]:-.}")
|
then $elevate exa --icons --color=always --long --group --classify --all --all --sort=modified --reverse $flags -- $(printf "'%s' " "${ls[@]:-.}")
|
||||||
else $elevate ls -l $(test $# -gt ${#ls[@]} && echo '-d') --color=always --human-readable --si --group-directories-first --file-type --dereference-command-line-symlink-to-dir --all $flags $(printf "'%s' " "${ls[@]:-.}")
|
else $elevate ls -l $(test $# -gt ${#ls[@]} && echo '-d') --color=always --human-readable --si --group-directories-first --file-type --dereference-command-line-symlink-to-dir --all $flags -- $(printf "'%s' " "${ls[@]:-.}")
|
||||||
fi
|
fi
|
||||||
" || $elevate ls $(test $# -gt ${#ls[@]} && echo "-d") --color=always --human-readable --si --dereference-command-line --all --sort=none $flags "${ls[@]:-.}"
|
" || $elevate ls $(test $# -gt ${#ls[@]} && echo "-d") --color=always --human-readable --si --dereference-command-line --all --sort=none $flags -- "${ls[@]:-.}"
|
||||||
} | $pager --quit-if-one-screen
|
} | $pager --quit-if-one-screen
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -6,7 +6,7 @@ typeset -A _clean_map
|
||||||
_clean_map=([h]=$XDG_CACHE_HOME [t]=/var/tmp [l]=/var/log [v]=/var/cache)
|
_clean_map=([h]=$XDG_CACHE_HOME [t]=/var/tmp [l]=/var/log [v]=/var/cache)
|
||||||
# TODO .mix - outdated version in socha
|
# TODO .mix - outdated version in socha
|
||||||
_clean_home=(.ant .autopsy .bundle .cache .cargo .cpanm .docker .electron .electron-gyp .gradle .gradle-kotlin-dsl .hex .java .kscript .konan .m2 .nix-defexpr .node-gyp .nv .openjfx .parallel .stack .surf .texlive
|
_clean_home=(.ant .autopsy .bundle .cache .cargo .cpanm .docker .electron .electron-gyp .gradle .gradle-kotlin-dsl .hex .java .kscript .konan .m2 .nix-defexpr .node-gyp .nv .openjfx .parallel .stack .surf .texlive
|
||||||
.yarn .node_modules .npm .pnpm-store
|
.yarn .node_modules .npm .pnpm-store
|
||||||
luametatex-cache luatex-cache
|
luametatex-cache luatex-cache
|
||||||
.lesshst .python_history .rubberband.wisdom.d .yarnrc)
|
.lesshst .python_history .rubberband.wisdom.d .yarnrc)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
# Move common files into their place from the downloads folder.
|
||||||
|
dow=$DATA/5-*/download
|
||||||
|
rmlint --rank-by=l -o pretty -o sh:/tmp/dow.sh *.*
|
||||||
|
printf "Enter to confirm, any text to skip. "
|
||||||
|
read -r answer
|
||||||
|
test -n "$answer" || /tmp/dow.sh -d
|
||||||
|
mv -v -- $dow/*.mp3 $dow/*.flac $dow/*.wav $MUSIC/
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# Start Gaming Tools
|
||||||
steam >/dev/null 2>&1 &
|
steam >/dev/null 2>&1 &
|
||||||
discord >/dev/null 2>&1 &
|
discord >/dev/null 2>&1 &
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Order images downloaded from gamedeveloperstudio into software-challenge assets
|
||||||
|
cd $DATA/1*/software-challenge/assets/illustrations
|
||||||
|
mv -v ${@:-$DATA/5*/download/*-*.zip} .
|
||||||
|
ex *.zip
|
||||||
|
find -name 'info_about_*' -name thankyou.png -delete
|
|
@ -12,7 +12,7 @@ fzfpipe() {
|
||||||
# Take nul-separated input from git-status short/porcelain
|
# Take nul-separated input from git-status short/porcelain
|
||||||
# and return a newline-separated list of selected files
|
# and return a newline-separated list of selected files
|
||||||
cut -z -c2- |
|
cut -z -c2- |
|
||||||
git fzf-diff --read0 -d' ' --nth=2.. --bind="alt-enter:execute($EDITOR '$(git rev-parse --show-toplevel)/{2..}')" \
|
git fzf-diff --read0 -d' ' --nth=2.. --bind="alt-enter:execute($EDITOR '$(git rev-parse --show-toplevel)/{2..}'),alt-d:execute(git restore --worktree --staged '$(git rev-parse --show-toplevel)/{2..}')" \
|
||||||
--preview="test {1} != \? && git diff --color HEAD --unified=4 -- {2..} | $(git config interactive.diffFilter | grep . || echo $PAGER) || find {2..} -type f | xargs -I% diff --recursive --color=always -u /dev/null %" |
|
--preview="test {1} != \? && git diff --color HEAD --unified=4 -- {2..} | $(git config interactive.diffFilter | grep . || echo $PAGER) || find {2..} -type f | xargs -I% diff --recursive --color=always -u /dev/null %" |
|
||||||
cut -c3-
|
cut -c3-
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,8 @@ showinfo() {
|
||||||
cmd="$1"
|
cmd="$1"
|
||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
# TODO extract help in standard format from scripts
|
# TODO extract help in standard format from scripts
|
||||||
(fwupdmgr|hunt|rdoc|gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr|docker|jrnl|difft|wiked-diff|qpdf) unbuffer "$@" --help | sed 's|^[^ ].*:|[1m\0[22m|' | $paginate;;
|
(fwupdmgr|hunt|rdoc|gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr|docker|jrnl|difft|wiked-diff|qpdf|ninja) unbuffer "$@" --help | sed 's|^[^ ].*:|[1m\0[22m|' | $paginate;;
|
||||||
(caddy|stretchly|go|fossil|flutter) test "$cmd" = "fossil" -a $# -eq 1 && repo="$(locate -b -l 1 "fossil*.fossil")" && fossil ui "$repo" && exit
|
(caddy|stretchly|go|flutter)
|
||||||
# TODO view fossil ui in terminal
|
|
||||||
shift
|
shift
|
||||||
"$cmd" help "$@" | $paginate;;
|
"$cmd" help "$@" | $paginate;;
|
||||||
# Non-standard help flags
|
# Non-standard help flags
|
||||||
|
@ -39,6 +38,12 @@ case "$cmd" in
|
||||||
(vlc) shift && unbuffer vlc --full-help "$@" | $paginate;;
|
(vlc) shift && unbuffer vlc --full-help "$@" | $paginate;;
|
||||||
(kdeconnect*) shift && kdeconnect-cli --help-all "$@" | $paginate;;
|
(kdeconnect*) shift && kdeconnect-cli --help-all "$@" | $paginate;;
|
||||||
# Show manpage with tweaks
|
# Show manpage with tweaks
|
||||||
|
(fossil)
|
||||||
|
# TODO view fossil ui in terminal
|
||||||
|
if test $# -eq 1 && repo="$(locate -b -l 1 "fossil*.fossil")"
|
||||||
|
then fossil ui --page=doc/trunk/www/permutedindex.html "$repo"
|
||||||
|
else shift; fossil help "$@"
|
||||||
|
fi;;
|
||||||
(pandoc) man pandoc; highlight "Extensions" && pandoc --list-extensions | paste -s -d' ';;
|
(pandoc) man pandoc; highlight "Extensions" && pandoc --list-extensions | paste -s -d' ';;
|
||||||
(swaymsg) test $# -gt 1 && shift && man sway "$@" || man swaymsg;;
|
(swaymsg) test $# -gt 1 && shift && man sway "$@" || man swaymsg;;
|
||||||
(swaymsg-*) man sway "${1#swaymsg-}";;
|
(swaymsg-*) man sway "${1#swaymsg-}";;
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
# Reload mpd with appropriate config
|
||||||
|
yadm alt
|
||||||
|
cd $XDG_CONFIG_HOME/mpd
|
||||||
|
mv *template ..
|
||||||
|
mv ../*template .
|
||||||
|
systemctl --user restart mpd
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Move all given files to a syncthing-like conflict file name based on the last argument
|
||||||
|
for last; do true; done
|
||||||
|
i=1
|
||||||
|
while test $i -lt $#
|
||||||
|
do file=${!i}
|
||||||
|
mv -iv $file $last.sync-conflict-$(stat -c %y $file | tr -d ':-' | cut -c-25 | tr ' .' '-')
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
|
@ -14,6 +14,6 @@ Examples:
|
||||||
- ${VAR##*/} :: retain the basename
|
- ${VAR##*/} :: retain the basename
|
||||||
- ${VAR%.*} :: remove extension
|
- ${VAR%.*} :: remove extension
|
||||||
- [[https://unix.stackexchange.com/a/486694][argument from end of list]] ::
|
- [[https://unix.stackexchange.com/a/486694][argument from end of list]] ::
|
||||||
: eval x=\$$(($#-1))
|
: eval last=\$$(($#-1))
|
||||||
(uses arithmetic substitution, a non-POSIX feature)
|
(uses arithmetic substitution, a non-POSIX feature)
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
sleep "$@"
|
# Put system to sleep after specified number of seconds
|
||||||
|
$(which timer || sleep) "${@:-10}"
|
||||||
systemctl suspend
|
systemctl suspend
|
||||||
|
|
|
@ -13,5 +13,5 @@ case "$1" in
|
||||||
(init) sudo -E sysyadm init -b main -w /;;
|
(init) sudo -E sysyadm init -b main -w /;;
|
||||||
(*) sudo -E sysyadm "$@";;
|
(*) sudo -E sysyadm "$@";;
|
||||||
esac
|
esac
|
||||||
|
#sudo chmod +rw /tmp/git -R 2>/dev/null
|
||||||
sudo chown -R $USER /etc/yadm
|
sudo chown -R $USER /etc/yadm
|
||||||
sudo chmod ugo+rw /tmp/git -R 2>/dev/null
|
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
convert -background white -density 500 "$@" "$1.png"
|
# Convert given file to PNG
|
||||||
|
pdftoppm -png "$@" >"$1.png" ||
|
||||||
|
convert -background white -alpha off -density 500 "$@" "$1.png"
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
# Use xdg-mime with a file's mime type
|
# Use xdg-mime with a file's mime type
|
||||||
# ARGS: file [application]
|
# ARGS: file [application]
|
||||||
xdg-mime query default "$(xdg-mime query filetype "$1")"
|
type="$(xdg-mime query filetype "$1")"
|
||||||
|
xdg-mime query default "$type"
|
||||||
if test $# -gt 1; then
|
if test $# -gt 1; then
|
||||||
desktop="$(find /usr/share/applications $XDG_DATA_HOME/applications | fzf -0 -1 --query="$2")" &&
|
desktop="$(find /usr/share/applications $XDG_DATA_HOME/applications | fzf -0 -1 --query="$2" --preview 'bat --color=always --style=numbers --line-range :200 {}' | xargs -r basename)" &&
|
||||||
xdg-mime default "$desktop" "$(xdg-mime query filetype "$1")" &&
|
xdg-mime default "$desktop" "$type" &&
|
||||||
echo -n "Updated to: " &&
|
echo -n "Updated to: " &&
|
||||||
xdg-mime query default "$(xdg-mime query filetype "$1")"
|
xdg-mime query default "$type"
|
||||||
fi
|
fi
|
||||||
# || echo "Cannot find application $2 in /usr/share/applications!"
|
# || echo "Cannot find application $2 in /usr/share/applications!"
|
||||||
|
|
8
.zshenv
8
.zshenv
|
@ -44,7 +44,7 @@ export KREW_ROOT="$XDG_DATA_HOME"/krew
|
||||||
export CARGO_HOME="$XDG_STATE_HOME"/cargo
|
export CARGO_HOME="$XDG_STATE_HOME"/cargo
|
||||||
export RUSTUP_HOME="$XDG_STATE_HOME"/rustup
|
export RUSTUP_HOME="$XDG_STATE_HOME"/rustup
|
||||||
|
|
||||||
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
|
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
|
||||||
export NVM_DIR="$XDG_DATA_HOME"/nvm
|
export NVM_DIR="$XDG_DATA_HOME"/nvm
|
||||||
export N_PREFIX="$XDG_STATE_HOME"/n
|
export N_PREFIX="$XDG_STATE_HOME"/n
|
||||||
|
|
||||||
|
@ -146,10 +146,12 @@ $($_fzf_latest && echo '--preview-window=60%,border-left --marker=o')"
|
||||||
FD_BASE="fd --hidden --color=always --no-ignore-vcs"
|
FD_BASE="fd --hidden --color=always --no-ignore-vcs"
|
||||||
export FZF_DEFAULT_COMMAND="$FD_BASE --type file"
|
export FZF_DEFAULT_COMMAND="$FD_BASE --type file"
|
||||||
export FZF_CTRL_T_COMMAND="$FD_BASE -d 7"
|
export FZF_CTRL_T_COMMAND="$FD_BASE -d 7"
|
||||||
## ctest
|
## cplusplus - ctest, cmake, ninja
|
||||||
|
SPARE_CORES=$(expr $(lscpu --extended | awk '{print $7}' | sort | uniq -c | head -1 | awk '{print $1}') \* 4 / 5)
|
||||||
|
export CMAKE_BUILD_PARALLEL_LEVEL=${SPARE_CORES}
|
||||||
|
export CTEST_PARALLEL_LEVEL=${SPARE_CORES}
|
||||||
export CTEST_PROGRESS_OUTPUT=1
|
export CTEST_PROGRESS_OUTPUT=1
|
||||||
export CTEST_OUTPUT_ON_FAILURE=1
|
export CTEST_OUTPUT_ON_FAILURE=1
|
||||||
export CTEST_PARALLEL_LEVEL=3
|
|
||||||
|
|
||||||
# TODO move to proper place - is also called when firenvim starts
|
# TODO move to proper place - is also called when firenvim starts
|
||||||
#autolight
|
#autolight
|
||||||
|
|
Loading…
Reference in New Issue