This commit is contained in:
kp2pml30 2024-10-20 16:32:01 +04:00
parent 5d8c6dd080
commit f2f4ead62f
7 changed files with 9317 additions and 6 deletions

View file

@ -1,19 +1,43 @@
function __scrap_select
for cmd in $argv
if command -v "$cmd" 2> /dev/null > /dev/null
command -v "$cmd"
return
end
end
end
function 'scrap-default-tool-paths'
env > /tmp/env-before
set -Ux PYENV_ROOT $HOME/.pyenv
set -le NP
for dir in "$HOME/.cargo/bin" "$HOME/.local/bin" "$HOME/.bin" "$HOME/.ghcup/bin" "$HOME/.cabal/bin"
for dir in "$HOME/.cargo/bin" "$HOME/.local/bin" "$HOME/.bin" "$HOME/.ghcup/bin" "$HOME/.cabal/bin" "$HOME/go/bin" "$HOME/.pyenv/bin"
if test -d "$dir"
echo "$dir exists"
set -a NP "$dir"
if test -n "$NP"
set NP "$NP:$dir"
else
set NP "$dir"
end
end
end
echo "found path is $NP"
set -U KP2PATH "$NP"
set -l OLDP "$PATH"
set PATH "$NP:$PATH"
set -l IFS ''
set -le COMPLETIONS
if command -v poetry > /dev/null
set -l out (poetry completions fish)
IFS='' set -l out (poetry completions fish)
set COMPLETIONS "$COMPLETIONS"\n"$out"
end
set -U KP2COMPLETIONS "$COMPLETIONS"
IFS='' set -U KP2COMPLETIONS "$COMPLETIONS"
set -Ux EDITOR (__scrap_select nvim vim vi)
set -Ux PAGER (__scrap_select less more)
set -Ux GIT_EDITOR "$EDITOR"
set PATH "$OLDP"
env > /tmp/env-after
diff /tmp/env-before /tmp/env-after
rm /tmp/env-after /tmp/env-before
end

11
private/genpass.py Normal file
View file

@ -0,0 +1,11 @@
import secrets
with open("words.txt", "rt") as f:
lines = [l.strip() for l in f]
bits = secrets.randbits(300)
mx = len(lines)
while bits > 0:
print(lines[bits % mx], end=' ')
bits //= mx
print()

38
private/run.sh Executable file
View file

@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
if ! command -v nvim
then
echo "no nvim"
exit 1
fi
if ! command -v base64
then
echo "no base64"
exit 1
fi
if ! command -v openssl
then
echo "no openssl"
exit 1
fi
if ! command -v python3
then
echo "no python3"
exit 1
fi
echo -n Password:
read -s password
echo
PASS="$password" nvim --clean -n \
-u "$SCRIPT_DIR/script.vim" \
"$SCRIPT_DIR/secrets.txt"

43
private/script.vim Normal file
View file

@ -0,0 +1,43 @@
set nobackup nowritebackup noundofile noswapfile viminfo= history=0 noshelltemp secure
function! s:OpenSSLReadPre()
endfunction
function! s:OpenSSLReadPost()
silent! execute "0,$!openssl enc -aes-256-cbc -pbkdf2 -iter 1000000 -base64 -d -k '" . $PASS . "'"
if v:shell_error
silent! 0,$y
silent! undo
echo "Note that your version of openssl may not have the given cipher engine built-in"
echo "even though the engine may be documented in the openssl man pages."
echo "ERROR FROM OPENSSL:"
echo @"
echo "COULD NOT DECRYPT"
return
endif
redraw!
endfunction
function! s:OpenSSLWritePre()
silent! execute "0,$!openssl enc -aes-256-cbc -pbkdf2 -iter 1000000 -base64 -k '" . $PASS . "'"
if v:shell_error
silent! 0,$y
silent! undo
echo "Note that your version of openssl may not have the given cipher engine built in"
echo "even though the engine may be documented in the openssl man pages."
echo "ERROR FROM OPENSSL:"
echo @"
echo "COULD NOT ENCRYPT"
return
endif
endfunction
function! s:OpenSSLWritePost()
"silent! undo
"redraw!
endfunction
autocmd BufReadPre,FileReadPre * call s:OpenSSLReadPre()
autocmd BufReadPost,FileReadPost * call s:OpenSSLReadPost()
autocmd BufWritePre,FileWritePre * call s:OpenSSLWritePre()
autocmd BufWritePost,FileWritePost * call s:OpenSSLWritePost()

10
private/secrets.txt Normal file
View file

@ -0,0 +1,10 @@
U2FsdGVkX1/IejDwU8laqAtttoC3wuFgOGjO9OVcGAUSAlXEH8QEmUEGuY/DReH8
nWpffl36C0Q7Jzrdx1xQIQW0G9d+rtaPy4myUdZjinR/9930tND05a8RvcLxQdGm
jjAaGkGB1H+JynoS9QB5bMpLb/ub+aOdKFP/mginc54h51jPblQ+ZnPbgICXwyP6
SxyniQaGhDKymr4mxbchXGnvaVFNetYtepD4+VgU1ksl9z06bHsY25YfEmU+TssO
9wn6a4gnq2jf43oL1epL9KuXPyKW3X+VOB7i4jVHSdUiryQJbYclWyUpcpjMCgNF
YQeMGYf/Ga1VQkFhudgXJKTB83jTsgblQnpU0mRBOuygWTtkPyp1jxMJkmx+WI6x
1QVIc5UiC9o5hVy4oMgpsgJOCbT4551xhknG5QFbjb9zclNCfuGG0wVmh4BIs8o+
IOP6WzttO56UilKHFNpnMXLPCFhUpYO7a3Io3n7VlBBbBd2QF5dJtfsfCJvLmyA6
pFDO/RwiAgMVJG6oeVDK38gfvOZzcGyzAv/11+NOlhg5Hii6Q/p7meI/OEICMH7W
s2WF3hjIMxRD3gBDgTYLR6SvOLLpUasACf7hZL+tULU=

9185
private/words.txt Normal file

File diff suppressed because it is too large Load diff

View file

@ -9,7 +9,7 @@
"editor.fontFamily": "Fira Code, FiraCode, Consolas, 'monospace', monospace",
"editor.fontLigatures": true,
"extensions.ignoreRecommendations": true,
"editor.accessibilitySupport": "on",
"editor.accessibilitySupport": "off",
"files.trimFinalNewlines": true,
"editor.padding.top": 64,
"explorer.confirmDragAndDrop": false,