diff options
author | Vikas Kushwaha <dev@vikas.rocks> | 2024-11-21 13:30:52 +0530 |
---|---|---|
committer | Vikas Kushwaha <dev@vikas.rocks> | 2024-11-21 13:30:52 +0530 |
commit | 5c916d69d457101326803eb076a746060e3618cf (patch) | |
tree | d6fce3256eede1c1bf78fb6a1be75b9cc4b84cee /.local/bin/shorts |
Moved from github
Diffstat (limited to '.local/bin/shorts')
-rwxr-xr-x | .local/bin/shorts/adbs | 3 | ||||
-rwxr-xr-x | .local/bin/shorts/append-to-history | 5 | ||||
-rwxr-xr-x | .local/bin/shorts/bs | 7 | ||||
-rwxr-xr-x | .local/bin/shorts/conv | 10 | ||||
-rwxr-xr-x | .local/bin/shorts/diffdirs | 6 | ||||
-rwxr-xr-x | .local/bin/shorts/font2svg | 3 | ||||
-rwxr-xr-x | .local/bin/shorts/preview-bat | 3 | ||||
-rwxr-xr-x | .local/bin/shorts/preview-highlight | 3 | ||||
-rwxr-xr-x | .local/bin/shorts/refcitx | 6 | ||||
-rwxr-xr-x | .local/bin/shorts/sc | 3 | ||||
-rwxr-xr-x | .local/bin/shorts/scrcpy-k | 8 | ||||
-rwxr-xr-x | .local/bin/shorts/ssha | 5 | ||||
-rwxr-xr-x | .local/bin/shorts/sync-server | 12 | ||||
-rwxr-xr-x | .local/bin/shorts/syncdrive | 3 | ||||
-rwxr-xr-x | .local/bin/shorts/synchs | 7 | ||||
-rwxr-xr-x | .local/bin/shorts/synctab | 19 | ||||
-rwxr-xr-x | .local/bin/shorts/xdg-terminal-exec | 3 | ||||
-rwxr-xr-x | .local/bin/shorts/xprint | 8 |
18 files changed, 114 insertions, 0 deletions
diff --git a/.local/bin/shorts/adbs b/.local/bin/shorts/adbs new file mode 100755 index 0000000..bca7733 --- /dev/null +++ b/.local/bin/shorts/adbs @@ -0,0 +1,3 @@ +#!/bin/sh + +adb -s "${ADB_DEVICE}" shell "$@" diff --git a/.local/bin/shorts/append-to-history b/.local/bin/shorts/append-to-history new file mode 100755 index 0000000..7d23dc8 --- /dev/null +++ b/.local/bin/shorts/append-to-history @@ -0,0 +1,5 @@ +#!/bin/sh + +[ -n "$1" ] || exit +sed -i "\|^${1}$|d" "${2}" +echo "$1" >> "$2" diff --git a/.local/bin/shorts/bs b/.local/bin/shorts/bs new file mode 100755 index 0000000..7e7ec0a --- /dev/null +++ b/.local/bin/shorts/bs @@ -0,0 +1,7 @@ +#!/bin/sh + +# build site + +cd "${SITE_BASE_DIR:-$HOME/Dev/sites/vikas.rocks}" || exit +rm -rf public/* +hugo diff --git a/.local/bin/shorts/conv b/.local/bin/shorts/conv new file mode 100755 index 0000000..92379e8 --- /dev/null +++ b/.local/bin/shorts/conv @@ -0,0 +1,10 @@ +#!/bin/sed -nf + +p +s/\([0-9]\+\)[0-9]\{3\}\([^A-Za-z0-9]\|$\)/\1K\2/gp +s/\([0-9]\+\)[0-9]\{3\}K\([^A-Za-z0-9]\|$\)/\1M\2/gp +s/\([0-9]\+\)[0-9]\{3\}M\([^A-Za-z0-9]\|$\)/\1G\2/gp +s/\([0-9]\+\)[0-9]\{3\}G\([^A-Za-z0-9]\|$\)/\1T\2/gp +s/\([0-9]\+\)[0-9]\{3\}T\([^A-Za-z0-9]\|$\)/\1P\2/gp +s/\([0-9]\+\)[0-9]\{3\}P\([^A-Za-z0-9]\|$\)/\1Z\2/gp +s/\([0-9]\+\)[0-9]\{3\}Z\([^A-Za-z0-9]\|$\)/\1Y\2/gp diff --git a/.local/bin/shorts/diffdirs b/.local/bin/shorts/diffdirs new file mode 100755 index 0000000..9585f9f --- /dev/null +++ b/.local/bin/shorts/diffdirs @@ -0,0 +1,6 @@ +#!/bin/sh + +tree --dirsfirst -aL 3 "$1" > "$PREFIX/tmp/dir1.tree.txt" +tree --dirsfirst -aL 3 "$2" > "$PREFIX/tmp/dir2.tree.txt" +nvim -d "$PREFIX/tmp/dir1.tree.txt" "$PREFIX/tmp/dir2.tree.txt" + diff --git a/.local/bin/shorts/font2svg b/.local/bin/shorts/font2svg new file mode 100755 index 0000000..539972d --- /dev/null +++ b/.local/bin/shorts/font2svg @@ -0,0 +1,3 @@ +#!/bin/sh + +fontforge -c "import fontforge; fontforge.open('$1').generate('${1%.*}.svg')" diff --git a/.local/bin/shorts/preview-bat b/.local/bin/shorts/preview-bat new file mode 100755 index 0000000..43d1532 --- /dev/null +++ b/.local/bin/shorts/preview-bat @@ -0,0 +1,3 @@ +#!/bin/sh + +bat --tabs=2 --style=plain --color=always "$@" diff --git a/.local/bin/shorts/preview-highlight b/.local/bin/shorts/preview-highlight new file mode 100755 index 0000000..0972538 --- /dev/null +++ b/.local/bin/shorts/preview-highlight @@ -0,0 +1,3 @@ +#!/bin/sh + +highlight --force --stdout --replace-tabs=2 --out-format=ansi "$@" diff --git a/.local/bin/shorts/refcitx b/.local/bin/shorts/refcitx new file mode 100755 index 0000000..e99fcd3 --- /dev/null +++ b/.local/bin/shorts/refcitx @@ -0,0 +1,6 @@ +#!/bin/sh + +fcitx +sleep 0.1 +remap + diff --git a/.local/bin/shorts/sc b/.local/bin/shorts/sc new file mode 100755 index 0000000..8760379 --- /dev/null +++ b/.local/bin/shorts/sc @@ -0,0 +1,3 @@ +#!/bin/sh + +sc-im "$@" diff --git a/.local/bin/shorts/scrcpy-k b/.local/bin/shorts/scrcpy-k new file mode 100755 index 0000000..139732b --- /dev/null +++ b/.local/bin/shorts/scrcpy-k @@ -0,0 +1,8 @@ +#!/bin/sh + +remap -x +adb connect blue:43896 +notify-send scrcpy-k "Starting scrcpy..." +scrcpy -K --no-playback +notify-send scrcpy-k "Connection closed..." +remap diff --git a/.local/bin/shorts/ssha b/.local/bin/shorts/ssha new file mode 100755 index 0000000..3cbf87c --- /dev/null +++ b/.local/bin/shorts/ssha @@ -0,0 +1,5 @@ +#!/bin/sh + +[ "$TERM" != "${TERM#st-256color}" ] && export TERM=xterm-256color +sshadd "$(find ~/.ssh -name "${1}_id_*" | head -1)" +ssh "$@" -t "tmux attach -t $USER || tmux new -s $USER" diff --git a/.local/bin/shorts/sync-server b/.local/bin/shorts/sync-server new file mode 100755 index 0000000..641db9c --- /dev/null +++ b/.local/bin/shorts/sync-server @@ -0,0 +1,12 @@ +#!/bin/sh + +sshadd "$HOME/.ssh/${1}_id_ed25519" +sync() { rsync -PRru --delete --exclude "*.git" "$@"; } + +sync \ + "${XDG_CONFIG_HOME:-$HOME/.config}/./vim/vimrc" \ + "${XDG_CONFIG_HOME:-$HOME/.config}/./tmux/tmux.conf" \ + "${XDG_CONFIG_HOME:-$HOME/.config}/./shell/aliasrc" \ + "${XDG_CONFIG_HOME:-$HOME/.config}/./shell/inputrc" \ + "${XDG_CONFIG_HOME:-$HOME/.config}/./shell/server.profile" \ + "${1}:.config" diff --git a/.local/bin/shorts/syncdrive b/.local/bin/shorts/syncdrive new file mode 100755 index 0000000..3d010cc --- /dev/null +++ b/.local/bin/shorts/syncdrive @@ -0,0 +1,3 @@ +#!/bin/sh + +rclone -v sync --delete-excluded --exclude=".git/**" ~/GDrive gdrive: diff --git a/.local/bin/shorts/synchs b/.local/bin/shorts/synchs new file mode 100755 index 0000000..244dd48 --- /dev/null +++ b/.local/bin/shorts/synchs @@ -0,0 +1,7 @@ +#!/bin/sh + +sync-server rpi + +# rsync -u ~/.config/lf/lfrc /tmp/lfrc +# sed -i '/set icons/d' /tmp/lfrc +# rsync -Pu /tmp/lfrc rpi:.config/lf/ diff --git a/.local/bin/shorts/synctab b/.local/bin/shorts/synctab new file mode 100755 index 0000000..1e44419 --- /dev/null +++ b/.local/bin/shorts/synctab @@ -0,0 +1,19 @@ +#!/bin/sh + +sshadd ~/.ssh/tab_id_ed25519 +sync() { rsync -Pru --delete --exclude "*.git" "$@"; } + +sync ~/GDrive/ tab:GDrive/ +sync "${XDG_VIDEOS_DIR:-$HOME/Videos}" tab:Videos/ + +sync -R \ + "${XDG_DOCUMENTS_DIR:-$HOME/Documents}/./allreader" \ + "${XDG_DOCUMENTS_DIR:-$HOME/Documents}/./latex" \ + "${XDG_DOCUMENTS_DIR:-$HOME/Documents}/./Notes/bookmarks.txt" \ + tab:Documents/ + +sync \ + "${XDG_MUSIC_DIR:-$HOME/Music}/Piano" \ + "${XDG_MUSIC_DIR:-$HOME/Music}/Devotional" \ + tab:Music/ + diff --git a/.local/bin/shorts/xdg-terminal-exec b/.local/bin/shorts/xdg-terminal-exec new file mode 100755 index 0000000..43ed65d --- /dev/null +++ b/.local/bin/shorts/xdg-terminal-exec @@ -0,0 +1,3 @@ +#!/bin/sh + +st -e "$@" diff --git a/.local/bin/shorts/xprint b/.local/bin/shorts/xprint new file mode 100755 index 0000000..12156f2 --- /dev/null +++ b/.local/bin/shorts/xprint @@ -0,0 +1,8 @@ +#!/bin/sh + +[ -n "$TERMUX_VERSION" ] && { termux-clipboard-get; exit; } + +xclip -out -selection clipboard 2>/dev/null || +xclip -out -selection secondry 2>/dev/null || +xclip -out -selection primary 2>/dev/null || +notify-send "Selection and clipboard is empty" |