diff options
-rw-r--r-- | alias | 18 | ||||
-rw-r--r-- | misc/openbox/rc.xml | 6 | ||||
-rwxr-xr-x | tools/init/sync.sh | 3 | ||||
-rwxr-xr-x | tools/unix/fdswap | 41 | ||||
-rw-r--r-- | zsh/_wi.sh | 6 | ||||
-rw-r--r-- | zsh/_ww.sh | 6 |
6 files changed, 73 insertions, 7 deletions
@@ -75,10 +75,11 @@ alias ports='sudo lsof -i -Pn | grep LISTEN' | |||
75 | .() { | 75 | .() { |
76 | source ${@:-$HOME/.$(basename $SHELL)rc} | 76 | source ${@:-$HOME/.$(basename $SHELL)rc} |
77 | } | 77 | } |
78 | alias ll='ls -alh' | 78 | alias ll='ls -lh' |
79 | alias lla='ls -lha' | ||
79 | llw() { which $1 | xargs ls -alh; } | 80 | llw() { which $1 | xargs ls -alh; } |
80 | alias hg='history | grep' | 81 | alias hg='history | grep' |
81 | alias rmrf='[[ `pwd` =~ ^$HOME.* ]] && [[ ! $PATH =~ `pwd` ]] && rm -rf' | 82 | alias rmrf='[[ `pwd` =~ ^$HOME.* ]] && rm -rf' |
82 | alias rr='_move_to_tmp' | 83 | alias rr='_move_to_tmp' |
83 | alias sound="echo -ne '\a'" | 84 | alias sound="echo -ne '\a'" |
84 | alias pst="pstree -ps $$" | 85 | alias pst="pstree -ps $$" |
@@ -250,7 +251,7 @@ cdss() { | |||
250 | # about vimwiki | 251 | # about vimwiki |
251 | alias cdw='cd ~/vimwiki' | 252 | alias cdw='cd ~/vimwiki' |
252 | alias chw='tig -C ~/vimwiki' | 253 | alias chw='tig -C ~/vimwiki' |
253 | alias today='vim ~/vimwiki/diary/`date +'%Y-%m-%d'`.md' | 254 | alias today='vim -c Goyo ~/vimwiki/diary/`date +'%Y-%m-%d'`.md' |
254 | alias to='today' | 255 | alias to='today' |
255 | ww() { entry="${1:-guideline}"; vim ~/vimwiki/${entry%%.md}.md; } | 256 | ww() { entry="${1:-guideline}"; vim ~/vimwiki/${entry%%.md}.md; } |
256 | wg() { grep -r "$@" --exclude-dir=logseq/ ~/vimwiki; } | 257 | wg() { grep -r "$@" --exclude-dir=logseq/ ~/vimwiki; } |
@@ -276,14 +277,21 @@ alias df='df -h' | |||
276 | 277 | ||
277 | # docker | 278 | # docker |
278 | alias dk='docker' | 279 | alias dk='docker' |
279 | alias dps='docker ps' | ||
280 | alias dis='docker images' | ||
281 | alias dc='docker-compose' | 280 | alias dc='docker-compose' |
281 | alias dis='docker images' | ||
282 | alias dps='docker ps' | ||
283 | alias dpsa='docker ps -a' | ||
282 | alias drm='docker rm `docker ps -aq`' | 284 | alias drm='docker rm `docker ps -aq`' |
285 | <<<<<<< HEAD | ||
283 | alias dr='docker run --rm -it' | 286 | alias dr='docker run --rm -it' |
284 | drsh() { docker run --rm -it --entrypoint /bin/sh $@; } | 287 | drsh() { docker run --rm -it --entrypoint /bin/sh $@; } |
285 | drbash() { docker run --rm -it --entrypoint /bin/bash $@; } | 288 | drbash() { docker run --rm -it --entrypoint /bin/bash $@; } |
286 | docker.tags() { curl -s -S "https://registry.hub.docker.com/v2/repositories/$@/tags/" | jq '.results[]["name"]' | sort; } | 289 | docker.tags() { curl -s -S "https://registry.hub.docker.com/v2/repositories/$@/tags/" | jq '.results[]["name"]' | sort; } |
290 | alias drsh='docker run --rm -it --entrypoint /bin/sh $@' | ||
291 | alias drbash='docker run --rm -it --entrypoint /bin/bash $@' | ||
292 | docker.tags() { | ||
293 | curl -s -S "https://registry.hub.docker.com/v2/repositories/$@/tags/" | jq '.results[]["name"]' | sort | ||
294 | } | ||
287 | 295 | ||
288 | # Android | 296 | # Android |
289 | alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_' | 297 | alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_' |
diff --git a/misc/openbox/rc.xml b/misc/openbox/rc.xml index 4584121..d0ab52e 100644 --- a/misc/openbox/rc.xml +++ b/misc/openbox/rc.xml | |||
@@ -930,6 +930,12 @@ | |||
930 | <y>center</y> | 930 | <y>center</y> |
931 | </position> | 931 | </position> |
932 | </application> | 932 | </application> |
933 | <application title="alacritty"> | ||
934 | <position force="yes"> | ||
935 | <x>center</x> | ||
936 | <y>center</y> | ||
937 | </position> | ||
938 | </application> | ||
933 | <!-- | 939 | <!-- |
934 | # this is an example with comments through out. use these to make your | 940 | # this is an example with comments through out. use these to make your |
935 | # own rules, but without the comments of course. | 941 | # own rules, but without the comments of course. |
diff --git a/tools/init/sync.sh b/tools/init/sync.sh index 04af87e..ebed33a 100755 --- a/tools/init/sync.sh +++ b/tools/init/sync.sh | |||
@@ -1,5 +1,8 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | # If git is working in other process, then don't sync again | ||
4 | ! pidof git && exit 0 | ||
5 | |||
3 | # my repo | 6 | # my repo |
4 | sync() { | 7 | sync() { |
5 | { cd $1 && [[ -n $(git remote -v) ]] || return ; } 2>/dev/null | 8 | { cd $1 && [[ -n $(git remote -v) ]] || return ; } 2>/dev/null |
diff --git a/tools/unix/fdswap b/tools/unix/fdswap new file mode 100755 index 0000000..251cdea --- /dev/null +++ b/tools/unix/fdswap | |||
@@ -0,0 +1,41 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # fdswap | ||
4 | # | ||
5 | # Orignal author: ingvarha | ||
6 | # ref: https://ingvarha.wordpress.com/2010/07/10/changing-a-process-file-descriptor-on-the-fly/ | ||
7 | |||
8 | if [ "$2" = "" ]; then | ||
9 | <<HELP cat | ||
10 | Usage: ${0##*/} /path/to/oldfile /path/to/newfile [pids] | ||
11 | Example: ${0##*/} /var/log/daemon.log /var/log/newvolume/daemon.log 1234 | ||
12 | Example: ${0##*/} /dev/pts/53 /dev/null 2345 | ||
13 | HELP | ||
14 | exit 0 | ||
15 | fi | ||
16 | |||
17 | if ! gdb --version &>/dev/null; then | ||
18 | echo "Unable to find gdb." | ||
19 | exit 1 | ||
20 | fi | ||
21 | |||
22 | src="$1"; dst="$2"; shift; shift | ||
23 | pids=$* | ||
24 | |||
25 | for pid in ${pids:=$( /sbin/fuser $src | cut -d ':' -f 2 )}; | ||
26 | do | ||
27 | echo "src=$src, dst=$dst" | ||
28 | echo "$src has $pid using it" | ||
29 | cmd=$(mktemp) | ||
30 | { | ||
31 | echo "attach $pid" | ||
32 | echo 'call (int)open("'$dst'", 66, 0666)' | ||
33 | for ufd in $(LANG=C ls -l /proc/$pid/fd | \ | ||
34 | grep "$src"\$ | awk ' { print $9; } '); | ||
35 | do echo 'call (int)dup2($1,'"$ufd"')'; done | ||
36 | echo 'call (int)close($1)' | ||
37 | echo 'detach'; echo 'quit' | ||
38 | sleep 5 | ||
39 | } | tee /dev/tty >$cmd | ||
40 | gdb -x $cmd | ||
41 | done | ||
@@ -1,7 +1,11 @@ | |||
1 | #compdef wi | 1 | #compdef wi |
2 | 2 | ||
3 | function _wi() { | 3 | function _wi() { |
4 | compadd -S '' $(cd ~/vimwiki && find -not -path "./logseq/*" -name '*.md' -printf "%f\n" | sed -E '/^[0-9]{4}-[0-9]{2}-[0-9]{2}/d') | 4 | compadd -S '' $( |
5 | cd ~/vimwiki && \ | ||
6 | find -not -path "./logseq/*" -name '*.md' -printf "%f\n" | \ | ||
7 | sed -E '/^[0-9]{4}-[0-9]{2}-[0-9]{2}/d; s/.md$//' | ||
8 | ) | ||
5 | } | 9 | } |
6 | 10 | ||
7 | _wi | 11 | _wi |
@@ -1,7 +1,11 @@ | |||
1 | #compdef ww | 1 | #compdef ww |
2 | 2 | ||
3 | function _ww() { | 3 | function _ww() { |
4 | compadd -S '' $(cd ~/vimwiki && find -not -path "./logseq/*" -name '*.md' -printf "%f\n" | sed -E '/^[0-9]{4}-[0-9]{2}-[0-9]{2}/d') | 4 | compadd -S '' $( |
5 | cd ~/vimwiki && \ | ||
6 | find -not -path "./logseq/*" -name '*.md' -printf "%f\n" | \ | ||
7 | sed -E '/^[0-9]{4}-[0-9]{2}-[0-9]{2}/d; s/.md$//' | ||
8 | ) | ||
5 | } | 9 | } |
6 | 10 | ||
7 | _ww | 11 | _ww |