mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-03-13 21:34:01 +08:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
055d44886b | |||
92aa5fa920 | |||
483f7fd7f3 | |||
5fb7ff0833 | |||
39b8dfce82 | |||
1a62ffe74b |
30
.eid/authorized_certificates
Normal file
30
.eid/authorized_certificates
Normal file
|
@ -0,0 +1,30 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIFIDCCAwigAwIBAgIUK1zXH5UosBim7i+kIZyPGpowU9cwDQYJKoZIhvcNAQEL
|
||||
BQAwgZUxCzAJBgNVBAYTAkNOMRAwDgYDVQQIDAdCRUlKSU5HMRAwDgYDVQQHDAdC
|
||||
RUlKSU5HMRIwEAYDVQQKDAlEaWN0IFRlY2gxEDAOBgNVBAsMB1Jvb3QgQ0ExHjAc
|
||||
BgNVBAMMFURpY3QgVGVjaCBSb290IENBIC0gMDEcMBoGCSqGSIb3DQEJARYNbWVA
|
||||
YmVhcmRpYy5jbjAeFw0yMjA3MjIxNzU5MjNaFw0yNTA3MjExNzU5MjNaMEkxEjAQ
|
||||
BgNVBAoMCURpY3QgVGVjaDEQMA4GA1UECAwHQkVJSklORzELMAkGA1UEBhMCQ04x
|
||||
FDASBgNVBAMMC3NrMC5pYmQuaW5rMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
|
||||
CgKCAQEAlDeyFxeJ5RXFX4B3rIIpNyyAIl5VTGCT5t8g9dxFWq0MeY6nQYJPA8IJ
|
||||
IH+KzzujBabyKYpzshDvMzkuhx0Kwi2VL+ckxWg5FLge3kNBJqYnBm5pPWx6o9R5
|
||||
DmcWqG5KRH0FJhSmL5KeBHsVcOurDtKn174x2eB+sggCSyuWlJyn4KxPLTg8z/Nr
|
||||
FP5qSY1vj6t7mpzau+eIGh8IcQiFxteN/86fKswQHint/MVaqg6vX05BuIb8xb5E
|
||||
XUvPIupdc/vtD959BxnTo7UoOz+3zu/u2cj2K9IDubwe9tDpv88aj6xnfXInFouD
|
||||
/mlSmvtLo1h/6arn1hurgoylh5wbOwIDAQABo4GyMIGvMAkGA1UdEwQCMAAwCwYD
|
||||
VR0PBAQDAgTwMB0GA1UdDgQWBBR9DxLqtR0+zUWoPyFoDRrnyJyDBTAfBgNVHSME
|
||||
GDAWgBRsprmVI/Tjey+sw4qoZpLd7PT0gTBVBgNVHSUETjBMBggrBgEFBQcDAgYI
|
||||
KwYBBQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYKKwYBBAGCN0MBAQYKKwYBBAGC
|
||||
N0MBAgYKKwYBBAGCNxQCAjANBgkqhkiG9w0BAQsFAAOCAgEA7BJXiRg32shmZWyY
|
||||
gPjq52ffN9RDNe58KadajJ1PnVP1yNJySgsOG3eSxONQX3ITr36Ihsfb3fZneBfX
|
||||
/IcXgjyvy1CDcvBBAyee91hdR8orMCePqMpeOSNP9CUp9Ctd4V+an0DE8Z1yrezA
|
||||
ieaYgBZCDxuZdloYSmj9Z/Rqn2dy4dcUAxKrEwW/6VPqQNrJETTtadS1SF0EsDxV
|
||||
XZpDqNYaS/N7/ciSm7TaQJud62A4m+FWWHNnttTp9IjLESr3U80+qtRY8yDNpulb
|
||||
/eNL8KK9aORiFUz9789l6M62HPi6vCsMflI0iHUeoi69GKX8mKf0WFR1KxoDsJiN
|
||||
DG9/1gCfj6whFCrT6fJTKAGl8Hp5toWMOeDprbsE5gf4Ik3p+sKMV9t43zNm3gvA
|
||||
1zNPtgQUffPU0kONlavIxUNfCmD8qVwK5ECT7wh0hrB8fRYfxTZHgN6Yvu7M9HNz
|
||||
SNt5JZCLBT4nLt0uQp9O/xctdHElZw+/W8OfnP5vxnPdccIeVOxpGIyzErwjD0+E
|
||||
9mNiqOa5JV9OMAJ+0I9cbOnuMaXm4mvHZadnetUzq2ZUw1Jba7z62zIJTciNRq9i
|
||||
ZJc6v5e+iqbE1ECZLco5LjWqqfvFfYCrkqeOhCRsRkVPsXnGPo2QDDYdTm4EGCmg
|
||||
dVZ6R452SZsrE4V+3LR011BxzEg=
|
||||
-----END CERTIFICATE-----
|
|
@ -9,6 +9,8 @@
|
|||
quotepath = false # chinese chars
|
||||
[push]
|
||||
autoSetupRemote = true
|
||||
[pull]
|
||||
ff = only
|
||||
[branch]
|
||||
# Show most recently changed branches first.
|
||||
sort = -committerdate
|
||||
|
|
26
.github/workflows/gitee_sync.yml
vendored
26
.github/workflows/gitee_sync.yml
vendored
|
@ -1,24 +1,22 @@
|
|||
name: sync repos to gitee
|
||||
on:
|
||||
push: ~
|
||||
schedule:
|
||||
- cron: 10 4 * * *
|
||||
workflow_dispatch: ~
|
||||
jobs:
|
||||
dotfiles:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: DictXiong/dotfiles # 名字随便起
|
||||
uses: Yikun/hub-mirror-action@v1.2 # 使用Yikun/hub-mirror-action
|
||||
- name: DictXiong/dotfiles
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
with:
|
||||
src: github/DictXiong # 源端账户名(github)
|
||||
dst: gitee/dictxiong # 目的端账户名(gitee)
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # SSH密钥对中的私钥
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }} # Gitee账户的私人令牌
|
||||
src: github/DictXiong
|
||||
dst: gitee/dictxiong
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }}
|
||||
src_account_type: user
|
||||
dst_account_type: user # 账户类型
|
||||
clone_style: "https" # 使用https方式进行clone,也可以使用ssh
|
||||
debug: true # 启用后会显示所有执行命令
|
||||
force_update: true # 启用后,强制同步,即强制覆盖目的端仓库
|
||||
static_list: "dotfiles" # 静态同步列表,在此填写需要同步的仓库名称,可填写多个
|
||||
timeout: '600s' # git超时设置,超时后会自动重试git操作
|
||||
dst_account_type: user
|
||||
clone_style: "https"
|
||||
debug: true
|
||||
force_update: true
|
||||
static_list: "dotfiles"
|
||||
timeout: '600s'
|
||||
|
|
185
.github/workflows/gitee_sync_dependencies.yml
vendored
185
.github/workflows/gitee_sync_dependencies.yml
vendored
|
@ -7,119 +7,136 @@ jobs:
|
|||
ohmyzsh:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: ohmyzsh repo # 名字随便起
|
||||
uses: Yikun/hub-mirror-action@v1.2 # 使用Yikun/hub-mirror-action
|
||||
- name: ohmyzsh repo
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
with:
|
||||
src: github/ohmyzsh # 源端账户名(github)
|
||||
dst: gitee/dictxiong # 目的端账户名(gitee)
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # SSH密钥对中的私钥
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }} # Gitee账户的私人令牌
|
||||
src: github/ohmyzsh
|
||||
dst: gitee/dictxiong
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }}
|
||||
src_account_type: org
|
||||
dst_account_type: user # 账户类型
|
||||
clone_style: "https" # 使用https方式进行clone,也可以使用ssh
|
||||
debug: true # 启用后会显示所有执行命令
|
||||
force_update: true # 启用后,强制同步,即强制覆盖目的端仓库
|
||||
static_list: "ohmyzsh" # 静态同步列表,在此填写需要同步的仓库名称,可填写多个
|
||||
timeout: '600s' # git超时设置,超时后会自动重试git操作
|
||||
dst_account_type: user
|
||||
clone_style: "https" # https/ssh
|
||||
debug: true # print all commands
|
||||
force_update: true
|
||||
static_list: "ohmyzsh"
|
||||
timeout: '600s'
|
||||
zsh-users:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: zsh-users repos # 名字随便起
|
||||
uses: Yikun/hub-mirror-action@v1.2 # 使用Yikun/hub-mirror-action
|
||||
- name: zsh-users repos
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
with:
|
||||
src: github/zsh-users # 源端账户名(github)
|
||||
dst: gitee/dictxiong # 目的端账户名(gitee)
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # SSH密钥对中的私钥
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }} # Gitee账户的私人令牌
|
||||
src: github/zsh-users
|
||||
dst: gitee/dictxiong
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }}
|
||||
src_account_type: org
|
||||
dst_account_type: user # 账户类型
|
||||
clone_style: "https" # 使用https方式进行clone,也可以使用ssh
|
||||
debug: true # 启用后会显示所有执行命令
|
||||
force_update: true # 启用后,强制同步,即强制覆盖目的端仓库
|
||||
static_list: "antigen,zsh-syntax-highlighting,zsh-autosuggestions,zsh-completions" # 静态同步列表,在此填写需要同步的仓库名称,可填写多个
|
||||
timeout: '600s' # git超时设置,超时后会自动重试git操作
|
||||
dst_account_type: user
|
||||
clone_style: "https"
|
||||
debug: true
|
||||
force_update: true
|
||||
static_list: "antigen,zsh-syntax-highlighting,zsh-autosuggestions,zsh-completions"
|
||||
timeout: '600s'
|
||||
zdharma-continuum:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: zdharma-continuum repos
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
with:
|
||||
src: github/zdharma-continuum
|
||||
dst: gitee/dictxiong
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }}
|
||||
src_account_type: org
|
||||
dst_account_type: user
|
||||
clone_style: "https"
|
||||
debug: true
|
||||
force_update: true
|
||||
static_list: "fast-syntax-highlighting"
|
||||
timeout: '600s'
|
||||
tmux-mem-cpu-load:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: thewtex/tmux-mem-cpu-load # 名字随便起
|
||||
uses: Yikun/hub-mirror-action@v1.2 # 使用Yikun/hub-mirror-action
|
||||
- name: thewtex/tmux-mem-cpu-load
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
with:
|
||||
src: github/thewtex # 源端账户名(github)
|
||||
dst: gitee/dictxiong # 目的端账户名(gitee)
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # SSH密钥对中的私钥
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }} # Gitee账户的私人令牌
|
||||
src: github/thewtex
|
||||
dst: gitee/dictxiong
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }}
|
||||
src_account_type: user
|
||||
dst_account_type: user # 账户类型
|
||||
clone_style: "https" # 使用https方式进行clone,也可以使用ssh
|
||||
debug: true # 启用后会显示所有执行命令
|
||||
force_update: true # 启用后,强制同步,即强制覆盖目的端仓库
|
||||
static_list: "tmux-mem-cpu-load" # 静态同步列表,在此填写需要同步的仓库名称,可填写多个
|
||||
timeout: '600s' # git超时设置,超时后会自动重试git操作
|
||||
dst_account_type: user
|
||||
clone_style: "https"
|
||||
debug: true
|
||||
force_update: true
|
||||
static_list: "tmux-mem-cpu-load"
|
||||
timeout: '600s'
|
||||
tmux-plugins:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: tmux-plugins # 名字随便起
|
||||
uses: Yikun/hub-mirror-action@v1.2 # 使用Yikun/hub-mirror-action
|
||||
- name: tmux-plugins
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
with:
|
||||
src: github/tmux-plugins # 源端账户名(github)
|
||||
dst: gitee/dictxiong # 目的端账户名(gitee)
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # SSH密钥对中的私钥
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }} # Gitee账户的私人令牌
|
||||
src: github/tmux-plugins
|
||||
dst: gitee/dictxiong
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }}
|
||||
src_account_type: org
|
||||
dst_account_type: user # 账户类型
|
||||
clone_style: "https" # 使用https方式进行clone,也可以使用ssh
|
||||
debug: true # 启用后会显示所有执行命令
|
||||
force_update: true # 启用后,强制同步,即强制覆盖目的端仓库
|
||||
static_list: "tpm,tmux-resurrect" # 静态同步列表,在此填写需要同步的仓库名称,可填写多个
|
||||
timeout: '600s' # git超时设置,超时后会自动重试git操作
|
||||
dst_account_type: user
|
||||
clone_style: "https"
|
||||
debug: true
|
||||
force_update: true
|
||||
static_list: "tpm,tmux-resurrect,tmux-yank"
|
||||
timeout: '600s'
|
||||
vundle-vim:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: VundleVim/Vundle-vim # 名字随便起
|
||||
uses: Yikun/hub-mirror-action@v1.2 # 使用Yikun/hub-mirror-action
|
||||
- name: VundleVim/Vundle-vim
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
with:
|
||||
src: github/VundleVim # 源端账户名(github)
|
||||
dst: gitee/dictxiong # 目的端账户名(gitee)
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # SSH密钥对中的私钥
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }} # Gitee账户的私人令牌
|
||||
src: github/VundleVim
|
||||
dst: gitee/dictxiong
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }}
|
||||
src_account_type: org
|
||||
dst_account_type: user # 账户类型
|
||||
clone_style: "https" # 使用https方式进行clone,也可以使用ssh
|
||||
debug: true # 启用后会显示所有执行命令
|
||||
force_update: true # 启用后,强制同步,即强制覆盖目的端仓库
|
||||
static_list: "Vundle.vim" # 静态同步列表,在此填写需要同步的仓库名称,可填写多个
|
||||
timeout: '600s' # git超时设置,超时后会自动重试git操作
|
||||
dst_account_type: user
|
||||
clone_style: "https"
|
||||
debug: true
|
||||
force_update: true
|
||||
static_list: "Vundle.vim"
|
||||
timeout: '600s'
|
||||
onedark-vim:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: joshdick/onedark-vim # 名字随便起
|
||||
uses: Yikun/hub-mirror-action@v1.2 # 使用Yikun/hub-mirror-action
|
||||
- name: joshdick/onedark-vim
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
with:
|
||||
src: github/joshdick # 源端账户名(github)
|
||||
dst: gitee/dictxiong # 目的端账户名(gitee)
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # SSH密钥对中的私钥
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }} # Gitee账户的私人令牌
|
||||
src: github/joshdick
|
||||
dst: gitee/dictxiong
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }}
|
||||
src_account_type: user
|
||||
dst_account_type: user # 账户类型
|
||||
clone_style: "https" # 使用https方式进行clone,也可以使用ssh
|
||||
debug: true # 启用后会显示所有执行命令
|
||||
force_update: true # 启用后,强制同步,即强制覆盖目的端仓库
|
||||
static_list: "onedark.vim" # 静态同步列表,在此填写需要同步的仓库名称,可填写多个
|
||||
timeout: '600s' # git超时设置,超时后会自动重试git操作
|
||||
dst_account_type: user
|
||||
clone_style: "https"
|
||||
debug: true
|
||||
force_update: true
|
||||
static_list: "onedark.vim"
|
||||
timeout: '600s'
|
||||
fzf:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: junegunn/fzf # 名字随便起
|
||||
uses: Yikun/hub-mirror-action@v1.2 # 使用Yikun/hub-mirror-action
|
||||
- name: junegunn/fzf
|
||||
uses: Yikun/hub-mirror-action@v1.4
|
||||
with:
|
||||
src: github/junegunn # 源端账户名(github)
|
||||
dst: gitee/dictxiong # 目的端账户名(gitee)
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # SSH密钥对中的私钥
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }} # Gitee账户的私人令牌
|
||||
src: github/junegunn
|
||||
dst: gitee/dictxiong
|
||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
|
||||
dst_token: ${{ secrets.GITEE_TOKEN }}
|
||||
src_account_type: user
|
||||
dst_account_type: user # 账户类型
|
||||
clone_style: "https" # 使用https方式进行clone,也可以使用ssh
|
||||
debug: true # 启用后会显示所有执行命令
|
||||
force_update: true # 启用后,强制同步,即强制覆盖目的端仓库
|
||||
static_list: "fzf" # 静态同步列表,在此填写需要同步的仓库名称,可填写多个
|
||||
timeout: '600s' # git超时设置,超时后会自动重试git操作
|
||||
dst_account_type: user
|
||||
clone_style: "https"
|
||||
debug: true
|
||||
force_update: true
|
||||
static_list: "fzf"
|
||||
timeout: '600s'
|
||||
|
|
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -25,6 +26,7 @@ bind | split-window -h -c "#{pane_current_path}"
|
|||
# other key bindings
|
||||
bind r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded"
|
||||
bind m run 'old=$(tmux show -gv mouse); new="off"; if [ "$old" = "off" ]; then new="on"; fi; tmux set -g mouse $new && tmux display-message toggle\ mouse\ mode\ $new'
|
||||
bind C-x set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
|
||||
|
||||
# styles
|
||||
# status bar
|
||||
|
@ -50,4 +52,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@'
|
||||
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
THIS_FILE=$(basename "${BASH_SOURCE}")
|
||||
|
|
6
.vimrc2
6
.vimrc2
|
@ -10,12 +10,13 @@ filetype plugin indent on
|
|||
" end vundle
|
||||
colorscheme onedark
|
||||
|
||||
syntax on
|
||||
set cursorline
|
||||
set syntax=on
|
||||
set autoindent
|
||||
set smartindent
|
||||
set tabstop=4
|
||||
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
|
||||
|
@ -31,6 +32,7 @@ hi User3 ctermfg=15 ctermbg=2
|
|||
au InsertEnter * hi User3 ctermfg=15 ctermbg=5
|
||||
au InsertLeave * hi User3 ctermfg=15 ctermbg=2
|
||||
set statusline=%3*\ %{mode()}\ %*[%n][%F](%{\"\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\"+\":\"\").\"\"},%{&ff},%Y)%2*%r%1*%m%*%<%=\'0x%B\'\ [Line:%l/%L,Col:%c][%p%%]
|
||||
nnoremap <silent> <C-n> :let [&nu, &rnu] = [!&rnu, &nu+&rnu==1]<cr>
|
||||
|
||||
" When editing a file, always jump to the last known cursor position.
|
||||
" Don't do it when the position is invalid, when inside an event handler
|
||||
|
|
41
.zshrc2
41
.zshrc2
|
@ -14,15 +14,17 @@ export EDITOR='vim'
|
|||
export PYTHONIOENCODING='UTF-8'
|
||||
export GPG_TTY=$(tty)
|
||||
export LESS_TERMCAP_md=$'\E[01;33m'
|
||||
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||
# 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
|
||||
ANTIGEN_URL="https://raw.githubusercontent.com/zsh-users/antigen/develop/bin/antigen.zsh"
|
||||
ANTIGEN_OMZ_REPO_URL="https://github.com/ohmyzsh/ohmyzsh.git"
|
||||
ANTIGEN_PLUGINS=(
|
||||
"https://github.com/zsh-users/zsh-syntax-highlighting"
|
||||
"https://github.com/zdharma-continuum/fast-syntax-highlighting"
|
||||
"https://github.com/zsh-users/zsh-completions"
|
||||
"https://github.com/zsh-users/zsh-autosuggestions"
|
||||
)
|
||||
|
@ -30,7 +32,7 @@ else
|
|||
ANTIGEN_URL="https://gitee.com/dictxiong/antigen/raw/develop/bin/antigen.zsh"
|
||||
ANTIGEN_OMZ_REPO_URL="https://gitee.com/dictxiong/ohmyzsh.git"
|
||||
ANTIGEN_PLUGINS=(
|
||||
"https://gitee.com/dictxiong/zsh-syntax-highlighting"
|
||||
"https://gitee.com/dictxiong/fast-syntax-highlighting"
|
||||
"https://gitee.com/dictxiong/zsh-completions"
|
||||
"https://gitee.com/dictxiong/zsh-autosuggestions"
|
||||
)
|
||||
|
@ -66,7 +68,15 @@ ANTIGEN_PLUGINS+=(
|
|||
"extract"
|
||||
"fzf"
|
||||
"git"
|
||||
"magic-enter"
|
||||
"per-directory-history"
|
||||
"pip"
|
||||
"podman"
|
||||
"python"
|
||||
"ripgrep"
|
||||
"rsync"
|
||||
"systemd"
|
||||
"timer"
|
||||
"tmux"
|
||||
"ufw"
|
||||
"z"
|
||||
|
@ -101,19 +111,24 @@ fi
|
|||
# alias
|
||||
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'
|
||||
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'
|
||||
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))"'
|
||||
case $(bash "$DOTFILES/tools/common.sh" get_os_type) in
|
||||
macos ) alias l='ls -lAGh -D "%y-%m-%d %H:%M"' ;;
|
||||
* ) alias l='ls -lAGh --time-style="+%y-%m-%d %H:%M"' ;;
|
||||
esac
|
||||
if [[ -x $(command -v trash) ]]; then
|
||||
alias "rm"="echo use the full path i.e. '/bin/rm'\; consider using trash"
|
||||
fi
|
||||
alias "ls"='ls --color=tty --time-style="+%y-%m-%d %H:%M"'
|
||||
alias "l"='ls -lAGh'
|
||||
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 $@)" }
|
||||
|
||||
|
@ -140,6 +155,9 @@ bindkey "\e[1;5D" backward-word # alt+left_arrow; termius
|
|||
|
||||
bindkey "\ed" delete-char # alt+d
|
||||
|
||||
# mods
|
||||
autoload zcalc
|
||||
|
||||
# dfs
|
||||
dfs()
|
||||
{
|
||||
|
@ -174,6 +192,11 @@ dfs()
|
|||
esac
|
||||
}
|
||||
|
||||
# motd
|
||||
if [[ "$DFS_INITED" != "1" && -n "$DFS_UPDATE_CHANNEL" && "$DFS_UPDATE_CHANNEL" != "main" ]]; then
|
||||
echo dotfiles not in the main channel. use with caution.
|
||||
fi
|
||||
|
||||
# clean
|
||||
unset i
|
||||
export DFS_INITED=1
|
||||
|
|
14
install.sh
14
install.sh
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
source "$THIS_DIR/tools/common.sh"
|
||||
|
@ -26,6 +26,8 @@ declare -a HOME_SYMLINKS_SRC
|
|||
declare -a HOME_SYMLINKS_DST
|
||||
HOME_SYMLINKS_SRC[0]=".ssh/authorized_keys2"
|
||||
HOME_SYMLINKS_DST[0]=".ssh/authorized_keys2"
|
||||
HOME_SYMLINKS_SRC[1]=".eid/authorized_certificates"
|
||||
HOME_SYMLINKS_DST[1]=".eid/authorized_certificates"
|
||||
|
||||
install_dependencies()
|
||||
{
|
||||
|
@ -147,6 +149,9 @@ install_symlink()
|
|||
{
|
||||
fmt_note "installing symlinks ..."
|
||||
for ((i=0; i<${#HOME_SYMLINKS_SRC[@]}; i++)); do
|
||||
if [[ -z "${HOME_SYMLINKS_SRC[$i]}" ]]; then
|
||||
continue
|
||||
fi
|
||||
local src="$DOTFILES/${HOME_SYMLINKS_SRC[$i]}"
|
||||
local dst="$HOME/${HOME_SYMLINKS_DST[$i]}"
|
||||
fmt_info "creating symlink \"$dst\" --> \"$src\" ..."
|
||||
|
@ -197,7 +202,11 @@ install_crontab()
|
|||
{
|
||||
if [[ -x $(command -v crontab) ]]; then
|
||||
fmt_note "installing \"$CRON_JOB\" to crontab ..."
|
||||
( crontab -l | grep -vxF "${CRON_JOB}" | grep -v "no crontab for"; echo "$CRON_JOB" ) | crontab -
|
||||
if [[ -z "$(crontab -l 2>/dev/null || true)" ]]; then
|
||||
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 ..."
|
||||
fi
|
||||
|
@ -322,6 +331,7 @@ for i in ${GOT_OPTS[@]}; do
|
|||
-a|--auto ) INSTALL_DEP=1 ;;
|
||||
-H|--hist|--history ) store_hist=1 ;;
|
||||
-x ) store_config=1 ;;
|
||||
--no-auth-info ) HOME_SYMLINKS_SRC=(); HOME_SYMLINKS_DST=() ;;
|
||||
* ) fmt_fatal "unknown option \"$i\"" ;;
|
||||
esac
|
||||
done
|
||||
|
|
63
riot-config.sh
Normal file
63
riot-config.sh
Normal file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/false
|
||||
|
||||
# remotes
|
||||
j.remote() {
|
||||
remote=ssh.beardic.cn
|
||||
RET_PORT=${RET_PORT:-24022}
|
||||
RET_USERNAME=${RET_USERNAME:-root}
|
||||
RET_TRUST_SERVER=1
|
||||
}
|
||||
|
||||
nasp.remote() {
|
||||
remote=nasp.fit
|
||||
RET_PORT=${RET_PORT:-36022}
|
||||
RET_USERNAME=${RET_USERNAME:-root}
|
||||
RET_TRUST_SERVER=1
|
||||
}
|
||||
|
||||
# domains
|
||||
.domain() {
|
||||
RET_USERNAME=${RET_USERNAME:-root}
|
||||
}
|
||||
|
||||
dxng.domain() {
|
||||
RET_HOSTNAME=$host.dxng.net
|
||||
RET_PORT=${RET_PORT:-12022}
|
||||
RET_USERNAME=${RET_USERNAME:-root}
|
||||
RET_TRUST_SERVER=1
|
||||
}
|
||||
|
||||
i.domain() {
|
||||
RET_HOSTNAME=$host.ibd.ink
|
||||
RET_PORT=${RET_PORT:-12022}
|
||||
RET_USERNAME=${RET_USERNAME:-root}
|
||||
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:]")
|
||||
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:-root}
|
||||
RET_JUMP_SERVER="ssh@nasp.fit:36022"
|
||||
RET_TRUST_SERVER=1
|
||||
}
|
||||
|
||||
default.domain() {
|
||||
dxng.domain
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
source "$THIS_DIR/../tools/common.sh"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
source "$THIS_DIR/../tools/common.sh"
|
||||
|
@ -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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
source "$THIS_DIR/../tools/common.sh"
|
||||
|
|
206
scripts/riot
206
scripts/riot
|
@ -1,9 +1,35 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# connect to iot services
|
||||
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_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
|
||||
test $1 -lt 65536 -a $1 -gt 0 || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
# check if username valid
|
||||
check_username() {
|
||||
( echo $1 | grep -qxE "^[a-z][-a-z0-9_]*\$" ) || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
# get single server setting
|
||||
# may be called more than once
|
||||
|
@ -20,65 +46,58 @@ get_server_meta() {
|
|||
if [[ "$remote" == *@* ]]; then
|
||||
RET_USERNAME=${remote%%@*}
|
||||
remote=${remote#*@}
|
||||
check_username $RET_USERNAME || fmt_warning \"$RET_USERNAME\" is not a valid unix username
|
||||
fi
|
||||
# if in the form ...:22
|
||||
if [[ "$remote" == *:* ]]; then
|
||||
if [[ "$remote" == "["*"]":* || ( "$remote" != "["*"]" && "$remote" == *:* ) ]]; then
|
||||
RET_PORT=${remote##*:}
|
||||
remote=${remote%:*}
|
||||
check_port $RET_PORT || fmt_fatal invalid port number \"$RET_PORT\"
|
||||
fi
|
||||
# presets -- match remote
|
||||
local remote_func="$remote.remote"
|
||||
if is_function "$remote_func"; then
|
||||
"$remote_func"
|
||||
fi
|
||||
# presets -- match domain
|
||||
RET_HOSTNAME=${remote}
|
||||
local domain=${remote##*.}
|
||||
local host=${remote%.*}
|
||||
# if there's no dot
|
||||
if [[ "$host" == "$domain" ]]; then
|
||||
domain="ibd"
|
||||
if [[ "$host" == "$domain" && "$host" != "["*"]" ]]; then
|
||||
domain="default"
|
||||
fi
|
||||
local domain_func="$domain.domain"
|
||||
if is_function "$domain_func"; then
|
||||
"$domain_func"
|
||||
elif is_function ".domain"; then
|
||||
".domain"
|
||||
fi
|
||||
case $domain in
|
||||
ibd|ebd )
|
||||
RET_HOSTNAME=$host.$domain.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|proxied )
|
||||
RET_HOSTNAME=proxy.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
|
||||
;;
|
||||
* )
|
||||
test -z "$domain" || fmt_warning "unknown domain: \"$domain\". will try as host name"
|
||||
RET_HOSTNAME="$remote"
|
||||
esac
|
||||
}
|
||||
|
||||
# remote setting, including jump servers
|
||||
# will be called only once
|
||||
# provides:
|
||||
SERVER=""
|
||||
TRUST_SERVER=1
|
||||
PORT="" # optional
|
||||
USERNAME="" # optional
|
||||
SSH_OPTIONS="" # optional
|
||||
if [[ "$RIOT_TRUST_CLIENT" == "1" ]]; then
|
||||
SSH_OPTIONS='-o ControlMaster=auto -o ControlPath=/tmp/sshcm-%C -o PermitLocalCommand=yes'
|
||||
fi
|
||||
parse_remote() {
|
||||
# remote setting, including jump servers
|
||||
# called for every remote
|
||||
# provides:
|
||||
SERVER=""
|
||||
TRUST_SERVER=1
|
||||
PORT="" # optional
|
||||
USERNAME="" # optional
|
||||
SSH_OPTIONS="" # optional
|
||||
if [[ "$RIOT_TRUST_CLIENT" == "1" ]]; then
|
||||
SSH_OPTIONS='-o PermitLocalCommand=yes'
|
||||
if [[ "$(get_os_type)" != "msys" ]]; then
|
||||
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
|
||||
# handle input
|
||||
local remote="$1"
|
||||
local jump_servers=""
|
||||
# loop for jump servers
|
||||
while [[ -n $remote ]]; do
|
||||
local server=${remote%%,*}
|
||||
remote=${remote#*,}
|
||||
while [[ -n $remote ]]; do
|
||||
local server=${remote%%/*}
|
||||
remote=${remote#*/}
|
||||
get_server_meta "$server"
|
||||
if [[ -n "$RET_JUMP_SERVER" ]]; then
|
||||
jump_servers="$jump_servers${jump_servers:+,}$RET_JUMP_SERVER"
|
||||
|
@ -119,13 +138,13 @@ 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"
|
||||
echo "$ssh_bin ${PORT:+$port_param} $PORT $SSH_OPTIONS $RIOT_EXTRA_OPTIONS $SCP_SRC $USERNAME${USERNAME:+@}$SERVER $SCP_DST ${@:2}"
|
||||
}
|
||||
|
||||
# ssh
|
||||
run_ssh()
|
||||
{
|
||||
local cmd="$(prepare_ssh_cmd $1)"
|
||||
local cmd="$(prepare_ssh_cmd $@)"
|
||||
fmt_note "-->" $cmd
|
||||
eval_or_echo $cmd
|
||||
}
|
||||
|
@ -138,12 +157,7 @@ run_sshl()
|
|||
# treat as a port number
|
||||
arg=localhost:$arg
|
||||
fi
|
||||
while
|
||||
local port=$(shuf -n 1 -i 49152-65535)
|
||||
netstat -atun | grep -q "$port"
|
||||
do
|
||||
continue
|
||||
done
|
||||
local port=$(get_free_port)
|
||||
|
||||
SSH_OPTIONS="$SSH_OPTIONS -NC -L $port:$arg"
|
||||
local cmd="$(prepare_ssh_cmd ssh)"
|
||||
|
@ -152,6 +166,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"
|
||||
|
@ -187,35 +213,53 @@ router() {
|
|||
print_help
|
||||
exit
|
||||
fi
|
||||
parse_remote "$1"
|
||||
case $2 in
|
||||
-h|--help)
|
||||
print_help
|
||||
exit
|
||||
;;
|
||||
ssh|"" )
|
||||
run_ssh
|
||||
;;
|
||||
zssh )
|
||||
run_ssh zssh
|
||||
;;
|
||||
sftp )
|
||||
run_ssh sftp
|
||||
;;
|
||||
sshl )
|
||||
test -n "$3" || fmt_fatal "no target address provided"
|
||||
run_sshl "$3"
|
||||
;;
|
||||
scp )
|
||||
test -n "$3" || fmt_fatal "no source path specified"
|
||||
test -n "$4" || fmt_fatal "no destination path specified"
|
||||
run_scp "$3" "$4"
|
||||
;;
|
||||
* )
|
||||
print_help
|
||||
fmt_fatal "unknown command: $2"
|
||||
;;
|
||||
esac
|
||||
|
||||
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
|
||||
continue
|
||||
fi
|
||||
parse_remote "$remote"
|
||||
case $2 in
|
||||
ssh|"" )
|
||||
run_ssh ssh "${@:3}"
|
||||
;;
|
||||
ping|ping6 )
|
||||
run_ssh ssh "${@:2}"
|
||||
;;
|
||||
zssh )
|
||||
run_ssh zssh
|
||||
;;
|
||||
sftp )
|
||||
run_ssh sftp
|
||||
;;
|
||||
sshl )
|
||||
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"
|
||||
run_scp "$3" "$4"
|
||||
;;
|
||||
* )
|
||||
print_help
|
||||
fmt_fatal "unknown command: $2"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
router "${GOT_OPTS[@]}"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
source "$THIS_DIR/common.sh"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
source "$THIS_DIR/common.sh"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
THIS_DIR_COMMON_SH=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
export DOTFILES=$( cd "$THIS_DIR_COMMON_SH/.." && pwd )
|
||||
|
@ -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:]'
|
||||
}
|
||||
|
||||
|
@ -233,6 +237,35 @@ get_os_name()
|
|||
echo $ans
|
||||
}
|
||||
|
||||
is_port_free() {
|
||||
( echo $1 | grep -qxE "[1-9][0-9]{0,4}" ) || false
|
||||
local cmd
|
||||
case $(get_os_type) in
|
||||
macos ) cmd="netstat -van | grep -q \".$1\"" ;;
|
||||
cygwin|msys ) cmd="netstat -ano | grep -q \":$1\"" ;;
|
||||
*) cmd="netstat -tuanp | grep -q \":$1\"" ;;
|
||||
esac
|
||||
if eval $cmd; then
|
||||
return 2
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
get_free_port() {
|
||||
while
|
||||
local port=$(shuf -n 1 -i 49152-65535)
|
||||
! is_port_free $port
|
||||
do
|
||||
continue
|
||||
done
|
||||
echo $port
|
||||
}
|
||||
|
||||
is_function() {
|
||||
test "$(type -t "$1")" = "function"
|
||||
}
|
||||
|
||||
# if bash-ed, else source-d
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
$1 "${@:2}"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
|
@ -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
|
||||
|
@ -162,4 +163,4 @@ router()
|
|||
esac
|
||||
}
|
||||
|
||||
router "${GOT_OPTS[@]}"
|
||||
router "${GOT_OPTS[@]}"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
ARG=""
|
||||
GOT_OPTS=()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
source "$THIS_DIR/common.sh"
|
||||
|
@ -6,7 +6,7 @@ source "$THIS_DIR/common.sh"
|
|||
brew_install()
|
||||
{
|
||||
# brew update
|
||||
brew install git zsh curl tmux vim util-linux
|
||||
brew install git zsh curl tmux vim util-linux coreutils
|
||||
}
|
||||
|
||||
router()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
source "$THIS_DIR/common.sh"
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
export DFS_COLOR=1
|
||||
source "$THIS_DIR/common.sh"
|
||||
|
||||
|
||||
SO_PATHS=(
|
||||
"/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so" # ubuntu 22.04
|
||||
"/run/current-system/sw/lib/opensc-pkcs11.so" # nixos 23.05
|
||||
"/Library/OpenSC/lib/opensc-pkcs11.so" # macos 13.4
|
||||
)
|
||||
|
||||
find_so_file()
|
||||
{
|
||||
local SO_PATHS=( "/usr/lib64/opensc-pkcs11.so" "/usr/local/lib/opensc-pkcs11.so" )
|
||||
local SO_FILE
|
||||
for SO_FILE in ${SO_PATHS[*]}; do
|
||||
if [[ -f "$SO_FILE" ]]; then
|
||||
|
@ -19,12 +24,8 @@ find_so_file()
|
|||
|
||||
create_agent()
|
||||
{
|
||||
local SO_FILE=$(find_so_file)
|
||||
if [[ -n "$SO_FILE" ]]; then
|
||||
fmt_note "opensc-pkcs11.so found"
|
||||
SO_FILE="-P $SO_FILE"
|
||||
fi
|
||||
ssh-agent $SO_FILE
|
||||
local IFS=","
|
||||
ssh-agent -P "${SO_PATHS[*]},/nix/store/*"
|
||||
}
|
||||
|
||||
kill_agent()
|
||||
|
@ -60,7 +61,8 @@ reset()
|
|||
|
||||
all()
|
||||
{
|
||||
local agent_file="/tmp/piv-agent-$(whoami)"
|
||||
test -d ~/.ssh || mkdir ~/.ssh
|
||||
local agent_file=~/.ssh/agent-$(whoami)
|
||||
if [[ -f $agent_file ]]; then
|
||||
source $agent_file > /dev/null
|
||||
else
|
||||
|
@ -106,4 +108,4 @@ route()
|
|||
esac
|
||||
}
|
||||
|
||||
route "$@"
|
||||
route "$@"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
OPTS='-a -bcl --color --arg1=1 --arg2 2 " 1 2" yes'
|
||||
TARGET_OPTS='-a -b -c --arg1 1 --arg2 2 1 2 yes'
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
set -ex
|
||||
trap "dfs beacon gh.ci.fail" ERR
|
||||
|
||||
# fix for macos
|
||||
dfs cd
|
||||
if [[ $(./tools/common.sh get_os_type) == "macos" ]]; then
|
||||
export PATH="/usr/local/opt/coreutils/libexec/gnubin:/opt/homebrew/opt/coreutils/libexec/gnubin:${PATH}"
|
||||
fi
|
||||
|
||||
# check files
|
||||
cd /
|
||||
l
|
||||
|
@ -13,7 +19,11 @@ l
|
|||
pwd
|
||||
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
|
||||
|
@ -31,14 +41,15 @@ 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 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 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.dxng.net:"/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.dxng.net:"/tmp/" "./tmp"'
|
||||
|
||||
# check alias
|
||||
alias p114
|
||||
alias cbds
|
||||
which riot
|
||||
sagt
|
||||
test -f "/tmp/piv-agent-$(whoami)"
|
||||
test -f ~/.ssh/agent-$(whoami)
|
||||
gbes || which gbes
|
||||
|
||||
# check update
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
declare -A INSTALL_COMMANDS
|
||||
INSTALL_COMMANDS=(\
|
||||
|
@ -10,7 +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()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
source "$THIS_DIR/common.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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user