diff options
| author | Marc Vertes <mvertes@free.fr> | 2025-04-26 12:32:31 +0200 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2025-04-26 12:32:31 +0200 |
| commit | df31a7764ff9168b211070b8ccc08186a8d06d3a (patch) | |
| tree | 8ea5eb868a57f417ed46af638c0a5854af947f06 | |
| parent | 7d4158e20b29a7d1d922ad1567f802f9e4865e44 (diff) | |
| parent | 733d2209b0c78adaf55baf26b4aa67ef08f057ab (diff) | |
Merge github.com:mvertes/dotfiles
| -rw-r--r-- | .bashrc | 6 | ||||
| -rw-r--r-- | .profile | 2 | ||||
| -rw-r--r-- | .vimrc | 5 | ||||
| l--------- | bin/cle | 1 | ||||
| -rwxr-xr-x | bin/crypt | 45 |
5 files changed, 56 insertions, 3 deletions
@@ -5,6 +5,7 @@ export PAGER=less export EDITOR=vim +export MANPAGER='vim +MANPAGER --not-a-term -' export HISTIGNORE='sudo id:uname:date:exit:df:ll:ls:ps:pwd:tc:top:history' export HISTCONTROL=ignoreboth:erasedups # no start space and duplicate entries export HISTSIZE=100000 # big big history @@ -26,13 +27,13 @@ OS=${OS:-$(~/bin/os)} case $OS in (arch|alpine|fedora-asahi-remix) alias ls='ls --color=auto -v' ll='ls -AlFhv' - [ "$OS" = arch ] || trap 'printf "\e]2;${PWD/~/\~} ${BASH_COMMAND%ps1}\a"' DEBUG + [ "$OS" = arch ] || trap 'printf "\e]2;%s\a" "$TERM_TAG ${BASH_COMMAND%ps1}"' DEBUG ;; (Darwin) alias ls='ls -GF' ll='ls -AlGFhv' alias ldd='otool -L' alias ibrew='arch -x86_64 /usr/local/bin/brew' - trap 'printf "\e]2;${PWD/~/\~} ${BASH_COMMAND%update_terminal_cwd}\a"' DEBUG + trap 'printf "\e]2;%s\a" "$TERM_TAG ${BASH_COMMAND%update_terminal_cwd}"' DEBUG ;; (termux) PATH=~/bin:${HOME%/*}/usr/bin:~/go/bin @@ -51,6 +52,7 @@ export LESS=iXFRx4 # Stopwatch alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' +alias fd='find . -iname' alias grep='grep -i --color' alias more='less' alias vi='vim' @@ -12,7 +12,7 @@ case $OS in export XKB_DEFAULT_LAYOUT=us XKB_DEFAULT_VARIANT=intl ;; (Darwin) - PATH=~/bin:~/mu/bin:/opt/homebrew/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/opt/tcl-tk/bin:$PATH:~/go/bin:~/.cargo/bin:~/.pyenv/versions/2.7.18/bin:~/.local/bin + PATH=~/bin:~/mu/bin:/opt/homebrew/bin:/opt/homebrew/opt/python/libexec/bin:$PATH:~/go/bin:~/.cargo/bin:~/.local/bin export REPLYTO='mvertes@free.fr' export LANG=en_US.UTF-8 . /opt/homebrew/etc/profile.d/bash_completion.sh @@ -34,6 +34,11 @@ augroup END set guifont=6x13:h13 set guicursor=a:block-Cursor/lCursor-blinkon0 +" Activate man pages display in vim with hyperlink navigation. +ru ftplugin/man.vim +set keywordprg=:Man +nmap q :q
+ " fzf plugin set rtp+=/opt/homebrew/opt/fzf let g:fzf_preview = 'cat {}' @@ -0,0 +1 @@ +../.cle/cle
\ No newline at end of file diff --git a/bin/crypt b/bin/crypt new file mode 100755 index 0000000..64afc42 --- /dev/null +++ b/bin/crypt @@ -0,0 +1,45 @@ +#!/bin/sh + +crypt_usage='Usage: crypt [-d] [-o output] [input] + +Encrypt or decrypt input (stdin) to ouput (stdout), using ssh rsa key. + +Options: + -d action is decrypt (default: encrypt) + -o output set ouput (default: stdout)' + +# Encrypt stdin to stdout. +encrypt() { + set -- "$(openssl rand -hex 32)" + + echo "$1" | openssl pkeyutl -encrypt -pubin -inkey /dev/fd/3 3<<- EOF + $(ssh-keygen -e -f ~/.ssh/id_rsa.pub -m PKCS8) + EOF + + openssl aes-256-cbc -pbkdf2 -pass file:/dev/fd/3 3<<- EOF + $1 + EOF +} + +# Decrypt stdin to stdout. +decrypt() { + openssl aes-256-cbc -d -pbkdf2 -pass file:/dev/fd/3 3<<- EOF + $(dd ibs=256 count=1 iflag=direct status=none | + openssl pkeyutl -decrypt -inkey ~/.ssh/id_rsa) + EOF +} + +# Execute main only if not sourced. +if [ "${0##*/}" = "crypt" ]; then + cmd=encrypt + while getopts :do: opt; do + case $opt in + d) cmd=decrypt ;; + o) exec 1>"$OPTARG" ;; + *) echo "$crypt_usage" >&2; exit 1 ;; + esac + done + shift $((OPTIND - 1)) + [ "$1" ] && exec 0<"$1" + "$cmd" +fi |
