mirror of
https://github.com/DictXiong/dotfiles.git
synced 2026-10-24 13:48:15 +08:00
[dev] refactor riot; improve tmux and vim; more plugins; more aliases (#43)
* riot: remove unknown domain warn
* install.sh: --no-ssh -> --no-auth-info
* doll: --restart=unless-stopped
* zshrc: alias cps and mvs
* riot: proxy -> ssh
* zshrc: not alias rm to trash
* (trial) riot devel: separate preset to config dir riot.d
* riot: support extra options and extra -o options
* (experimental) riot config in a single file
* riot config: add nasp remote and null domain
* gitconf: pull.ff = only
* fix ci
* riot: dynamic port forwarding
* riot: only one domain func will be exec
* to-install: update lemonbench
* to-install: alist
* [exp] riot inferred ssh: ping ping6
* sagt: fix nixos
* riot config: domain 42
* ubuntu.sh: DEBIAN_FRONTEND=noninteractive
* zshrc: ping -n
* zshrc: alias ping -n
* riot-config: jumpserver from sir0 to ssh.beardic.cn
* zshrc: alias ping before checking os type
* frigg: support api4.beardic.cn
* fix(install.sh): crontab fails on a new server
* fix(riot-conf): nasp.ob.ac.cn -> nasp.fit
* fix(install.sh): install crontab (exp)
* feat(test.zsh): test crontab
* fix(riot): secure control master
* fix(ci): riot control master
* fix(riot): not mkdir if dry-run
* feat(vimrc): set shiftwidth=4
* feat(ci): sync tmux-yank
* feat(tmux): set-clipboard on and mouse on (experimental)
* feat(zshrc): alias ping6
* build(ci): hub mirror 1.3->1.4
* fix(zshrc): tmux on msys; feat(common): better perf getting os type and linux dist
* fix(common.sh): get_os_type and get_linux_dist
* feat(zshrc): add plugin {magic-enter,per-directory-history,pip,podman,python,rsync,systemd,timer}
* feat(zshrc): journalctl alias
* feat(vimrc): tab=2 for c,cpp,nix,yaml
* build(ci): checkout v3 -> v4
---------
Co-authored-by: xiongdian.me <xiongdian.me@bytedance.com>
This commit is contained in:
@@ -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:]'
|
||||
}
|
||||
|
||||
@@ -258,6 +262,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}"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
@@ -38,8 +41,8 @@ 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"
|
||||
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"'
|
||||
|
||||
# check alias
|
||||
alias p114
|
||||
|
||||
@@ -10,8 +10,9 @@ 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' \
|
||||
[alist]='curl -fsSL "https://alist.nn.ci/v3.sh" | bash -s install' \
|
||||
)
|
||||
|
||||
install()
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user