summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2025-04-26 12:32:31 +0200
committerMarc Vertes <mvertes@free.fr>2025-04-26 12:32:31 +0200
commitdf31a7764ff9168b211070b8ccc08186a8d06d3a (patch)
tree8ea5eb868a57f417ed46af638c0a5854af947f06
parent7d4158e20b29a7d1d922ad1567f802f9e4865e44 (diff)
parent733d2209b0c78adaf55baf26b4aa67ef08f057ab (diff)
Merge github.com:mvertes/dotfiles
-rw-r--r--.bashrc6
-rw-r--r--.profile2
-rw-r--r--.vimrc5
l---------bin/cle1
-rwxr-xr-xbin/crypt45
5 files changed, 56 insertions, 3 deletions
diff --git a/.bashrc b/.bashrc
index ad713c8..52806bd 100644
--- a/.bashrc
+++ b/.bashrc
@@ -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'
diff --git a/.profile b/.profile
index 98093f8..f9ec18d 100644
--- a/.profile
+++ b/.profile
@@ -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
diff --git a/.vimrc b/.vimrc
index 158c3ec..9c90b81 100644
--- a/.vimrc
+++ b/.vimrc
@@ -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 {}'
diff --git a/bin/cle b/bin/cle
new file mode 120000
index 0000000..a0092cf
--- /dev/null
+++ b/bin/cle
@@ -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