diff --git a/home/.local/Apps/daily-utils/bin/hari-tools.sh b/home/.local/Apps/daily-utils/bin/hari-tools.sh index 21c3c31..24c5838 100755 --- a/home/.local/Apps/daily-utils/bin/hari-tools.sh +++ b/home/.local/Apps/daily-utils/bin/hari-tools.sh @@ -12,6 +12,74 @@ list-commands(){ typeset -F | cut -d ' ' -f 3 | grep -v '^_' | sort } +# ts / tsx to js/jsx +tstojs(){ + set -x + tsc --jsx preserve -t es2020 --outDir js --noEmit false $@ +} + +# cmd Create file by creating all parents +touchp(){ + local fname="$1" + local parentDir=$(dirname "$fname") + mkdir -p "$parentDir" + touch "$fname" +} + +# cmd . Change waydroid size and restart session +waydroidChangeSize(){ + local width=$1 + local height=$2 + waydroid prop set persist.waydroid.width $width + waydroid prop set persist.waydroid.height $height + waydroid session stop + waydroid session start & + sleep 1 + waydroid show-full-ui +} + +# Restart pulseaudio +pulseAudioRestart(){ + set -x + systemctl --user restart pipewire-pulse +} + +# Convert video to mp4 for mobile device. videoformobile [opts...] +videoformobile(){ + local infile=$1; + shift + set -x + ffmpeg -i "$infile" -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 $@ +} + +# allow permission for docker container. dockerAllow +dockerAllow(){ + set -x + chcon -R system_u:object_r:container_file_t:s0 "$1" +} + +# Start development env in current directory +devSetup(){ + qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Switch One Desktop to the Right" + lvim & + bash-session -n & + sleep 1.5 + qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Window Maximize" + qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Walk Through Windows" + qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Window Maximize" + qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Switch One Desktop Down" + git gui & + sleep 1.5 + qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Window Maximize" + qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Switch One Desktop Up" +} + +# cd to npm home +npmHome(){ + cd ~/.node_modules_mine; + bash-session +} + # cmd .csv to json using miller cli csvToJson(){ mlr --c2j --jlistwrap cat "$1" @@ -39,7 +107,7 @@ ocr(){ } # resize pdf -resizePdf(){ +pdfResize(){ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dDownsampleColorImages=true -dColorImageResolution=94 -dNOPAUSE -dBATCH -sOutputFile="$2" "$1" } @@ -68,6 +136,7 @@ clearSysRq(){ # Print current public ip using ipify API myIp(){ + set -x curl 'https://api.ipify.org?format=json' } @@ -202,6 +271,23 @@ kwinCompositorReload(){ qdbus-qt5 org.kde.KWin /Compositor resume } +# Clone git with custom key +# gitclone [ssh_key_path] +gitClone(){ + set -x + local url="$1" + shift + local sshkey="$1" + if [[ -n "$sshkey" ]]; then + export GIT_SSH_COMMAND="ssh -i '$sshkey'" + fi + targetDir=$(basename "$url") + targetDir=${targetDir/.git/} + git clone "$url" "$targetDir" + cd "$targetDir" + git config core.sshCommand "$GIT_SSH_COMMAND" +} + # format cookies copied from chrome cookie table # Usage cat file | formatChromeCookie domain.com formatChromeCookie(){ @@ -284,12 +370,12 @@ pulseTcpStop(){ pactl unload-module module-native-protocol-tcp } -#list scsi devices +# list scsi devices scsiList(){ cat /proc/scsi/scsi } -#remove scsi device +# remove scsi device scsiRemoveDevice(){ cat < /proc/scsi/scsi diff --git a/home/.local/Apps/daily-utils/install-data-utils.sh b/home/.local/Apps/daily-utils/install-data-utils.sh new file mode 100755 index 0000000..6652fdf --- /dev/null +++ b/home/.local/Apps/daily-utils/install-data-utils.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# Download following +# 1. https://github.com/cube2222/octosql +# 2. https://github.com/TomWright/dasel +# 3. https://github.com/multiprocessio/dsq +# 4. https://github.com/roapi/roapi +# 5. https://github.com/dcmoura/spyql + +Projects=( + https://github.com/cube2222/octosql + https://github.com/TomWright/dasel + https://github.com/multiprocessio/dsq + https://github.com/roapi/roapi + https://github.com/dcmoura/spyql +) + +getTarball(){ + local projUrl=$1 + local githubRepo=$(echo $projUrl | sed 's#https://github.com/##g') + local tarballs=$(curl -s "https://api.github.com/repos/$githubRepo/releases/latest" | grep 'browser_download_url.*gz' | grep -E 'amd64|x86_64' | grep linux | cut -d'"' -f4) + echo $tarballs +} + +downloadPkg(){ + local projUrl=$1 + latestTarball=$(getTarball "$projUrl") + echo wget -c "$latestTarball" +} + +main(){ + for projUrl in ${Projects[@]} ; do + downloadPkg "$projUrl" + done +} + +main diff --git a/home/.tmux.conf b/home/.tmux.conf index 02b2cae..ac81c16 100644 --- a/home/.tmux.conf +++ b/home/.tmux.conf @@ -1,3 +1,5 @@ +set-option -g default-terminal 'tmux-256color' +set-option -ga terminal-overrides ',xterm-256color:Tc' setw -g mode-keys vi set-option -g mouse on bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xsel -i --clipboard"