all repos — dotfiles @ d474d5f8e7d6bd7bd443965bedc0cc097aa70b00

linux dotfiles

a bunch of stuff man, idk..lol
Prithu Goswami prithugoswami524@gmail.com
Sun, 23 May 2021 12:29:07 +0530
commit

d474d5f8e7d6bd7bd443965bedc0cc097aa70b00

parent

22beee0d8cbd75e392e684e648ec1e0751615a51

M bin/cron/org-autocommit-cronbin/cron/org-autocommit-cron

@@ -5,3 +5,6 @@ cmsg=$(git status -s)

git add . && git commit -m "auto commit: $(whoami)@$(hostname)"\ -m "$cmsg" ping -q -c 1 google.com >/dev/null && git push + +cd $HOME +pass git pull && pass git push && pass git push glix
A bin/misc/lmm_test

@@ -0,0 +1,76 @@

+#!/bin/sh + +ADMIN_TOKEN="" +BASE_URL="https://lmmdev.tk" +#BASE_URL="http://localhost:8000" + +if [ -z $LT_ENV ] +then + printf 'set $LT_ENV to local or remote\n' +else + if [ $LT_ENV = "local" ] + then + BASE_URL="localhost:8000" + else + # BASE_URL="https://lmmdev.tk" + BASE_URL="https://lmm.gdaschools.com" + fi +fi + + +method="$1" +if [ $method = "POST" ] +then + file="$2" + api_endpoint="$3" + + if [ -n "$4" ] + then + if [ "$4" = none ] + then + token="" + auth_header="" + else + token="$4" + auth_header="Authorization: Bearer $token" + fi + else + token="$ADMIN_TOKEN" + auth_header="Authorization: Bearer $token" + fi + + url="$BASE_URL$api_endpoint" + curl -X POST\ + -d@"$file"\ + -H 'Content-Type: application/json'\ + -H "$auth_header"\ + "$url" + +elif [ $method = "GET" ] +then + api_endpoint="$2" + if [ -n "$3" ] + then + if [ "$3" = none ] + then + token="" + auth_header="" + else + token="$3" + auth_header="Authorization: Bearer $token" + fi + else + token=$ADMIN_TOKEN + auth_header="Authorization: Bearer $token" + fi + + url="$BASE_URL$api_endpoint" + curl -L -X GET\ + -H 'Content-Type: application/json'\ + -H "$auth_header"\ + "$url" +fi + + + +
A bin/scripts/calc_investments

@@ -0,0 +1,9 @@

+#!/bin/bash + +file="$HOME/docs/org/investments.csv" + +sc=$(awk -F, '/,/{gsub(/ /, "",$2); if ($2=="SC") sum+=$1 } END { print sum }' $file) +c=$(awk -F ',' '/,/{gsub(/ /, "",$2); if ($2=="C") sum+=$1 } END { print sum }' $file) +t=$(awk -F ',' '/,/{sum+=$1 } END { print sum }' $file) + +echo -e "SC: \t$sc\nC:\t$c\nTotal:\t$t"
M bin/scripts/logbin/scripts/log

@@ -8,7 +8,7 @@ tmp_file_path=/tmp/llentry

l="$(printf '' | dmenu)" date="$(date "+%Y-%m-%d %H:%M:%S")" [ "$l" = "" ] && exit -printf '%s\t%s\n' "$date" "$l" | cat <(gpg -d $log_path 2>/dev/null) - > $tmp_file_path +printf '%s\t%s\n' "$date" "$l" | cat <(gpg -d $log_path 2>/dev/null || exit) - > $tmp_file_path gpg --yes -r $key -o $log_path -e $tmp_file_path # printf '%s\t%s\n' "$date" "$l" > $tmp_file_path rm $tmp_file_path
A bin/scripts/mup

@@ -0,0 +1,47 @@

+#!/bin/bash + +# quick and dirty file sharing script using rsync +# .share folder has to be on the remote machine's +# user's home directory + +remote_hostname="inty" +remote_url="https://m.prithu.dev" +# remote_url="https://m.prithu.xyz" + +slugen () { + # generate a slug of alphabets + dd if=/dev/urandom status=none bs=1024 count=1 | \ + strings | tr -d '[:space:][:punct:][:digit:][lIq]' | cut -c -${1:-3} +} + + +if [ "$1" ] +then + if [ -z "$2" ] + then + slug=$(slugen) + if echo "$1" | grep '\.' 2>&1 > /dev/null + then + ext=$(echo "$1" | grep '\.' | awk -F'.' '{print "."$NF}') + else + ext="" + fi + # if ssh $remote_hostname "test -f .share/$slug$ext" + # then + # echo "[Error] File already exists: $slug$ext" 1>&2 + # exit 1 + # else + rsync --ignore-existing --info=progress1,skip "$1" "$remote_hostname:.share/$slug$ext" 1>&2 || exit 1 + echo "$remote_url/$slug$ext" + # fi + else + # if ssh $remote_hostname "test -f .share/$2" + # then + # echo "[Error] File already exists: $2" 1>&2 + # exit 1 + # else + rsync --ignore-existing --info=progress1,skip "$1" "$remote_hostname:.share/$2" 1>&2 || exit 1 + echo "$remote_url/$2" + # fi + fi +fi
A bin/scripts/passmenu-otp

@@ -0,0 +1,25 @@

+#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@") + +[[ -n $password ]] || exit + +if [[ $typeit -eq 0 ]]; then + pass otp -c "$password" 2>/dev/null +else + pass otp "$password" | { IFS= read -r pass; printf %s "$pass"; } | + xdotool type --clearmodifiers --file - +fi
M bin/scripts/update_home_dns.shbin/scripts/update_home_dns.sh

@@ -24,7 +24,7 @@

ACCESS_TOKEN="$NETLIFY_ACCESS_TOKEN" DOMAIN="prithu.xyz" SUBDOMAIN="$SUBDOMAIN_" -TTL="300" +TTL="5" NETLIFY_API="https://api.netlify.com/api/v1"
M config/i3/configconfig/i3/config

@@ -185,7 +185,7 @@ # bindsym $mod+i exec --no-startup-id "qutebrowser"

# PD bindsym $mod+p exec --no-startup-id dmenu_run $dmenu_args -l 20 -i -F # window swticher using rofi -bindsym $mod+v exec --no-startup-id "rofi -show window -width 70" +bindsym $mod+v exec --no-startup-id "pestman" bindsym $mod+slash exec --no-startup-id st -e bash -c 'rifle "$(find ~/ -path "/home/prithu/.*" -prune -o -print -path "/home/prithu/repos" -prune -o -print -type f | fzf -i --reverse)"' bindsym $mod+z exec --no-startup-id change-wall # change volume or toggle mute

@@ -385,6 +385,7 @@ for_window [class="Xfburn"] floating enable

for_window [title="Nam Console v1.15"] floating enable move scratchpad for_window [title="Mumble(?i)"] floating enable resize set 575 385, move position 785 25 for_window [title="scratch-terminal"] floating enable resize set 720 432, move position 0 22 +for_window [title="E-book viewer$"] floating enable, resize set 557 845, move position 1474 69 # Resize floating file chooser for_window [window_role="GtkFileChooserDialog"] resize set 840 580, move position center

@@ -538,7 +539,7 @@ ### Status Bar ###{{{

#Start i3bar to display a workspace bar (plus the system information i3status if available) bar { i3bar_command i3bar - status_command i3blocks + status_command i3status position top font pango:DejaVu Sans Mono 9 # separator_symbol " ╱ "
M config/i3blocks/configconfig/i3blocks/config

@@ -19,25 +19,25 @@ # markup=pango

# command=~/.config/i3blocks/pacupdate # interval=once # signal=8 -[btcprice] -command=print_btc_price -interval=120 -markup=pango +# [btcprice] +# command=print_btc_price +# interval=120 +# markup=pango [reminder] command=~/.config/i3blocks/note interval=1 markup=pango -[taskwarrior] -command=~/.config/i3blocks/taskwarrior -interval=1 -markup=pango +# [taskwarrior] +# command=~/.config/i3blocks/taskwarrior +# interval=1 +# markup=pango -[mail] -markup=pango -command=~/.config/i3blocks/mail -interval=1 +# [mail] +# markup=pango +# command=~/.config/i3blocks/mail +# interval=1 [iface] # color=#49A2D1
M config/launcherconfig/launcher

@@ -13,4 +13,5 @@ notes_scrot

google ud passmenu --type +passmenu-otp --type st -e bash -c neomutt
M config/newsboat/urlsconfig/newsboat/urls

@@ -13,6 +13,8 @@ https://prithu.xyz/posts/index.xml

https://nixnet.services/feed.xml https://secluded.site/posts/index.xml https://cedaei.com/index.xml +https://ianthehenry.com/feed.xml + #https://www.wezm.net/feed/ #https://00f.net/atom.xml
A config/ssh/config

@@ -0,0 +1,25 @@

+Host glix + HostName glix + User prithu + IdentityFile ~/.ssh/glix_rsa + SetEnv TERM=xterm-color +Host inty + HostName inty.prithu.xyz + user ubuntu + IdentityFile ~/.ssh/id_rsa +Host reed + HostName reed.prithu.xyz + user ubuntu + IdentityFile ~/.ssh/id_rsa +Host rpi + HostName rpi + user pi + IdentityFile ~/.ssh/id_rsa +Host lmmdev + HostName lmmvm + user prithugoswami524 + IdentityFile ~/.ssh/id_rsa +Host lmmprod + HostName lmmaws + user lmm_dev + IdentityFile ~/.ssh/id_rsa
M config/weechat/weechat.confconfig/weechat/weechat.conf

@@ -72,6 +72,7 @@ hotlist_short_names = on

hotlist_sort = group_time_asc hotlist_suffix = "" hotlist_unique_numbers = on +hotlist_update_on_buffer_switch = on input_cursor_scroll = 20 input_share = none input_share_overwrite = off

@@ -121,6 +122,7 @@ quote_time_format = "%H:%M:%S"

read_marker = line read_marker_always_show = off read_marker_string = "- " +read_marker_update_on_buffer_switch = on save_config_on_exit = on save_config_with_fsync = off save_layout_on_exit = none
M home/.bashrchome/.bashrc

@@ -129,8 +129,8 @@

[[ -f ~/bin/bash_prompt.sh ]] && . ~/bin/bash_prompt.sh HISTCONTROL=ingoreboth -HISTSIZE=10000000 -HISTFILESIZE=10000000 +HISTSIZE=100000000 +HISTFILESIZE=100000000 PROMPT_COMMAND='history -a' HISTIGNORE='ls:bg:fg:history:cd:rm'

@@ -141,3 +141,7 @@ }

PROMPT_DIRTRIM=2 # source /usr/share/nvm/init-nvm.sh + +# export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" + +# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
M home/.vimrchome/.vimrc

@@ -13,14 +13,14 @@ Plugin 'junegunn/goyo.vim'

Plugin 'tpope/vim-commentary' Plugin 'dracula/vim' Plugin 'drewtempelmeyer/palenight.vim' -Plugin 'dracula/vim', {'name':'dracula'} Plugin 'simeji/winresizer' Plugin 'rakr/vim-one' Plugin 'tomasr/molokai' Plugin 'junegunn/fzf.vim' Plugin 'chriskempson/base16-vim' -Plugin 'dhruvasagar/vim-table-mode' +" Plugin 'dhruvasagar/vim-table-mode' Plugin 'dense-analysis/ale' +Plugin 'szw/vim-maximizer' " Plugin 'pedrohdz/vim-yaml-folds'

@@ -39,6 +39,7 @@ " file-specific indenting is enabled

set autoindent " set viminfo='10,<100,:100,%,n~/.vim/.viminfo set undofile +set colorcolumn=80 set mouse=a

@@ -56,22 +57,31 @@ "

autocmd FileType markdown nnoremap cm :w<Enter>:!pandoc -H ~/.config/header -f markdown+raw_tex+raw_attribute -o pdf/%.pdf %<Enter><Enter> " autocmd FileType markdown nnoremap cm :w<Enter>:!pandoc -f markdown+raw_tex+raw_attribute -o pdf/%.pdf %<Enter><Enter> autocmd FileType tex nnoremap cm :w<Enter>:!xelatex % 1&>/dev/null<Enter><Enter> +autocmd BufRead *make_request.sh nnoremap cm :w<CR>:!./%<CR> " autocmd FileType tex nnoremap cm :w<Enter>:!pdflatex -interaction nonstopmode % 1&>/dev/null<Enter><Enter> autocmd FileType html setlocal ts=2 sts=2 sw=2 autocmd FileType javascript setlocal sw=2 +autocmd FileType typescript setlocal sw=2 autocmd FileType yaml setlocal sw=2 +autocmd BufRead *jsx setlocal sw=2 " autocmd FileType c nnoremap cp :w<Enter>:!clear && gcc % && ./a.out<Enter> autocmd BufRead *.pdentry :Goyo autocmd BufRead *.pdentry set nosmartindent autocmd BufRead *.md set nosmartindent + +command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".shellescape(<q-args>), 1, {'options': '--delimiter : --nth 4..'}, <bang>0) + + " leader is comma let mapleader="," " QuickFix Navigation nnoremap cn :cn<CR> nnoremap cN :cN<CR> +nnoremap H gT +nnoremap L gt set backspace=indent,eol,start

@@ -103,7 +113,7 @@ set foldnestmax=10 " 10 nested folds max

set foldmethod=indent " fold based on indent " <Space> is foldToggle (za) in normal mode -nnoremap <silent> <Tab> @=(foldlevel('.')?'za':"\<Space>")<CR> +nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR> " <C-c> in visual mode copies to clipboard vnoremap <C-c> "+y

@@ -131,7 +141,7 @@ nnoremap <C-l> <C-W><C-L>

nnoremap <unique> <C-_> :FZF<CR> nnoremap <unique> <C-B> :Buffers<CR> -nnoremap <unique> <C-a> :Ag<CR> +nnoremap <leader>f :Rg<CR> set autoread nnoremap <leader>r :e!<Enter>

@@ -162,17 +172,28 @@ " let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"

" let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" " endif " -nnoremap <leader>n :w<Enter>:!ns %<Enter> +" nnoremap <leader>n :w<Enter>:!ns %<Enter> let g:ale_enabled = 0 let g:ale_linters = { -\ 'javascript': ['eslint'], +\ 'javascript': ['prettier'], \} let g:ale_sign_column_always = 1 let g:ale_sign_error = '>>' let g:ale_sign_warning = '--' + +let g:ale_fixers = {'javascript': ['prettier']} +let g:ale_fix_on_save = 1 + let g:table_mode_corner_corner='+' let g:table_mode_header_fillchar='=' + +let $FZF_DEFAULT_COMMAND= 'rg . -l' + +let g:maximizer_set_default_mapping = 0 + +nnoremap <leader>z :MaximizerToggle<CR> +