From 3127f52dd3d17529b625e417d6fb62ec68fb292c Mon Sep 17 00:00:00 2001 From: hophacker Date: Tue, 22 Nov 2022 16:53:26 +0800 Subject: [PATCH] chore: psm(ps with readable memory, commitlint, etc --- SpaceVim.d/autoload/paiyou.vim | 2 +- zsh/aliases.zsh | 30 ++++++++++++++++++++++++++---- zsh/commitlint.zsh | 2 +- zsh/functions.zsh | 10 ---------- zsh/git.zsh | 25 ------------------------- zsh/local.zsh | 13 ++++++------- 6 files changed, 34 insertions(+), 48 deletions(-) delete mode 100644 zsh/git.zsh diff --git a/SpaceVim.d/autoload/paiyou.vim b/SpaceVim.d/autoload/paiyou.vim index 9a6c0db..4c11582 100644 --- a/SpaceVim.d/autoload/paiyou.vim +++ b/SpaceVim.d/autoload/paiyou.vim @@ -5,7 +5,7 @@ function! paiyou#before() abort \ 'args': ['--stdin', '--stdin-filepath', '"%:p"', '--parser', 'typescript'], \ 'stdin': 1 \ } - let g:neoformat_enabled_typescriptreact = ['tsfmt', 'prettier'] + let g:neoformat_enabled_typescriptreact = ['prettier'] let g:neoformat_enabled_ruby = ['rubocop'] endfunction diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 781b1c0..e80275d 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -21,10 +21,9 @@ alias yup='yadr update-plugins' alias yip='yadr init-plugins' # PS -alias psa="ps aux" -alias psg="ps aux | grep " -alias psr='ps aux | grep ruby' - +psm() { + ps aux | awk 'NR>1 {$5=int($5/1024)"M";$6=int($6/1024)"M";}{ print;}' +} # Moving around alias cdb='cd -' alias cls='clear;ls' @@ -130,6 +129,26 @@ alias gt='git t' alias gbg='git bisect good' alias gbb='git bisect bad' alias gdmb='git branch --merged | grep -v "\*" | xargs -n 1 git branch -d' +alias gfR='gf origin master; gwR origin/master' +alias gpb='git push origin "$(git-branch-current 2> /dev/null):build"' +alias gfs="gs;gfr;gsp" +git_rebase_to_origin() { + BRANCH=${1:-master} + DIRTY=false + git fetch origin + [[ -n $(git status -s) ]] && DIRTY=true + $DIRTY && echo "Git is dirty" + $DIRTY && (git add .; git stash) + git rebase origin/$BRANCH + $DIRTY && (git stash pop; git reset HEAD) +} +git_rm_tag_of_remote() { + TAG=$1 + REMOTE=${2:-origin} + git tag -d $TAG + git push --delete $REMOTE $TAG +} +git_log_history='git log -p --' # Common shell functions alias less='less -r' @@ -260,3 +279,6 @@ alias docker_restart_in_mac='killall Docker && open /Applications/Docker.app' ## source files alias ss="source ~/.zshrc" alias delete_all_binaries="find . -type f -perm -u+x -not -path './.git/*' | xargs rm" + +## grep && ag +alias agq="ag -Q" diff --git a/zsh/commitlint.zsh b/zsh/commitlint.zsh index 255ff99..93c9fef 100644 --- a/zsh/commitlint.zsh +++ b/zsh/commitlint.zsh @@ -1,5 +1,5 @@ commitlint_init() { - yarn add husky @commitlint/{config-conventional,cli} -D + yarn add husky @commitlint/{config-conventional,cli} -D -W echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js yarn husky install yarn husky add .husky/commit-msg 'yarn commitlint --edit $1' diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 76e4001..22595c4 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -24,16 +24,6 @@ function post { function search_installed_packages { dpkg --get-selections | grep $1 } -function set_anonymous { - git filter-branch --env-filter ' - if [ "$GIT_AUTHOR_NAME" = "ralletstellar" ]; then \ - export GIT_AUTHOR_NAME="Anonymous" GIT_AUTHOR_EMAIL="anonymous@anonymous.com"; \ - fi - ' -} -function genAndroidKeystore { - keytool -genkey -v -keystore /tmp/.keystore -alias rallets -keyalg RSA -keysize 2048 -validity 10000 -} function delete_except_latest { total=`ll | wc -l` num_to_delete=$((total-$1)) diff --git a/zsh/git.zsh b/zsh/git.zsh deleted file mode 100644 index 1b53725..0000000 --- a/zsh/git.zsh +++ /dev/null @@ -1,25 +0,0 @@ -# Makes git auto completion faster favouring for local completions -__git_files () { - _wanted files expl 'local files' _files -} -alias gfR='gf origin master; gwR origin/master' -alias gpb='git push origin "$(git-branch-current 2> /dev/null):build"' -alias gitUserRallet="git config user.name rallets;git config user.email rallet@rallets.com" -alias gfs="gs;gfr;gsp" -git_rebase_to_origin() { - BRANCH=${1:-master} - DIRTY=false - git fetch origin - [[ -n $(git status -s) ]] && DIRTY=true - $DIRTY && echo "Git is dirty" - $DIRTY && (git add .; git stash) - git rebase origin/$BRANCH - $DIRTY && (git stash pop; git reset HEAD) -} -git_rm_tag_of_remote() { - TAG=$1 - REMOTE=${2:-origin} - git tag -d $TAG - git push --delete $REMOTE $TAG -} -git_log_history='git log -p --' diff --git a/zsh/local.zsh b/zsh/local.zsh index d176d26..5f0e024 100644 --- a/zsh/local.zsh +++ b/zsh/local.zsh @@ -2,13 +2,12 @@ export EDITOR=vim #### Android -#export ANDROID_HOME=$HOME/Library/Android/sdk -#export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk -##export ANDROID_SDK_HOME=$HOME/Library/Android/sdk -#export ANDROID_NDK_HOME=$HOME/Library/Android/sdk/ndk-bundle -##export NDK_PROJECT_PATH=$HOME/Projects/rallets-android/src/main -#export NDK_PROJECT_PATH=src/main -#export PATH=$PATH:$HOME/Android/sdk/platform-tools:$HOME/Android/sdk/tools/ +export ANDROID_HOME=$HOME/Library/Android/sdk +export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk +export ANDROID_SDK_HOME=$HOME/Library/Android/sdk +export ANDROID_NDK_HOME=$HOME/Library/Android/sdk/ndk-bundle +export NDK_PROJECT_PATH=src/main +export PATH=$PATH:$HOME/Android/sdk/platform-tools:$HOME/Android/sdk/tools/ #### Qiniu QINIU_ACCESS_KEY=l6Rf0LgQDgpSwjdXr_MgsCynhsofRM7W2dwvIOXO