From bf726ea5cc7d46fa632858e2b769b3504fb7643a Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Mon, 6 Nov 2023 19:19:03 +0800 Subject: [PATCH 01/43] riot: remove unknown domain warn --- scripts/riot | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/riot b/scripts/riot index 9827750..c677a6a 100755 --- a/scripts/riot +++ b/scripts/riot @@ -86,7 +86,6 @@ get_server_meta() { RET_TRUST_SERVER=1 ;; * ) - test -z "$domain" || fmt_warning "unknown domain: \"$domain\". will try as host name" RET_HOSTNAME="$remote" esac } From 9766b40796d8bb13d12094d0d2505f9306515b35 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Fri, 10 Nov 2023 15:06:06 +0800 Subject: [PATCH 02/43] install.sh: --no-ssh -> --no-auth-info --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 7ecdc94..50a1ca0 100755 --- a/install.sh +++ b/install.sh @@ -330,7 +330,7 @@ for i in ${GOT_OPTS[@]}; do -a|--auto ) INSTALL_DEP=1 ;; -H|--hist|--history ) store_hist=1 ;; -x ) store_config=1 ;; - --no-ssh ) unset HOME_SYMLINKS_SRC[0]; unset HOME_SYMLINKS_DST[0] ;; + --no-auth-info ) HOME_SYMLINKS_SRC=(); HOME_SYMLINKS_DST=() ;; * ) fmt_fatal "unknown option \"$i\"" ;; esac done From a28906c1d7c0042939370649d9114faf4f59f0c5 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Fri, 10 Nov 2023 18:05:28 +0800 Subject: [PATCH 03/43] doll: --restart=unless-stopped --- scripts/doll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/doll b/scripts/doll index 6da3a6d..22075a8 100755 --- a/scripts/doll +++ b/scripts/doll @@ -21,5 +21,5 @@ if [[ -z "$IMAGE" ]]; then fmt_fatal "image not found" else fmt_note "--> ${IMAGE_META[@]}" - $SUDO docker run ${2:+"--name"} $2 -itd $IMAGE sh + $SUDO docker run ${2:+"--name"} $2 -itd --restart=unless-stopped $IMAGE sh fi From a28673b50ce0d0e78495f17088a4f93c40787bcf Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Wed, 29 Nov 2023 15:55:34 +0800 Subject: [PATCH 04/43] zshrc: alias cps and mvs --- .zshrc2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.zshrc2 b/.zshrc2 index 9d8df17..a1993da 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -102,6 +102,8 @@ fi alias "pls"='sudo $(fc -ln -1)' alias "se"='sudo -sE' alias "sl"='sudo zsh -l' +alias "cps"='rsync -avh --info=progress2' +alias "mvs"='rsync -avh --info=progress2 --remove-source-files' alias "pbd"='ping baidu.com' alias "p114"='ping 114.114.114.114' alias "p666"='ping6 2001:da8::666' From 3223ca53fa8a1a16cfe9176072cc48790708c5d8 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Thu, 30 Nov 2023 00:20:53 +0800 Subject: [PATCH 05/43] riot: proxy -> ssh --- scripts/riot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/riot b/scripts/riot index c677a6a..f8e18e0 100755 --- a/scripts/riot +++ b/scripts/riot @@ -70,8 +70,8 @@ get_server_meta() { RET_JUMP_SERVER="ssh@nasp.ob.ac.cn:36022" RET_TRUST_SERVER=1 ;; - x|proxied ) - RET_HOSTNAME=proxy.beardic.cn + x|ssh ) + RET_HOSTNAME=ssh.beardic.cn local tmp=$(sha256sum <<< "$host" | tr -cd "[:digit:]") tmp=${tmp:0:4} RET_PORT=$((10#$tmp+36000)) From fbb4a6ff76e59afd6157d7656c73e5bff87f366e Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Wed, 6 Dec 2023 18:00:06 +0800 Subject: [PATCH 06/43] zshrc: not alias rm to trash --- .zshrc2 | 3 --- 1 file changed, 3 deletions(-) diff --git a/.zshrc2 b/.zshrc2 index a1993da..c40d898 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -112,9 +112,6 @@ alias "cbds"='curl https://www.baidu.com' alias "gdebug"='git add -A; git commit --allow-empty -m "bug fix ($(date))"' alias "ls"='ls --color=tty' alias "l"='ls -lAGh --time-style="+%y-%m-%d %H:%M"' -if [[ -x $(command -v trash) ]]; then - alias "rm"="echo use the full path i.e. '/bin/rm'\; consider using trash" -fi gbes() { git for-each-ref --sort=-committerdate refs/heads refs/remotes --format="%(authordate:format:%y-%m-%d.%a %H:%M %z)|%(color:red)%(objectname:short)|%(color:yellow)%(refname:short)%(color:reset)|%(color:reset)%(authorname): %(color:green)%(subject)" --color=always | column -ts"|" | less -FX } sagt() { eval "$($DOTFILES/tools/sagent.sh $@)" } From 76af9fa43426172ed77679e93443a47ef3c0c526 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Wed, 6 Dec 2023 19:17:19 +0800 Subject: [PATCH 07/43] (trial) riot devel: separate preset to config dir riot.d --- scripts/riot | 57 ++++++++++------------------------- scripts/riot.d/default.domain | 1 + scripts/riot.d/i.domain | 4 +++ scripts/riot.d/j.remote | 4 +++ scripts/riot.d/nasp.domain | 5 +++ scripts/riot.d/x.domain | 6 ++++ 6 files changed, 36 insertions(+), 41 deletions(-) create mode 120000 scripts/riot.d/default.domain create mode 100644 scripts/riot.d/i.domain create mode 100644 scripts/riot.d/j.remote create mode 100644 scripts/riot.d/nasp.domain create mode 100644 scripts/riot.d/x.domain diff --git a/scripts/riot b/scripts/riot index f8e18e0..24b9678 100755 --- a/scripts/riot +++ b/scripts/riot @@ -4,6 +4,7 @@ THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) source "$THIS_DIR/../tools/common.sh" RIOT_TRUST_CLIENT=${RIOT_TRUST_CLIENT:-${DFS_TRUST:-0}} RIOT_TRUST_SERVER=${RIOT_TRUST_SERVER:-0} +RIOT_CONFIG_DIR="$THIS_DIR/riot.d" # check if port number valid check_port() { @@ -29,14 +30,6 @@ get_server_meta() { RET_JUMP_SERVER="" # optional # body local remote="$1" - # shortcuts - if [[ "$remote" == "i" ]]; then - remote="sir0.ibd" - elif [[ "$remote" == "x" ]]; then - remote="bj1.ibd" - elif [[ "$remote" == "j" ]]; then - remote="sir0.ibd:36122" - fi # if in the form user@... if [[ "$remote" == *@* ]]; then RET_USERNAME=${remote%%@*} @@ -49,45 +42,27 @@ get_server_meta() { remote=${remote%:*} check_port $RET_PORT || fmt_fatal invalid port number \"$RET_PORT\" fi + # presets -- match remote + local remote_config="$RIOT_CONFIG_DIR/$remote.remote" + if [[ -f "$remote_config" ]]; then + source "$remote_config" + fi # presets -- match domain + RET_HOSTNAME=${remote} local domain=${remote##*.} local host=${remote%.*} # if there's no dot if [[ "$host" == "$domain" && "$host" != "["*"]" ]]; then - domain="ibd" + domain="default" + fi + local root_domain_config="$RIOT_CONFIG_DIR/.domain" + if [[ -f "$root_domain_config" ]]; then + source "$root_domain_config" + fi + local domain_config="$RIOT_CONFIG_DIR/$domain.domain" + if [[ -n "$$domain" && -f "$domain_config" ]]; then + source "$domain_config" fi - case $domain in - i|ibd ) - RET_HOSTNAME=$host.ibd.ink - RET_PORT=${RET_PORT:-12022} - RET_USERNAME=${RET_USERNAME:-root} - RET_TRUST_SERVER=1 - ;; - nasp ) - RET_HOSTNAME=$host - RET_PORT=${RET_PORT:-12022} - RET_USERNAME=${RET_USERNAME:-dictxiong} - RET_JUMP_SERVER="ssh@nasp.ob.ac.cn:36022" - RET_TRUST_SERVER=1 - ;; - x|ssh ) - RET_HOSTNAME=ssh.beardic.cn - local tmp=$(sha256sum <<< "$host" | tr -cd "[:digit:]") - tmp=${tmp:0:4} - RET_PORT=$((10#$tmp+36000)) - RET_USERNAME=root - RET_TRUST_SERVER=1 - ;; - box[0-9] ) - RET_HOSTNAME=$host - RET_PORT=${RET_PORT:-12022} - RET_USERNAME=${RET_USERNAME:-root} - RET_JUMP_SERVER="root@$domain.ibd.ink:12022" - RET_TRUST_SERVER=1 - ;; - * ) - RET_HOSTNAME="$remote" - esac } parse_remote() { diff --git a/scripts/riot.d/default.domain b/scripts/riot.d/default.domain new file mode 120000 index 0000000..04cc35d --- /dev/null +++ b/scripts/riot.d/default.domain @@ -0,0 +1 @@ +./i.domain \ No newline at end of file diff --git a/scripts/riot.d/i.domain b/scripts/riot.d/i.domain new file mode 100644 index 0000000..6315e28 --- /dev/null +++ b/scripts/riot.d/i.domain @@ -0,0 +1,4 @@ +RET_HOSTNAME=$host.ibd.ink +RET_PORT=${RET_PORT:-12022} +RET_USERNAME=${RET_USERNAME:-root} +RET_TRUST_SERVER=1 \ No newline at end of file diff --git a/scripts/riot.d/j.remote b/scripts/riot.d/j.remote new file mode 100644 index 0000000..eb2a647 --- /dev/null +++ b/scripts/riot.d/j.remote @@ -0,0 +1,4 @@ +remote=sir0.ibd.ink +RET_PORT=${RET_PORT:-36122} +RET_USERNAME=${RET_USERNAME:-root} +RET_TRUST_SERVER=1 \ No newline at end of file diff --git a/scripts/riot.d/nasp.domain b/scripts/riot.d/nasp.domain new file mode 100644 index 0000000..d33036a --- /dev/null +++ b/scripts/riot.d/nasp.domain @@ -0,0 +1,5 @@ +RET_HOSTNAME=$host +RET_PORT=${RET_PORT:-12022} +RET_USERNAME=${RET_USERNAME:-dictxiong} +RET_JUMP_SERVER="ssh@nasp.ob.ac.cn:36022" +RET_TRUST_SERVER=1 \ No newline at end of file diff --git a/scripts/riot.d/x.domain b/scripts/riot.d/x.domain new file mode 100644 index 0000000..8389866 --- /dev/null +++ b/scripts/riot.d/x.domain @@ -0,0 +1,6 @@ +RET_HOSTNAME=ssh.beardic.cn +local tmp=$(sha256sum <<< "$host" | tr -cd "[:digit:]") +tmp=${tmp:0:4} +RET_PORT=$((10#$tmp+36000)) +RET_USERNAME=root +RET_TRUST_SERVER=1 \ No newline at end of file From 2fa248fdb04f713b71ea3ce22a390fbb8747d9bf Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Wed, 6 Dec 2023 19:32:24 +0800 Subject: [PATCH 08/43] riot: support extra options and extra -o options --- scripts/riot | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/riot b/scripts/riot index 24b9678..c0720f7 100755 --- a/scripts/riot +++ b/scripts/riot @@ -5,6 +5,7 @@ source "$THIS_DIR/../tools/common.sh" RIOT_TRUST_CLIENT=${RIOT_TRUST_CLIENT:-${DFS_TRUST:-0}} RIOT_TRUST_SERVER=${RIOT_TRUST_SERVER:-0} RIOT_CONFIG_DIR="$THIS_DIR/riot.d" +RIOT_EXTRA_OPTIONS="" # check if port number valid check_port() { @@ -124,7 +125,7 @@ prepare_ssh_cmd() { else local port_param='-p' fi - echo "$ssh_bin ${PORT:+$port_param} $PORT $SSH_OPTIONS $SCP_SRC $USERNAME${USERNAME:+@}$SERVER $SCP_DST ${@:2}" + echo "$ssh_bin ${PORT:+$port_param} $PORT $SSH_OPTIONS $RIOT_EXTRA_OPTIONS $SCP_SRC $USERNAME${USERNAME:+@}$SERVER $SCP_DST ${@:2}" } # ssh @@ -188,6 +189,15 @@ router() { exit fi + while [[ "$1" == -* ]]; do + RIOT_EXTRA_OPTIONS="$RIOT_EXTRA_OPTIONS $1" + if [[ "$1" == "-o" ]]; then + RIOT_EXTRA_OPTIONS="$RIOT_EXTRA_OPTIONS $2" + shift + fi + shift + done + IFS=',' read -ra remotes <<< "$1" for remote in "${remotes[@]}"; do if [[ -z "$remote" ]]; then From 79d376265eb8588429200d15620a6a5712a1b47c Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Wed, 6 Dec 2023 21:52:54 +0800 Subject: [PATCH 09/43] (experimental) riot config in a single file --- riot-config.sh | 38 +++++++++++++++++++++++++++++++++++ scripts/riot | 30 ++++++++++++++++++--------- scripts/riot.d/default.domain | 1 - scripts/riot.d/i.domain | 4 ---- scripts/riot.d/j.remote | 4 ---- scripts/riot.d/nasp.domain | 5 ----- scripts/riot.d/x.domain | 6 ------ tools/common.sh | 4 ++++ 8 files changed, 62 insertions(+), 30 deletions(-) create mode 100644 riot-config.sh delete mode 120000 scripts/riot.d/default.domain delete mode 100644 scripts/riot.d/i.domain delete mode 100644 scripts/riot.d/j.remote delete mode 100644 scripts/riot.d/nasp.domain delete mode 100644 scripts/riot.d/x.domain diff --git a/riot-config.sh b/riot-config.sh new file mode 100644 index 0000000..b0bc063 --- /dev/null +++ b/riot-config.sh @@ -0,0 +1,38 @@ +#!/bin/false + +# remotes +j.remote() { + remote=sir0.ibd.ink + RET_PORT=${RET_PORT:-36122} + RET_USERNAME=${RET_USERNAME:-root} + RET_TRUST_SERVER=1 +} + +# domains +i.domain() { + RET_HOSTNAME=$host.ibd.ink + RET_PORT=${RET_PORT:-12022} + RET_USERNAME=${RET_USERNAME:-root} + RET_TRUST_SERVER=1 +} + +x.domain() { + RET_HOSTNAME=ssh.beardic.cn + local tmp=$(sha256sum <<< "$host" | tr -cd "[:digit:]") + tmp=${tmp:0:4} + RET_PORT=$((10#$tmp+36000)) + RET_USERNAME=root + RET_TRUST_SERVER=1 +} + +nasp.domain() { + RET_HOSTNAME=$host + RET_PORT=${RET_PORT:-12022} + RET_USERNAME=${RET_USERNAME:-dictxiong} + RET_JUMP_SERVER="ssh@nasp.ob.ac.cn:36022" + RET_TRUST_SERVER=1 +} + +default.domain() { + i.domain +} diff --git a/scripts/riot b/scripts/riot index c0720f7..10c7561 100755 --- a/scripts/riot +++ b/scripts/riot @@ -4,9 +4,20 @@ THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) source "$THIS_DIR/../tools/common.sh" RIOT_TRUST_CLIENT=${RIOT_TRUST_CLIENT:-${DFS_TRUST:-0}} RIOT_TRUST_SERVER=${RIOT_TRUST_SERVER:-0} -RIOT_CONFIG_DIR="$THIS_DIR/riot.d" RIOT_EXTRA_OPTIONS="" +# config +RIOT_CONFIG_FILES=( + "$DOTFILES/riot-config.sh" + "$HOME/.config/riot-config.sh" + "riot-config.sh" +) +for file in "${RIOT_CONFIG_FILES[@]}"; do + if [[ -f "$file" ]]; then + source "$file" + fi +done + # check if port number valid check_port() { ( echo $1 | grep -qxE "[1-9][0-9]{0,4}" ) || return 1 @@ -44,9 +55,9 @@ get_server_meta() { check_port $RET_PORT || fmt_fatal invalid port number \"$RET_PORT\" fi # presets -- match remote - local remote_config="$RIOT_CONFIG_DIR/$remote.remote" - if [[ -f "$remote_config" ]]; then - source "$remote_config" + local remote_func="$remote.remote" + if is_function "$remote_func"; then + "$remote_func" fi # presets -- match domain RET_HOSTNAME=${remote} @@ -56,13 +67,12 @@ get_server_meta() { if [[ "$host" == "$domain" && "$host" != "["*"]" ]]; then domain="default" fi - local root_domain_config="$RIOT_CONFIG_DIR/.domain" - if [[ -f "$root_domain_config" ]]; then - source "$root_domain_config" + if is_function ".domain"; then + ".domain" fi - local domain_config="$RIOT_CONFIG_DIR/$domain.domain" - if [[ -n "$$domain" && -f "$domain_config" ]]; then - source "$domain_config" + local domain_func="$domain.domain" + if [[ -n "$domain" ]] && is_function "$domain_func"; then + "$domain_func" fi } diff --git a/scripts/riot.d/default.domain b/scripts/riot.d/default.domain deleted file mode 120000 index 04cc35d..0000000 --- a/scripts/riot.d/default.domain +++ /dev/null @@ -1 +0,0 @@ -./i.domain \ No newline at end of file diff --git a/scripts/riot.d/i.domain b/scripts/riot.d/i.domain deleted file mode 100644 index 6315e28..0000000 --- a/scripts/riot.d/i.domain +++ /dev/null @@ -1,4 +0,0 @@ -RET_HOSTNAME=$host.ibd.ink -RET_PORT=${RET_PORT:-12022} -RET_USERNAME=${RET_USERNAME:-root} -RET_TRUST_SERVER=1 \ No newline at end of file diff --git a/scripts/riot.d/j.remote b/scripts/riot.d/j.remote deleted file mode 100644 index eb2a647..0000000 --- a/scripts/riot.d/j.remote +++ /dev/null @@ -1,4 +0,0 @@ -remote=sir0.ibd.ink -RET_PORT=${RET_PORT:-36122} -RET_USERNAME=${RET_USERNAME:-root} -RET_TRUST_SERVER=1 \ No newline at end of file diff --git a/scripts/riot.d/nasp.domain b/scripts/riot.d/nasp.domain deleted file mode 100644 index d33036a..0000000 --- a/scripts/riot.d/nasp.domain +++ /dev/null @@ -1,5 +0,0 @@ -RET_HOSTNAME=$host -RET_PORT=${RET_PORT:-12022} -RET_USERNAME=${RET_USERNAME:-dictxiong} -RET_JUMP_SERVER="ssh@nasp.ob.ac.cn:36022" -RET_TRUST_SERVER=1 \ No newline at end of file diff --git a/scripts/riot.d/x.domain b/scripts/riot.d/x.domain deleted file mode 100644 index 8389866..0000000 --- a/scripts/riot.d/x.domain +++ /dev/null @@ -1,6 +0,0 @@ -RET_HOSTNAME=ssh.beardic.cn -local tmp=$(sha256sum <<< "$host" | tr -cd "[:digit:]") -tmp=${tmp:0:4} -RET_PORT=$((10#$tmp+36000)) -RET_USERNAME=root -RET_TRUST_SERVER=1 \ No newline at end of file diff --git a/tools/common.sh b/tools/common.sh index ddae15f..2705aca 100755 --- a/tools/common.sh +++ b/tools/common.sh @@ -258,6 +258,10 @@ get_free_port() { echo $port } +is_function() { + test "$(type -t "$1")" = "function" +} + # if bash-ed, else source-d if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then $1 "${@:2}" From b1272e22bb7369a0ca40ab09a264d73c68202b37 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Thu, 7 Dec 2023 14:48:27 +0800 Subject: [PATCH 10/43] riot config: add nasp remote and null domain --- riot-config.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/riot-config.sh b/riot-config.sh index b0bc063..dc77bd1 100644 --- a/riot-config.sh +++ b/riot-config.sh @@ -8,7 +8,18 @@ j.remote() { RET_TRUST_SERVER=1 } +nasp.remote() { + remote=nasp.ob.ac.cn + RET_PORT=${RET_PORT:-36022} + RET_USERNAME=${RET_USERNAME:-ssh} + RET_TRUST_SERVER=1 +} + # domains +.domain() { + RET_USERNAME=${RET_USERNAME:-root} +} + i.domain() { RET_HOSTNAME=$host.ibd.ink RET_PORT=${RET_PORT:-12022} From c1d555393aa0ee8f6e1da66b9dd2b98510029c9f Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Thu, 7 Dec 2023 18:14:42 +0800 Subject: [PATCH 11/43] gitconf: pull.ff = only --- .gitconfig2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitconfig2 b/.gitconfig2 index 09a899e..c731d12 100644 --- a/.gitconfig2 +++ b/.gitconfig2 @@ -9,6 +9,8 @@ quotepath = false # chinese chars [push] autoSetupRemote = true +[pull] + ff = only [branch] # Show most recently changed branches first. sort = -committerdate From ce657c8300ce463b6703d638f9f3555036feeb5f Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Thu, 7 Dec 2023 18:21:02 +0800 Subject: [PATCH 12/43] fix ci --- tools/test.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test.zsh b/tools/test.zsh index 68edf99..4625b36 100644 --- a/tools/test.zsh +++ b/tools/test.zsh @@ -38,7 +38,7 @@ test $(echo n | tools/common.sh ask_for_yN "test") = "0" test $(echo | tools/common.sh ask_for_yN "test") = "0" test $(echo | tools/common.sh ask_for_Yn "test") = "1" test $(DFS_QUIET=1 tools/common.sh ask_for_Yn "test") = "1" -test "$(DFS_TRUST=1 riot time@is.impt:2222/yes@you-r.right/you@are.really.recht./ibd./try@it,another@host scp /tmp/ ./tmp -D 2>/dev/null)" = 'scp -P 12022 -o ControlMaster=auto -o ControlPath=/tmp/sshcm-%C -o PermitLocalCommand=yes -o ProxyJump=time@is.impt:2222,yes@you-r.right,you@are.really.recht.,ibd. -r try@it.ibd.ink:"/tmp/" "./tmp" +test "$(DFS_TRUST=1 riot time@is.impt:2222/yes@you-r.right/you@are.really.recht./ibd./try@it,another@host scp /tmp/ ./tmp -D 2>/dev/null)" = 'scp -P 12022 -o ControlMaster=auto -o ControlPath=/tmp/sshcm-%C -o PermitLocalCommand=yes -o ProxyJump=time@is.impt:2222,yes@you-r.right,you@are.really.recht.,root@ibd. -r try@it.ibd.ink:"/tmp/" "./tmp" scp -P 12022 -o ControlMaster=auto -o ControlPath=/tmp/sshcm-%C -o PermitLocalCommand=yes -o ForwardX11=yes -o ForwardAgent=yes -r another@host.ibd.ink:"/tmp/" "./tmp"' # check alias From 35c302a44526beba9b55b595a501c4dfd8604f86 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Thu, 7 Dec 2023 18:24:56 +0800 Subject: [PATCH 13/43] riot: dynamic port forwarding --- scripts/riot | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/riot b/scripts/riot index 10c7561..ec62f33 100755 --- a/scripts/riot +++ b/scripts/riot @@ -163,6 +163,18 @@ run_sshl() eval_or_echo $cmd } +# sshd +run_sshd() +{ + local port=$(get_free_port) + + SSH_OPTIONS="$SSH_OPTIONS -NC -D $port" + local cmd="$(prepare_ssh_cmd ssh)" + fmt_note "-->" $cmd + fmt_note " > please access localhost:$port" + eval_or_echo $cmd +} + # scp run_scp() { local src="$1" @@ -228,6 +240,9 @@ router() { test -n "$3" || fmt_fatal "no target address provided" run_sshl "$3" ;; + sshd ) + run_sshd + ;; scp ) test -n "$3" || fmt_fatal "no source path specified" test -n "$4" || fmt_fatal "no destination path specified" From b727841cccc69762440f1fbdc8389c81032ae0df Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Tue, 12 Dec 2023 18:08:23 +0800 Subject: [PATCH 14/43] riot: only one domain func will be exec --- scripts/riot | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/riot b/scripts/riot index ec62f33..cf53dd5 100755 --- a/scripts/riot +++ b/scripts/riot @@ -67,12 +67,11 @@ get_server_meta() { if [[ "$host" == "$domain" && "$host" != "["*"]" ]]; then domain="default" fi - if is_function ".domain"; then - ".domain" - fi local domain_func="$domain.domain" - if [[ -n "$domain" ]] && is_function "$domain_func"; then + if is_function "$domain_func"; then "$domain_func" + elif is_function ".domain"; then + ".domain" fi } From c3baed2bea7485d0fc2bf40274d435d3349dffde Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Fri, 22 Dec 2023 15:11:56 +0800 Subject: [PATCH 15/43] to-install: update lemonbench --- tools/to-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/to-install.sh b/tools/to-install.sh index 04b019e..d163758 100755 --- a/tools/to-install.sh +++ b/tools/to-install.sh @@ -10,7 +10,7 @@ INSTALL_COMMANDS=(\ [v2fly]="bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) #--remove" \ [zerotier-one]='curl -s https://install.zerotier.com | sudo bash' \ [docker-ce]='curl -fsSL https://get.docker.com | sudo bash -s - --mirror Aliyun #--dry-run' \ - [lemonbench]='curl -fsSL https://ilemonra.in/LemonBenchIntl | bash -s fast # or full' \ + [lemonbench]='curl -fsSL https://raw.githubusercontent.com/LemonBench/LemonBench/main/LemonBench.sh | bash -s fast # or full' \ [nix]='sh <(curl -L https://nixos.org/nix/install) #--daemon' \ ) From f861eee42474d8eb159656a0f701f48ca5812211 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Sat, 30 Dec 2023 21:20:17 +0800 Subject: [PATCH 16/43] to-install: alist --- tools/to-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/to-install.sh b/tools/to-install.sh index d163758..93f9d80 100755 --- a/tools/to-install.sh +++ b/tools/to-install.sh @@ -12,6 +12,7 @@ INSTALL_COMMANDS=(\ [docker-ce]='curl -fsSL https://get.docker.com | sudo bash -s - --mirror Aliyun #--dry-run' \ [lemonbench]='curl -fsSL https://raw.githubusercontent.com/LemonBench/LemonBench/main/LemonBench.sh | bash -s fast # or full' \ [nix]='sh <(curl -L https://nixos.org/nix/install) #--daemon' \ + [alist]='curl -fsSL "https://alist.nn.ci/v3.sh" | bash -s install' \ ) install() From 0f6ee20bed92539ca63eba460a31bf90f845a17a Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Sat, 30 Dec 2023 21:24:44 +0800 Subject: [PATCH 17/43] [exp] riot inferred ssh: ping ping6 --- scripts/riot | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/riot b/scripts/riot index cf53dd5..c9b8d3b 100755 --- a/scripts/riot +++ b/scripts/riot @@ -229,6 +229,9 @@ router() { ssh|"" ) run_ssh ssh "${@:3}" ;; + ping|ping6 ) + run_ssh ssh "${@:2}" + ;; zssh ) run_ssh zssh ;; From a87bc0b36d2a28975a12d6507383c3749870e1d8 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Thu, 4 Jan 2024 15:41:08 +0800 Subject: [PATCH 18/43] sagt: fix nixos --- tools/sagent.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/sagent.sh b/tools/sagent.sh index 8f2545f..083ef4e 100755 --- a/tools/sagent.sh +++ b/tools/sagent.sh @@ -25,7 +25,7 @@ find_so_file() create_agent() { local IFS="," - ssh-agent -P "${SO_PATHS[*]}" + ssh-agent -P "${SO_PATHS[*]},/nix/store/*" } kill_agent() From 3f8c071c65563be20f4eeaec3d4bfc892d1c8495 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Thu, 4 Jan 2024 22:00:22 +0800 Subject: [PATCH 19/43] riot config: domain 42 --- riot-config.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/riot-config.sh b/riot-config.sh index dc77bd1..544c864 100644 --- a/riot-config.sh +++ b/riot-config.sh @@ -27,6 +27,13 @@ i.domain() { RET_TRUST_SERVER=1 } +42.domain() { + RET_HOSTNAME=$host.i.bd.dn42 + RET_PORT=${RET_PORT:-12022} + RET_USERNAME=${RET_USERNAME:-root} + RET_TRUST_SERVER=1 +} + x.domain() { RET_HOSTNAME=ssh.beardic.cn local tmp=$(sha256sum <<< "$host" | tr -cd "[:digit:]") From b631d32b2247d4380e7f0df919c5057064be0839 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Mon, 8 Jan 2024 11:46:56 +0800 Subject: [PATCH 20/43] ubuntu.sh: DEBIAN_FRONTEND=noninteractive --- tools/ubuntu.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ubuntu.sh b/tools/ubuntu.sh index 8f7e611..1bcd158 100755 --- a/tools/ubuntu.sh +++ b/tools/ubuntu.sh @@ -14,11 +14,11 @@ apt_install() { apt-get update -y # lite - apt-get install -y git zsh bash tmux vim curl inetutils-ping less bsdmainutils + DEBIAN_FRONTEND=noninteractive apt-get install -y git zsh bash tmux vim curl iputils-ping less bsdmainutils # full if [[ -z "$DFS_LITE" || "$DFS_LITE" == "0" ]]; then - apt-get install -y wget dialog net-tools dnsutils netcat traceroute sudo python3 python3-pip cron openssh-client openssh-server htop gcc g++ cmake make zip - for i in {fzf,ripgrep,man-db}; do apt-get install -y $i; done + DEBIAN_FRONTEND=noninteractive apt-get install -y wget dialog net-tools dnsutils netcat traceroute sudo python3 python3-pip cron openssh-client openssh-server htop gcc g++ cmake make zip + for i in {fzf,ripgrep,man-db}; do DEBIAN_FRONTEND=noninteractive apt-get install -y $i; done fi } From 64808ce742c3a9f55e08e9467bdb99fdede2f5ce Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Mon, 8 Jan 2024 11:47:37 +0800 Subject: [PATCH 21/43] zshrc: ping -n --- .zshrc2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.zshrc2 b/.zshrc2 index c40d898..73f0786 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -105,8 +105,8 @@ alias "sl"='sudo zsh -l' alias "cps"='rsync -avh --info=progress2' alias "mvs"='rsync -avh --info=progress2 --remove-source-files' alias "pbd"='ping baidu.com' -alias "p114"='ping 114.114.114.114' -alias "p666"='ping6 2001:da8::666' +alias "p114"='ping -n 114.114.114.114' +alias "p666"='ping6 -n 2001:da8::666' alias "cbd"='curl http://www.baidu.com' alias "cbds"='curl https://www.baidu.com' alias "gdebug"='git add -A; git commit --allow-empty -m "bug fix ($(date))"' From 607b27b38568f16fbc41890ba68f715d09accced Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Wed, 10 Jan 2024 12:51:07 +0800 Subject: [PATCH 22/43] zshrc: alias ping -n --- .zshrc2 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.zshrc2 b/.zshrc2 index 73f0786..8570614 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -104,9 +104,10 @@ alias "se"='sudo -sE' alias "sl"='sudo zsh -l' alias "cps"='rsync -avh --info=progress2' alias "mvs"='rsync -avh --info=progress2 --remove-source-files' +alias "ping"='ping -n' alias "pbd"='ping baidu.com' -alias "p114"='ping -n 114.114.114.114' -alias "p666"='ping6 -n 2001:da8::666' +alias "p114"='ping 114.114.114.114' +alias "p666"='ping6 2001:da8::666' alias "cbd"='curl http://www.baidu.com' alias "cbds"='curl https://www.baidu.com' alias "gdebug"='git add -A; git commit --allow-empty -m "bug fix ($(date))"' From 3667d3bd15812504d724cf2d7ce174c7df39c270 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Mon, 15 Jan 2024 20:11:54 +0800 Subject: [PATCH 23/43] riot-config: jumpserver from sir0 to ssh.beardic.cn --- riot-config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/riot-config.sh b/riot-config.sh index 544c864..7209534 100644 --- a/riot-config.sh +++ b/riot-config.sh @@ -2,8 +2,8 @@ # remotes j.remote() { - remote=sir0.ibd.ink - RET_PORT=${RET_PORT:-36122} + remote=ssh.beardic.cn + RET_PORT=${RET_PORT:-24022} RET_USERNAME=${RET_USERNAME:-root} RET_TRUST_SERVER=1 } From 864456d35df01c350a8b2ec1abcdfdb278d16015 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Mon, 15 Jan 2024 20:16:29 +0800 Subject: [PATCH 24/43] zshrc: alias ping before checking os type --- .zshrc2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zshrc2 b/.zshrc2 index 8570614..2ac4246 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -104,7 +104,7 @@ alias "se"='sudo -sE' alias "sl"='sudo zsh -l' alias "cps"='rsync -avh --info=progress2' alias "mvs"='rsync -avh --info=progress2 --remove-source-files' -alias "ping"='ping -n' +if [[ $("$DOTFILES/tools/common.sh" get_os_type) == "linux" ]]; then alias "ping"='ping -n'; fi alias "pbd"='ping baidu.com' alias "p114"='ping 114.114.114.114' alias "p666"='ping6 2001:da8::666' From 3d4a264a309c5ec4ddb34d7fd28bbef04727b1ca Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Mon, 15 Jan 2024 20:31:31 +0800 Subject: [PATCH 25/43] frigg: support api4.beardic.cn --- tools/frigg-client.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/frigg-client.sh b/tools/frigg-client.sh index cb68efd..4d5d3da 100755 --- a/tools/frigg-client.sh +++ b/tools/frigg-client.sh @@ -103,6 +103,7 @@ update_dns() ip4="" elif [[ "$DFS_DDNS_IP4" == "auto" ]]; then ip4="auto" + api_url="https://api4.beardic.cn" elif [[ "$DFS_DDNS_IP4" == "api" ]]; then ip4=$(curl $DFS_CURL_OPTIONS -sSL "https://api.ipify.org") elif [[ "$DFS_DDNS_IP4" == "http"* ]]; then From 019781f9ee6668f49196ecbe4838671777ce1919 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Mon, 1 Apr 2024 22:16:34 +0800 Subject: [PATCH 26/43] fix(install.sh): crontab fails on a new server --- install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 50a1ca0..24ffba3 100755 --- a/install.sh +++ b/install.sh @@ -203,9 +203,10 @@ install_crontab() if [[ -x $(command -v crontab) ]]; then fmt_note "installing \"$CRON_JOB\" to crontab ..." if ! crontab -l 1>/dev/null 2>&1; then - echo -n | crontab - + echo "$CRON_JOB" | crontab - + else + ( crontab -l | grep -vxF "${CRON_JOB}" | grep -v "no crontab for"; echo "$CRON_JOB" ) | crontab - fi - ( crontab -l | grep -vxF "${CRON_JOB}" | grep -v "no crontab for"; echo "$CRON_JOB" ) | crontab - else fmt_warning "crontab does not exist. skipping ..." fi From c8c3289c792098ae28280693015b40182cfa49ef Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Tue, 16 Apr 2024 00:53:40 +0800 Subject: [PATCH 27/43] fix(riot-conf): nasp.ob.ac.cn -> nasp.fit --- riot-config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/riot-config.sh b/riot-config.sh index 7209534..03199a3 100644 --- a/riot-config.sh +++ b/riot-config.sh @@ -9,7 +9,7 @@ j.remote() { } nasp.remote() { - remote=nasp.ob.ac.cn + remote=nasp.fit RET_PORT=${RET_PORT:-36022} RET_USERNAME=${RET_USERNAME:-ssh} RET_TRUST_SERVER=1 @@ -47,7 +47,7 @@ nasp.domain() { RET_HOSTNAME=$host RET_PORT=${RET_PORT:-12022} RET_USERNAME=${RET_USERNAME:-dictxiong} - RET_JUMP_SERVER="ssh@nasp.ob.ac.cn:36022" + RET_JUMP_SERVER="ssh@nasp.fit:36022" RET_TRUST_SERVER=1 } From b31bcfe44b7dc50aaeed17ddbd7307c68e54f60a Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Tue, 16 Apr 2024 17:41:49 +0800 Subject: [PATCH 28/43] fix(install.sh): install crontab (exp) --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 24ffba3..5c54181 100755 --- a/install.sh +++ b/install.sh @@ -202,10 +202,10 @@ install_crontab() { if [[ -x $(command -v crontab) ]]; then fmt_note "installing \"$CRON_JOB\" to crontab ..." - if ! crontab -l 1>/dev/null 2>&1; then + if [[ -z "$(crontab -l 2>/dev/null || true)" ]]; then echo "$CRON_JOB" | crontab - - else - ( crontab -l | grep -vxF "${CRON_JOB}" | grep -v "no crontab for"; echo "$CRON_JOB" ) | crontab - + elif !( crontab -l | grep -qxF "${CRON_JOB}"); then + ( crontab -l; echo "$CRON_JOB" ) | crontab - fi else fmt_warning "crontab does not exist. skipping ..." From 36fd85121bb0ba7849efcc5b9b0520c18a2d78e0 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Tue, 16 Apr 2024 19:34:24 +0800 Subject: [PATCH 29/43] feat(test.zsh): test crontab --- tools/test.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/test.zsh b/tools/test.zsh index 4625b36..e37dd7c 100644 --- a/tools/test.zsh +++ b/tools/test.zsh @@ -21,6 +21,9 @@ test -f .zshrc2 diff -q ./.ssh/authorized_keys2 ~/.ssh/authorized_keys2 diff -q ./.eid/authorized_certificates ~/.eid/authorized_certificates grep -q ".zshrc2" ~/.zshrc +if [[ -x $(command -v crontab) ]]; then + crontab -l | grep -qxF "0 * * * * ${DOTFILES}/update.sh" +fi # check scripts and functions dfs version From 500c3bdfe52ff39677176566922cff91f5ec4114 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Tue, 16 Apr 2024 21:31:04 +0800 Subject: [PATCH 30/43] fix(riot): secure control master --- scripts/riot | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/riot b/scripts/riot index c9b8d3b..01a80c5 100755 --- a/scripts/riot +++ b/scripts/riot @@ -85,7 +85,11 @@ parse_remote() { USERNAME="" # optional SSH_OPTIONS="" # optional if [[ "$RIOT_TRUST_CLIENT" == "1" ]]; then - SSH_OPTIONS='-o ControlMaster=auto -o ControlPath=/tmp/sshcm-%C -o PermitLocalCommand=yes' + SSH_OPTIONS='-o PermitLocalCommand=yes' + if [[ "$(get_os_type)" != "msys" ]]; then + mkdir -p ~/.ssh/master-socket + SSH_OPTIONS="$SSH_OPTIONS -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C" + fi fi # handle input local remote="$1" From 5d6d13e623dc480f5a9ca97275b0f940b3246181 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Tue, 16 Apr 2024 21:36:47 +0800 Subject: [PATCH 31/43] fix(ci): riot control master --- tools/test.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/test.zsh b/tools/test.zsh index e37dd7c..8a02ef6 100644 --- a/tools/test.zsh +++ b/tools/test.zsh @@ -41,8 +41,12 @@ test $(echo n | tools/common.sh ask_for_yN "test") = "0" test $(echo | tools/common.sh ask_for_yN "test") = "0" test $(echo | tools/common.sh ask_for_Yn "test") = "1" test $(DFS_QUIET=1 tools/common.sh ask_for_Yn "test") = "1" -test "$(DFS_TRUST=1 riot time@is.impt:2222/yes@you-r.right/you@are.really.recht./ibd./try@it,another@host scp /tmp/ ./tmp -D 2>/dev/null)" = 'scp -P 12022 -o ControlMaster=auto -o ControlPath=/tmp/sshcm-%C -o PermitLocalCommand=yes -o ProxyJump=time@is.impt:2222,yes@you-r.right,you@are.really.recht.,root@ibd. -r try@it.ibd.ink:"/tmp/" "./tmp" -scp -P 12022 -o ControlMaster=auto -o ControlPath=/tmp/sshcm-%C -o PermitLocalCommand=yes -o ForwardX11=yes -o ForwardAgent=yes -r another@host.ibd.ink:"/tmp/" "./tmp"' +test "$(DFS_TRUST=1 riot time@is.impt:2222/yes@you-r.right/you@are.really.recht./ibd./try@it,another@host scp /tmp/ ./tmp -D 2>/dev/null)" = 'scp -P 12022 -o PermitLocalCommand=yes -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C -o ProxyJump=time@is.impt:2222,yes@you-r.right,you@are.really.recht.,root@ibd. -r try@it.ibd.ink:"/tmp/" "./tmp" +scp -P 12022 -o PermitLocalCommand=yes -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C -o ForwardX11=yes -o ForwardAgent=yes -r another@host.ibd.ink:"/tmp/" "./tmp"' +if [[ "$(tools/common.sh get_os_type)" != "msys" ]]; then + test -d ~/.ssh/master-socket +fi + # check alias alias p114 From 7600d07d46a964c0ffdb96aa283cc3af0fee812f Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Tue, 16 Apr 2024 21:44:38 +0800 Subject: [PATCH 32/43] fix(riot): not mkdir if dry-run --- scripts/riot | 2 +- tools/test.zsh | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/riot b/scripts/riot index 01a80c5..db6e00a 100755 --- a/scripts/riot +++ b/scripts/riot @@ -87,7 +87,7 @@ parse_remote() { if [[ "$RIOT_TRUST_CLIENT" == "1" ]]; then SSH_OPTIONS='-o PermitLocalCommand=yes' if [[ "$(get_os_type)" != "msys" ]]; then - mkdir -p ~/.ssh/master-socket + test "$DFS_DRY_RUN" = "1" || mkdir -p ~/.ssh/master-socket SSH_OPTIONS="$SSH_OPTIONS -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C" fi fi diff --git a/tools/test.zsh b/tools/test.zsh index 8a02ef6..8e98efe 100644 --- a/tools/test.zsh +++ b/tools/test.zsh @@ -43,10 +43,6 @@ test $(echo | tools/common.sh ask_for_Yn "test") = "1" test $(DFS_QUIET=1 tools/common.sh ask_for_Yn "test") = "1" test "$(DFS_TRUST=1 riot time@is.impt:2222/yes@you-r.right/you@are.really.recht./ibd./try@it,another@host scp /tmp/ ./tmp -D 2>/dev/null)" = 'scp -P 12022 -o PermitLocalCommand=yes -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C -o ProxyJump=time@is.impt:2222,yes@you-r.right,you@are.really.recht.,root@ibd. -r try@it.ibd.ink:"/tmp/" "./tmp" scp -P 12022 -o PermitLocalCommand=yes -o ControlMaster=auto -o ControlPath=~/.ssh/master-socket/%C -o ForwardX11=yes -o ForwardAgent=yes -r another@host.ibd.ink:"/tmp/" "./tmp"' -if [[ "$(tools/common.sh get_os_type)" != "msys" ]]; then - test -d ~/.ssh/master-socket -fi - # check alias alias p114 From 534a8c55163c56152d5bcdb1b3401ecf13adcf01 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Fri, 26 Apr 2024 10:15:55 +0800 Subject: [PATCH 33/43] feat(vimrc): set shiftwidth=4 --- .vimrc2 | 1 + 1 file changed, 1 insertion(+) diff --git a/.vimrc2 b/.vimrc2 index f62e48f..f125af3 100644 --- a/.vimrc2 +++ b/.vimrc2 @@ -15,6 +15,7 @@ set syntax=on set autoindent set smartindent set tabstop=4 +set shiftwidth=4 set expandtab "spaces instead of tabs set backspace=indent,eol,start set number "line numbers From 26598863f098f7355e50572d6d610525e37f8b0c Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Fri, 26 Apr 2024 10:56:09 +0800 Subject: [PATCH 34/43] feat(ci): sync tmux-yank --- .github/workflows/gitee_sync_dependencies.yml | 2 +- .vimrc2 | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gitee_sync_dependencies.yml b/.github/workflows/gitee_sync_dependencies.yml index ed222f2..4d20616 100644 --- a/.github/workflows/gitee_sync_dependencies.yml +++ b/.github/workflows/gitee_sync_dependencies.yml @@ -87,7 +87,7 @@ jobs: clone_style: "https" debug: true force_update: true - static_list: "tpm,tmux-resurrect" + static_list: "tpm,tmux-resurrect,tmux-yank" timeout: '600s' vundle-vim: runs-on: ubuntu-20.04 diff --git a/.vimrc2 b/.vimrc2 index f125af3..271c162 100644 --- a/.vimrc2 +++ b/.vimrc2 @@ -14,9 +14,8 @@ set cursorline set syntax=on set autoindent set smartindent -set tabstop=4 -set shiftwidth=4 set expandtab "spaces instead of tabs +set tabstop=4 softtabstop=4 shiftwidth=4 set backspace=indent,eol,start set number "line numbers set history=1000 From 4c8d5aa2af89a1daabf7b7e9d9ec7a0d9c1df28b Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Fri, 26 Apr 2024 11:59:20 +0800 Subject: [PATCH 35/43] feat(tmux): set-clipboard on and mouse on (experimental) --- .tmux.conf2 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.tmux.conf2 b/.tmux.conf2 index 5ffeff8..659ecb0 100644 --- a/.tmux.conf2 +++ b/.tmux.conf2 @@ -1,5 +1,6 @@ set -g prefix ^a -set -g mouse off +set -g mouse on +set -g set-clipboard on set -g default-terminal "xterm-256color" set -g history-limit 10000 @@ -50,4 +51,4 @@ set -g window-style fg=colour248 set -g window-active-style fg=white # better mouse scrolling. see: https://superuser.com/questions/1622812/mouse-scrolling-in-mobaxterm-tmux -set -g terminal-overrides 'xterm*:smcup@:rmcup@' \ No newline at end of file +set -g terminal-overrides 'xterm*:smcup@:rmcup@' From 6bb6a428bc991ac68c7a841f999ac26508c22b7f Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Fri, 26 Apr 2024 14:50:23 +0800 Subject: [PATCH 36/43] feat(zshrc): alias ping6 --- .zshrc2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zshrc2 b/.zshrc2 index 2ac4246..3b66101 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -104,7 +104,7 @@ alias "se"='sudo -sE' alias "sl"='sudo zsh -l' alias "cps"='rsync -avh --info=progress2' alias "mvs"='rsync -avh --info=progress2 --remove-source-files' -if [[ $("$DOTFILES/tools/common.sh" get_os_type) == "linux" ]]; then alias "ping"='ping -n'; fi +if [[ $("$DOTFILES/tools/common.sh" get_os_type) == "linux" ]]; then alias "ping"='ping -n'; alias "ping6"='ping6 -n'; fi alias "pbd"='ping baidu.com' alias "p114"='ping 114.114.114.114' alias "p666"='ping6 2001:da8::666' From 96a21666cbc63b7bfa5cf15134da16a26ceccb4c Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Fri, 26 Apr 2024 19:40:11 +0800 Subject: [PATCH 37/43] build(ci): hub mirror 1.3->1.4 --- .github/workflows/gitee_sync.yml | 2 +- .github/workflows/gitee_sync_dependencies.yml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/gitee_sync.yml b/.github/workflows/gitee_sync.yml index 5595e7e..7c1e0ed 100644 --- a/.github/workflows/gitee_sync.yml +++ b/.github/workflows/gitee_sync.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: DictXiong/dotfiles - uses: Yikun/hub-mirror-action@v1.3 + uses: Yikun/hub-mirror-action@v1.4 with: src: github/DictXiong dst: gitee/dictxiong diff --git a/.github/workflows/gitee_sync_dependencies.yml b/.github/workflows/gitee_sync_dependencies.yml index 4d20616..8c47530 100644 --- a/.github/workflows/gitee_sync_dependencies.yml +++ b/.github/workflows/gitee_sync_dependencies.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: ohmyzsh repo - uses: Yikun/hub-mirror-action@v1.3 + uses: Yikun/hub-mirror-action@v1.4 with: src: github/ohmyzsh dst: gitee/dictxiong @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: zsh-users repos - uses: Yikun/hub-mirror-action@v1.3 + uses: Yikun/hub-mirror-action@v1.4 with: src: github/zsh-users dst: gitee/dictxiong @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: zdharma-continuum repos - uses: Yikun/hub-mirror-action@v1.3 + uses: Yikun/hub-mirror-action@v1.4 with: src: github/zdharma-continuum dst: gitee/dictxiong @@ -59,7 +59,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: thewtex/tmux-mem-cpu-load - uses: Yikun/hub-mirror-action@v1.3 + uses: Yikun/hub-mirror-action@v1.4 with: src: github/thewtex dst: gitee/dictxiong @@ -76,7 +76,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: tmux-plugins - uses: Yikun/hub-mirror-action@v1.3 + uses: Yikun/hub-mirror-action@v1.4 with: src: github/tmux-plugins dst: gitee/dictxiong @@ -93,7 +93,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: VundleVim/Vundle-vim - uses: Yikun/hub-mirror-action@v1.3 + uses: Yikun/hub-mirror-action@v1.4 with: src: github/VundleVim dst: gitee/dictxiong @@ -110,7 +110,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: joshdick/onedark-vim - uses: Yikun/hub-mirror-action@v1.3 + uses: Yikun/hub-mirror-action@v1.4 with: src: github/joshdick dst: gitee/dictxiong @@ -127,7 +127,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: junegunn/fzf - uses: Yikun/hub-mirror-action@v1.3 + uses: Yikun/hub-mirror-action@v1.4 with: src: github/junegunn dst: gitee/dictxiong From bd2c5eeec1f20bbb39d947e9df619cdff717a39c Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Fri, 26 Apr 2024 20:18:21 +0800 Subject: [PATCH 38/43] fix(zshrc): tmux on msys; feat(common): better perf getting os type and linux dist --- .zshrc2 | 4 +++- tools/common.sh | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.zshrc2 b/.zshrc2 index 3b66101..9b2f4be 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -16,6 +16,7 @@ export GPG_TTY=$(tty) export LESS_TERMCAP_md=$'\E[01;33m' # env for dfs if [[ -f ~/.config/dotfiles/env ]]; then set -a; source ~/.config/dotfiles/env; set +a; fi +export DFS_OS_TYPE="$("$DOTFILES/tools/common.sh" get_os_type)" # antigen if [[ "$DFS_NO_WALL" == "1" ]]; then @@ -104,7 +105,8 @@ alias "se"='sudo -sE' alias "sl"='sudo zsh -l' alias "cps"='rsync -avh --info=progress2' alias "mvs"='rsync -avh --info=progress2 --remove-source-files' -if [[ $("$DOTFILES/tools/common.sh" get_os_type) == "linux" ]]; then alias "ping"='ping -n'; alias "ping6"='ping6 -n'; fi +if [[ "$DFS_OS_TYPE" == "linux" ]]; then alias "ping"='ping -n'; alias "ping6"='ping6 -n'; fi +if [[ "$DFS_OS_TYPE" == "msys" ]]; then alias "tmux"='script -qO /dev/null -c "tmux -u"'; fi alias "pbd"='ping baidu.com' alias "p114"='ping 114.114.114.114' alias "p666"='ping6 2001:da8::666' diff --git a/tools/common.sh b/tools/common.sh index 2705aca..ad62ae7 100755 --- a/tools/common.sh +++ b/tools/common.sh @@ -190,6 +190,7 @@ apost_beacon() get_os_type() { + test -z "$DFS_OS_TYPE" || ( echo "$DFS_OS_TYPE"; return ) local ans="unknown" case "$(uname -s)" in Darwin*) ans="MacOS";; @@ -198,11 +199,13 @@ get_os_type() Linux* ) ans="Linux";; *) ans="unknown";; esac + export DFS_OS_TYPE="$ans" echo $ans | tr '[:upper:]' '[:lower:]' } get_linux_dist() { + test -z "$DFS_LINUX_DIST" || ( echo "$DFS_LINUX_DIST"; return ) local ans="unknown" if [ -f /etc/os-release ]; then . /etc/os-release @@ -221,6 +224,7 @@ get_linux_dist() else ans="unknown" fi + export DFS_LINUX_DIST="$ans" echo $ans | tr '[:upper:]' '[:lower:]' } From 7c62359ecfebd1011a9cba3b4959cd6a54569856 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Fri, 26 Apr 2024 21:44:20 +0800 Subject: [PATCH 39/43] fix(common.sh): get_os_type and get_linux_dist --- tools/common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/common.sh b/tools/common.sh index ad62ae7..eafb2bd 100755 --- a/tools/common.sh +++ b/tools/common.sh @@ -190,7 +190,7 @@ apost_beacon() get_os_type() { - test -z "$DFS_OS_TYPE" || ( echo "$DFS_OS_TYPE"; return ) + test -z "$DFS_OS_TYPE" || { echo "$DFS_OS_TYPE"; return; } local ans="unknown" case "$(uname -s)" in Darwin*) ans="MacOS";; @@ -205,7 +205,7 @@ get_os_type() get_linux_dist() { - test -z "$DFS_LINUX_DIST" || ( echo "$DFS_LINUX_DIST"; return ) + test -z "$DFS_LINUX_DIST" || { echo "$DFS_LINUX_DIST"; return; } local ans="unknown" if [ -f /etc/os-release ]; then . /etc/os-release From 71b9c5e7221a25abe2b1aba4db1e020182811019 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Mon, 29 Apr 2024 20:57:11 +0800 Subject: [PATCH 40/43] feat(zshrc): add plugin {magic-enter,per-directory-history,pip,podman,python,rsync,systemd,timer} --- .zshrc2 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.zshrc2 b/.zshrc2 index 9b2f4be..d000e34 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -67,7 +67,15 @@ ANTIGEN_PLUGINS+=( "extract" "fzf" "git" + "magic-enter" + "per-directory-history" + "pip" + "podman" + "python" "ripgrep" + "rsync" + "systemd" + "timer" "tmux" "ufw" "z" From cbc09bc73b06ac7f89b89148e62d44fc9cedcac6 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Mon, 29 Apr 2024 21:04:27 +0800 Subject: [PATCH 41/43] feat(zshrc): journalctl alias --- .zshrc2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.zshrc2 b/.zshrc2 index d000e34..0bbc74e 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -123,6 +123,11 @@ alias "cbds"='curl https://www.baidu.com' alias "gdebug"='git add -A; git commit --allow-empty -m "bug fix ($(date))"' alias "ls"='ls --color=tty' alias "l"='ls -lAGh --time-style="+%y-%m-%d %H:%M"' +alias "jc"='journalctl' +alias "jce"='jc -e' +alias "jceu"='jc -eu' +alias "jcf"='jc -f' +alias "jcfu"='jc -fu' gbes() { git for-each-ref --sort=-committerdate refs/heads refs/remotes --format="%(authordate:format:%y-%m-%d.%a %H:%M %z)|%(color:red)%(objectname:short)|%(color:yellow)%(refname:short)%(color:reset)|%(color:reset)%(authorname): %(color:green)%(subject)" --color=always | column -ts"|" | less -FX } sagt() { eval "$($DOTFILES/tools/sagent.sh $@)" } From 7b3a596232bacafc2e2fa01866c872f0337ab68b Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Mon, 29 Apr 2024 21:20:11 +0800 Subject: [PATCH 42/43] feat(vimrc): tab=2 for c,cpp,nix,yaml --- .vimrc2 | 1 + 1 file changed, 1 insertion(+) diff --git a/.vimrc2 b/.vimrc2 index 271c162..059c6c9 100644 --- a/.vimrc2 +++ b/.vimrc2 @@ -16,6 +16,7 @@ set autoindent set smartindent set expandtab "spaces instead of tabs set tabstop=4 softtabstop=4 shiftwidth=4 +autocmd FileType c,cpp,nix,yaml setlocal tabstop=2 softtabstop=2 shiftwidth=2 set backspace=indent,eol,start set number "line numbers set history=1000 From e3fc87e58a474454da552991bd8442d55a247863 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Mon, 29 Apr 2024 21:29:03 +0800 Subject: [PATCH 43/43] build(ci): checkout v3 -> v4 --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d71f67..57fd9f5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -49,7 +49,7 @@ jobs: runs-on: macos-12 steps: - name: checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -94,7 +94,7 @@ jobs: sudo apt-get -y remove curl vim python3 - name: checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -116,7 +116,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0