diff --git a/.gitignore b/.gitignore index 8f362c7..7baaf5d 100755 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ \#*\# *API* *.bak +.*.git/ config/.local/share/ranger/* !config/.local/share/ranger/bookmarks config/.mozilla/* diff --git a/config/.Xresources b/config/.Xresources index d6a1aab..d982a3b 100644 --- a/config/.Xresources +++ b/config/.Xresources @@ -8,8 +8,8 @@ *.color8: #0c0e14 ! red -*.color1: #8b8b8b -*.color9: #e91e63 +*.color1: #e84f4f +*.color9: #d23d3d ! green *.color2: #00ffaf diff --git a/config/.local/share/ranger/bookmarks b/config/.local/share/ranger/bookmarks index e9b76b2..973a361 100644 --- a/config/.local/share/ranger/bookmarks +++ b/config/.local/share/ranger/bookmarks @@ -7,6 +7,6 @@ l:/home/tuan/Local c:/home/tuan/Documents/CTF/picoCTF t:/home/tuan/Templates w:/home/tuan/workspace_l/Projects -k:/home/tuan/Documents/Protokolle/FSE +k:/home/tuan q:/home/tuan/.nextcloud/Quick Drop -':/home/tuan/isofiles +':/home/tuan/.dotfiles/vim/.vim diff --git a/config/.scripts/i3lock.py b/config/.scripts/i3lock.py index f0d9c3f..f71c21b 100755 --- a/config/.scripts/i3lock.py +++ b/config/.scripts/i3lock.py @@ -152,13 +152,8 @@ def proc_exists(proc_name): proc_content = '{}: {}'.format(counter, proc_content) if proc_content: if proc_name in proc_content: - # print(proc_name) - # print(proc_content) - # print(proc_name in proc_content) if 'xss-lock' not in proc_content: - # print('xss-lock' not in proc_content) if this_proc not in proc_content: - # print(this_proc not in proc_content) print('Process Exists: {}'.format(time.time() - proc_check)) return True except FileNotFoundError: diff --git a/config/.scripts/startup.sh b/config/.scripts/startup.sh index dd865d3..39c9400 100755 --- a/config/.scripts/startup.sh +++ b/config/.scripts/startup.sh @@ -1,5 +1,9 @@ #!/bin/bash +lower_battery_threshold=10 +KBD=""; +oldKBD=""; + function kb_routine { oldKBD="$KBD"; case "$(xset -q | grep -A 0 'LED' | cut -c59-67)" in @@ -18,14 +22,11 @@ function kb_routine { function battery_routine { capacity=$(< /sys/class/power_supply/BAT0/capacity) - if [[ $capacity -lt 5 ]]; then - echo $capacity + if [[ $capacity -lt lower_battery_threshold ]]; then + notify-send "$capacity"; fi } -KBD=""; -oldKBD=""; - while : do kb_routine diff --git a/config/.ssh/config b/config/.ssh/config index aeae120..9899761 100644 --- a/config/.ssh/config +++ b/config/.ssh/config @@ -4,6 +4,12 @@ Host mx User infra IdentityFile /mnt/veracrypt1/fse +Host gitlab + HostName 132.252.238.13 + Port 22 + User infra + IdentityFile /mnt/veracrypt1/fse + Host helios HostName 132.252.238.17 Port 22 diff --git a/vim/.vim/autoload/colorizer.vim b/vim/.vim/autoload/colorizer.vim new file mode 100644 index 0000000..350456e --- /dev/null +++ b/vim/.vim/autoload/colorizer.vim @@ -0,0 +1,467 @@ +" colorizer.vim Colorize all text in the form #rrggbb or #rgb; autoload functions +" Maintainer: lilydjwg +" Version: 1.4.2 +" License: Vim License (see vim's :help license) +" +" See plugin/colorizer.vim for more info. + +let s:keepcpo = &cpo +set cpo&vim + +function! s:FGforBG(bg) "{{{1 + " takes a 6hex color code and returns a matching color that is visible + let pure = substitute(a:bg,'^#','','') + let r = str2nr(pure[0:1], 16) + let g = str2nr(pure[2:3], 16) + let b = str2nr(pure[4:5], 16) + let fgc = g:colorizer_fgcontrast + if r*30 + g*59 + b*11 > 12000 + return s:predefined_fgcolors['dark'][fgc] + else + return s:predefined_fgcolors['light'][fgc] + end +endfunction + +function! s:Rgb2xterm(color) "{{{1 + " selects the nearest xterm color for a rgb value like #FF0000 + let best_match=0 + let smallest_distance = 10000000000 + let r = str2nr(a:color[1:2], 16) + let g = str2nr(a:color[3:4], 16) + let b = str2nr(a:color[5:6], 16) + let colortable = s:GetXterm2rgbTable() + for c in range(0,254) + let d = pow(colortable[c][0]-r,2) + pow(colortable[c][1]-g,2) + pow(colortable[c][2]-b,2) + if d=16 && a:color<=232 + let l:color=a:color-16 + let r = s:valuerange[(l:color/36)%6] + let g = s:valuerange[(l:color/6)%6] + let b = s:valuerange[l:color%6] + endif + + " gray tone + if a:color>=233 && a:color<=253 + let r=8+(a:color-232)*0x0a + let g=r + let b=r + endif + let rgb=[r,g,b] + return rgb +endfunction + +function! s:SetMatcher(color, pat) "{{{1 + " "color" is the converted color and "pat" is what to highlight + let group = 'Color' . strpart(a:color, 1) + if !hlexists(group) || s:force_group_update + let fg = g:colorizer_fgcontrast < 0 ? a:color : s:FGforBG(a:color) + if &t_Co == 256 + exe 'hi '.group.' ctermfg='.s:Rgb2xterm(fg).' ctermbg='.s:Rgb2xterm(a:color) + endif + " Always set gui* as user may switch to GUI version and it's cheap + exe 'hi '.group.' guifg='.fg.' guibg='.a:color + endif + if !exists("w:colormatches[a:pat]") + let w:colormatches[a:pat] = matchadd(group, a:pat) + endif +endfunction + +" Color Converters {{{1 +function! s:RgbBgColor() "{{{2 + let bg = synIDattr(synIDtrans(hlID("Normal")), "bg") + let r = str2nr(bg[1:2], 16) + let g = str2nr(bg[3:4], 16) + let b = str2nr(bg[5:6], 16) + return [r,g,b] +endfunction + +function! s:Hexa2Rgba(hex,alpha) "{{{2 + let r = str2nr(a:hex[1:2], 16) + let g = str2nr(a:hex[3:4], 16) + let b = str2nr(a:hex[5:6], 16) + let alpha = printf("%.2f", str2float(str2nr(a:alpha,16)) / 255.0) + return [r,g,b,alpha] +endfunction + +function! s:Rgba2Rgb(r,g,b,alpha,percent,rgb_bg) "{{{2 + " converts matched r,g,b values and percentages to [0:255] + " if possible, overlays r,g,b with alpha on given rgb_bg color + if a:percent + let r = a:r * 255 / 100 + let g = a:g * 255 / 100 + let b = a:b * 255 / 100 + else + let r = a:r + let g = a:g + let b = a:b + endif + if r > 255 || g > 255 || b > 255 + return [] + endif + if empty(a:rgb_bg) + return [r,g,b] + endif + let alpha = str2float(a:alpha) + if alpha < 0 + let alpha = 0.0 + elseif alpha > 1 + let alpha = 1.0 + endif + if alpha == 1.0 + return [r,g,b] + endif + let r = float2nr(ceil(r * alpha) + ceil(a:rgb_bg[0] * (1 - alpha))) + let g = float2nr(ceil(g * alpha) + ceil(a:rgb_bg[1] * (1 - alpha))) + let b = float2nr(ceil(b * alpha) + ceil(a:rgb_bg[2] * (1 - alpha))) + if r > 255 + let r = 255 + endif + if g > 255 + let g = 255 + endif + if b > 255 + let b = 255 + endif + return [r,g,b] +endfunction + +"ColorFinders {{{1 +function! s:HexCode(str, lineno) "{{{2 + " finds RGB: #00f #0000ff and RGBA: #00f8 #0000ff88 (or ARGB: #800f #880000ff) + if has("gui_running") + let rgb_bg = s:RgbBgColor() + else + " translucent colors would display incorrectly, so ignore the alpha value + let rgb_bg = [] + endif + let ret = [] + let place = 0 + let colorpat = '#[0-9A-Fa-f]\{3\}\>\|#[0-9A-Fa-f]\{6\}\>\|#[0-9A-Fa-f]\{8\}\>\|#[0-9A-Fa-f]\{4\}\>' + while 1 + let foundcolor = matchstr(a:str, colorpat, place) + if foundcolor == '' + break + endif + let place = matchend(a:str, colorpat, place) + let pat = foundcolor . '\>' + let colorlen = len(foundcolor) + if get(g:, 'colorizer_hex_alpha_first') == 1 + if colorlen == 4 || colorlen == 5 + let ha = tolower(foundcolor[1]) + let hr = tolower(foundcolor[2]) + let hg = tolower(foundcolor[3]) + let hb = tolower(foundcolor[4]) + let foundcolor = substitute(foundcolor, '[[:xdigit:]]', '&&', 'g') + else + let ha = tolower(foundcolor[1:2]) + let hr = tolower(foundcolor[3:4]) + let hg = tolower(foundcolor[5:6]) + let hb = tolower(foundcolor[7:8]) + endif + if len(foundcolor) == 9 + let alpha = foundcolor[1:2] + let foundcolor = '#'.foundcolor[3:8] + else + let alpha = 'ff' + endif + if empty(rgb_bg) + if colorlen == 5 + let pat = printf('\c#\x\zs%s%s%s\ze\>', hr,hg,hb) + elseif colorlen == 9 + let pat = printf('\c#\x\x\zs%s%s%s\ze\>', hr,hg,hb) + endif + endif + else + if colorlen == 4 || colorlen == 5 + let hr = tolower(foundcolor[1]) + let hg = tolower(foundcolor[2]) + let hb = tolower(foundcolor[3]) + let ha = tolower(foundcolor[4]) + let foundcolor = substitute(foundcolor, '[[:xdigit:]]', '&&', 'g') + else + let hr = tolower(foundcolor[1:2]) + let hg = tolower(foundcolor[3:4]) + let hb = tolower(foundcolor[5:6]) + let ha = tolower(foundcolor[7:8]) + endif + if len(foundcolor) == 9 + let alpha = foundcolor[7:8] + let foundcolor = foundcolor[0:6] + else + let alpha = 'ff' + endif + if empty(rgb_bg) + if colorlen == 5 + let pat = printf('\c#%s%s%s\ze\x\>', hr,hg,hb) + elseif colorlen == 9 + let pat = printf('\c#%s%s%s\ze\x\x\>', hr,hg,hb) + endif + endif + endif + if empty(rgb_bg) || tolower(alpha) == 'ff' + call add(ret, [foundcolor, pat]) + else + let rgba = s:Hexa2Rgba(foundcolor, alpha) + let rgb = s:Rgba2Rgb(rgba[0], rgba[1], rgba[2], rgba[3], 0, rgb_bg) + let l:color = printf('#%02x%02x%02x', rgb[0], rgb[1], rgb[2]) + call add(ret, [l:color, pat]) + endif + endwhile + return ret +endfunction + +function! s:RgbColor(str, lineno) "{{{2 + let ret = [] + let place = 0 + let colorpat = '\ 255 || g > 255 || b > 255 + break + endif + let pat = printf('\ 0) && (g:colorizer_maxlines <= line('$')) + return + end + let w:colormatches = {} + if g:colorizer_fgcontrast != s:saved_fgcontrast || (exists("a:1") && a:1 == '!') + let s:force_group_update = 1 + endif + for i in range(1, line("$")) + call s:PreviewColorInLine(i) + endfor + let s:force_group_update = 0 + let s:saved_fgcontrast = g:colorizer_fgcontrast + augroup Colorizer + au! + if exists('##TextChanged') + autocmd TextChanged * silent call s:TextChanged() + if v:version > 704 || v:version == 704 && has('patch143') + autocmd TextChangedI * silent call s:TextChanged() + else + " TextChangedI does not work as expected + autocmd CursorMovedI * silent call s:CursorMoved() + endif + else + autocmd CursorMoved,CursorMovedI * silent call s:CursorMoved() + endif + " rgba handles differently, so need updating + autocmd GUIEnter * silent call colorizer#ColorHighlight(1) + autocmd BufEnter * silent call colorizer#ColorHighlight(1) + autocmd WinEnter * silent call colorizer#ColorHighlight(1) + autocmd ColorScheme * let s:force_group_update=1 | silent call colorizer#ColorHighlight(1) + augroup END +endfunction + +function! colorizer#ColorClear() "{{{1 + augroup Colorizer + au! + augroup END + augroup! Colorizer + let save_tab = tabpagenr() + let save_win = winnr() + tabdo windo call s:ClearMatches() + exe 'tabn '.save_tab + exe save_win . 'wincmd w' +endfunction + +function! s:ClearMatches() "{{{1 + if !exists('w:colormatches') + return + endif + for i in values(w:colormatches) + try + call matchdelete(i) + catch /.*/ + " matches have been cleared in other ways, e.g. user has called clearmatches() + endtry + endfor + unlet w:colormatches +endfunction + +function! colorizer#ColorToggle() "{{{1 + if exists('#Colorizer') + call colorizer#ColorClear() + echomsg 'Disabled color code highlighting.' + else + call colorizer#ColorHighlight(0) + echomsg 'Enabled color code highlighting.' + endif +endfunction + +function! colorizer#AlphaPositionToggle() "{{{1 + if exists('#Colorizer') + if get(g:, 'colorizer_hex_alpha_first') == 1 + let g:colorizer_hex_alpha_first = 0 + else + let g:colorizer_hex_alpha_first = 1 + endif + call colorizer#ColorHighlight(1) + endif +endfunction + +function! s:GetXterm2rgbTable() "{{{1 + if !exists('s:table_xterm2rgb') + let s:table_xterm2rgb = [] + for c in range(0, 254) + let s:color = s:Xterm2rgb(c) + call add(s:table_xterm2rgb, s:color) + endfor + endif + return s:table_xterm2rgb +endfun + +" Setups {{{1 +let s:ColorFinder = [function('s:HexCode'), function('s:RgbColor'), function('s:RgbaColor')] +let s:force_group_update = 0 +let s:predefined_fgcolors = {} +let s:predefined_fgcolors['dark'] = ['#444444', '#222222', '#000000'] +let s:predefined_fgcolors['light'] = ['#bbbbbb', '#dddddd', '#ffffff'] +if !exists("g:colorizer_fgcontrast") + " Default to black / white + let g:colorizer_fgcontrast = len(s:predefined_fgcolors['dark']) - 1 +elseif g:colorizer_fgcontrast >= len(s:predefined_fgcolors['dark']) + echohl WarningMsg + echo "g:colorizer_fgcontrast value invalid, using default" + echohl None + let g:colorizer_fgcontrast = len(s:predefined_fgcolors['dark']) - 1 +endif +let s:saved_fgcontrast = g:colorizer_fgcontrast + +" Restoration and modelines {{{1 +let &cpo = s:keepcpo +unlet s:keepcpo +" vim:ft=vim:fdm=marker:fmr={{{,}}}:ts=8:sw=2:sts=2:et diff --git a/vim/.vim/ftplugin/markdown.vim b/vim/.vim/ftplugin/markdown.vim index be2a0ea..361c0c8 100644 --- a/vim/.vim/ftplugin/markdown.vim +++ b/vim/.vim/ftplugin/markdown.vim @@ -4,5 +4,5 @@ " Begin Shortcuts " Compilation -map :!pandoc % -o %pdf --from markdown+pandoc_title_block --template $HOME/Templates/Pandoc/eisvogel --listings &>/dev/null & disown +map :!pandoc % -o %pdf --from markdown+yaml_metadata_block --template $HOME/Templates/Pandoc/eisvogel --listings &>/dev/null & disown map :!evince %pdf &>/dev/null & disown diff --git a/vim/.vim/plugged/ultisnips b/vim/.vim/plugged/ultisnips new file mode 160000 index 0000000..a6c9d4f --- /dev/null +++ b/vim/.vim/plugged/ultisnips @@ -0,0 +1 @@ +Subproject commit a6c9d4fd1b23e1480b973e7cee1fe20c79248b75 diff --git a/vim/.vim/plugin/colorizer.vim b/vim/.vim/plugin/colorizer.vim new file mode 100644 index 0000000..1354dcf --- /dev/null +++ b/vim/.vim/plugin/colorizer.vim @@ -0,0 +1,76 @@ +" colorizer.vim Colorize all text in the form #rrggbb or #rgb; entrance +" Maintainer: lilydjwg +" Version: 1.4.2 +" Licence: Vim license. See ':help license' +" Derived From: css_color.vim +" http://www.vim.org/scripts/script.php?script_id=2150 +" Thanks To: Niklas Hofer (Author of css_color.vim), Ingo Karkat, rykka, +" KrzysztofUrban, blueyed, shanesmith, UncleBill +" Usage: +" +" This plugin defines three commands: +" +" ColorHighlight - start/update highlighting +" ColorClear - clear all highlights +" ColorToggle - toggle highlights +" +" By default, tc is mapped to ColorToggle. If you want to use another +" key map, do like this: +" nmap ,tc Colorizer +" +" If you want completely not to map it, set the following in your vimrc: +" let g:colorizer_nomap = 1 +" +" To use solid color highlight, set this in your vimrc (later change won't +" probably take effect unless you use ':ColorHighlight!' to force update): +" let g:colorizer_fgcontrast = -1 +" set it to 0 or 1 to use a softened foregroud color. +" +" If you don't want to enable colorizer at startup, set the following: +" let g:colorizer_startup = 0 +" +" You can disable it on long buffers, for example if more than 1000 lines: +" let g:colorizer_maxlines = 1000 +" -1 means unlimited number of lines +" +" There are color strings in the format #RRGGBBAA and #AARRGGBB. The former is +" more common so it's the default. If you want the latter, set the following: +" let g:colorizer_hex_alpha_first = 1 +" +" You can toggle the recognized alpha position by +" call colorizer#AlphaPositionToggle() +" +" Note: if you modify a color string in normal mode, if the cursor is still on +" that line, it'll take 'updatetime' seconds to update. You can use +" :ColorHighlight (or your key mapping) again to force update. +" +" Performance Notice: In terminal, it may take several seconds to highlight 240 +" different colors. GUI version is much quicker. + +" Reload guard and 'compatible' handling {{{1 +if exists("loaded_colorizer") || v:version < 700 || !(has("gui_running") || &t_Co == 256) + finish +endif +let loaded_colorizer = 1 + +let s:save_cpo = &cpo +set cpo&vim + +"Define commands {{{1 +if !exists('g:colorizer_maxlines') + let g:colorizer_maxlines = -1 +endif +command! -bar -bang ColorHighlight call colorizer#ColorHighlight(1, "") +command! -bar ColorClear call colorizer#ColorClear() +command! -bar ColorToggle call colorizer#ColorToggle() +nnoremap Colorizer :ColorToggle +if !hasmapto("Colorizer") && (!exists("g:colorizer_nomap") || g:colorizer_nomap == 0) + nmap tc Colorizer +endif +if !exists('g:colorizer_startup') || g:colorizer_startup + call colorizer#ColorHighlight(0) +endif + +" Cleanup and modelines {{{1 +let &cpo = s:save_cpo +" vim:ft=vim:fdm=marker:fmr={{{,}}}:ts=8:sw=2:sts=2: diff --git a/vim/.vim/plugin/plugins.vim b/vim/.vim/plugin/plugins.vim index ae25370..6a46c5d 100644 --- a/vim/.vim/plugin/plugins.vim +++ b/vim/.vim/plugin/plugins.vim @@ -2,7 +2,16 @@ runtime macros/matchit.vim filetype on call plug#begin() +Plug 'SirVer/ultisnips' +Plug 'honza/vim-snippets' Plug 'lervag/vimtex' Plug 'sheerun/vim-polyglot' Plug 'fatih/vim-go' +Plug 'SirVer/ultisnips' call plug#end() + +let g:polyglot_disabled = ['latex'] + +let g:UltiSnipsExpandTrigger="" +let g:UltiSnipsJumpForwardTrigger="" +let g:UltiSnipsJumpBackwardTrigger="" diff --git a/vim/.vim/plugin/remaps.vim b/vim/.vim/plugin/remaps.vim index 3cf342f..c16dfc1 100644 --- a/vim/.vim/plugin/remaps.vim +++ b/vim/.vim/plugin/remaps.vim @@ -9,7 +9,7 @@ map :b nnoremap :earlier nnoremap :later noremap Y "+y -noremap :tabedit **/* +noremap :e **/* noremap :tabedit:ter:q noremap :syntax sync fromstart inoremap :syntax sync fromstart diff --git a/vim/.vim/spell/de.utf-8.add b/vim/.vim/spell/de.utf-8.add index a6d7b4e..e8fd785 100644 --- a/vim/.vim/spell/de.utf-8.add +++ b/vim/.vim/spell/de.utf-8.add @@ -843,3 +843,14 @@ Zusammlegung #igitalisierung Hauptcampus Campussen +Desktopanwendungen +Requests +IoT +emacs +vim +docker +shell +scripting +Frameworks +AirSniff +Poos diff --git a/vim/.vim/spell/de.utf-8.add.spl b/vim/.vim/spell/de.utf-8.add.spl index 3b750a7..59315cd 100644 Binary files a/vim/.vim/spell/de.utf-8.add.spl and b/vim/.vim/spell/de.utf-8.add.spl differ diff --git a/vim/.vim/templates/skeleton.go b/vim/.vim/templates/skeleton.go new file mode 100644 index 0000000..c8f4ae0 --- /dev/null +++ b/vim/.vim/templates/skeleton.go @@ -0,0 +1,6 @@ +package main + +import () + +func main() { +} diff --git a/vim/.vim/templates/skeleton.md b/vim/.vim/templates/skeleton.md index de53695..53865f8 100644 --- a/vim/.vim/templates/skeleton.md +++ b/vim/.vim/templates/skeleton.md @@ -1,5 +1,5 @@ -% Dokukmentation für die alte Infrastruktur -% Tuan-Dat Tran -% [:VIM_EVAL:]strftime('%Y-%m-%d')[:END_EVAL:] - -# INSERT +--- + title: + author: Tuan-Dat Tran + date: [:VIM_EVAL:]strftime('%Y-%m-%d')[:END_EVAL:] +---