Merge branch 'master' of gitee.com:klesh/dotfiles

This commit is contained in:
Klesh Wong 2021-01-17 16:51:06 +08:00
commit 99efc6fc5e
12 changed files with 58 additions and 38 deletions

16
bin/kp Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
POD=$(sudo kubectl get pod | grep -P "^$2" | awk '{print $1}')
CTN=$3
case $1 in
sh)
kubectl exec -it $POD ${CTN+"-c$CTN"} -- sh
;;
d) # describe pod
kubectl describe pod $POD
;;
e) # watch event of pod
kubectl get event -w --field-selector=involvedObject.name=$POD
esac

View File

@ -14,13 +14,6 @@ case "$PM" in
openssh-client \
curl wget \
man sudo
if [ -f /etc/lsb-release ]; then
set -a
. /etc/lsb-release
set +a
export DISTRIB_RELEASE_MAJOR=${DISTRIB_RELEASE%.*}
export DISTRIB_RELEASE_MINOR=${DISTRIB_RELEASE#.*}
fi
;;
pacman)
sudo pacman -S --noconfirm --needed \

View File

@ -7,13 +7,15 @@ DIR=$(dirname "$(readlink -f "$0")")
log 'Setting up shell'
case "$PM" in
apt)
sudo add-apt-repository ppa:fish-shell/release-3 -y
sudo add-apt-repository ppa:fish-shell/release-3 -y -n
pm_update
sudo apt install fish silversearcher-ag -y
echo DISTRIB_RELEASE_MAJOR: $DISTRIB_RELEASE_MAJOR
echo DISTRIB_RELEASE: $DISTRIB_RELEASE
if [ "$DISTRIB_RELEASE_MAJOR" -gt 19 ] || [ "$DISTRIB_RELEASE" = "19.10" ]; then
sudo apt install dash bat -y
fi
lnsf /usr/bin/batcat /usr/bin/bat
sudo ln -sf /usr/bin/batcat /usr/bin/bat
intorepo https://github.com/junegunn/fzf.git "$HOME/.fzf"
./install --all
exitrepo
@ -39,16 +41,6 @@ case "$PM" in
esac
if has_cmd bat; then
log 'Setting up bat'
BAT_THEMES="$(bat --config-dir)/themes"
BAT_GRUVBOX="$BAT_THEMES/gruvbox"
if [ ! -d "$BAT_GRUVBOX" ]; then
mkdir -p "$BAT_THEMES"
git_clone https://github.com/peaceant/gruvbox.git "$BAT_GRUVBOX"
fi
fi
# only for local machine with gui
if [ -z "$SSH_CLIENT" ] && [ -n "$DISPLAY" ] && has_cmd dash; then
log 'Setting up dash as default shell'

View File

@ -23,7 +23,7 @@ if status is-interactive
set -gx LS_COLORS 'ow=34;42;40'
# === bat configuration
set -gx BAT_THEME 'gruvbox'
set -gx BAT_THEME 'OneHalfDark'
set -gx MANPAGER "sh -c 'col -bx | bat -l man -p'"
# === dict.sh configuration
@ -53,7 +53,7 @@ if status is-interactive
alias dt='date "+%Y%m%d-%H%M%S"'
# === PATH and file sourcing
append_paths ~/.yarn/bin
append_paths ~/.yarn/bin ~/dotfiles/bin
source_files /usr/share/autojump/autojump.fish /usr/local/share/autojump/autojump.fish \
~/.profile.fish

View File

@ -1,6 +1,6 @@
function append_paths
for f in $argv
test -e $f && set -gx PATH $f $PATH
test -e $f && ! contains $f $PATH && set -gx PATH $f $PATH
end
end

View File

@ -29,7 +29,7 @@ if ! has_cmd "$VIM"; then
#fi
# gui-common is required for clipboard integration
sudo add-apt-repository ppa:jonathonf/vim -y
sudo add-apt-repository ppa:jonathonf/vim -y -n
pm_update
sudo apt install -y vim vim-gui-common
if enhance_vim; then

View File

@ -81,6 +81,10 @@ au ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
au Syntax * match ExtraWhitespace /\s\+$/
nnoremap <leader>es :%s/\s\+$//g<CR>
" location jumping
nnoremap <leader>n :cnext<CR>
nnoremap <leader>p :cprev<CR>
" auto install vim-plug
if has('nvim')
if has('win32')
@ -234,7 +238,7 @@ let g:fugitive_no_maps=1
nnoremap <C-p> :call fzf#vim#files(trim(system("git rev-parse --show-toplevel \|\| pwd")))<Cr>
nnoremap <leader>gco :call fzf#run({'source': 'git branch \| cut -c 3-; git tag -l', 'sink': '!git checkout'})<CR>
nnoremap <leader>gm :call fzf#run({'source': 'git branch \| cut -c 3-', 'sink': '!git merge'})<CR>
nnoremap <leader>ls :Buffers<CR>
nnoremap <leader>b :Buffers<CR>
" ==== gruvbox configuration ====

View File

@ -19,9 +19,9 @@ case "$PM" in
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys \
https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /" -y -n
pm_update
sudo apt -y install cuda
elif [ "$DISTRIB_RELEASE" = "20.04" ]; then
sudo apt install nvidia-cuda-toolkit
else

View File

@ -19,6 +19,7 @@ CF_API_KEY=$5
# install ks3
ssh "$SSH" '
if ! command -v k3s >/dev/null ; then
export K3S_KUBECONFIG_MODE="644"
export INSTALL_K3S_MIRROR=cn
export INSTALL_K3S_VERSION=v1.20.0-k3s2
export INSTALL_K3S_EXEC="--tls-san '"$IP"' --node-external-ip '"$IP"' --disable traefik --default-local-storage-path /data"

View File

@ -44,9 +44,9 @@ spec:
spec:
serviceAccountName: traefik-ingress-controller
containers:
- name: traefik
image: traefik:v2.3.6
args:
- name: traefik
image: traefik:v2.3.6
args:
- --api.insecure
- --accesslog
- --entrypoints.web.Address=:80
@ -54,11 +54,19 @@ spec:
- --providers.kubernetescrd
- --certificatesresolvers.myresolver.acme.tlschallenge
- --certificatesresolvers.myresolver.acme.email=EMAIL
- --certificatesresolvers.myresolver.acme.storage=acme.json
ports:
- --certificatesresolvers.myresolver.acme.storage=/data/acme.json
ports:
- name: web
containerPort: 80
- name: websecure
containerPort: 443
- name: admin
containerPort: 8080
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
hostPath:
path: /data/traefik
type: DirectoryOrCreate

10
env.sh
View File

@ -80,7 +80,7 @@ enhance_vim() {
pm_update() {
# skip updation on daily basis
TSFILE=/tmp/apt_updated_at_$(date +%Y%m%d)
CHECKSUM=$(md5sum $(find /etc/apt -type f | sort))
CHECKSUM=$(md5sum /etc/apt/sources.list /etc/apt/sources.list.d/*.list | sort | md5sum)
grep -qF "$CHECKSUM" "$TSFILE" && return
case "$PM" in
apt)
@ -107,6 +107,13 @@ if [ "$PM" = "n/a" ]; then
echo "Unsupported Package Manager"
exit 1
fi
if [ -f /etc/lsb-release ]; then
set -a
. /etc/lsb-release
set +a
export DISTRIB_RELEASE_MAJOR=${DISTRIB_RELEASE%.*}
export DISTRIB_RELEASE_MINOR=${DISTRIB_RELEASE#.*}
fi
log "Environments"
echo " PM : $PM"
@ -114,4 +121,3 @@ echo " DIR : $DIR"
echo " PDIR : $PDIR"
echo " PREFIX : $PREFIX"
echo " GITHUB_PROXY : $GITHUB_PROXY"

View File

@ -8,10 +8,10 @@ log 'Settingup office tools: libreoffice keepassxc nextcloud chrome zathura gimp
case "$PM" in
apt)
sudo add-apt-repository -y ppa:libreoffice/libreoffice-7-0
sudo add-apt-repository -y ppa:phoerious/keepassxc
sudo add-apt-repository -y ppa:nextcloud-devs/client
sudo apt update
sudo add-apt-repository -y -n ppa:libreoffice/libreoffice-7-0
sudo add-apt-repository -y -n ppa:phoerious/keepassxc
sudo add-apt-repository -y -n ppa:nextcloud-devs/client
pm_update
sudo apt install -y \
google-chrome-stable \
zathura zathura-pdf-poppler sxiv \