mirror of
https://github.com/harish2704/dotFiles.git
synced 2026-09-10 07:11:09 +00:00
Various updates
This commit is contained in:
+4
-4
@@ -34,12 +34,12 @@ export NVM_DIR="$HOME/.nvm"
|
||||
|
||||
|
||||
# The next line updates PATH for the Google Cloud SDK.
|
||||
if [ -f '/home/hari/Downloads/google-cloud-sdk/path.bash.inc' ]; then . '/home/hari/Downloads/google-cloud-sdk/path.bash.inc'; fi
|
||||
if [ -f "$HOME/Downloads/google-cloud-sdk/path.bash.inc" ]; then . "$HOME/Downloads/google-cloud-sdk/path.bash.inc"; fi
|
||||
|
||||
# The next line enables shell command completion for gcloud.
|
||||
if [ -f '/home/hari/Downloads/google-cloud-sdk/completion.bash.inc' ]; then . '/home/hari/Downloads/google-cloud-sdk/completion.bash.inc'; fi
|
||||
if [ -f "$HOME/Downloads/google-cloud-sdk/completion.bash.inc" ]; then . "$HOME/Downloads/google-cloud-sdk/completion.bash.inc"; fi
|
||||
|
||||
export DENO_INSTALL="/home/hari/.deno"
|
||||
export DENO_INSTALL="$HOME/.deno"
|
||||
export PATH="$DENO_INSTALL/bin:$PATH"
|
||||
export USER_BASHRC_READ=1
|
||||
fi
|
||||
@@ -49,5 +49,5 @@ nvmLoad(){
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
}
|
||||
|
||||
. $HOME/.local/Apps/daily-utils/bin/_hari-tools-completion.sh
|
||||
eval "$($HOME/.local/bin/hari-tools.sh setup-autocomplete) hari-tools.sh"
|
||||
. /usr/share/bash-completion/completions/fzf-key-bindings
|
||||
|
||||
@@ -11,7 +11,7 @@ _k_friendly_name=Keyboard Layout Switcher
|
||||
Capture=Ctrl+Print,none,Take screenshot
|
||||
Configure=none,none,Configure
|
||||
_k_friendly_name=Launch Flameshot
|
||||
_launch=,none,Launch Flameshot
|
||||
_launch=Meta+Ctrl+Print,none,Launch Flameshot
|
||||
|
||||
[kaccess]
|
||||
Toggle Screen Reader On and Off=Meta+Alt+S,Meta+Alt+S,Toggle Screen Reader On and Off
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ CommandActiveTitlebar3=Operations menu
|
||||
CommandAll1=Move
|
||||
CommandAll2=Toggle raise and lower
|
||||
CommandAll3=Resize
|
||||
CommandAllKey=Alt
|
||||
CommandAllKey=Meta
|
||||
CommandAllWheel=Nothing
|
||||
CommandInactiveTitlebar1=Activate and raise
|
||||
CommandInactiveTitlebar2=Nothing
|
||||
|
||||
@@ -48,7 +48,7 @@ let r_syntax_folding=1 " R
|
||||
let ruby_fold=1 " Ruby
|
||||
let sh_fold_enabled=1 " sh
|
||||
let vimsyn_folding='af' " Vim script
|
||||
let $FZF_DEFAULT_COMMAND='ag -g ""'
|
||||
let $FZF_DEFAULT_COMMAND='ag -ig ""'
|
||||
let g:gruvbox_contrast_dark = 'dark'
|
||||
|
||||
au BufEnter *.js.ejs set ft=javascript.ejs
|
||||
@@ -113,6 +113,7 @@ let g:syntastic_always_populate_loc_list = 1
|
||||
let g:syntastic_javascript_checkers = ['eslint']
|
||||
" }}}
|
||||
|
||||
let g:syntastic_go_checkers = ['gofmt']
|
||||
|
||||
|
||||
" set lazyredraw
|
||||
@@ -187,6 +188,7 @@ Plug 'ollykel/v-vim', { 'for': 'vlang' }
|
||||
Plug 'editorconfig/editorconfig-vim'
|
||||
Plug 'dart-lang/dart-vim-plugin', { 'for': 'dart' }
|
||||
Plug 'thosakwe/vim-flutter', { 'for': 'dart' }
|
||||
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
|
||||
" }
|
||||
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ immutability=1
|
||||
plugin=org.kde.plasma.icon
|
||||
|
||||
[Containments][23][Applets][74][Configuration]
|
||||
PreloadWeight=10
|
||||
PreloadWeight=0
|
||||
localPath=/home/hari/.local/share/plasma_icons/kcm_kdeconnect.desktop
|
||||
url=file:///usr/share/kservices5/kcm_kdeconnect.desktop
|
||||
|
||||
@@ -301,10 +301,18 @@ immutability=1
|
||||
plugin=org.kde.plasma.icon
|
||||
|
||||
[Containments][23][Applets][75][Configuration]
|
||||
PreloadWeight=42
|
||||
PreloadWeight=18
|
||||
localPath=/home/hari/.local/share/plasma_icons/firefox.desktop
|
||||
url=file:///usr/share/applications/firefox.desktop
|
||||
|
||||
[Containments][23][Applets][78]
|
||||
immutability=1
|
||||
plugin=org.kde.plasma.icon
|
||||
|
||||
[Containments][23][Applets][78][Configuration]
|
||||
localPath=/home/hari/.local/share/plasma_icons/barrier.desktop
|
||||
url=file:///usr/share/applications/barrier.desktop
|
||||
|
||||
[Containments][23][ConfigDialog]
|
||||
DialogHeight=90
|
||||
DialogWidth=1920
|
||||
@@ -313,7 +321,7 @@ DialogWidth=1920
|
||||
PreloadWeight=0
|
||||
|
||||
[Containments][23][General]
|
||||
AppletOrder=71;43;40;75;39;74;59;41;42;62;26;25;27;29;30
|
||||
AppletOrder=71;43;40;75;39;74;59;41;42;62;78;26;25;27;29;30
|
||||
|
||||
[Containments][46]
|
||||
activityId=
|
||||
@@ -350,14 +358,14 @@ immutability=1
|
||||
plugin=org.kde.plasma.keyboardindicator
|
||||
|
||||
[Containments][46][Applets][50][Configuration]
|
||||
PreloadWeight=5
|
||||
PreloadWeight=0
|
||||
|
||||
[Containments][46][Applets][51]
|
||||
immutability=1
|
||||
plugin=org.kde.plasma.notifications
|
||||
|
||||
[Containments][46][Applets][51][Configuration]
|
||||
PreloadWeight=15
|
||||
PreloadWeight=0
|
||||
|
||||
[Containments][46][Applets][51][Configuration][ConfigDialog]
|
||||
DialogHeight=1017
|
||||
@@ -368,7 +376,7 @@ immutability=1
|
||||
plugin=org.kde.plasma.battery
|
||||
|
||||
[Containments][46][Applets][52][Configuration]
|
||||
PreloadWeight=50
|
||||
PreloadWeight=100
|
||||
|
||||
[Containments][46][Applets][53]
|
||||
immutability=1
|
||||
@@ -386,14 +394,14 @@ immutability=1
|
||||
plugin=org.kde.plasma.bluetooth
|
||||
|
||||
[Containments][46][Applets][54][Configuration]
|
||||
PreloadWeight=2
|
||||
PreloadWeight=7
|
||||
|
||||
[Containments][46][Applets][55]
|
||||
immutability=1
|
||||
plugin=org.kde.plasma.mediacontroller
|
||||
|
||||
[Containments][46][Applets][55][Configuration]
|
||||
PreloadWeight=15
|
||||
PreloadWeight=0
|
||||
|
||||
[Containments][46][Applets][56][Configuration]
|
||||
PreloadWeight=42
|
||||
@@ -403,7 +411,7 @@ immutability=1
|
||||
plugin=org.kde.kdeconnect
|
||||
|
||||
[Containments][46][Applets][58][Configuration]
|
||||
PreloadWeight=0
|
||||
PreloadWeight=5
|
||||
|
||||
[Containments][46][Applets][61]
|
||||
immutability=1
|
||||
@@ -415,6 +423,16 @@ PreloadWeight=0
|
||||
[Containments][46][Applets][75][Configuration]
|
||||
PreloadWeight=42
|
||||
|
||||
[Containments][46][Applets][76]
|
||||
immutability=1
|
||||
plugin=org.kde.kscreen
|
||||
|
||||
[Containments][46][Applets][76][Configuration]
|
||||
PreloadWeight=100
|
||||
|
||||
[Containments][46][Applets][77][Configuration]
|
||||
PreloadWeight=42
|
||||
|
||||
[Containments][46][ConfigDialog]
|
||||
DialogHeight=540
|
||||
DialogWidth=720
|
||||
@@ -423,7 +441,7 @@ DialogWidth=720
|
||||
PreloadWeight=0
|
||||
|
||||
[Containments][46][General]
|
||||
extraItems=org.kde.plasma.volume,org.kde.plasma.keyboardindicator,org.kde.plasma.mediacontroller,org.kde.plasma.devicenotifier,org.kde.plasma.networkmanagement,org.kde.plasma.battery,org.kde.plasma.bluetooth,org.kde.plasma.notifications,org.kde.kdeconnect,org.kde.plasma.nightcolorcontrol
|
||||
extraItems=org.kde.plasma.volume,org.kde.plasma.keyboardindicator,org.kde.plasma.mediacontroller,org.kde.plasma.devicenotifier,org.kde.plasma.networkmanagement,org.kde.plasma.battery,org.kde.plasma.bluetooth,org.kde.plasma.notifications,org.kde.kdeconnect,org.kde.plasma.nightcolorcontrol,org.kde.kscreen
|
||||
iconSize=1
|
||||
knownItems=org.kde.plasma.volume,org.kde.plasma.keyboardindicator,org.kde.plasma.mediacontroller,org.kde.plasma.devicenotifier,org.kde.plasma.clipboard,org.kde.plasma.networkmanagement,org.kde.plasma.battery,org.kde.plasma.bluetooth,org.kde.plasma.notifications,org.kde.kdeconnect,org.kde.plasma.nightcolorcontrol
|
||||
|
||||
@@ -495,7 +513,7 @@ plugin=org.kde.plasma.folder
|
||||
wallpaperplugin=org.kde.image
|
||||
|
||||
[Containments][72][Configuration]
|
||||
PreloadWeight=10
|
||||
PreloadWeight=0
|
||||
|
||||
[Containments][72][Wallpaper][org.kde.image][General]
|
||||
Image=file:///usr/share/wallpapers/Next/contents/images/1920x1080.jpg
|
||||
@@ -508,4 +526,4 @@ immutability=1
|
||||
|
||||
[ScreenMapping]
|
||||
itemsOnDisabledScreens=
|
||||
screenMapping=desktop:/arduino-arduinoide.desktop,0,desktop:/LTspice XVII.desktop,0,desktop:/spacefm.desktop,0
|
||||
screenMapping=desktop:/spacefm.desktop,0,desktop:/LTspice XVII.desktop,0,desktop:/arduino-arduinoide.desktop,0
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
allCmds=$( hari-tools.sh list_all_commands )
|
||||
_complete_hari_utils(){
|
||||
saveIFS=$IFS
|
||||
IFS=$'\n'
|
||||
case $COMP_CWORD in
|
||||
1)
|
||||
COMPREPLY=( $( compgen -W "$allCmds" -- "${COMP_WORDS[COMP_CWORD]}") )
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( $( compgen -o default -- "${COMP_WORDS[COMP_CWORD]}") )
|
||||
;;
|
||||
esac
|
||||
IFS="$saveIFS"
|
||||
return 0
|
||||
}
|
||||
complete -F _complete_hari_utils hari-tools.sh
|
||||
@@ -1,5 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
THIS_DIR=$(dirname $(readlink -f $0))
|
||||
THIS_FILE=$0
|
||||
# Maximum allowed length of function name. longer names will break tabular display
|
||||
MAX_FN_NAME_LEN=30
|
||||
# Maximum number of documentation lines
|
||||
MAX_DOC_LINES=3
|
||||
|
||||
# list all available commands
|
||||
list-commands(){
|
||||
typeset -F | cut -d ' ' -f 3 | grep -v '^_' | sort
|
||||
}
|
||||
|
||||
# list available fonts for a language.
|
||||
# Usage: THIS_FN <lang_code>
|
||||
fonts_for_lang(){
|
||||
fc-list :lang=$1
|
||||
}
|
||||
@@ -17,19 +31,22 @@ sshInTabs(){
|
||||
done
|
||||
}
|
||||
|
||||
# Edit this file
|
||||
edit(){
|
||||
${EDITOR:-vim} ~/.local/Apps/daily-utils/bin/hari-tools.sh
|
||||
}
|
||||
|
||||
|
||||
# convert text to 8k wav
|
||||
# convert text to 8k 1ch wav
|
||||
genSound(){ echo $1 | espeak --stdout | ffmpeg -i - -ar 8000 -y $2.wav ; }
|
||||
|
||||
|
||||
# Clear SysRq-r if enabled
|
||||
clearSysRq(){
|
||||
sudo kbd_mode -s -C /dev/tty7
|
||||
}
|
||||
|
||||
# Print current public ip using ipify API
|
||||
myIp(){
|
||||
curl 'https://api.ipify.org?format=json'
|
||||
}
|
||||
@@ -75,6 +92,7 @@ block_dev_to_vmdk(){
|
||||
# Decode sha256 id shown in ssh log
|
||||
ssh-sha256-decode(){ awk '{print $2}' $1 | base64 -d | sha256sum -b | awk '{print $1}' | xxd -r -p | base64 ; }
|
||||
|
||||
# Git clone project into Downloads directory, and keep copy of the same as archive
|
||||
githubdl(){
|
||||
cd ~/Downloads
|
||||
git clone $1
|
||||
@@ -83,17 +101,17 @@ githubdl(){
|
||||
mksquashfs ./$projName $projName.sqfs
|
||||
}
|
||||
|
||||
# Uniq command awk version
|
||||
uniq(){
|
||||
awk '!array[$0]++'
|
||||
}
|
||||
|
||||
# Convert video webm format ( optional 2 pass encoding )
|
||||
video_to_webm(){
|
||||
src="$(readlink -f "$1")"
|
||||
dest="$(readlink -f "$2")"
|
||||
deadline=good
|
||||
cpu_param='--cpu-used=16'
|
||||
# cpu_param=''
|
||||
# deadline=best
|
||||
CODEC=${CODEC:-vp8}
|
||||
framesCount=$(ffmpeg -i "$src" -vcodec copy -acodec copy -f null /dev/null 2>&1 | grep 'frame=' | sed 's/frame= *\([0-9]*\).*/\1/' )
|
||||
echo "Frames count = $framesCount . If speed=10 fps, it will take $( python -S -c 'print("%2.2f" % ('$framesCount'/10.0/60))' ) minutes"
|
||||
@@ -105,40 +123,19 @@ video_to_webm(){
|
||||
ffmpeg -i "$src" -f yuv4mpegpipe - 2>/dev/null | vpxenc ${cpu_param} --codec=$CODEC -p 2 --${deadline} -o "$dest" --fpf="$pass1File" --pass=2 /dev/stdin
|
||||
rm $pass1File
|
||||
fi
|
||||
|
||||
# tmpFile=$(date +%s).webm
|
||||
# tmpdir=~/.cache/hari-utils/video_to_webm
|
||||
# mkdir -p $tmpdir
|
||||
# rm $tmpdir/*
|
||||
# cd $tmpdir
|
||||
# echo "Running first pass ..."
|
||||
# ffmpeg -i "$src" -c:v libvpx-vp9 -pass 1 -b:v 1000K -threads 8 -speed 4 \
|
||||
# -tile-columns 6 -frame-parallel 1 \
|
||||
# -an -f webm /dev/null
|
||||
#
|
||||
# echo "Now Second pass ..."
|
||||
# ffmpeg -i "$src" -c:v libvpx-vp9 -pass 2 -b:v 1000K -threads 8 -speed 1 \
|
||||
# -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 \
|
||||
# -c:a libopus -b:a 64k -f webm "$tmpFile"
|
||||
# mv "$tmpFile" "$dest"
|
||||
}
|
||||
|
||||
# Record desktop to h264 mp4 using ffmpeg
|
||||
record_desktop(){
|
||||
# ffmpeg -report -f x11grab -draw_mouse 1 -framerate 10 -video_size 1600x900 \
|
||||
# -i :0+0,0 -f alsa -ac 2 -i hw:0,0 -pix_fmt yuv420p -c:v h264 -c:a libmp3lame \
|
||||
# -q:v 1 -s 1600x900 -f mp4 ~/Videos/myscreencast-$(date +%F_%T).mp4
|
||||
|
||||
ffmpeg -vaapi_device /dev/dri/renderD128 -f x11grab -draw_mouse 1 -video_size 1600x900 \
|
||||
-i :0 -f alsa -ac 2 -i hw:0,0 -vf 'hwupload,scale_vaapi=format=nv12' -c:v h264_vaapi -qp 32 ~/Videos/myscreencast-$(date +%F_%T).mp4
|
||||
}
|
||||
|
||||
|
||||
list_all_commands(){
|
||||
typeset -F | cut -d ' ' -f 3 | grep -v '^_'
|
||||
}
|
||||
|
||||
|
||||
# Bulk replace string in all files in the directory
|
||||
bulk_replace(){
|
||||
set -u
|
||||
old=$1
|
||||
new=$2
|
||||
ag -l "$old" | xargs -l sed -i "s/${old}/${new}/g"
|
||||
@@ -146,6 +143,7 @@ bulk_replace(){
|
||||
}
|
||||
|
||||
|
||||
# Import csv file into postgres table by autogenerating table and column names
|
||||
psql_csv_table(){
|
||||
local db=$1
|
||||
shift
|
||||
@@ -170,6 +168,7 @@ EOF
|
||||
cat "$src" | psql "$@" $db -c "COPY \"$tbl\"( $( echo $cols | sed -E -e "s/'/\"/g" -e 's/([^,]*)/\1/g' ) ) FROM STDIN CSV HEADER"
|
||||
}
|
||||
|
||||
# Swap two files
|
||||
swap() {
|
||||
local TMPFILE=tmp.$$;
|
||||
mv "$1" $TMPFILE;
|
||||
@@ -177,22 +176,44 @@ swap() {
|
||||
mv $TMPFILE "$2";
|
||||
}
|
||||
|
||||
# Reload kwin Compositor
|
||||
kwinCompositorReload(){
|
||||
qdbus-qt5 org.kde.KWin /Compositor suspend
|
||||
qdbus-qt5 org.kde.KWin /Compositor resume
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Setup autocomplete. run eval "$(THIS_FILE setup-autocomplete)"
|
||||
setup-autocomplete(){
|
||||
cat<<EOF
|
||||
_complete_hdutils(){
|
||||
saveIFS=\$IFS
|
||||
IFS=\$'\n'
|
||||
case \$COMP_CWORD in
|
||||
1)
|
||||
COMPREPLY=( \$( compgen -W "\$( $THIS_FILE list-commands )" -- "\${COMP_WORDS[COMP_CWORD]}") )
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( \$( compgen -o default -- "\${COMP_WORDS[COMP_CWORD]}") )
|
||||
;;
|
||||
esac
|
||||
IFS="\$saveIFS"
|
||||
return 0
|
||||
}
|
||||
complete -F _complete_hdutils $THIS_FILE
|
||||
EOF
|
||||
}
|
||||
|
||||
cmd=$1
|
||||
shift
|
||||
allFunctions=$(list_all_commands | tr '\n' ' ')
|
||||
allFunctions=$(list-commands | tr '\n' ' ')
|
||||
if [ -n "$cmd" ] && [[ " $allFunctions " =~ " $cmd " ]]; then
|
||||
$cmd "$@"
|
||||
else
|
||||
cat<<EOF
|
||||
cat<<EOF
|
||||
Available commands:
|
||||
$( list_all_commands | sed 's/^/\t/g' | sort )
|
||||
$( list-commands | xargs -I@@ bash -c 'tabs '$MAX_FN_NAME_LEN'; \
|
||||
echo -en @@\\t; grep -B'$MAX_DOC_LINES' -A0 @@\(\) '$THIS_FILE' | grep "^#" | sed "s#THIS_FILE#'$THIS_FILE'#g; s#THIS_FN#@@#g;" | sed ":a; N; \$!ba; s/\n/\n\t/g;" ' )
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user