From feec295692bd82e3193bf228ce709b8d63a0c24c Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Thu, 28 Nov 2024 09:00:00 +0000 Subject: Update --- alias | 107 ++++++++++++++++++++++++++-------------------------- mutt/muttrc.topo | 80 +-------------------------------------- snippets/make_basic | 9 +++++ vim/mini.lua | 1 + 4 files changed, 64 insertions(+), 133 deletions(-) create mode 100644 snippets/make_basic diff --git a/alias b/alias index 1e5a250..491336c 100644 --- a/alias +++ b/alias @@ -39,9 +39,51 @@ urlencode() { } # }}} # ADMIN {{{ + alias etc.passwd='sudo vim /etc/passwd' +alias s='sudo systemctl' +alias j='sudo journalctl -xeu' +alias jf='sudo journalctl -xfeu' + +# }}} +# Nginx{{{ +alias vgx='sudo vim /etc/nginx/sites-enabled/vps && sudo nginx -t && sudo systemctl reload nginx' +alias ng.conf='sudo vim /etc/nginx/nginx.conf' +alias ng.log='tail -f /var/log/nginx/access.log' +alias cdngx='cd /etc/nginx' +# }}} +# Web {{{ +alias www.git='/srv/git/create.sh' +alias www='make -f ~/site/www/Makefile' +alias cdwww='cd ~/site/www' +vp() { + [[ $HOST = vultr ]] || PREFIX='ssh -qt vps' + + filename="${1%.md}.md" + post=$(eval $PREFIX find ~/blog/content -name $filename | head -1 | sed 's/\r//') + + if [ -z "$post" ]; then + echo "sh -c 'cd ~/blog && hugo new posts/$filename'" | eval ${PREFIX} + post="~/blog/content/posts/$filename" + fi + + shift + if [[ $HOST = vultr ]]; then + vim $@ "$post" + else + # Copy from vps + tmpfile=$(mktemp --suffix .md) + scp vps:"$post" $tmpfile + + # Edit locally + vim $tmpfile --cmd "autocmd BufWritePost $tmpfile silent! :!setsid scp % vps:$post &" && \ + cat $tmpfile | ssh vps "cd ~/blog && cat >$post && git add $post && git commit -m 'Update with vim'" && \ + rm $tmpfile + fi +} # }}} # UNIX {{{ + config(){ cd ~/.config/$1; } alias sound="echo -ne '\a'" alias hg='history | grep' @@ -128,11 +170,6 @@ file.size() { }' } -# }}} -# Systemctl {{{ -alias s='sudo systemctl' -alias j='sudo journalctl -xeu' -alias jf='sudo journalctl -xfeu' # }}} # TTY {{{ alias tma='tmux a' @@ -272,6 +309,10 @@ alias xo='xsel -ob' alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob' # }}} # X11: Misc {{{ +alias cdD='cd ~/Documents' +alias cdP='cd ~/Pictures' +alias cdV='cd ~/Videos' +alias cdM='cd ~/Music' alias x='xdg-open' alias ob.rc='vim ~/.config/openbox/rc.xml' # }}} @@ -315,42 +356,9 @@ alias ld='cd -' # last directory alias cda='mkdir -p ~/data && cd ~/data' cde() { cd /etc/$@; } alias cdetc='cde' -alias cdd='cd ~/Downloads' -alias cdD='cd ~/Documents' -alias cdP='cd ~/Pictures' alias cdpu='cd ~/public' -alias cdV='cd ~/Videos' -alias cdM='cd ~/Music' +alias cdd='cd ~/Downloads' alias cdtrash='cd ~/.local/share/Trash' -# }}} -# website {{{ -alias cdb='cd ~/site/www' -vp() { - [[ $HOST = vultr ]] || PREFIX='ssh -qt vps' - - filename="${1%.md}.md" - post=$(eval $PREFIX find ~/blog/content -name $filename | head -1 | sed 's/\r//') - - if [ -z "$post" ]; then - echo "sh -c 'cd ~/blog && hugo new posts/$filename'" | eval ${PREFIX} - post="~/blog/content/posts/$filename" - fi - - shift - if [[ $HOST = vultr ]]; then - vim $@ "$post" - else - # Copy from vps - tmpfile=$(mktemp --suffix .md) - scp vps:"$post" $tmpfile - - # Edit locally - vim $tmpfile --cmd "autocmd BufWritePost $tmpfile silent! :!setsid scp % vps:$post &" && \ - cat $tmpfile | ssh vps "cd ~/blog && cat >$post && git add $post && git commit -m 'Update with vim'" && \ - rm $tmpfile - fi -} - # }}} # GIT: config {{{ alias git.config="$EDITOR ~/.gitconfig" @@ -368,9 +376,6 @@ alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to alias ch="/home/pham/helper/bin/git/check-repos.sh" alias git.check="/home/pham/helper/bin/git/check-repos.sh" -# }}} -# GIT: Web {{{ -alias git.web='/srv/git/create.sh' # }}} # GIT: TIG {{{ alias cdt='cd ~/git/tig' @@ -445,13 +450,6 @@ adb.push() { adb push $1 /sdcard/Download } # }}} -# Beancount{{{ -alias cdB='cd $HOME/bean' -alias b='vim $HOME/bean/main.bean' -# }}} -# python{{{ -alias pip3='python3 -m pip' -# }}} # sample file{{{ alias foo='echo bar > foo && echo File foo is created && ls -lh foo' alias bar='echo foo > bar && echo File bar is created && ls -lh bar' @@ -524,11 +522,12 @@ words() { } # }}} -# Nginx{{{ -alias vgx='sudo vim /etc/nginx/sites-enabled/vps && sudo nginx -t && sudo systemctl reload nginx' -alias ng.conf='sudo vim /etc/nginx/nginx.conf' -alias ng.log='tail -f /var/log/nginx/access.log' -alias cdngx='cd /etc/nginx' +# Beancount{{{ +alias cdB='cd $HOME/bean' +alias b='vim $HOME/bean/main.bean' +# }}} +# python{{{ +alias pip3='python3 -m pip' # }}} # GIS {{{ alias oo='ogr2ogr' diff --git a/mutt/muttrc.topo b/mutt/muttrc.topo index 0672b63..fc0a0a6 100644 --- a/mutt/muttrc.topo +++ b/mutt/muttrc.topo @@ -1,83 +1,5 @@ source ~/.config/mutt/default # IMAP/SMTP settings -set my_user = "pham@mail.topo.tw"; setenv my_user "$my_user" +#set my_user = "pham@mail.topo.tw"; setenv my_user "$my_user" set folder = "/home/pham/Maildir" -set smtp_url = "smtp://$my_user:587" -set smtp_pass = "$imap_pass" - -# Identify meself -set from = "pham@topo.tw" -set realname = "謝晉凡 Hsieh Chin Fan" -set signature = "~/.config/mutt/.signature" -set pgp_use_gpg_agent = yes -set crypt_use_gpgme = yes -set pgp_timeout = 300 -set pgp_sign_as = 6DD8C14A # replace 6DD8C14A with your gpg key id -set autocrypt = yes - -# For contacts -set display_filter = ~/.config/mutt/message_filter.sh -source ~/.config/mutt/alias.topo -source ~/.config/mutt/hooks.topo - -# Basic Mailbox -set spoolfile = "+INBOX" -set mbox= "+mbox" -set move = yes -set record = "+INBOX" -set trash = "+Trash" -set postponed = "+Drafts" -set mask="!(INBOX|mbox|dev|Sent|Trash|Drafts|DeltaChat|civildef|hometeach|osm|STOCK|pay|keep|login|update|test|spam)" - -# Sidebar -mailboxes -label '📭 [i]' +INBOX \ - -label '📥 [m]' +mbox \ - -label '👀 [d]' +dev \ - -label '💬 [D]' +DeltaChat \ - +github \ - +JOB \ - +promotion \ - "+---- Watch -----" \ - -label CivilDEF +civildef \ - +hometeach \ - -label OSM +osm \ - +STOCK \ - -label '📢 [f]' +feedback \ - "+-- Permanent ---" \ - -label '💲 [p]' +pay \ - -label '🍺 [k]' +keep \ - -label '📤 [s]' +Sent \ - -label '🗑 [t]' -poll +Trash \ - +login \ - +update \ - +service \ - +Drafts \ - +test \ - +spam - -# Keybinding -macro index,pager 'source ~/.config/mutt/muttrc.topo!' -macro index,pager 'source ~/.config/mutt/muttrc.gmail!' -macro index,pager 'source ~/.config/mutt/muttrc.b97602041!' - -# Hooks for accounts -folder-hook imaps://imap.gmail.com/ 'source ~/.config/mutt/muttrc.gmail' -folder-hook ~/Maildir 'source ~/.config/mutt/muttrc.b97602041' - -# Change mailboxes -macro index,pager,browser gi "+INBOX" "Switch to INBOX folder" -macro index,pager,browser gm "+mbox" "Switch to mbox folder" -macro index,pager,browser gp "+pay" "Switch to pay folder" -macro index,pager,browser gP "+promotion" "Switch to promotion folder" -macro index,pager,browser gh "+hometeach" "Switch to hometeach folder" -macro index,pager,browser gs "+Sent" "Switch to Sent folder" -macro index,pager,browser gS "+spam" "Switch to spam folder" -macro index,pager,browser gd "+dev" "Switch to DEV folder" -macro index,pager,browser gD "+DeltaChat" "Switch to DeltaChat folder" -macro index,pager,browser gt "+Trash" "Switch to Trash folder" -macro index,pager,browser gl "+login" "Switch to login folder" -macro index,pager,browser ga "+arch-general" "Switch to arch-general folder" -macro index,pager,browser gk "+keep" "Switch to keep folder" -macro index,pager,browser gu "+update" "Switch to update folder" -macro index,pager,browser gf "+feedback" "Switch to feedback folder" diff --git a/snippets/make_basic b/snippets/make_basic new file mode 100644 index 0000000..5ab47b9 --- /dev/null +++ b/snippets/make_basic @@ -0,0 +1,9 @@ +.ONESHELL: +.PHONY: some-target +ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST)))) + +all: + echo bar + +some-target: + echo foo diff --git a/vim/mini.lua b/vim/mini.lua index 7ca5051..24d868b 100644 --- a/vim/mini.lua +++ b/vim/mini.lua @@ -907,6 +907,7 @@ require("lazy").setup({ vim.keymap.set("v", "on", ":ObsidianLinkNew", {}) vim.keymap.set("n", "ol", ":ObsidianLinks", {}) require("obsidian").setup({ + disable_frontmatter = true, workspaces = { { name = "log", -- cgit v1.2.3-70-g09d2