diff --git a/.Xresources b/.Xresources index 38961baa..4c5b54c2 100644 --- a/.Xresources +++ b/.Xresources @@ -20,33 +20,19 @@ URxvt.clipboard.pastecmd: xsel --output --clipboard URxvt.title: rxvt-unicode URxvt.saveLines: 10000 -;URxvt.font: xft:Fira Code:size=10,style=regular -;URxvt.boldFont: xft:Fira Code:size=10,style=bold -;URxvt.italicFont: xft:Fira Code:size=10,style=bold -;URxvt.boldItalicFont: xft:Fira Code:size=10,style=bold - -URxvt.font: xft:Source Code Pro:size=10,style=regular -URxvt.boldFont: xft:Source Code Pro:size=10,style=bold -URxvt.italicFont: xft:Source Code Pro:size=10,style=italic -URxvt.boldItalicFont: xft:Source Code Pro:size=10,style=bold +URxvt.font: xft:Iosevka:size=10,style=regular +URxvt.boldFont: xft:Iosevka:size=10,style=bold +URxvt.italicFont: xft:Iosevka:size=10,style=italic +URxvt.boldItalicFont: xft:Iosevka:size=10,style=bold URxvt.lineSpace: -5 -;URxvt.font: xft:Fira Code:size=10,style=regular -;URxvt.boldFont: xft:Fira Code:size=10,style=bold -;URxvt.italicFont: xft:Fira Code:size=10,style=bold -;URxvt.boldItalicFont: xft:Fira Code:size=10,style=bold - -;URxvt*font: xft:PragmataPro:Regular:size=10 -;URxvt*boldFont: xft:PragmataPro:Bold:size=10 -;URxvt*italicFont: xft:PragmataPro:Italic:size=10 -;URxvt*boldItalicFont: xft:Fantasque Sans Mono:Bold Italic:size=11 -;URxvt*imFont: xft:Fantasque Sans Mono:Italic:size=11 - URxvt.underlineColor: blue URxvt.cursorBlink: true URxvt.scrollBar: false -URxvt.troughColor: #000000 +URxvt.troughColor: #100000 URxvt.transparent: false Xft.dpi: 96 + +st.font: Fira Code:pixelsize=14:style=regular:antialias=true:autohint=true diff --git a/.Xresources.office b/.Xresources.office new file mode 100644 index 00000000..f23f0c22 --- /dev/null +++ b/.Xresources.office @@ -0,0 +1,4 @@ +URxvt.font: xft:Iosevka:size=11,style=regular +URxvt.boldFont: xft:Iosevka:size=11,style=bold +URxvt.italicFont: xft:Iosevka:size=11,style=italic +URxvt.boldItalicFont: xft:Iosevka:size=11,style=bold diff --git a/.config/autorandr/postswitch b/.config/autorandr/postswitch index 3dcf331f..a926d8c0 100755 --- a/.config/autorandr/postswitch +++ b/.config/autorandr/postswitch @@ -19,3 +19,5 @@ echo "$profile" > ~/.config/autorandr_profile if [[ "$profile" =~ office ]]; then redshift stop fi + +pkill dunst diff --git a/.config/i3/config.base b/.config/i3/config.base index 991d8ad2..12b70b99 100644 --- a/.config/i3/config.base +++ b/.config/i3/config.base @@ -1,13 +1,13 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 -gaps inner 1 -gaps outer 0 +gaps inner 3 +gaps outer 2 smart_gaps on hide_edge_borders both font pango:Monaco 1 new_window 1pixel -focus_follows_mouse off +focus_follows_mouse yes set $win Mod1 set $alt Mod4 diff --git a/.config/i3/config.office b/.config/i3/config.office index 74215acd..6be2b850 100644 --- a/.config/i3/config.office +++ b/.config/i3/config.office @@ -7,4 +7,4 @@ workspace 3 output $primary workspace 4 output $primary workspace s output $primary -workspace q output $secondary +workspace q output $primary diff --git a/.config/i3/layouts/1.json b/.config/i3/layouts/1.json new file mode 100644 index 00000000..c3b13b9c --- /dev/null +++ b/.config/i3/layouts/1.json @@ -0,0 +1,196 @@ +// vim:ts=4:sw=4:et +{ + // splitv split container with 3 children + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.3, + "type": "con", + "nodes": [ + { + "border": "pixel", + "current_border_width": 1, + "floating": "auto_off", + "geometry": { + "height": 412, + "width": 564, + "x": 0, + "y": 0 + }, + "percent": 0.0733333333333333, + "swallows": [ + { + "class": "^URxvt$", + "instance": "^urxvt$" + } + ], + "type": "con" + }, + { + // splith split container with 1 children + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 0.733333333333334, + "type": "con", + "nodes": [ + { + "border": "pixel", + "current_border_width": 1, + "floating": "auto_off", + "geometry": { + "height": 412, + "width": 564, + "x": 0, + "y": 0 + }, + "percent": 1, + "swallows": [ + { + "class": "^URxvt$", + "instance": "^urxvt$" + } + ], + "type": "con" + } + ] + }, + { + // splith split container with 2 children + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 0.193333333333333, + "type": "con", + "nodes": [ + { + "border": "pixel", + "current_border_width": 1, + "floating": "auto_off", + "geometry": { + "height": 412, + "width": 564, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^URxvt$", + "instance": "^urxvt$" + } + ], + "type": "con" + }, + { + "border": "pixel", + "current_border_width": 1, + "floating": "auto_off", + "geometry": { + "height": 412, + "width": 564, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^URxvt$", + "instance": "^urxvt$" + } + ], + "type": "con" + } + ] + } + ] +} + +{ + // splitv split container with 2 children + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.7, + "type": "con", + "nodes": [ + { + // splith split container with 1 children + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 0.8, + "type": "con", + "nodes": [ + { + "border": "pixel", + "current_border_width": 1, + "floating": "auto_off", + "geometry": { + "height": 412, + "width": 564, + "x": 0, + "y": 0 + }, + "percent": 1, + "swallows": [ + { + "class": "^URxvt$", + "instance": "^urxvt$" + } + ], + "type": "con" + } + ] + }, + { + // splith split container with 2 children + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 0.2, + "type": "con", + "nodes": [ + { + "border": "pixel", + "current_border_width": 1, + "floating": "auto_off", + "geometry": { + "height": 412, + "width": 564, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^URxvt$", + "instance": "^urxvt$" + } + ], + "type": "con" + }, + { + "border": "pixel", + "current_border_width": 1, + "floating": "auto_off", + "geometry": { + "height": 412, + "width": 564, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^URxvt$", + "instance": "^urxvt$" + } + ], + "type": "con" + } + ] + } + ] +} + diff --git a/.config/i3/layouts/2.json b/.config/i3/layouts/2.json new file mode 100644 index 00000000..a8fe47a6 --- /dev/null +++ b/.config/i3/layouts/2.json @@ -0,0 +1,109 @@ +// vim:ts=4:sw=4:et +{ + // splith split container with 1 children + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 1, + "type": "con", + "nodes": [ + { + // splitv split container with 1 children + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 1, + "type": "con", + "nodes": [ + { + // splith split container with 1 children + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 1, + "type": "con", + "nodes": [ + { + // splith split container with 2 children + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 1, + "type": "con", + "nodes": [ + { + // splitv split container with 2 children + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + "current_border_width": 1, + "floating": "auto_off", + "geometry": { + "height": 412, + "width": 564, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^URxvt$", + "instance": "^urxvt$" + } + ], + "type": "con" + }, + { + "border": "pixel", + "current_border_width": 1, + "floating": "auto_off", + "geometry": { + "height": 412, + "width": 564, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^URxvt$", + "instance": "^urxvt$" + } + ], + "type": "con" + } + ] + }, + { + "border": "pixel", + "current_border_width": 1, + "floating": "auto_off", + "geometry": { + "height": 412, + "width": 564, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^URxvt$", + "instance": "^urxvt$" + } + ], + "type": "con" + } + ] + } + ] + } + ] + } + ] +} + diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index f8e80b59..62737b61 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -5,7 +5,7 @@ shift + super + Return terminal -d control + Return - terminal -e 'cd $(fzf-choose-favorite -s); clear' + terminal-with-cwd super + r modal-run -matching normal @@ -20,7 +20,7 @@ super + control + s browser super + control + w - todoist + chrome-todoist super + control + d upwork @@ -38,10 +38,13 @@ control + F10 brightness toggle super + 8 - volume down + ;volume down super + 9 - volume up + ;volume up + +super + control + 0 + ;pa-switch-profile active output:hdmi-stereo output:analog-stereo alt + control + d notification-information-basic @@ -52,12 +55,18 @@ super + control + e super + control + t toggle translator-watcher +alt + Tab + i3re -w 500 + super + Tab - quicknote + rofi -show window super + 5 carcosa-ui +control + super + 5 + carcosa-ui clipboard + super + 6 carcosa-new-password @@ -93,15 +102,15 @@ control + F9 control + F11 jidle-toggle - +# control + F12 SUSPEND_NOTIFY_TIMEOUT=60 upwork-suspend control + Pause screen-lock -suspend -control + super + Print +control + super + Insert screen-lock -suspend -shift + F1 - chrome-netflix +#shift + F1 +# chrome-netflix diff --git a/.gitconfig b/.gitconfig index d1c006f1..f66369be 100644 --- a/.gitconfig +++ b/.gitconfig @@ -35,6 +35,7 @@ insteadOf = ssh://github.com/ insteadOf = ssh://git@github.com/ insteadOf = https://github.com/ + insteadOf = http://github.com/ [url "git@gitlab.com:"] insteadOf = gl: insteadOf = https://git@gitlab.com: diff --git a/.i3/config b/.i3/config index 0c93dbd4..b2f4ef1d 100644 --- a/.i3/config +++ b/.i3/config @@ -1,13 +1,13 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 -gaps inner 1 -gaps outer 0 +gaps inner 3 +gaps outer 2 smart_gaps on hide_edge_borders both font pango:Monaco 1 new_window 1pixel -focus_follows_mouse off +focus_follows_mouse yes set $win Mod1 set $alt Mod4 @@ -112,4 +112,4 @@ workspace 3 output $primary workspace 4 output $primary workspace s output $primary -workspace q output $secondary +workspace q output $primary diff --git a/.ssh/config b/.ssh/config index a4ccc796..8c6008f0 100644 --- a/.ssh/config +++ b/.ssh/config @@ -10,10 +10,11 @@ Host github.com ControlMaster no Host * - ControlMaster auto + ControlMaster no ControlPersist 1h ControlPath ~/.cache/ssh_%r_%h_%p Compression yes SendEnv BACKGROUND User root SendEnv TERM=xterm + diff --git a/.symlinks b/.symlinks index db4f8a96..a8e1ee17 100644 --- a/.symlinks +++ b/.symlinks @@ -1,7 +1,10 @@ + .asoundrc bin +.config/autorandr .config/dunst .config/fontconfig +.config/kitty .config/pacman.d .config/surfingkeys.js .config/sxhkd/sxhkdrc @@ -39,10 +42,9 @@ bin .Xresources .Xresources.dark .Xresources.light +.Xresources.office .yaourtrc .zprezto/modules/prompt/functions .zpreztorc .zsh .zshrc -.config/autorandr -.config/kitty diff --git a/.tmux.conf b/.tmux.conf index 81b2e03d..cd9b9864 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -28,7 +28,8 @@ bind-key k copy-mode bind-key -n PageUp copy-mode -u bind-key -n PageDown send-keys PageDown -bind-key C-Space run 'tmux-autocomplete 2>/tmp/x' +bind-key C-Space run 'tmux-autocomplete --theme dark 2>/tmp/x' +bind-key C-E run 'tmux-autocomplete --regexp-candidate "[a-zA-Z-_][^ ]+" --no-prefix' bind-key C-x run 'tmux-autocomplete-url' set -g status-keys vi diff --git a/.vim/bundle/versions.vim b/.vim/bundle/versions.vim index 61d2d9e1..7d0641e3 100644 --- a/.vim/bundle/versions.vim +++ b/.vim/bundle/versions.vim @@ -1,5 +1,6 @@ -ale 726a768 +ale 6ae2e60b ashium 3d8281f +completor.vim 3dcb348 cpsm 8e61bf3 ctrlp.vim bde7a29 deoplete-go 3269813 @@ -14,7 +15,12 @@ gundo.vim 46c443e i3-vim-syntax 2e50adc kb-train a20c958 l9 c822b05 +lh-brackets f757d75 +lh-dev 4d61c7a +lh-tags d0ba0d4 +lh-vim-lib bd5ed95 matchem 79a9ec5 +matchit 060d9d8 nerdcommenter e679d8a next-indentation d04f221 nvim-go 7680017 @@ -22,6 +28,7 @@ nvim-yarp b222af8 papercolor-theme 52418a2 python-mode f94b0d7 QFEnter 400352f +quick-scope 4c725f1 Recover.vim d5a3d6e rename.vim f133763 rufo-vim ba7d1dd @@ -31,23 +38,27 @@ SearchParty 48dbaa9 sideways.vim dd5935b snippets 978650c sxhkd-vim b0abc9e -synta 0d37d59 +synta 29665c3 tabular 00e1e7f targets.vim c173218 tern_for_vim 3cffc28 tomorrow-theme 0e0d35a +traces.vim f81659b ultisnips 423f264 vim-argwrap 93d1a33 vim-autoresize e6390e8 vim-autosurround 8d9cfe5 vim-bash 992d8e5 -vim-colorscheme cebaaa3 +vim-colorscheme 1d0263d vim-cool 06918c3 vim-cpp-enhanced-highlight 3aa9562 vim-crystal 2ba42bd vim-cucu 56234e1 +vim-dispatch ab7470d +vim-eclim 868b8eb vim-empty-lines b0ee3f8 -vim-go 4cdb8c3 +vim-extract-variable 81d7c92 +vim-go 58c35e9 vim-go-impl 3a68a75 vim-hacks f423472 vim-hug-neovim-rpc 9a82667 @@ -56,11 +67,13 @@ vim-json 3727f08 vim-markdown 8ace663 vim-multiple-cursors b781b14 vim-nunu 56234e1 +vim-one 08aca1b vim-over 146b065 vimperator.vim 7223609 vim-plugvim-utils c59a498 vim-python-pep8-indent 5f4184f -vim-pythonx a18c589 +vim-pythonx 151dd4c +vim-refactor d242579 vim-ruby 474b99f vim-side-search be409b2 vim-simple-todo 4acb068 diff --git a/.vim/snippets/go.snippets b/.vim/snippets/go.snippets index 53679dd2..25a24a8c 100644 --- a/.vim/snippets/go.snippets +++ b/.vim/snippets/go.snippets @@ -59,7 +59,7 @@ snippet f "false" w false endsnippet -snippet t "true" w +snippet t "true" bw true endsnippet @@ -339,3 +339,14 @@ snip.rv=contents` return `!p snip.rv=t[1].lower()` } endsnippet + +snippet ss "" w +$1 := $2{ + $3 +} +endsnippet + + +snippet nw "" w +fmt.Fprintf(os.Stderr,"XXXXXX %v ${1}\n", time.Now().Format(time.RFC3339Nano)) +endsnippet diff --git a/.vim/snippets/ruby.snippets b/.vim/snippets/ruby.snippets index 12532d1d..ff2d6747 100644 --- a/.vim/snippets/ruby.snippets +++ b/.vim/snippets/ruby.snippets @@ -122,8 +122,26 @@ end $0 endsnippet -snippet d "" w +snippet d "" wb def $1 $0 end endsnippet + +snippet "(\w+) d" "" wr +`!p snip.rv=match.group(1)` do |$1| + $0 +end +endsnippet + +snippet m "" w +module $1 + $0 +end +endsnippet + +snippet c "" w +class $1 + $0 +end +endsnippet diff --git a/.vimrc b/.vimrc index f966805e..ab8c8206 100644 --- a/.vimrc +++ b/.vimrc @@ -33,31 +33,38 @@ Plug 'kovetskiy/vim-hacks' Plug 'junegunn/fzf', {'do': './install --all'} Plug 'kovetskiy/fzf.vim' - "let g:fzf_prefer_tmux = 1 + let g:fzf_prefer_tmux = 1 au operations FileType * let g:fzf#vim#default_layout = {'bottom': '10%'} - let $FZF_DEFAULT_COMMAND = 'ctrlp-search' + let $FZF_DEFAULT_COMMAND = 'prols' func! _ctrlp() call _snippets_stop() exec 'FZF' endfunc! + + func! _ctrlp_buffers() + call _snippets_stop() + exec 'Buffers' + endfunc! + + nnoremap :call _ctrlp_buffers() map :call _ctrlp() Plug 'marijnh/tern_for_vim', {'for': 'js'} au operations BufNewFile,BufRead *.js setlocal noet -"Plug 'itchyny/lightline.vim' - "let g:lightline = {} +Plug 'itchyny/lightline.vim' + let g:lightline = {} - "let g:lightline.enable = { - "\ 'statusline': 1, - "\ 'tabline': 0 - "\ } + let g:lightline.enable = { + \ 'statusline': 1, + \ 'tabline': 0 + \ } - "if &background == "light" - "let g:lightline.colorscheme = 'Tomorrow' - "else - "let g:lightline.colorscheme = 'wombat' - "endif + if &background == "light" + let g:lightline.colorscheme = 'PaperColor' + else + let g:lightline.colorscheme = 'wombat' + endif if $BACKGROUND == "dark" @@ -68,52 +75,73 @@ if $BACKGROUND == "dark" endif Plug 'scrooloose/nerdcommenter' -if has('nvim') - Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } - set guicursor= -else - Plug 'Shougo/deoplete.nvim' -endif - -Plug 'fishbullet/deoplete-ruby' -Plug 'roxma/nvim-yarp' -Plug 'roxma/vim-hug-neovim-rpc' - -Plug 'zchee/deoplete-go', { 'do': 'make'} - let g:deoplete#enable_at_startup = 1 - - func! _setup_deoplete() - call deoplete#custom#source( - \ '_', 'min_pattern_length', 1) - - call deoplete#custom#source('_', 'matchers', ['matcher_full_fuzzy']) - call deoplete#custom#source('_', 'sorters', []) - - " unlimited candidate length - call deoplete#custom#source('_', 'max_kind_width', 0) - call deoplete#custom#source('_', 'max_menu_width', 0) - call deoplete#custom#source('_', 'max_abbr_width', 0) - endfunc! +"if has('nvim') + "Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } + "set guicursor= +"else + "Plug 'Shougo/deoplete.nvim' +"endif - augroup _setup_deoplete - au! - au VimEnter * call _setup_deoplete() - augroup end +"Plug 'fishbullet/deoplete-ruby' +"Plug 'roxma/nvim-yarp' +"Plug 'roxma/vim-hug-neovim-rpc' + +"Plug 'zchee/deoplete-go', { 'do': 'make'} +" let g:deoplete#enable_at_startup = 1 +" +" func! _setup_deoplete() +" call deoplete#custom#source( +" \ '_', 'min_pattern_length', 1) +" +" call deoplete#custom#source('_', 'matchers', ['matcher_full_fuzzy']) +" call deoplete#custom#source('_', 'sorters', []) +" +" " unlimited candidate length +" call deoplete#custom#source('_', 'max_kind_width', 0) +" call deoplete#custom#source('_', 'max_menu_width', 0) +" call deoplete#custom#source('_', 'max_abbr_width', 0) +" endfunc! +" +" augroup _setup_deoplete +" au! +" au VimEnter * call _setup_deoplete() +" augroup end + +"Plug 'Valloric/YouCompleteMe' + "let g:ycm_server_python_interpreter = '/usr/bin/python3' + "let g:ycm_show_diagnostics_ui = 0 + "let g:ycm_confirm_extra_conf = 0 + "let g:ycm_key_list_previous_completion=[''] + "let g:ycm_key_list_select_completion=[''] + + "let g:ycm_collect_identifiers_from_tags_files = 1 + ""let g:ycm_collect_identifiers_from_comments_and_strings = 1 + + "let g:ycm_seed_identifiers_with_syntax = 1 + "let g:ycm_use_ultisnips_completer = 0 + +Plug 'maralla/completor.vim' + let g:completor_gocode_binary = $HOME . '/go/bin/gocode' + let g:completor_python_binary = '/usr/bin/python3' Plug 'kovetskiy/synta' let g:synta_go_highlight_calls = 0 let g:synta_go_highlight_calls_funcs = 1 let g:synta_use_sbuffer = 0 + let g:synta_use_go_fast_build = 0 + let g:synta_go_build_recursive = 1 "if has('nvim') "Plug 'zchee/nvim-go', { 'do': 'make'} "else Plug 'fatih/vim-go', {'for': 'go'} + let g:go_template_autocreate = 0 + let g:go_fmt_fail_silently = 0 let g:go_fmt_command = "goimports" let g:go_fmt_autosave = 0 let g:go_bin_path = $GOPATH . "/bin" - let g:go_metalinter_command="gometalinter -D golint --cyclo-over 15" + let g:go_metalinter_command="golangci-lint run" let g:go_list_type = "quickfix" let g:go_auto_type_info = 0 let g:go_gocode_autobuild = 1 @@ -242,131 +270,11 @@ Plug 'pangloss/vim-javascript', { 'for': 'js' } Plug 'danro/rename.vim' nnoremap r :noautocmd Rename -Plug 'kovetskiy/SearchParty' - - -if has('nvim') - set inccommand=nosplit - nnoremap H :%s/\v - nnoremap L V:%s/\v - vnoremap H :s/ - - nnoremap M :%s/\C\V/ -else - Plug 'seletskiy/vim-over' - let g:over#command_line#search#enable_move_cursor = 1 - let g:over#command_line#search#very_magic = 1 - - nmap L VH - - nnoremap M :exec 'OverExec' '%s/\C\V' . expand('') . '/' - nnoremap H :OverExec %s/ - vnoremap H :OverExec s/ - - nmap :call _search_clear_highlighting() - noremap n :call _search_cursorhold_register()n - noremap N :call _search_cursorhold_register()N - - au operations User OverCmdLineExecute call _over_autocmd() - - augroup _search_cursorhold_events - au! - augroup end - - func! _search_clear_highlighting() - call searchparty#mash#unmash() - call feedkeys(":nohlsearch\") - "nohlsearch - endfunc! - - func! _search_cursorhold_do() - if &updatetime != g:updatetime - exec "set updatetime =" . g:updatetime - endif - - augroup _search_cursorhold_events - au! - augroup end - - call _search_clear_highlighting() - endfunc! - - func! _search_cursorhold_register() - set updatetime=3000 - - augroup _search_cursorhold_events - au! - au CursorHold * call _search_cursorhold_do() - augroup end - - call searchparty#mash#mash() - endfunc! - - let g:over_exec_autocmd_skip = 0 - func! _over_autocmd() - if g:over_exec_autocmd_skip - let g:over_exec_autocmd_skip = 0 - return - endif - - call searchparty#mash#mash() - endfunc! - - - func! _over_exec(line1, line2, args) - call _search_cursorhold_register() - - let g:over#command_line#search#enable_move_cursor = 1 - - try - call over#command_line( - \ g:over_command_line_prompt, - \ a:line1 != a:line2 ? printf("'<,'>%s", a:args) : a:args - \) - catch - call _over_exec(a:line1, a:line2, a:args) - endtry - - endfunc! - - command! -range -nargs=* OverExec call _over_exec(, , ) - - nmap (OverExec) :OverExec - - func! s:_over_exec_do(args) - let g:over_exec_autocmd_skip = 1 - let g:over#command_line#search#enable_move_cursor = 0 - call feedkeys("\" . a:args . "\(OverExec)\") - endfunc! - - func! _over_next() - call s:_over_exec_do("n") - return "" - endfunc! - - nmap / :OverExec / - - let g:over_command_line_key_mappings = { - \ "\": ".", - \ "\": '\w+', - \ "\": ".*", - \ "\": "\\zs", - \ - \ "\": "\\\\", - \ "\": "\\\", - \ - \ "\" : { - \ "key" : "_over_next()", - \ "expr": 1, - \ "noremap" : 1, - \ "lock" : 1, - \ }, - \ } -endif Plug 'plasticboy/vim-markdown', { 'for': 'markdown' } au operations BufRead,BufNewFile *.md set filetype=markdown au operations BufRead,BufNewFile *.md set fo-=l + let g:vim_markdown_folding_disabled=0 Plug 'AndrewRadev/sideways.vim' nnoremap h :SidewaysLeft @@ -415,6 +323,11 @@ Plug 'godlygeek/tabular', { 'on': 'Tabularize' } Plug 'reconquest/vim-pythonx' let g:pythonx_highlight_completion = 0 + + vnoremap v :python px.langs.go.transform.to_variable() + + + Plug 'reconquest/snippets' "au operations FileType go nmap "\ gc :py px.go.goto_const() @@ -477,6 +390,7 @@ if $BACKGROUND == "light" Plug 'nightsense/seagrey' Plug 'NLKNguyen/papercolor-theme' Plug 'chriskempson/tomorrow-theme', {'rtp': 'vim'} + Plug 'rakr/vim-one' func! _setup_colorscheme() set background="light" @@ -488,15 +402,16 @@ Plug 'justinmk/vim-syntax-extra', { 'for': 'c' } Plug 'seletskiy/ashium' -Plug 'klen/python-mode', {'for': 'python'} - let g:pymode_lint = 0 - let g:pymode_lint_on_write = 0 - let g:pymode_run = 0 - let g:pymode_rope_lookup_project = 0 - let g:pymode_rope_project_root = $HOME . '/ropeproject/' - let g:pymode_folding = 0 +"Plug 'klen/python-mode', {'for': 'python'} +" let g:pymode_rope_complete_on_dot = 0 +" let g:pymode_lint = 1 +" let g:pymode_lint_on_write = 1 +" let g:pymode_run = 0 +" let g:pymode_rope_lookup_project = 0 +" let g:pymode_rope_project_root = $HOME . '/ropeproject/' +" let g:pymode_folding = 0 -Plug 'hynek/vim-python-pep8-indent', { 'for': 'python' } +"Plug 'hynek/vim-python-pep8-indent', { 'for': 'python' } Plug 'yssl/QFEnter' @@ -540,7 +455,6 @@ Plug 'wellle/targets.vim' nnoremap :Grep nnoremap :call _grep_word() - nnoremap :call _grep_recover() Plug 'kovetskiy/vim-bash' nmap gd @@ -616,12 +530,6 @@ Plug 'kovetskiy/sxhkd-vim' Plug 'PotatoesMaster/i3-vim-syntax', {'for': 'i3'} -Plug 'vitalk/vim-simple-todo', {'for': 'markdown'} - let g:simple_todo_map_keys = 1 - let g:simple_todo_map_insert_mode_keys = 0 - let g:simple_todo_map_visual_mode_keys = 0 - let g:simple_todo_map_normal_mode_keys = 1 - Plug 'brooth/far.vim' nmap a :Farp au operations FileType far_vim nmap d :Fardo @@ -641,14 +549,14 @@ Plug 'ddrscott/vim-side-search' Plug 'lambdalisue/gina.vim' -Plug 'w0rp/ale' +Plug 'kovetskiy/ale' func! _ale_gotags() endfunc! let g:ale_enabled = 0 let g:ale_fixers = { - \ 'go': [function("synta#ale#goimports#Fix")], + \ 'go': [function("synta#ale#goimports#Fix"), function("synta#ale#goinstall#Fix")], \ 'ruby': [function('ale#fixers#rufo#Fix')], \} let g:ale_linters = { @@ -658,7 +566,7 @@ Plug 'w0rp/ale' " au operations BufRead,BufNewFile *.go -Plug 'romainl/vim-cool' +"Plug 'romainl/vim-cool' Plug 'rhysd/vim-crystal' Plug 'vim-ruby/vim-ruby' @@ -676,6 +584,7 @@ Plug 'mg979/vim-visual-multi' let g:VM_maps = { \ 'Select All': '', \ } + let g:VM_leader = "\\" fun! VM_before_auto() call MacroBefore() @@ -703,6 +612,32 @@ Plug 'mg979/vim-visual-multi' map ; Sneak_; endfunction! +Plug 'tmhedberg/matchit' + +Plug 'pangloss/vim-javascript' + +Plug 'markonm/traces.vim' + nnoremap M :%s/\C\V=expand('')/ + nnoremap H :%s/\v + vnoremap H :s/\v + nmap L VH + +Plug 'lambdalisue/gina.vim' + let g:gina#command#blame#formatter#format="%su%=%au on %ti %ma%in" + +Plug 'tpope/vim-dispatch' + + func! _setup_java() + setlocal errorformat=[ERROR]\ %f:[%l\\,%v]\ %m + endfunc! + + au operations FileType java call _setup_java() + au operations FileType java nmap :Make + au operations FileType java nmap ; :cn + au operations FileType java nmap ; :cN + +Plug 'fvictorio/vim-extract-variable' + augroup end call plug#end() @@ -801,7 +736,7 @@ au operations BufWritePost ~/.vimrc au operations BufWritePost */.config/sxhkd/sxhkdrc silent !pkill -USR1 sxhkd au operations BufWritePost */.i3/config silent !i3-msg restart -set cc=80 +set cc=80,100 au operations BufRead *.noml set ft=noml.dracula @@ -1022,5 +957,12 @@ endfunc! nnoremap i :call _fzf_github() +func! _prompt_new_file_where_current_file() + execute "normal :e" +endfunc! + +nnoremap x :vsp =expand('%:h')/ +nnoremap t :vsp + noh diff --git a/.xinitrc b/.xinitrc index 05b48007..17b1f2a8 100755 --- a/.xinitrc +++ b/.xinitrc @@ -3,17 +3,8 @@ source ~/bin/environment-variables source ~/bin/environment-setup -marvex-spawn-reserve & - xsetroot -bg 0 -( - if [[ -f ~/wallpaper.jpg ]]; then - feh --bg-scale ~/wallpaper.jpg - fi -) & - -dunst & ( while :; do keynav; sleep 1; done ) & SHELL=/bin/zsh sudo -E nice -n -19 sudo -E -u $USER sxhkd & @@ -23,4 +14,8 @@ systemctl --user import-environment DISPLAY redshift & export I3SOCK=${I3SOCK:-/tmp/i3-ipc.sock} + +wallpaper +conky + exec i3 diff --git a/.zshrc b/.zshrc index 02274b2c..9ffe382f 100644 --- a/.zshrc +++ b/.zshrc @@ -79,7 +79,7 @@ export WORDCHARS=- zgen load kovetskiy/zsh-smart-ssh zgen load kovetskiy/zsh-insert-dot-dot-slash - zgen load seletskiy/zsh-ssh-urxvt + #zgen load seletskiy/zsh-ssh-urxvt zgen load seletskiy/zsh-hash-aliases zgen load deadcrew/deadfiles @@ -254,30 +254,27 @@ export WORDCHARS=- # :fastcd { - bindkey -v '^N' :fzf:favorites:cd - zle -N :fzf:favorites:cd - :fzf:favorites:cd() { - local __dir="$(fzf-choose-favorite)" - if [[ ! "$__dir" ]]; then + bindkey -v '^N' :favor + zle -N :favor + :favor() { + local favor_dir="$(favor 2>/dev/null)" + if [[ ! "$favor_dir" ]]; then return fi - eval cd "$__dir" - - unset __dir + eval cd "$favor_dir" + unset favor_dir - clear + #clear zle -R lambda17:update zle reset-prompt - ls -lah --color=always - git status -s } bindkey -v '^Q' :fzf:git:file:cd zle -N :fzf:git:file:cd :fzf:git:file:cd() { - local __dir="$(fzf-git-file)" + local favor_dir="$(fzf-git-file)" if [[ ! "$__dir" ]]; then return fi @@ -427,9 +424,6 @@ export WORDCHARS=- if [[ "$user" = "k" ]]; then user="kovetskiy" fi - if [[ "$user" = "mgx" ]]; then - user="MagalixTechnologies" - fi uri="https://github.com/$user/$project" echo "$uri" @@ -656,10 +650,11 @@ export WORDCHARS=- shift else repo=$(git remote get-url origin) - if grep -q "github.com" <<< "$repo"; then - repo=$(sed-replace '.*@' 'git://' <<< "$repo") - repo=$(sed-replace '.*://' 'git://' <<< "$repo") - fi + fi + + if grep -q "github.com" <<< "$repo"; then + repo=$(sed-replace '.*@' 'git://' <<< "$repo") + repo=$(sed-replace '.*://' 'git://' <<< "$repo") fi go-makepkg -g -c -n "$package" -d . $(echo $FLAGS) "$description" "$repo" $@ @@ -1026,11 +1021,6 @@ export WORDCHARS=- head -n "$1" | tail -n 1 | copy-to-clipboard } - :makefile:list() { - /bin/grep -Po '^[\w-\d]+(?=:)' Makefile - } - - :join_by() { local d=$1; shift; @@ -1054,6 +1044,16 @@ export WORDCHARS=- :circleci:recent-build() { watch -c -n0.0 circleci-recent-build } + + :find-gem() { + if gem=$(gem list \ + | grep "${1} " \ + | sed 's/ (/-/' \ + | sed 's/)//'); then + echo "gem: ${gem}" + cd /usr/lib/ruby/gems/2.5.0/gems/"$gem" + fi + } } { @@ -1083,6 +1083,12 @@ ssha() { # :alias { + alias rs='rm -rf ~/.cache/ssh_*' + alias mc='sudo machinectl' + alias gg=':find-gem' + alias mpa='mp *' + alias mp='mpv --slang=eng --alang=eng -fs' + alias ju='journalctl --user-unit' alias s='sift' alias e='less -i' alias 8='mtr 8.8.8.8' @@ -1104,7 +1110,6 @@ ssha() { alias 'a'='cat' alias 'ax'=':axel' alias 'vlc'='/usr/bin/vlc --no-metadata-network-access' # fffuuu - alias 'mc'='make clean' alias 'm'='make' alias 'icv'='() { iconv -f WINDOWS-1251 -t UTF-8 $1 | vim - }' alias 'sss'='ssh -oStrictHostKeyChecking=no' @@ -1173,13 +1178,12 @@ ssha() { alias 'rf'='rm -rf' alias 'ls'='ls -lah --group-directories-first -v --color=always' alias 'l'='ls' - alias 'mp'='mplayer -slave' alias 'v'='vim' alias 'vi'='vim' alias 'se'='sed -r' alias 'py'='python' alias 'py2'='python2' - alias 'god'='godoc-search' + #alias 'god'='godoc-search' alias 'nhh'='ssh' alias 'nhu'='container-status' alias 'nhr'='container-restart' @@ -1360,8 +1364,6 @@ ssha() { alias 'jxf'='sudo journalctl -xef' alias 'jxg'='sudo journalctl -xe | grep ' alias 'jxfg'='sudo journalctl -xef | grep ' - alias 'ju'='sudo journalctl -u' - alias 'juf'='sudo journalctl -f -u' } } @@ -1650,11 +1652,9 @@ export HISTSIZE=100000 export SAVEHIST=100000 export HISTFILE=~/.history -#TRAPWINCH() { - #: - #echo "COLUMNS: $COLUMNS" >&2 -#} - -#TRAPWINCH -# setopt share_history + +function precmd () { + window_title="\033]0;${PWD##*/}\007" + echo -ne "$window_title" +} diff --git a/bin/add-license-mit b/bin/add-license-mit new file mode 100755 index 00000000..67ea647d --- /dev/null +++ b/bin/add-license-mit @@ -0,0 +1,23 @@ +#!/bin/bash + +line="This project is licensed under the terms of the MIT license." + +readme="README.md" +if [[ ! -f $readme ]]; then + echo "No $readme file found" >&2 + exit 1 +fi + +if grep -qi "# License" $readme; then + echo "License already added to $readme" >&2 + grep -A2 "# License" $readme + + exit 0 +fi + +echo "" >> $readme +echo "# License" >> $readme +echo "" >> $readme +echo "$line" >> $readme + +echo "License added to $readme" diff --git a/bin/atlas-cat-errors b/bin/atlas-cat-errors new file mode 100755 index 00000000..08377c5a --- /dev/null +++ b/bin/atlas-cat-errors @@ -0,0 +1,4 @@ +#!/bin/bash + +in_error=0 +atlas-mvn package -q -T 4 diff --git a/bin/browser b/bin/browser index 2864f678..04ba8315 100755 --- a/bin/browser +++ b/bin/browser @@ -11,16 +11,23 @@ if [[ "$scheme" != "http://" && "$scheme" != "" ]]; then notify-send "URL" "$url" - exit + exit 1 fi -if [[ ! "${BROWSER_PROFILE:-}" ]]; then - if [[ "$DISPLAY" != ":0" ]]; then - BROWSER_PROFILE=mgx - else - BROWSER_PROFILE=default - fi +browser="chromium" +if [[ "$url" ]]; then + exec $browser "$url" +else + exec "$browser" fi -set -x -exec firefox-beta -P ${BROWSER_PROFILE:-default} "$url" +#if [[ ! "${BROWSER_PROFILE:-}" ]]; then +# if [[ "$DISPLAY" != ":0" ]]; then +# BROWSER_PROFILE=mgx +# else +# BROWSER_PROFILE=default +# fi +#fi + +#set -x +#exec firefox-beta -P ${BROWSER_PROFILE:-default} "$url" diff --git a/bin/browser-cpu b/bin/browser-cpu deleted file mode 100755 index 25bbd20b..00000000 --- a/bin/browser-cpu +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -QUOTA=${QUOTA:-80} - -sudo systemd-run \ - --pty \ - --setenv=DISPLAY=${DISPLAY} \ - --property=CPUQuota=${QUOTA}% \ - --slice=browser-cpu-limited \ - sudo -u ${USER} $(which browser) diff --git a/bin/cboot b/bin/cboot new file mode 100755 index 00000000..f364ce07 --- /dev/null +++ b/bin/cboot @@ -0,0 +1,3 @@ +#!/bin/bash + +systemctl --user start machine@${1:-lab} diff --git a/bin/cshell b/bin/cshell new file mode 100755 index 00000000..6b80a99e --- /dev/null +++ b/bin/cshell @@ -0,0 +1,14 @@ +#!/bin/bash + +path="${1:-.}" +path=$(readlink -f "$path") + +machine="lab" + +echo ":: Binding $path for machine '$machine'" +sudo machinectl bind lab $path + +echo ":: Starting shell in $path in '$machine'" +sudo machinectl shell \ + --setenv=BIND_DIR=${path} \ + $machine /bin/sh -c 'cd $BIND_DIR && exec bash -l' diff --git a/bin/ctrlp-search b/bin/ctrlp-search index 894fec8a..cb7e16a6 100755 --- a/bin/ctrlp-search +++ b/bin/ctrlp-search @@ -2,18 +2,11 @@ :list() { local dir="${1:-./}" - ag "${dir}" -p .agignore -f -l --nocolor -g "" 2>/dev/null + ag "${dir}" -p .gitignore -f -l --nocolor -g "" 2>/dev/null } :sort-by-extension() { sort -t . --key=2 -r } -:reorder() { - all=$(cat) - - grep -v '\.go$' <<< "$all" - grep '\.go$' <<< "$all" -} - -:list "$*" | :sort-by-extension | :reorder +:list "$*" | :sort-by-extension diff --git a/bin/dns b/bin/dns new file mode 100755 index 00000000..323ea733 --- /dev/null +++ b/bin/dns @@ -0,0 +1,39 @@ +#!/bin/bash + +addresses=( + "Level3 209.244.0.3 209.244.0.4" + "Verisign 64.6.64.6 64.6.65.6" + "Google 8.8.8.8 8.8.4.4" + "Quad9 9.9.9.9 149.112.112.112" + "DNS.WATCH5 84.200.69.80 84.200.70.40" + "ComodoSecureDNS 8.26.56.26 8.20.247.20" + "OpenDNSHome 208.67.222.222 208.67.220.220" + "NortonConnectSafe 199.85.126.10 199.85.127.10" + "SafeDNS 195.46.39.39 195.46.39.40" + "Dyn 216.146.35.35 216.146.36.36" + "AlternateDNS 198.101.242.72 23.253.163.53" + "Yandex.DNS 77.88.8.8 77.88.8.1" + "UncensoredDNS1 91.239.100.100 89.233.43.71" + "Neustar 156.154.70.1 156.154.71.1" + "Cloudflare1 1.1.1.1 1.0.0.1" + "CleanBrowsing 185.228.168.9 185.228.169.9" + "dead.archi 172.104.149.186" +) + +:dig() { + dig +short "${@}" +time=1 +tries=1 | sort +} + +for item in "${addresses[@]}"; do + read name primary secondary <<< "$item" + echo "------------------------------------------------------------" + echo "$name ${primary} ${secondary}" + contents="$(:dig "${@}" "@$primary")" + echo "$contents" + if [[ "$secondary" ]]; then + secondary_contents="$(:dig "${@}" "@$secondary")" + if [[ "$contents" != "$secondary_contents" ]]; then + echo "$secondary_contents" + fi + fi +done diff --git a/bin/dns-hosts-yards b/bin/dns-hosts-yards deleted file mode 100755 index e6155265..00000000 --- a/bin/dns-hosts-yards +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -dig @dn.s -p53000 s axfr | egrep '^\w+.yard.s' diff --git a/bin/dnsroots b/bin/dnsroots new file mode 100755 index 00000000..33115c65 --- /dev/null +++ b/bin/dnsroots @@ -0,0 +1,32 @@ +#!/bin/bash + +roots=( + "a.root-servers.net 198.41.0.4" + "b.root-servers.net 199.9.14.201" + "c.root-servers.net 192.33.4.12" + "d.root-servers.net 199.7.91.13" + "e.root-servers.net 192.203.230.10" + "f.root-servers.net 192.5.5.241" + "g.root-servers.net 192.112.36.4" + "h.root-servers.net 198.97.190.53" + "i.root-servers.net 192.36.148.17" + "j.root-servers.net 192.58.128.30" + "k.root-servers.net 193.0.14.129" + "l.root-servers.net 199.7.83.42" + "m.root-servers.net 202.12.27.33" +) + +domain="$1" +for root in "${roots[@]}"; do + read name ip <<< "$root" + + zone=$(tr '.' '\n' <<< "$domain" | tail -n1) + dig NS $zone. @$ip \ + | grep -P "^$zone\." \ + | while read _ _ _ _ server; do + echo "$name -> $server" + dig NS $domain "@${server}" \ + | grep -P "^$domain\." \ + | sort + done +done diff --git a/bin/environment-setup b/bin/environment-setup index 601d3eca..ba1d34e8 100755 --- a/bin/environment-setup +++ b/bin/environment-setup @@ -1,5 +1,7 @@ #!/bin/bash +wallpaper + xkb autorandr --change @@ -7,12 +9,15 @@ autorandr --change amixer -c 0 cset 'numid=10' 1 &>/dev/null killall -9 xcsyncd -systemd-cat -t xcsynd xcsyncd & +systemd-cat -t xcsyncd xcsyncd & pkill keynav redshift start +pkill dunst +systemd-cat -t dunst bash -c 'while :; do dunst; done' & + xset dpms 0 0 0 xset s off xset -b @@ -22,4 +27,4 @@ xset fp rehash xrdb -load ~/.Xresources background-switch $(cat ~/.config/background) -feh --bg-scale ~/wallpaper.* +wallpaper diff --git a/bin/environment-variables b/bin/environment-variables index 339506b6..8a146b03 100755 --- a/bin/environment-variables +++ b/bin/environment-variables @@ -15,13 +15,18 @@ export BROWSER="$HOME/bin/browser" export GOROOT="" export GOPATH="$HOME/go" -export RUBYPATH=$(/bin/ruby -e 'print Gem.user_dir')/bin + +export RUBYDIR=/opt/ruby/2.5.0 +export RUBYPATH=${RUBYDIR}/bin +export GEM_HOME=${RUBYDIR}/gems BIN=( "$HOME/bin" "$HOME/bin/rewrite" + "$HOME/wbin/" "$HOME/sources/jewfiles/bin" "$HOME/dotfiles/deadfiles/bin" + "$HOME/.local/bin" "/usr/bin/" "$GOPATH/bin" "$RUBYPATH" diff --git a/bin/get-chromium-ext b/bin/get-chromium-ext new file mode 100755 index 00000000..d7af56d3 --- /dev/null +++ b/bin/get-chromium-ext @@ -0,0 +1,11 @@ +#!/bin/bash + +extension="$1" +version=$(pacman -Q chromium | awk '{print $2}') + +curl -v -L -o "/tmp/$extension.crx" "https://clients2.google.com/service/update2/crx?response=redirect&prodversion=$version&x=id%3D$extension%26installsource%3Dondemand%26uc" + +echo +echo "/tmp/$extension.crx" + +browser "/tmp/$extension.crx" diff --git a/bin/github-watching b/bin/github-watching new file mode 100755 index 00000000..6fe2d1fc --- /dev/null +++ b/bin/github-watching @@ -0,0 +1,10 @@ +#!/bin/bash + +set -euo pipefail + +page=0 +while :; do + page=$((page+1)) + curl -s 'https://api.github.com/users/kovetskiy/subscriptions?page='$page | jq -r '.[] | .html_url + " | " + .updated_at + " | " + .description' + sleep 1 +done diff --git a/bin/hex-to-dec b/bin/hex-to-dec new file mode 100755 index 00000000..1cf1faed --- /dev/null +++ b/bin/hex-to-dec @@ -0,0 +1,4 @@ +#!/bin/sh +hexinput=`echo $1 | tr '[:lower:]' '[:upper:]'` # uppercase-ing + +echo "ibase=16; $hexinput" | bc diff --git a/bin/i3-get-workspace b/bin/i3-get-workspace new file mode 100755 index 00000000..b90731da --- /dev/null +++ b/bin/i3-get-workspace @@ -0,0 +1,5 @@ +#!/bin/bash + +i3-msg -t get_workspaces \ + | jq '.[] | select(.focused==true).name' \ + | cut -d"\"" -f2 diff --git a/bin/i3-restore-layout b/bin/i3-restore-layout new file mode 100755 index 00000000..a8ee5475 --- /dev/null +++ b/bin/i3-restore-layout @@ -0,0 +1,15 @@ +#!/bin/bash + +set -euo pipefail + +workspace=$(i3-get-workspace) +layout=~/.config/i3/layouts/${workspace}.json + +i3-msg "workspace ${workspace}" +terminals=$(grep -c 'urxvt' $layout) + +i3-msg "append_layout $layout" + +seq 1 $terminals | while read _; do + terminal +done diff --git a/bin/i3-save-layout b/bin/i3-save-layout new file mode 100755 index 00000000..5f68ea9a --- /dev/null +++ b/bin/i3-save-layout @@ -0,0 +1,25 @@ +#!/bin/bash + +set -euo pipefail +workspace=$(i3-get-workspace) +output=~/.config/i3/layouts/${workspace}.json +mkdir -p ~/.config/i3/layouts/ + +dst=$(mktemp) + +i3-save-tree --workspace "$workspace" > $dst + +# for whatever reason it's commented by default +sed -ri 's@// "@ "@g' $dst + +# remove title and remove transient_for (unsupported feature) +sed -ri '/marvex|transient_for/d' $dst + +# remove last , +sed -ri 's/(.*instance.*),/\1/' $dst + +cat $dst > $output + +echo "$output" + +rm $dst diff --git a/bin/jpgs-to-gif b/bin/jpgs-to-gif new file mode 100755 index 00000000..5fc9c79c --- /dev/null +++ b/bin/jpgs-to-gif @@ -0,0 +1,14 @@ +#!/bin/bash + +if [[ $# -lt 1 || "$1" == "-h" ]]; then + echo usage: "$0 [parallel_processes_count]" + exit 1 +fi + +temp_dir=$(mktemp -d) + +ls -1 *.jpg | xargs -P${2:-2} -II -n1 convert -resize 480x -verbose I $temp_dir/I.gif + +gifsicle --delay=8 --optimize --loop $temp_dir/*.gif > $1 + +rm -r $temp_dir diff --git a/bin/latency8 b/bin/latency8 new file mode 100755 index 00000000..ca8797c3 --- /dev/null +++ b/bin/latency8 @@ -0,0 +1,3 @@ +#!/bin/bash + +ping -c 1 8.8.8.8 | grep -Po 'time=\K.*' diff --git a/bin/machine-spawn b/bin/machine-spawn new file mode 100755 index 00000000..b851abda --- /dev/null +++ b/bin/machine-spawn @@ -0,0 +1,23 @@ +#!/bin/bash + +container="${1:-lab}" + +:sudo() { + echo "!! sudo: ${@}" + sudo "${@}" +} + +BRIDGE=nspawn${RANDOM} +trap "{ sudo ip link set $BRIDGE down; sudo brctl delbr ${BRIDGE}; }" EXIT + +:sudo brctl addbr ${BRIDGE} +:sudo ip link set $BRIDGE up +:sudo ip addr add 169.254.0.$((RANDOM%255))/16 dev ${BRIDGE} + +echo ">> Spawning container '$container'..." + +:sudo systemd-nspawn \ + --quiet \ + -D ~/machines/$container \ + --network-bridge=${BRIDGE} -n \ + -b diff --git a/bin/notification-information-basic b/bin/notification-information-basic index ee2fe187..27f08a63 100755 --- a/bin/notification-information-basic +++ b/bin/notification-information-basic @@ -73,6 +73,7 @@ :body-append "TIME MSK" "$(:get-section-time Europe/Moscow)" :body-append "TIME UTC" "$(:get-section-time UTC)" :body-append "TIME PST" "$(:get-section-time PST8PDT)" + :body-append "TIME BRN" "$(:get-section-time Europe/Berlin)" :body-append "MEMORY" "$(:get-section-memory)" :body-append "CPU" "$(:get-section-cpu)" :body-append "WIFI" "$(:get-section-wifi)" diff --git a/bin/q-click b/bin/q-click new file mode 100755 index 00000000..060ba73e --- /dev/null +++ b/bin/q-click @@ -0,0 +1,6 @@ +#!/bin/bash + +exec >/tmp/x 2>&1 +set -x +xdotool getactivewindow getwindowname +xdotool getactivewindow windowactivate --sync diff --git a/bin/restore-i3-layout b/bin/restore-i3-layout new file mode 100755 index 00000000..a8ee5475 --- /dev/null +++ b/bin/restore-i3-layout @@ -0,0 +1,15 @@ +#!/bin/bash + +set -euo pipefail + +workspace=$(i3-get-workspace) +layout=~/.config/i3/layouts/${workspace}.json + +i3-msg "workspace ${workspace}" +terminals=$(grep -c 'urxvt' $layout) + +i3-msg "append_layout $layout" + +seq 1 $terminals | while read _; do + terminal +done diff --git a/bin/rewrite/vim b/bin/rewrite/vim index d76868ad..a8a47d73 100755 --- a/bin/rewrite/vim +++ b/bin/rewrite/vim @@ -1,7 +1,7 @@ #!/bin/bash if [[ "$1" ]]; then - if ! grep "^[\-+]" <<< "$1"; then + if ! grep -q "^[-+]" <<< "$1"; then if [[ ! -f "$1" ]]; then file=$(/bin/ls -t $1* 2>/dev/null | head -n1) fi diff --git a/bin/screen-lock b/bin/screen-lock index cded720a..2db35c3e 100755 --- a/bin/screen-lock +++ b/bin/screen-lock @@ -18,7 +18,8 @@ if [[ "${1:-}" == "-suspend" ]]; then cmd=("systemctl" "suspend") fi -slock "${cmd[@]}" +"${cmd[@]}" +i3lock -n mplayer_cmd "pause" diff --git a/bin/spawn-cpu-limited b/bin/spawn-cpu-limited new file mode 100755 index 00000000..17fe4417 --- /dev/null +++ b/bin/spawn-cpu-limited @@ -0,0 +1,17 @@ +#!/bin/bash + +QUOTA="${1}" +shift + +echo "max cpu: ${QUOTA}" +echo "running: ${@}" + +SLICE="cpu-limited-${RANDOM}" +echo "systemd-slice: $SLICE" + +sudo systemd-run \ + --pty \ + --setenv=DISPLAY=${DISPLAY} \ + --property=CPUQuota=${QUOTA}% \ + --slice=${SLICE} \ + sudo -u ${USER} "${@}" diff --git a/bin/sxiv-reload b/bin/sxiv-reload index ee918d8d..2d97fde2 100755 --- a/bin/sxiv-reload +++ b/bin/sxiv-reload @@ -7,5 +7,6 @@ if [[ "$window" ]]; then else nohup sxiv "${1}" &>/dev/null & disown + sleep 0.1 exit 0 fi diff --git a/bin/terminal b/bin/terminal index 50947022..af1948ed 100755 --- a/bin/terminal +++ b/bin/terminal @@ -2,7 +2,9 @@ PROFILE=$(cat ~/.config/profile) if [[ "$PROFILE" == "laptop" ]]; then - exec marvex -s --quiet -b urxvt --terminal '@path --title "@title" -e @command' -r 2 "${@}" + exec marvex \ + -s -b urxvt \ + --terminal '@path --title "@title" -e @command' -r 0 "${@}" else urxvt || konsole fi diff --git a/bin/terminal-with-cwd b/bin/terminal-with-cwd new file mode 100755 index 00000000..4b5f742f --- /dev/null +++ b/bin/terminal-with-cwd @@ -0,0 +1,11 @@ +#!/bin/bash + +cwd=$(tmux list-clients -F '#{client_pid} #{pane_current_path}' \ + | grep -P "^$(pgrep -P $(xdotool getwindowfocus getwindowpid) tmux)" \ + | cut -f2- -d' ') + + +cd "$cwd" + +echo '$cwd: '"${cwd}" +exec terminal diff --git a/bin/usb-device-toggle b/bin/usb-device-toggle index b940a54f..026ea8c1 100755 --- a/bin/usb-device-toggle +++ b/bin/usb-device-toggle @@ -8,6 +8,7 @@ if [[ ! "$id_vendor" || ! "$id_product" ]]; then exit 1 fi +found=false for dir in /sys/bus/usb/devices/*; do if [[ -f $dir/idVendor && -f $dir/idProduct ]]; then device_vendor=$(cat $dir/idVendor) @@ -32,6 +33,23 @@ for dir in /sys/bus/usb/devices/*; do else echo "new status: enabled" fi + + found=true + break fi fi done + +if ! $found; then + echo "No such device, here are USB devices: " >&2 + for dir in /sys/bus/usb/devices/*; do + device_vendor=$(cat $dir/idVendor 2>/dev/null) + device_product=$(cat $dir/idProduct 2>/dev/null) + product=$(cat $dir/product 2>/dev/null) + if [[ ! "$device_vendor" || ! "$device_product" || ! "$product" ]]; then + continue + fi + + echo "$device_vendor $device_product $product" + done +fi diff --git a/bin/volume b/bin/volume index 9ff3fd7b..2e6d4123 100755 --- a/bin/volume +++ b/bin/volume @@ -1,22 +1,13 @@ #!/bin/bash -[ -n "$_LOCK" ] || _LOCK=x exec flock -n $0 $0 "$@" +#[ -n "$_LOCK" ] || _LOCK=x exec flock -n $0 $0 "$@" :main() { local action=$1 local status="$(:change "$action")" - if [[ -f /tmp/volume.value ]]; then - prev=$(cat /tmp/volume.value) - if [[ "$prev" == "$status" ]]; then - pkill -9 volume - exit 0 - fi - fi - :notify "$status" - echo "$status" > /tmp/volume.value } :notify() { @@ -29,11 +20,11 @@ case $action in up) - ponymix increase 2 + volumectl -f '%.0f' up 1 ;; down) - ponymix decrease 2 + volumectl -f '%.0f' down 1 ;; esac } diff --git a/bin/wallpaper b/bin/wallpaper new file mode 100755 index 00000000..1583f395 --- /dev/null +++ b/bin/wallpaper @@ -0,0 +1,12 @@ +#!/bin/bash + +resolution=$(xrandr | grep -w connected | awk -F'[ +]' '/primary/{print $4}') + +file=~/wallpapers/$resolution.png + +if [[ ! -f $file ]]; then + echo "No wallpaper for $resolution" + file=~/wallpapers/2560x1440.png +fi + +feh --bg-fill $file diff --git a/bin/wifi b/bin/wifi index dbf8015a..cb015a69 100755 --- a/bin/wifi +++ b/bin/wifi @@ -4,4 +4,61 @@ sudo netctl-auto list | awk '/^* /{ print $2 }' } -:status +target="${1:-}" +if [[ ! "$target" ]]; then + :status + exit 0 +fi + +prev_status=$(:status) + +cd /etc/netctl/ +found=$(find -maxdepth 1 -type f -printf '%P\n' | grep -i "$target" | head -n1) +if [[ "$found" ]]; then + if [[ "$found" == "$prev_status" ]]; then + echo ":: Already connected to $found" >&2 + sudo systemctl restart systemd-networkd + exit 0 + fi + + echo ":: Connecting to $found" >&2 +else + echo ":: No such profile." >&2 + exit 1 +fi + + +sudo netctl-auto switch-to "$found" &>/dev/null & +TICK=0.01 +while :; do + status=$(:status) + if [[ "$status" == "$prev_status" ]]; then + echo -n "." >&2 + sleep $TICK + else + if [[ "$status" == "" ]]; then + echo -n "." >&2 + sleep $TICK + else + break + fi + fi +done + +echo + +echo ":: Connected to $status" >&2 +sudo systemctl restart systemd-networkd +echo ":: Obtaining IP address" >&2 +while :; do + ip=$(ip a | grep inet | grep wlp) + if [[ "$ip" ]]; then + break + fi + + echo -n "." >&2 + sleep $TICK +done + +echo +echo ":: $ip" diff --git a/bin/xkb b/bin/xkb index a4a447c9..3624d860 100755 --- a/bin/xkb +++ b/bin/xkb @@ -9,4 +9,11 @@ xset -b repeat_delay=110 repeat_rate=170 +# That chinese keyboard somehow has decreased repeat delay with comparison to +# other keyboards +if [[ -e /dev/input/by-id/usb-STMicroelectronics_USB_KB-event-kbd ]]; then + echo "Crazy Keyboarrdd" + repeat_delay=140 +fi + xset r rate $repeat_delay $repeat_rate diff --git a/bin/xkb-udev b/bin/xkb-udev index 4ba87727..939d245c 100755 --- a/bin/xkb-udev +++ b/bin/xkb-udev @@ -1,4 +1,6 @@ #!/bin/bash +blah +env > /tmp/env source $(dirname $0)/environment-variables source $(dirname $0)/xkb diff --git a/bin/zfs-destroy-all-snapshots b/bin/zfs-destroy-all-snapshots index b0bd60b0..32edc27c 100755 --- a/bin/zfs-destroy-all-snapshots +++ b/bin/zfs-destroy-all-snapshots @@ -8,6 +8,7 @@ set -euo pipefail :main() { sudo zfs list -t snapshot -H -o name \ + | grep backup_ \ | while read snapshot; do :log "removing snapshot $snapshot" sudo zfs destroy -R -- "$snapshot" diff --git a/deadfiles b/deadfiles index 118e0549..1b15e0ae 160000 --- a/deadfiles +++ b/deadfiles @@ -1 +1 @@ -Subproject commit 118e05495bc4deeb50156bc96ea65a0b09725738 +Subproject commit 1b15e0ae3f8dd4c935a8308df7dba66b72f44313 diff --git a/rootfs/etc/udev/rules.d/88-kbd.rules b/rootfs/etc/udev/rules.d/88-kbd.rules index 78f753e3..76eee37f 100644 --- a/rootfs/etc/udev/rules.d/88-kbd.rules +++ b/rootfs/etc/udev/rules.d/88-kbd.rules @@ -1 +1 @@ -ACTION=="add", SUBSYSTEMS=="usb", SUBSYSTEM=="input", ENV{ID_INPUT_KEYBOARD}=="1", ENV{REL}=="[0-9]*", RUN+="/home/operator/bin/xkb-udev" +ACTION=="add", SUBSYSTEM=="input", ENV{ID_INPUT_KEYBOARD}=="1", RUN+="/home/operator/bin/xkb-udev"