├── .zshrc.etc.d
├── .gitkeep
├── docker-alias-commands.zshrc
├── python-global-init.zshrc
├── chmod-root-s.zshrc
├── kube-promote.zshrc
├── hosts-on-off.zshrc
├── clean-cache.zshrc
└── project.zshrc
├── local
├── etc
│ ├── mssql_bindings.txt
│ └── Blank.css
└── bin
│ ├── tinyproxy_start.sh
│ ├── myip
│ ├── trash-put
│ ├── jmxsh
│ ├── myip-ip-sb
│ ├── myip-ip-sb-hk
│ ├── myip-ip-me-usa
│ ├── myip-ifconfig-co
│ ├── myip-ifconfig-gcs
│ ├── myip-ipecho
│ ├── myip-ipinfo
│ ├── soks5proxyhttp
│ ├── jmxterm
│ ├── crash
│ ├── myip-dig
│ ├── tinyproxy_stop.sh
│ ├── rsocks_start.sh
│ ├── myip-ipip
│ ├── soks5proxyssh
│ ├── paste-weread-to-md
│ ├── apple-music-playing
│ ├── format-gfm
│ ├── paste-md-to-html
│ ├── paste-weread-to-md-copy
│ ├── resize-img-1200
│ ├── resize-img-2000
│ ├── resize-img-800
│ ├── fcitx-remote-osa
│ ├── generate-summary-md
│ ├── shadowsocks_client_start_ha.sh
│ ├── paste-rtf-to-md-copy
│ ├── format-markdown
│ ├── paste-rtf-to-html-copy
│ ├── paste-html-to-rtf
│ ├── ls-upload-log4d
│ ├── paste-html-to-md-copy
│ ├── paste-html-to-rtf-copy
│ ├── paste-md-to-html-copy
│ ├── paste-md-to-rtf-copy
│ ├── mouse-tracking-echo-in-shell
│ ├── paste-rtf-to-md-for-table-copy
│ ├── svn_diff_wrapper
│ ├── yaml-pretty-pyyaml
│ ├── git-archive-zip
│ ├── git_diff_wrapper
│ ├── git-changes
│ ├── yaml-pretty
│ ├── dig-http
│ ├── paste-md-to-rtf
│ ├── paste-rtf-to-html
│ ├── funiq
│ ├── paste-rtf-to-md-for-table
│ ├── uniqf
│ ├── rime_dict_manager
│ ├── paste-simplemind-outline-to-md
│ ├── git-code-numbers-by-authors
│ ├── privoxy_restart.sh
│ ├── tsa
│ ├── puml-format-order-node
│ ├── git-min-backup
│ ├── qrdecode
│ ├── shj
│ ├── release-sbt-to-git-release-binary-branch.sh
│ ├── shadowsocks_client_start_hk.sh
│ ├── shadowsocks_client_start_jp.sh
│ ├── paste-html-to-md
│ ├── release-mvn-to-git-release-binary-branch.sh
│ ├── resize-img
│ ├── mouse_restore.sh
│ ├── unzip-gbk
│ ├── lark-gen-markdown
│ ├── tinypng
│ ├── image-from-clipboard-to-png-global
│ ├── mdmv
│ ├── mdsearch
│ ├── image-from-clipboard-to-png-copy-markdown
│ ├── image-from-path-to-assets-copy-markdown
│ ├── generate-output-summary-md
│ ├── ddns-by-cloudflare-wan
│ ├── mov2gif
│ ├── ddns-by-dnspod
│ ├── mdcp
│ ├── ddns-by-cloudflare
│ ├── socks5proxywrapper
│ ├── ddns-by-dnspod-wan
│ ├── view-pyc-file
│ ├── view-pyc-file3
│ ├── iterm2-send-zmodem.sh
│ ├── homebrew-using-mirror
│ ├── bing-wallpaper.sh
│ ├── iterm2-recv-zmodem.sh
│ ├── sqlite3-to-mysql.py
│ ├── csv2json
│ ├── viscosity-to-ios-connect.rb
│ ├── tree2fulltree
│ ├── paste-rtf-to-md
│ ├── remark
│ ├── speedfox
│ ├── check-brew-cask-upgrade
│ ├── gh-md-toc
│ ├── scel2mmseg.py
│ ├── generate_dash_index.sh
│ ├── mysql2sqlite.sh
│ ├── cdnjs-download.py
│ ├── reveal
│ ├── svg2icns
│ └── markdown2ctags.py
├── .iftoprc
├── .config
├── kitty
│ ├── kitty.d
│ │ └── local
│ │ │ └── .gitkeeper
│ └── theme.conf
├── uv
│ └── uv.toml
└── ghostty
│ └── config
├── VimFx-custom
├── vimfx.js
├── bootstrap.js
└── install.rdf
├── mac
├── phoenix
│ ├── _asserts
│ │ ├── window.gif
│ │ ├── application-launch.gif
│ │ └── application-switch.gif
│ ├── tsconfig.json
│ ├── package.json
│ ├── src
│ │ ├── app.ts
│ │ ├── mouse.ts
│ │ ├── config.ts
│ │ ├── space.ts
│ │ ├── util.ts
│ │ └── window.ts
│ ├── webpack.config.js
│ ├── README.md
│ └── tslint.json
├── Library
│ └── LaunchAgents
│ │ └── com.alswl.edit-server.plist
├── .slate
├── _Library
│ └── Application Support
│ │ └── Karabiner
│ │ └── private.xml
├── .bashrc
├── .mjolnir
│ └── init.lua
└── .amethyst
├── .jslintrc
├── .npmrc
├── .wgetrc
├── .pip
└── pip.conf
├── .pydistutils.cfg
├── .nload
├── .zprofile
├── .gitignore_global
├── .screenrc
├── linux
├── .Xmodmap
├── .xprofile
├── .Xresources
└── .config
│ ├── fontconfig
│ └── fonts.conf
│ └── conky
│ └── conky.conf
├── diff
└── usr
│ └── local
│ └── share
│ └── zsh
│ └── site-functions
│ └── git-completion.bash.diff
├── .htoprc
├── .webterm.lua
├── .gitignore
├── .pentadactylrc
├── .vimperatorrc
├── .obsidian.vimrc
├── .cvimrc
├── .tmux.conf
├── _.gitconfig
├── .ctags
├── .cvim.css
├── .ideavimrc
├── .surfingkeys.js
├── README.md
└── .zsh_completion
└── _toodledo
/.zshrc.etc.d/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/local/etc/mssql_bindings.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.iftoprc:
--------------------------------------------------------------------------------
1 | max-bandwidth: 10M
2 |
--------------------------------------------------------------------------------
/.config/kitty/kitty.d/local/.gitkeeper:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/local/bin/tinyproxy_start.sh:
--------------------------------------------------------------------------------
1 | tinyproxy
2 |
--------------------------------------------------------------------------------
/local/bin/myip:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | myip-ifconfig-co
3 |
--------------------------------------------------------------------------------
/local/bin/trash-put:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | trash "$@"
4 |
--------------------------------------------------------------------------------
/local/bin/jmxsh:
--------------------------------------------------------------------------------
1 | java -jar $HOME/local/libs/jmxsh-R5.jar
2 |
--------------------------------------------------------------------------------
/local/bin/myip-ip-sb:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | curl -s http://ip.sb
3 |
--------------------------------------------------------------------------------
/local/bin/myip-ip-sb-hk:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | curl -sL http://ip.sb
3 |
--------------------------------------------------------------------------------
/local/bin/myip-ip-me-usa:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | curl -sL https://ip.me
3 |
--------------------------------------------------------------------------------
/VimFx-custom/vimfx.js:
--------------------------------------------------------------------------------
1 | console.log('Hello, world! This is vimfx:', vimfx)
--------------------------------------------------------------------------------
/local/bin/myip-ifconfig-co:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | curl -sL http://ifconfig.co
3 |
--------------------------------------------------------------------------------
/local/bin/myip-ifconfig-gcs:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | curl -sL http://ifconfig.me
3 |
--------------------------------------------------------------------------------
/local/bin/myip-ipecho:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | curl -sL http://ipecho.net/plain
3 |
--------------------------------------------------------------------------------
/local/bin/myip-ipinfo:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | curl -sL https://ipinfo.io/ip
3 |
--------------------------------------------------------------------------------
/local/bin/soks5proxyhttp:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | connect -H 127.0.0.1:1235 "$@"
3 |
--------------------------------------------------------------------------------
/local/bin/jmxterm:
--------------------------------------------------------------------------------
1 | java -jar $HOME/local/libs/jmxterm-1.0-alpha-4-uber.jar
2 |
--------------------------------------------------------------------------------
/local/bin/crash:
--------------------------------------------------------------------------------
1 | java -jar ~/local/libs/crash.shell-1.3.1-SNAPSHOT-standalone.jar
2 |
--------------------------------------------------------------------------------
/local/bin/myip-dig:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | dig +short myip.opendns.com @resolver1.opendns.com
3 |
--------------------------------------------------------------------------------
/local/bin/tinyproxy_stop.sh:
--------------------------------------------------------------------------------
1 | kill $(cat /usr/local/var/run/tinyproxy/tinyproxy.pid)
2 |
--------------------------------------------------------------------------------
/.config/uv/uv.toml:
--------------------------------------------------------------------------------
1 | [[index]]
2 | url = "https://pypi.tuna.tsinghua.edu.cn/simple"
3 | default = true
4 |
--------------------------------------------------------------------------------
/local/bin/rsocks_start.sh:
--------------------------------------------------------------------------------
1 | nohup $HOME/.virtualenvs/7/bin/rsocks --config=$HOME/.rsocks.toml >/dev/null &
2 |
--------------------------------------------------------------------------------
/local/bin/myip-ipip:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | curl -s https://myip.ipip.net | awk -F ':' '{print $2}' | awk '{print $1}'
3 |
--------------------------------------------------------------------------------
/local/bin/soks5proxyssh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | ssh -o ProxyCommand="$HOME/local/bin/socks5proxywrapper %h %p" "$@"
3 |
--------------------------------------------------------------------------------
/mac/phoenix/_asserts/window.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alswl/.oOo./HEAD/mac/phoenix/_asserts/window.gif
--------------------------------------------------------------------------------
/local/bin/paste-weread-to-md:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | pbpaste |
4 | gsed 's/◆ /> /'
5 |
6 |
7 | # vim: set ft=sh:
8 |
--------------------------------------------------------------------------------
/.jslintrc:
--------------------------------------------------------------------------------
1 | /*jslint browser: true, regexp: true */
2 | /*global jQuery, $, window */
3 |
4 | // vim: set ft=javascript:
5 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | email=
2 | registry=https://registry.npmmirror.com
3 | electron_mirror=https://npmmirror.com/mirrors/electron/
4 |
--------------------------------------------------------------------------------
/local/bin/apple-music-playing:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | osascript -e 'tell application "Music" to get name of current track'
4 |
--------------------------------------------------------------------------------
/local/bin/format-gfm:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cat $1 | pandoc -f markdown_github -t markdown_github --wrap=none | sponge $1
4 |
--------------------------------------------------------------------------------
/local/bin/paste-md-to-html:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | pbpaste |
4 | pandoc -f markdown -t html
5 |
6 | # vim: set ft=sh:
7 |
--------------------------------------------------------------------------------
/local/bin/paste-weread-to-md-copy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ./paste-weread-to-md | pbcopy
4 |
5 |
6 | # vim: set ft=sh:
7 |
8 |
--------------------------------------------------------------------------------
/.wgetrc:
--------------------------------------------------------------------------------
1 | # 不要乱转义中文
2 | --restrict-file-names=nocontrol
3 | # 使用重定向后的文件名
4 | --trust-server-names=on
5 | --content-disposition=on
6 |
--------------------------------------------------------------------------------
/local/bin/resize-img-1200:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # using imagemagic to resize image
3 |
4 | set -e
5 |
6 | resize-img "$1" 1200x1200
7 |
--------------------------------------------------------------------------------
/local/bin/resize-img-2000:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # using imagemagic to resize image
3 |
4 | set -e
5 |
6 | resize-img "$1" 2000x2000
7 |
--------------------------------------------------------------------------------
/local/bin/resize-img-800:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # using imagemagic to resize image
3 |
4 | set -e
5 |
6 | resize-img "$1" 800x800
7 |
8 |
--------------------------------------------------------------------------------
/mac/phoenix/_asserts/application-launch.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alswl/.oOo./HEAD/mac/phoenix/_asserts/application-launch.gif
--------------------------------------------------------------------------------
/mac/phoenix/_asserts/application-switch.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alswl/.oOo./HEAD/mac/phoenix/_asserts/application-switch.gif
--------------------------------------------------------------------------------
/.config/ghostty/config:
--------------------------------------------------------------------------------
1 | window-inherit-working-directory = false
2 | macos-titlebar-proxy-icon = hidden
3 | copy-on-select = clipboard
4 |
--------------------------------------------------------------------------------
/.pip/pip.conf:
--------------------------------------------------------------------------------
1 | [global]
2 | #index-url = https://mirrors.aliyun.com/pypi/simple/
3 | index-url = https://pypi.tuna.tsinghua.edu.cn/simple
4 |
--------------------------------------------------------------------------------
/local/bin/fcitx-remote-osa:
--------------------------------------------------------------------------------
1 | #!/usr/bin/osascript
2 |
3 | tell application "System Events" to keystroke "z" using {shift down, control down}
4 |
--------------------------------------------------------------------------------
/local/bin/generate-summary-md:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ls *.md | sed 's/.md//g' | grep -v summary | awk '{print "- ["$0"]("$0")"}' >summary.md
4 |
--------------------------------------------------------------------------------
/.pydistutils.cfg:
--------------------------------------------------------------------------------
1 | [easy_install]
2 | # index-url = https://mirrors.aliyun.com/pypi/simple/
3 | index-url = https://pypi.tuna.tsinghua.edu.cn/simple
4 |
--------------------------------------------------------------------------------
/local/bin/shadowsocks_client_start_ha.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ss-local -c /usr/local/etc/shadowsocks-libev_ha.json -f /usr/local/var/run/ss-local_ha.pid
4 |
--------------------------------------------------------------------------------
/local/bin/paste-rtf-to-md-copy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
4 |
5 | $DIR/paste-rtf-to-md | pbcopy
6 |
--------------------------------------------------------------------------------
/local/bin/format-markdown:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cat $1 | pandoc -f markdown -t markdown --wrap=auto --columns=100 | sponge $1
4 |
5 | # TODO fix colums not work
6 |
--------------------------------------------------------------------------------
/local/bin/paste-rtf-to-html-copy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
4 |
5 | $DIR/paste-rtf-to-html | pbcopy
6 |
--------------------------------------------------------------------------------
/.zshrc.etc.d/docker-alias-commands.zshrc:
--------------------------------------------------------------------------------
1 | #alias swagger="docker run --rm -it --user $(id -u):$(id -g) -e GOPATH=$HOME/go:/go -v $HOME:$HOME -w $(pwd) quay.io/goswagger/swagger"
2 |
--------------------------------------------------------------------------------
/.zshrc.etc.d/python-global-init.zshrc:
--------------------------------------------------------------------------------
1 | alias python-global-init='pip2 install virtualenvwrapper
2 | pip3 install virtualenvwrapper
3 | pip2 install pynvim
4 | pip3 install pynvim'
5 |
--------------------------------------------------------------------------------
/local/bin/paste-html-to-rtf:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | pbpaste |
4 | textutil -stdin -inputencoding utf-8 -encoding utf-8 -format html -convert rtf -stdout
5 |
6 | # vim: set ft=sh:
7 |
--------------------------------------------------------------------------------
/local/bin/ls-upload-log4d:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | pushd ~/Dropbox/Public/upload_dropbox
4 | ls */* | awk '{print ""}'
5 | popd
6 |
--------------------------------------------------------------------------------
/local/bin/paste-html-to-md-copy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
4 |
5 | $DIR/paste-html-to-md | pbcopy
6 |
7 | # vim: set ft=sh:
8 |
--------------------------------------------------------------------------------
/local/bin/paste-html-to-rtf-copy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
4 |
5 | $DIR/paste-html-to-rtf | pbcopy
6 |
7 | # vim: set ft=sh:
8 |
--------------------------------------------------------------------------------
/local/bin/paste-md-to-html-copy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
4 |
5 | $DIR/paste-md-to-html | pbcopy
6 |
7 | # vim: set ft=sh:
8 |
--------------------------------------------------------------------------------
/local/bin/paste-md-to-rtf-copy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
4 |
5 | $DIR/paste-md-to-rtf | pbcopy
6 |
7 | # vim: set ft=sh:
8 |
--------------------------------------------------------------------------------
/local/bin/mouse-tracking-echo-in-shell:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # usage: source mouse-tracing-echo-in-shell
3 | # and move your mouse
4 | # https://stackoverflow.com/a/51911371/342757
5 |
6 | echo -e "\e[?1003h"
7 |
--------------------------------------------------------------------------------
/local/bin/paste-rtf-to-md-for-table-copy:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
4 |
5 | $DIR/paste-rtf-to-md-for-table | pbcopy
6 |
7 | # vim: set ft=sh:
8 |
--------------------------------------------------------------------------------
/local/bin/svn_diff_wrapper:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # 配置你喜欢的diff程序路径
3 | DIFF="vimdiff"
4 | # SVN diff命令会传入两个文件的参数
5 | LEFT=${6}
6 | RIGHT=${7}
7 | # 拼接成diff命令所需要的命令格式
8 | $DIFF $LEFT $RIGHT
9 |
10 | # vim: set ft=sh:
11 |
--------------------------------------------------------------------------------
/.nload:
--------------------------------------------------------------------------------
1 | Version="1"
2 | AverageWindow="300"
3 | BarMaxIn="10240"
4 | BarMaxOut="10240"
5 | DataFormat="Human Readable (Byte)"
6 | Devices="all"
7 | MultipleDevices="[ ]"
8 | RefreshInterval="500"
9 | TrafficFormat="MByte"
10 |
--------------------------------------------------------------------------------
/local/bin/yaml-pretty-pyyaml:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # cat f | yaml-pretty-pyyaml
3 | # comment inline is not supported
4 |
5 | python -c 'import sys,yaml; print(yaml.dump_all(yaml.safe_load_all(sys.stdin), indent=2, allow_unicode=True))'
6 |
--------------------------------------------------------------------------------
/local/bin/git-archive-zip:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | BRANCH=master
4 |
5 | if [ -n "$1" ]; then
6 | BRANCH=$1
7 | fi
8 |
9 | git archive --format zip --output ../$(basename "$PWD").$(git rev-parse --short "$BRANCH").zip "$BRANCH"
10 |
--------------------------------------------------------------------------------
/local/bin/git_diff_wrapper:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # deprecated, shoud use git difftoll
3 | # see https://git-scm.com/docs/git-difftool
4 | # see https://stackoverflow.com/questions/3713765/viewing-all-git-diffs-with-vimdiff
5 |
6 | vimdiff "$2" "$5"
7 |
--------------------------------------------------------------------------------
/local/bin/git-changes:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | target_branch=origin/master
4 |
5 | # if params is empty, using origin/master
6 | if [ $# -eq 1 ]; then
7 | target_branch=$1
8 | fi
9 |
10 | git log --format='- %h: %s' "$target_branch"..HEAD
11 |
--------------------------------------------------------------------------------
/local/bin/yaml-pretty:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # usage: yaml-pretty your-file
3 |
4 | # Checking to ensure a filename was specified and that it exists
5 | if [ -f "$1" ]; then
6 | yq --prettyPrint -M "$1" | sponge "$1";
7 | else
8 | echo "No file given!"
9 | fi
10 |
--------------------------------------------------------------------------------
/.zprofile:
--------------------------------------------------------------------------------
1 | # Added by Toolbox App
2 | export PATH="$PATH:$HOME/Library/Application Support/JetBrains/Toolbox/scripts"
3 |
4 |
5 | [ -f /usr/local/bin/brew ] && eval $(/usr/local/bin/brew shellenv)
6 | [ -f /opt/homebrew/bin/brew ] && eval $(/opt/homebrew/bin/brew shellenv)
7 |
--------------------------------------------------------------------------------
/local/bin/dig-http:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # query DNS via DNSPod HTTP API
4 | #
5 | # API doc: https://www.dnspod.cn/httpdns/guide
6 |
7 | domain=$1
8 |
9 | if [ -z $domain ]; then
10 | echo "error auguments"
11 | exit 0
12 | fi
13 |
14 | curl -s "http://119.29.29.29/d?dn=$domain."
15 |
--------------------------------------------------------------------------------
/local/bin/paste-md-to-rtf:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #set -x
4 | #set -e
5 |
6 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
7 |
8 | $DIR/paste-md-to-html |
9 | textutil -stdin -inputencoding utf-8 -encoding utf-8 -format html -convert rtf -stdout
10 |
11 | # vim: set ft=sh:
12 |
--------------------------------------------------------------------------------
/local/bin/paste-rtf-to-html:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | osascript -e 'the clipboard as "HTML"' |
4 | perl -ne 'print chr foreach unpack("C*",pack("H*",substr($_,11,-3)))' |
5 | gsed -E 's/style="[^"]+"//g' |
6 | gsed -E 's/ / /g' |
7 | gsed -E 's///g' |
8 | gsed -E 's///g'
9 |
10 | # vim: set ft=sh:
11 |
--------------------------------------------------------------------------------
/.zshrc.etc.d/chmod-root-s.zshrc:
--------------------------------------------------------------------------------
1 | alias chmod-root-s-hostess='sudo chown root:wheel /usr/local/Cellar/hostess/*/bin/hostess; sudo chmod +s /usr/local/Cellar/hostess/*/bin/hostess'
2 | alias chmod-root-s-mtr='sudo chown root:wheel /usr/local/Cellar/mtr/*/sbin/mtr-packet; sudo chmod +s /usr/local/Cellar/mtr/*/sbin/mtr-packet'
3 |
--------------------------------------------------------------------------------
/local/bin/funiq:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # funiq = file uniq
3 |
4 | FILE_NAME=$1
5 |
6 | if [ -z $FILE_NAME ]; then
7 | echo "Useage: file-uniq filename"
8 | exit 0
9 | fi
10 |
11 | HASH=$(cat "$FILE_NAME" | gmd5sum | cut -c -7)
12 | NAME="${FILE_NAME%.*}"
13 | EXT="${FILE_NAME##*.}"
14 |
15 | mv "$FILE_NAME" "$NAME.$HASH.$EXT"
16 |
--------------------------------------------------------------------------------
/local/bin/paste-rtf-to-md-for-table:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
4 |
5 | $DIR/paste-rtf-to-html |
6 | sed 's/
//g' |
7 | sed 's/<\/p>//g' |
8 | sed 's/
//g' |
9 | pandoc -f html --wrap none -t 'markdown_strict+pipe_tables'
10 |
11 | # vim: set ft=sh:
12 |
--------------------------------------------------------------------------------
/local/bin/uniqf:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # funiq = file uniq
3 |
4 | FILE_NAME=$1
5 |
6 | if [ -z $FILE_NAME ]; then
7 | echo "Useage: file-uniq filename"
8 | exit 0
9 | fi
10 |
11 | HASH=$(cat "$FILE_NAME" | gmd5sum | cut -c -7)
12 | NAME="${FILE_NAME%.*}"
13 | EXT="${FILE_NAME##*.}"
14 |
15 | mv "$FILE_NAME" "$NAME.$HASH.$EXT"
16 |
--------------------------------------------------------------------------------
/local/bin/rime_dict_manager:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # put this script in ~/Library/Rime, list existing user dictionaries:
4 | # ./rime_dict_manager --list
5 | # see other supported options:
6 | # ./rime_dict_manager
7 |
8 | DYLD_LIBRARY_PATH="/Library/Input Methods/Squirrel.app/Contents/Frameworks" "/Library/Input Methods/Squirrel.app/Contents/MacOS/rime_dict_manager" $@
9 |
--------------------------------------------------------------------------------
/local/bin/paste-simplemind-outline-to-md:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # 1. tab to space
4 | # 2. add - before every emptyline
5 | # 3. remove head space
6 | # 4. add newline to second line
7 |
8 | pbpaste \
9 | | gsed -E 's/\t/ /g' \
10 | | gsed -E 's/( +) /\1- /g' \
11 | | gsed -E 's/^ //g' \
12 | | awk 'NR==1{print; print ""} NR!=1'
13 |
14 | # vim: set ft=sh:
15 |
--------------------------------------------------------------------------------
/local/bin/git-code-numbers-by-authors:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | SINCE=$1
4 |
5 | if [ -z $SINCE ]; then
6 | SINCE=50.years
7 | fi
8 |
9 | git log --since=$SINCE --numstat --pretty="%ae %H" | sed 's/@.*//g' | awk '{ if (NF == 1){ name = $1}; if(NF == 3) {plus[name] += $1; minus[name] += $2}} END { for (name in plus) {print name": +"plus[name]" -"minus[name]}}' | sort -k2 -gr
10 |
--------------------------------------------------------------------------------
/local/bin/privoxy_restart.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #set -e
4 | #set -x
5 |
6 | killall privoxy
7 | PORT=$(networksetup -getsocksfirewallproxy Wi-Fi | grep 'Port' | cut -d ' ' -f2)
8 | cp $HOME/local/etc/privoxy/config.template /usr/local/etc/privoxy/config
9 | /usr/local/bin/gsed -i "s/PORT/$PORT/g" /usr/local/etc/privoxy/config
10 |
11 | /usr/local/sbin/privoxy /usr/local/etc/privoxy/config
12 | networksetup -setsocksfirewallproxystate Wi-Fi off
13 |
--------------------------------------------------------------------------------
/local/bin/tsa:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ $(tmux ls | grep sa | wc -l) -gt 0 ]; then
4 | tmux attach -t sa
5 | exit
6 | fi
7 |
8 | tmux new -s sa -d
9 | for host in 12; do
10 | cmd='echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" > /home/admin/alswl/.ssh/auth_sock.sh && chmod 755 /home/admin/alswl/.ssh/auth_sock.sh && screen -rD sa_d'
11 | tmux neww -d -t $host -n "s$host" "ssh s$host -t '$cmd'"
12 | done
13 | tmux killw -t 0
14 |
15 | tmux attach -t sa
16 |
--------------------------------------------------------------------------------
/local/bin/puml-format-order-node:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # format plantuml file for ording description.
3 | # eg.
4 | #
5 | # original file:
6 | #
7 | # BigFish -> Bateway: 0. Request
8 | # Bateway -> openmonitor: 0.Forward
9 | #
10 | # after file:
11 | #
12 | # BigFish -> Bateway: 1. Request
13 | # Bateway -> openmonitor: 2.Forward
14 |
15 | cat $1 | sponge | perl -pe 's/(: +)(\d+)\. +/"$1".++$i.". "/e' | sponge $1
16 |
17 | # vim: set ft=sh:
18 |
--------------------------------------------------------------------------------
/local/bin/git-min-backup:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | DIR=$PWD
6 |
7 | if [ ! -z $1 ]; then
8 | DIR=$1
9 | fi
10 |
11 |
12 | if [[ $(git -C $DIR status --porcelain) ]]; then
13 | # Changes
14 | echo 'Error, Git Changed, exited'
15 | exit 1
16 | else
17 | # No changes
18 | echo -n ''
19 | fi
20 |
21 | DIR=$(greadlink -f $DIR)
22 | NAME=$(basename $DIR)
23 |
24 | git -C $DIR remote -v > $(dirname $DIR)/$NAME.git.archived
25 | trash $DIR
26 |
--------------------------------------------------------------------------------
/.gitignore_global:
--------------------------------------------------------------------------------
1 | ## Vim ##
2 |
3 | # Swap
4 | [._]*.s[a-v][a-z]
5 | [._]*.sw[a-p]
6 | [._]s[a-rt-v][a-z]
7 | [._]ss[a-gi-z]
8 | [._]sw[a-p]
9 |
10 | # Session
11 | Session.vim
12 |
13 | # Temporary
14 | .netrwhist
15 | *~
16 | # Auto-generated tag files
17 | /tags
18 | # Persistent undo
19 | [._]*.un~
20 |
21 | ## Jetbrains
22 |
23 | .idea
24 |
25 |
26 | ## My Global ##
27 |
28 | *.generated.html
29 | .DS_Store
30 | .java-version
31 | .python-version
32 | ~*
33 | .env
34 | .venv
35 |
--------------------------------------------------------------------------------
/.screenrc:
--------------------------------------------------------------------------------
1 | startup_message off # default: on
2 |
3 | autodetach on # default:on
4 |
5 | shell zsh
6 |
7 | encoding UTF-8
8 |
9 | caption always "%{=b}%{b}%{C}[stream]%{-} %+010=%-w%8L>%{uB .my}*%n %t%{-}%+w%-014< %-012=%{b m} "
10 |
11 | term screen-256color
12 |
13 | # bind F9 to "move to previous window"
14 | bindkey -k k9 prev
15 | # bind F10 to "move to next window"
16 | bindkey -k k; next
17 |
18 | # bind key see
19 | # http://web.mit.edu/gnu/doc/html/screen_toc.html#SEC82
20 |
--------------------------------------------------------------------------------
/local/bin/qrdecode:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # usage: # copy image data, and run qrdecode
3 |
4 | set -e
5 |
6 | check_command_installed() {
7 | name=$1
8 | brew_name=$2
9 | if ! [ -x "$(command -v $name)" ]; then
10 | echo "Error: Required GNU $name, try \`brew install $brew_name\`"
11 | exit 1
12 | fi
13 | }
14 | check_command_installed brew brew
15 | check_command_installed zbarimg zbarimg
16 | check_command_installed pngpaste pngpaste
17 |
18 | pngpaste /tmp/a.png && zbarimg /tmp/a.png
19 |
--------------------------------------------------------------------------------
/mac/phoenix/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "es6",
4 | "allowJs": false,
5 | "target": "es6",
6 | "strict": true,
7 | "pretty": true,
8 | "moduleResolution": "node",
9 | "typeRoots": [
10 | "./node_modules/@types",
11 | "./typings/globals/"
12 | ],
13 | "lib": [
14 | "es2017"
15 | ]
16 | },
17 | "include": [
18 | "./src/**/*"
19 | ],
20 | "exclude": [
21 | "node_modules",
22 | "**/*.spec.ts"
23 | ]
24 | }
25 |
--------------------------------------------------------------------------------
/linux/.Xmodmap:
--------------------------------------------------------------------------------
1 | ! clear
2 |
3 | !clear lock
4 | !clear control
5 | !clear mod1
6 | !clear mod4
7 |
8 | ! modify physical keycode to logical button
9 |
10 | !keycode 64 = Super_L Super_L Super_L Super_L
11 | !keycode 108 = Super_R Super_R Super_R Super_R
12 | !keycode 133 = Control_L Control_L Control_L Control_L
13 | !keycode 134 = Control_R Control_R Control_R Control_R
14 |
15 | ! add logical button to logical modifier group
16 |
17 | !add control = Caps_Lock Control_L Control_R
18 | !add mod4 = Super_L Super_R
19 |
--------------------------------------------------------------------------------
/local/bin/shj:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # shortcut command for ssh login
4 | # ssh-agent
5 | # tmux
6 | # tmux set window title
7 | # usage: shj 192.168.1.1
8 |
9 | SHORTCUT=$1
10 | #SHORTCUT=`echo $SHORTCUT | sed 's/^192\.168\.//g'`
11 | #SHORTCUT=`echo $SHORTCUT | sed 's/^192\.168\.//g'`
12 |
13 | # set tmux window title
14 | printf "\033k$SHORTCUT\033\\"
15 |
16 | ssh $SHORTCUT -A -t 'echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" > /home/hjdjc/.ssh/auth_sock.sh && chmod 755 /home/hjdjc/.ssh/auth_sock.sh && screen -RDU alswl'
17 |
18 | exit
19 |
--------------------------------------------------------------------------------
/local/bin/release-sbt-to-git-release-binary-branch.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -x
4 |
5 | sbt clean assembly
6 |
7 | GIT_HASH=$(git rev-parse --short HEAD)
8 | BRANCH=release-binary-$(date +%y%m%d.%H%M)-$GIT_HASH
9 | TAG=v-$(date +%y%m%d.%H%M)
10 |
11 | git tag $TAG
12 | git push origin $TAG
13 | git checkout --orphan $BRANCH
14 | cp target/scala-*/*-assembly-*.jar .
15 | git rm --cached -r .
16 | cp *-assembly-*.jar .
17 | git add -f *.jar
18 | git commit -a -m 'release'
19 | git push origin HEAD
20 | git checkout -f master
21 | git branch -D $BRANCH
22 |
--------------------------------------------------------------------------------
/local/bin/shadowsocks_client_start_hk.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | args=$(getopt -a -o: -l japan,hokong: -- $*) # Notice: Mac OSX 上面 getopt 非标准实现,需要安装 `brew install gnu-getopt`
4 | eval set -- "$args"
5 |
6 | for i; do
7 | case "$1" in
8 | -j | --japan)
9 | japan="1"
10 | shift 2
11 | ;;
12 | -h | --hongkong)
13 | terrier=$2
14 | shift 2
15 | ;;
16 | --)
17 | shift
18 | break
19 | ;;
20 | esac
21 | done
22 |
23 | ss-local -c /usr/local/etc/shadowsocks-libev_hk.json -b 127.0.0.1 -f /usr/local/var/run/ss-local.pid
24 |
--------------------------------------------------------------------------------
/local/bin/shadowsocks_client_start_jp.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | args=$(getopt -a -o: -l japan,hokong: -- $*) # Notice: Mac OSX 上面 getopt 非标准实现,需要安装 `brew install gnu-getopt`
4 | eval set -- "$args"
5 |
6 | for i; do
7 | case "$1" in
8 | -j | --japan)
9 | japan="1"
10 | shift 2
11 | ;;
12 | -h | --hongkong)
13 | terrier=$2
14 | shift 2
15 | ;;
16 | --)
17 | shift
18 | break
19 | ;;
20 | esac
21 | done
22 |
23 | ss-local -c /usr/local/etc/shadowsocks-libev_jp.json -b 127.0.0.1 -f /usr/local/var/run/ss-local.pid
24 |
--------------------------------------------------------------------------------
/.zshrc.etc.d/kube-promote.zshrc:
--------------------------------------------------------------------------------
1 | kube_prompt_info () {
2 | local context
3 | if [[ "$(command kubectl config get-contexts | grep '*' | wc -l | awk '{print $1}' 2>/dev/null)" != "0" ]]
4 | then
5 | context=$(command kubectl config get-contexts | grep '*' | awk '{print $2"@"$3}' 2> /dev/null) || return 0
6 | echo "%{%}(%{%}${context}%{%})%{%} "
7 | fi
8 | }
9 |
10 | load_kube_promote_info() {
11 | export PROMOTE='%{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)$(kube_prompt_info)${ret_status}%{$reset_color%} '
12 | export PS1="$PROMOTE"
13 | }
14 |
--------------------------------------------------------------------------------
/local/bin/paste-html-to-md:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | pbpaste |
4 | pandoc -f html --wrap none -t "markdown+pipe_tables-simple_tables-multiline_tables-raw_html-link_attributes" |
5 | gsed -E '/^
$/d' |
6 | gsed -E '/^<\/div>$/d' |
7 | gsed -E '/\s*:::\s*$/d' |
8 | gsed -E '/\s*:::\s* \{.+\}$/d' |
9 | gsed -E 's/\{\s?(\s*(#\S+)*|(\.[a-zA-Z0-9\-]+)*|([a-zA-Z0-9\-]+="[^"]+")*\s*)+\}//g' |
10 | gsed -E 's/\s+$//g' |
11 | gsed -E '/^$/N;/^\n$/D' |
12 | gsed -E '/^\[\[\[\]\]\]$/d' |
13 | gsed -E 's/^\\$//g' |
14 | gsed -E 's/^ $//g'
15 |
16 | # vim: set ft=sh:
17 |
--------------------------------------------------------------------------------
/mac/Library/LaunchAgents/com.alswl.edit-server.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Label
6 | com.alswl.edit-server
7 | LaunchOnlyOnce
8 |
9 | RunAtLoad
10 |
11 | ProgramArguments
12 |
13 | /bin/bash
14 | -c
15 | $HOME/local/bin/edit-server
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/diff/usr/local/share/zsh/site-functions/git-completion.bash.diff:
--------------------------------------------------------------------------------
1 | --- /usr/local/etc/bash_completion.d/git-completion.bash 2019-03-18 17:29:54.000000000 +0800
2 | +++ /usr/local/share/zsh/site-functions/git-completion.bash 2019-03-18 17:29:47.000000000 +0800
3 | @@ -1329,7 +1329,12 @@
4 | [ -n "$(__git_find_on_cmdline "$flags")" ]; then
5 | track_opt=''
6 | fi
7 | - __git_complete_refs $track_opt
8 | + #__git_complete_refs $track_opt
9 | + if [ "$command" = "checkoutr" ]; then
10 | + __git_complete_refs $track_opt
11 | + else
12 | + __gitcomp_nl "$(__git_heads '' $track)"
13 | + fi
14 | ;;
15 | esac
16 | }
17 |
--------------------------------------------------------------------------------
/local/bin/release-mvn-to-git-release-binary-branch.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 | set -x
5 |
6 | TARGET=$1
7 |
8 | REPO_PATH=$(git rev-parse --show-toplevel)
9 | REPO_NAME=$(basename $REPO_PATH)
10 |
11 | mvn clean package
12 | GIT_HASH=$(git rev-parse --short HEAD)
13 | BRANCH=$REPO_NAME-release-binary-$(date +%y%m%d.%H%M)-$GIT_HASH
14 | TAG=$REPO_NAME-$(date +%y%m%d.%H%M)
15 | git tag $TAG
16 | git push origin $TAG
17 | git checkout --orphan $BRANCH
18 | cp $TARGET .
19 | git rm --cached -r .
20 | git add -f *.jar
21 | git commit -a -m 'release'
22 | git push origin HEAD
23 | git checkout -f master
24 | git branch -D $BRANCH
25 |
--------------------------------------------------------------------------------
/.htoprc:
--------------------------------------------------------------------------------
1 | # Beware! This file is rewritten every time htop exits.
2 | # The parser is also very primitive, and not human-friendly.
3 | # (I know, it's in the todo list).
4 | fields=0 48 17 18 38 39 40 2 46 47 49 1
5 | sort_key=46
6 | sort_direction=1
7 | hide_threads=1
8 | hide_kernel_threads=1
9 | hide_userland_threads=1
10 | shadow_other_users=1
11 | highlight_base_name=0
12 | highlight_megabytes=1
13 | highlight_threads=0
14 | tree_view=0
15 | header_margin=1
16 | detailed_cpu_time=0
17 | color_scheme=0
18 | delay=15
19 | left_meters=AllCPUs Memory Swap
20 | left_meter_modes=1 1 1
21 | right_meters=Tasks LoadAverage Uptime
22 | right_meter_modes=2 2 2
23 |
--------------------------------------------------------------------------------
/linux/.xprofile:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | xrandr --output HDMI1 --brightness 0.85
4 | xrandr --output DP2 --brightness 0.85
5 | xrandr --output HDMI1 --primary
6 | xrandr --output DP2 --rotate normal --right-of HDMI1
7 |
8 | xset r rate 200 30
9 |
10 | export GTK_IM_MODULE=fcitx
11 | export QT_IM_MODULE=fcitx
12 | export XMODIFIERS=@im=fcitx
13 |
14 | xscreensaver -no-splash &
15 | numlockx &
16 | fcitx &
17 | #ibus-daemon -drx
18 | dropbox &
19 | copyq &
20 | xclip &
21 | albert &
22 | rescuetime &
23 | shutter --min_at_startup &
24 |
25 | /usr/bin/feh --randomize --bg-scale $HOME/Pictures/bing-wallpapers.all
26 | wmname LG3D
27 |
28 | #exec awesome
29 | #exec i3
30 |
--------------------------------------------------------------------------------
/VimFx-custom/bootstrap.js:
--------------------------------------------------------------------------------
1 | let {classes: Cc, interfaces: Ci, utils: Cu} = Components
2 | function startup() {
3 | Cu.import('resource://gre/modules/Services.jsm')
4 | Cu.import('resource://gre/modules/devtools/Console.jsm')
5 | let apiPref = 'extensions.VimFx.api_url'
6 | let apiUrl = Services.prefs.getComplexValue(apiPref, Ci.nsISupportsString).data
7 | Cu.import(apiUrl, {}).getAPI(vimfx => {
8 | let path = __SCRIPT_URI_SPEC__.replace('bootstrap.js', 'vimfx.js')
9 | let scope = {Cc, Ci, Cu, vimfx}
10 | Services.scriptloader.loadSubScript(path, scope, 'UTF-8')
11 | })
12 | }
13 | function shutdown() {}
14 | function install() {}
15 | function uninstall() {}
--------------------------------------------------------------------------------
/local/bin/resize-img:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # using imagemagic to resize image
3 |
4 | set -e
5 |
6 | file_name=$1
7 | size=$2
8 |
9 | check_command_installed() {
10 | name=$1
11 | brew_name=$2
12 | if ! [ -x "$(command -v $name)" ]; then
13 | echo "Error: Required GNU $name, try \`brew install $brew_name\`"
14 | exit 1
15 | fi
16 | }
17 |
18 | check_command_installed mogrify
19 |
20 | if [ -z "$file_name" ]; then
21 | echo "Useage: resize-img filename [widthxheight]"
22 | exit 0
23 | fi
24 | if [ -z "$size" ]; then
25 | size='1200x1200'
26 | fi
27 |
28 | cp "$file_name" "$file_name.original"
29 | mogrify -resize $size "$file_name"
30 |
31 | # vim: set ft=sh:
32 |
--------------------------------------------------------------------------------
/.webterm.lua:
--------------------------------------------------------------------------------
1 | -- Pull in the wezterm API
2 | local wezterm = require 'wezterm'
3 |
4 | -- This will hold the configuration.
5 | local config = wezterm.config_builder()
6 |
7 | -- This is where you actually apply your config choices
8 |
9 | -- For example, changing the color scheme:
10 | -- config.color_scheme = 'AdventureTime'
11 | -- config.font = wezterm.font 'Monaco'
12 | config.font = wezterm.font("Monaco", {weight="Regular", stretch="Normal", style="Normal"})
13 | -- config.font = wezterm.font 'Menlo'
14 | config.font_size = 13.0
15 |
16 | config.default_prog = { '/opt/homebrew/bin/tmux' }
17 |
18 |
19 | -- and finally, return the configuration to wezterm
20 | return config
21 |
--------------------------------------------------------------------------------
/local/bin/mouse_restore.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | ## Save
4 | # get current postion, save to last
5 | CURRENT_WINDOW=iTerm
6 | [ -f /tmp/SLATE_M_CURR ] && CURRENT_WINDOW=$(cat /tmp/SLATE_M_CURR)
7 |
8 | # save now pos
9 |
10 | NOW_POS=$(/usr/local/bin/cliclick p | /usr/bin/awk '{print $4}')
11 | echo $NOW_POS >/tmp/SLATE_M_$CURRENT_WINDOW
12 |
13 | ## Restore
14 | if [ $1 != '' ]; then
15 | # get wanted position
16 | POS=500,400
17 | [ -f /tmp/SLATE_M_$1 ] && POS=$(cat /tmp/SLATE_M_$1)
18 |
19 | # restore postion
20 | /usr/local/bin/cliclick m:$POS
21 |
22 | #LAST_WINDOW=iTerm
23 | #[ -f /tmp/SLATE_M_LAST_WINDOW ] && LAST_WINDOW=`cat /tmp/SLATE_M_LAST_WINDOW`
24 | echo $1 >/tmp/SLATE_M_CURR
25 | fi
26 |
--------------------------------------------------------------------------------
/local/bin/unzip-gbk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | import os
5 | import sys
6 | import zipfile
7 |
8 | print
9 | "Processing File " + sys.argv[1]
10 |
11 | zip_file = zipfile.ZipFile(sys.argv[1], "r");
12 |
13 | for name in zip_file.namelist():
14 | utf8name = name.decode('gbk')
15 | print
16 | "Extracting " + utf8name
17 | pathname = os.path.dirname(utf8name)
18 | if not os.path.exists(pathname) and pathname != "":
19 | os.makedirs(pathname)
20 | data = zip_file.read(name)
21 | if not os.path.exists(utf8name):
22 | output_file = open(utf8name, "w")
23 | output_file.write(data)
24 | output_file.close()
25 |
26 | zip_file.close()
27 |
--------------------------------------------------------------------------------
/.config/kitty/theme.conf:
--------------------------------------------------------------------------------
1 | background #202020
2 | foreground #adadad
3 | cursor #ffffff
4 | selection_background #1a3272
5 | color0 #000000
6 | color8 #545454
7 | color1 #fa5355
8 | color9 #fb7172
9 | color2 #126e00
10 | color10 #67ff4f
11 | color3 #c2c300
12 | color11 #ffff00
13 | color4 #4581eb
14 | color12 #6d9df1
15 | color5 #fa54ff
16 | color13 #fb82ff
17 | color6 #33c2c1
18 | color14 #60d3d1
19 | color7 #adadad
20 | color15 #eeeeee
21 | selection_foreground #202020
22 |
--------------------------------------------------------------------------------
/local/bin/lark-gen-markdown:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | OUTPUT_DIR=./.output
6 |
7 | rm -rf $OUTPUT_DIR/*
8 | touch $OUTPUT_DIR/.gitkeep
9 | cp .lark.yml $OUTPUT_DIR/lark.yml
10 |
11 | for FILE_NAME in $(find . -type f -name "*.md"); do
12 | NEW_FILE_NAME=$OUTPUT_DIR/${FILE_NAME%.*}.md
13 | mkdir -p $(dirname $NEW_FILE_NAME)
14 | cat $FILE_NAME | pandoc -f markdown -t markdown_github --wrap=none >$NEW_FILE_NAME 2>/dev/null
15 | echo "" >>$NEW_FILE_NAME
16 | echo "" >>$NEW_FILE_NAME
17 | echo "" >>$NEW_FILE_NAME
18 | done
19 |
20 | for ASSETS_DIR in $(find . -type d -name "*.assets"); do
21 | rsync -q -avr $ASSETS_DIR/ $OUTPUT_DIR/$ASSETS_DIR/
22 | done
23 |
24 | generate-output-summary-md
25 |
--------------------------------------------------------------------------------
/local/bin/tinypng:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # set token in your `~/.zshrc.etc.d/tinypng.zshrc`,
3 | # export TINYPNG_API_SECRECT=YOUR-TOKEN-HERE
4 |
5 | set -e
6 |
7 | file_name=$1
8 |
9 | check_command_installed() {
10 | name=$1
11 | brew_name=$2
12 | if ! [ -x "$(command -v $name)" ]; then
13 | echo "Error: Required GNU $name, try \`brew install $brew_name\`"
14 | exit 1
15 | fi
16 | }
17 |
18 | if [ -z "$file_name" ]; then
19 | echo "Useage: tinypng filename"
20 | exit 0
21 | fi
22 | check_command_installed jq jq
23 |
24 | cp "$file_name" "$file_name.original"
25 | url=$(curl -s --user "api:${TINYPNG_API_SECRECT}" --data-binary "@$file_name" https://api.tinify.com/shrink | jq -r ".output.url")
26 | wget $url -O "$file_name"
27 |
28 | # vim: set ft=sh:
29 |
--------------------------------------------------------------------------------
/local/bin/image-from-clipboard-to-png-global:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | IMAGE_DIR="$HOME/Desktop/md/assets/"
4 | URL_PREFIX=$IMAGE_DIR
5 | test -d $IMAGE_DIR || mkdir -p $IMAGE_DIR
6 |
7 | FILE_NAME=$1
8 |
9 | if [ -z $FILE_NAME ]; then
10 | FILE_NAME="paste-$(date '+%Y%m%d-%H%M%S').png"
11 | else
12 | FILE_NAME=$FILE_NAME".png"
13 | fi
14 |
15 | if [ $(uname) = 'Darwin' ]; then
16 | PNGPASTE_BIN="/usr/local/bin/pngpaste"
17 | $PNGPASTE_BIN "$IMAGE_DIR/$FILE_NAME"
18 | echo -n "" | tee | pbcopy
19 | elif [ $(uname -s) = 'Linux' ] || [ $(uname -o) = 'Cygwin' ]; then
20 | xclip -selection clipboard -t image/png -o >"$IMAGE_DIR/$FILE_NAME"
21 | echo -n "" | tee | xclip -selection clipboard
22 | fi
23 |
--------------------------------------------------------------------------------
/local/bin/mdmv:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # rename markdown file with assets
3 |
4 | if [ "$#" -eq 2 ]; then
5 | source_path=$1
6 | target_path=$2
7 | fi
8 |
9 | if [ ! -f "${source_path}" ]; then
10 | echo "Error: Cannot find ${source_path}"
11 | exit 1
12 | fi
13 | if [ -f "${target_path}" ]; then
14 | echo "Error: ${target_path} exist"
15 | exit 1
16 | fi
17 |
18 | source_base_name=$(basename "${source_path}")
19 | target_base_name=$(basename "${target_path}")
20 |
21 | mv "${source_path}" "${target_path}"
22 |
23 | if [ -d "${source_path}.assets" ]; then
24 | mv "${source_path}.assets" "${target_path}.assets"
25 | perl -p -i -e 's/(?<=\!\[.{0,100}\]\(.{0,100})'"${source_base_name}"'(?=\.assets\/.+\))/'"${target_base_name}"'/g' "${target_path}"
26 | fi
27 |
28 | # vim: set ft=sh:
29 |
--------------------------------------------------------------------------------
/local/bin/mdsearch:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # mdsearch = markdown search
3 |
4 | positional=()
5 | while [[ $# -gt 0 ]]; do
6 | key="$1"
7 |
8 | case $key in
9 | -l | --lib)
10 | list=YES
11 | shift # past argument
12 | ;;
13 | *) # unknown option
14 | positional+=("$1") # save it in an array for later
15 | shift # past argument
16 | ;;
17 | esac
18 | done
19 |
20 | if [ "${#positional[@]}" -eq 1 ]; then
21 | dir=.
22 | text=${positional[0]}
23 | elif [ "${#positional[@]}" -eq 2 ]; then
24 | dir=${positional[0]}
25 | text=${positional[1]}
26 | fi
27 |
28 | parameters="-i --markdown"
29 |
30 | if [ "$list" = "YES" ]; then
31 | parameters="$parameters -l"
32 | fi
33 |
34 | ag $parameters "^#(.*$text.*)" $dir
35 |
36 | # vim: set ft=sh:
37 |
--------------------------------------------------------------------------------
/mac/phoenix/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "@types/lodash": "^4.14.195",
4 | "@types/phoenix": "github:mafredri/phoenix-typings#main",
5 | "awesome-typescript-loader": "^5.2.1",
6 | "lodash": "^4.17.21",
7 | "source-map-loader": "^4.0.1",
8 | "ts-loader": "^9.4.4",
9 | "tslint": "^6.1.0",
10 | "typescript": "^5.1.6",
11 | "typings": "^2.1.1",
12 | "webpack": "^5.88.1",
13 | "webpack-cli": "^5.1.4"
14 | },
15 | "name": "phoenix_configuration_ts",
16 | "version": "1.0.0",
17 | "main": "webpack.config.js",
18 | "scripts": {
19 | "test": "echo \"Error: no test specified\" && exit 1"
20 | },
21 | "keywords": [],
22 | "author": "",
23 | "license": "ISC",
24 | "description": "",
25 | "repository": "git@github.com:alswl/.oOo..git"
26 | }
27 |
--------------------------------------------------------------------------------
/local/bin/image-from-clipboard-to-png-copy-markdown:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DOC_NAME=$1
4 | if [ -z $DOC_NAME ]; then
5 | exit 1
6 | fi
7 |
8 | IMAGE_DIR="./${DOC_NAME%.*}.assets"
9 | URL_PREFIX=$IMAGE_DIR
10 | test -d $IMAGE_DIR || mkdir -p $IMAGE_DIR
11 |
12 | FILE_NAME=$2
13 |
14 | if [ -z $FILE_NAME ]; then
15 | FILE_NAME="paste-$(date '+%Y%m%d-%H%M%S').png"
16 | else
17 | FILE_NAME=$FILE_NAME".png"
18 | fi
19 |
20 | if [ $(uname) = 'Darwin' ]; then
21 | PNGPASTE_BIN="/usr/local/bin/pngpaste"
22 | $PNGPASTE_BIN "$IMAGE_DIR/$FILE_NAME"
23 | echo -n "" | tee | pbcopy
24 | elif [ $(uname -s) = 'Linux' ] || [ $(uname -o) = 'Cygwin' ]; then
25 | xclip -selection clipboard -t image/png -o >"$IMAGE_DIR/$FILE_NAME"
26 | echo -n "" | tee | xclip -selection clipboard
27 | fi
28 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Vim ##
2 |
3 | *.s[a-w][a-z]
4 | *.un~
5 | Session.vim
6 | .netrwhist
7 | *~
8 |
9 | ## Project ##
10 |
11 | .vimperator/info/
12 | .pentadactyl/info/
13 | .pip/pip.log
14 | .pip/zsh-cache
15 |
16 | .gitmessage.txt
17 | .fonts/.uuid
18 | .fonts/ttf-dejavu-powerline/.uuid
19 | *.generated.html
20 | .DS_Store
21 | .java-version
22 | .python-version
23 | .zshrc.etc.d/alibaba.zshrc
24 | .zshrc.etc.d/tinypng.zshrc
25 | node_modules
26 | dist
27 | package-lock.json
28 | typings
29 | .zshrc.etc.d/*alibaba*.zshrc
30 | .zshrc.etc.d/*secrets*.zshrc
31 | .config/goneovim/sessions
32 | .zsh_completion/_baiyan
33 | .zsh_completion/_sofa
34 | .zsh_completion/_antcode
35 | .zshrc.etc.d/_*.zshrc
36 | .config/kitty/kitty.d/local/*
37 | .zsh_completion/_cpt
38 | .zsh_completion/_aone
39 | .zsh_completion/_hrctl
40 | .zsh_completion/_dima
41 | .zsh_completion/_cloudinc
42 | .zsh_completion/_isee
43 |
--------------------------------------------------------------------------------
/VimFx-custom/install.rdf:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 | VimFx-custom
8 | VimFx-custom@vimfx.org
9 | 1
10 |
11 |
12 | true
13 | true
14 | 2
15 |
16 |
17 | {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
18 | 38
19 | *
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/local/bin/image-from-path-to-assets-copy-markdown:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DOC_NAME=$1
4 | if [ -z $DOC_NAME ]; then
5 | exit 1
6 | fi
7 |
8 | IMAGE_DIR="./${DOC_NAME%.*}.assets"
9 | URL_PREFIX=$IMAGE_DIR
10 | test -d $IMAGE_DIR || mkdir -p $IMAGE_DIR
11 |
12 | if [ $(uname) = 'Darwin' ]; then
13 | SOURCE=$(pbpaste)
14 | elif [ $(uname -s) = 'Linux' ] || [ $(uname -o) = 'Cygwin' ]; then
15 | SOURCE=$(xselect -selection -o)
16 | fi
17 |
18 | FILE_NAME=$2
19 | if [ -z $FILE_NAME ]; then
20 | FILE_NAME=$(basename "$SOURCE")
21 | else
22 | FILE_NAME=$FILE_NAME".png"
23 | fi
24 |
25 | cp "$SOURCE" "$IMAGE_DIR/$FILE_NAME"
26 |
27 | if [ $(uname) = 'Darwin' ]; then
28 | echo -n "" | tee | pbcopy
29 | elif [ $(uname -s) = 'Linux' ] || [ $(uname -o) = 'Cygwin' ]; then
30 | echo -n "" | tee | xclip -selection clipboard
31 | fi
32 |
--------------------------------------------------------------------------------
/local/bin/generate-output-summary-md:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | check_command_installed() {
4 | NAME=$1
5 | BREW_NAME=$2
6 | if ! [ -x "$(command -v $NAME)" ]; then
7 | echo "Error: Required GNU $NAME, try \`brew install $BREW_NAME\`"
8 | exit 1
9 | fi
10 | }
11 |
12 | if [ $(uname) = 'Darwin' ]; then
13 | check_command_installed gsed gnu-sed
14 | fi
15 |
16 | mkdir -p .output
17 | echo -n '' >.output/summary.md
18 | # ls *.md | sed 's/.md//g' | grep -v summary | awk '{print "- ["$0"]("$0")"}'
19 |
20 | for file in $(gfind . -name "*.md" -printf "%T+\t%p\n" | awk '{print $2}' | gsed 's/^\.\///g' | grep -v .output | grep -v summary.md | gsort -h); do
21 | TITLE=$(cat $file | grep -m 1 '^# ' | awk -F '#' '{gsub(/[ \t]+$/, "", $2);gsub(/^[ \t]+/, "", $2); print $2}')
22 | NAME=$(echo $file | sed 's/.md//g' | awk -F '/' '{print $NF}')
23 | echo "- [$TITLE]($NAME)" >>.output/summary.md
24 | done
25 |
26 | # vim: set ft=sh:
27 |
--------------------------------------------------------------------------------
/local/bin/ddns-by-cloudflare-wan:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # set domain A record with public IP
3 | # Usage: ddns-by-cloudflare-wan
4 |
5 | set -e
6 |
7 | DOMAIN=$1
8 | ZONE_ID=$2
9 | RECORD_ID=$3
10 | TOKEN=$4
11 |
12 | if [ -z $DOMAIN ] || [ -z $ZONE_ID ] || [ -z $RECORD_ID ] || [ -z $TOKEN ]; then
13 | echo "error auguments"
14 | echo "Usage: ddns-by-cloudflare-wan "
15 | exit 0
16 | fi
17 |
18 | IP=$(curl -s https://ifconfig.me);
19 | C_IP=$(drill $DOMAIN | grep "^$DOMAIN" | awk '{print $5}')
20 |
21 | [ "$IP" = "$C_IP" ] && exit 0
22 | [ -z $IP ] && exit 0
23 |
24 |
25 | curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records/${RECORD_ID}" \
26 | -H "Authorization: Bearer ${TOKEN}" \
27 | -H "Content-Type: application/json" \
28 | --data "{\"type\":\"A\",\"name\":\"${DOMAIN}\",\"content\":\"${IP}\",\"proxied\":false}"
29 |
30 | # vim: set ft=sh:
31 |
--------------------------------------------------------------------------------
/local/bin/mov2gif:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # By: Hua Liang [Stupid ET]
3 | # Website: http://EverET.org
4 | # brew install ffmpeg imagemagick gifsicle
5 |
6 |
7 | check_command_installed() {
8 | name=$1
9 | brew_name=$2
10 | if ! [ -x "$(command -v $name)" ]; then
11 | echo "Error: Required GNU $name, try \`brew install $brew_name\`"
12 | exit 1
13 | fi
14 | }
15 |
16 | check_command_installed ffmpeg ffmpeg
17 | check_command_installed convert imagemagick
18 | check_command_installed gifsicle gifsicle
19 |
20 | mov_file=$1
21 | gif_file=$2
22 |
23 | if [ -z "$mov_file" ]; then
24 | echo "Useage: mov2gif mov_file gif_file"
25 | exit 0
26 | fi
27 |
28 | if [ -z "$gif_file" ]; then
29 | echo "Useage: mov2gif mov_file gif_file"
30 | exit 0
31 | fi
32 |
33 | ffmpeg -i $mov_file -r 10 -f image2pipe -vcodec ppm - | convert -verbose +dither -layers Optimize -resize 640x640\> - gif:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - >$gif_file
34 |
--------------------------------------------------------------------------------
/local/bin/ddns-by-dnspod:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DEVICE=$1
4 | SUB_DOMAIN=$2
5 | BASE_DOMAIN=$3
6 | DOMAIN_ID=$4
7 | RECORD_ID=$5
8 | TOKEN=$6
9 |
10 | if [ -z $DEVICE ] || [ -z $SUB_DOMAIN ] || [ -z $BASE_DOMAIN ] || [ -z $DOMAIN_ID ] || [ -z $RECORD_ID ] || [ -z $TOKEN ]; then
11 | echo "error auguments"
12 | exit 0
13 | fi
14 |
15 | DOMAIN="$SUB_DOMAIN.$BASE_DOMAIN"
16 | IP=$(ifconfig | grep $DEVICE: -A 4 | grep "inet " | tail -n 1 | awk '{print $2}')
17 | C_IP=$(drill $DOMAIN | grep "^$DOMAIN" | awk '{print $5}')
18 |
19 | [ "$IP" = "$C_IP" ] && exit 0
20 | [ -z $IP ] && exit 0
21 |
22 | #record_list_json=$(curl -s https://dnsapi.cn/Record.List -d "domain=$BASE_DOMAIN&sub_domain=$SUB_DOMAIN&record_type=A&record_line=默认&login_token=$TOKEN&format=json")
23 |
24 | curl -s https://dnsapi.cn/Record.Modify -d "domain_id=$DOMAIN_ID&record_id=$RECORD_ID&sub_domain=$SUB_DOMAIN&record_type=A&record_line=默认&value=$IP&login_token=$TOKEN&format=json"
25 |
26 | # vim: set ft=sh:
27 |
--------------------------------------------------------------------------------
/local/bin/mdcp:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # copy markdown file with assets
3 |
4 | if [ "$#" -eq 2 ]; then
5 | source_path=$1
6 | target_path=$2
7 | fi
8 |
9 | if [ ! -f "${source_path}" ]; then
10 | echo "Error: Cannot find ${source_path}"
11 | exit 1
12 | fi
13 | if [ -f "${target_path}" ]; then
14 | echo "Error: ${target_path} exist"
15 | exit 1
16 | fi
17 |
18 | source_base_name=$(basename "${source_path}")
19 | target_base_name=$(basename "${target_path}")
20 | #if [ -d "${target_path}" ]; then
21 | #target_base_name="$target_path"/""
22 | #target_path="$target_path"/"${source_path##*/}"
23 | #else
24 | #target_base_name=$(basename "${target_path}")
25 | #fi
26 |
27 | cp "${source_path}" "${target_path}"
28 |
29 | if [ -d "${source_path}.assets" ]; then
30 | cp -R "${source_path}.assets" "${target_path}.assets"
31 | perl -p -i -e 's/(?<=\!\[.{0,100}\]\(.{0,100})'"${source_base_name}"'(?=\.assets\/.+\))/'"${target_base_name}"'/g' "${target_path}"
32 | fi
33 |
34 | # vim: set ft=sh:
35 |
--------------------------------------------------------------------------------
/local/bin/ddns-by-cloudflare:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Usage: ddns-by-cloudflare.sh
3 |
4 | set -e
5 |
6 | DEVICE=$1
7 | DOMAIN=$2
8 | ZONE_ID=$3
9 | RECORD_ID=$4
10 | TOKEN=$5
11 |
12 | if [ -z $DEVICE ] || [ -z $DOMAIN ] || [ -z $ZONE_ID ] || [ -z $RECORD_ID ] || [ -z $TOKEN ]; then
13 | echo "error auguments"
14 | echo "Usage: ddns-by-cloudflare.sh "
15 | exit 0
16 | fi
17 |
18 | IP=$(ifconfig | grep $DEVICE: -A 4 | grep "inet " | tail -n 1 | awk '{print $2}')
19 | C_IP=$(drill $DOMAIN | grep "^$DOMAIN" | awk '{print $5}')
20 |
21 | [ "$IP" = "$C_IP" ] && exit 0
22 | [ -z $IP ] && exit 0
23 |
24 |
25 | curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records/${RECORD_ID}" \
26 | -H "Authorization: Bearer ${TOKEN}" \
27 | -H "Content-Type: application/json" \
28 | --data "{\"type\":\"A\",\"name\":\"${DOMAIN}\",\"content\":\"${IP}\",\"proxied\":false}"
29 |
30 | # vim: set ft=sh:
31 |
--------------------------------------------------------------------------------
/local/bin/socks5proxywrapper:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -e
4 |
5 | if [ 0 = $# ]; then
6 | echo "export GIT_PROXY_COMMAND='$(which $0)'"
7 | exit 0
8 | fi
9 |
10 | SOCKS_SERVER=127.0.0.1
11 | SOCKS_PORT=1234
12 | SYSTEM_PROXY_ENABLED=$(networksetup -getsocksfirewallproxy Wi-Fi | grep '^Enabled' | cut -d ' ' -f2)
13 | SYSTEM_PROXY_PORT=$(networksetup -getsocksfirewallproxy Wi-Fi | grep 'Port' | cut -d ' ' -f2)
14 | if [[ $SYSTEM_PROXY_ENABLED = "Yes" ]] && [[ $SYSTEM_PROXY_PORT != "0" ]]; then
15 | SOCKS_PORT=$SYSTEM_PROXY_PORT
16 | fi
17 |
18 | # sniproxy
19 | #SOCKS_SERVER=192.168.203.11
20 | #SOCKS_PORT=80
21 | #SOCKS_PORT=443
22 |
23 | if [ $(uname) = 'Darwin' ]; then
24 | # https://bitbucket.org/gotoh/connect
25 | # https://github.com/gotoh/ssh-connect
26 | connect -S ${SOCKS_SERVER}:${SOCKS_PORT} "$@"
27 | elif [ $(uname -s) = 'Linux' ] || [ $(uname -o) = 'Cygwin' ]; then
28 | # openbsd-netcat
29 | exec nc -x${SOCKS_SERVER}:${SOCKS_PORT} -X5 $@
30 | fi
31 |
32 | # socat
33 | # exec socat STDIO SOCKS4:${SOCKS_SERVER}:$1:$2,socksport=${SOCKS_PORT}
34 |
--------------------------------------------------------------------------------
/mac/phoenix/src/app.ts:
--------------------------------------------------------------------------------
1 | import * as _ from "lodash";
2 | import {restoreMousePositionForWindow, saveMousePositionForWindow} from './mouse';
3 | import {getCurrentWindow} from "./window";
4 |
5 | /**
6 | * App Functions
7 | */
8 | // switch app, and remember mouse position
9 | export function callApp(appName: string, orAppName?: string) {
10 | const window = getCurrentWindow();
11 | if (window !== undefined) {
12 | saveMousePositionForWindow(window);
13 | }
14 | let app: App | undefined = App.launch(appName);
15 | // backup app
16 | if (app === undefined && orAppName) {
17 | app = App.launch(orAppName);
18 | }
19 | if (app === undefined) {
20 | return;
21 | }
22 | const mainWindow = app.mainWindow();
23 | if (mainWindow === undefined) {
24 | return;
25 | }
26 | if (window !== undefined && window.hash() === mainWindow.hash()) {
27 | return;
28 | }
29 |
30 | Timer.after(0.300, () => {
31 | (app as App).focus();
32 | restoreMousePositionForWindow((app as App).mainWindow());
33 | });
34 | }
35 |
--------------------------------------------------------------------------------
/local/bin/ddns-by-dnspod-wan:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # set domain A record with public IP
3 | # Usage: ddns-by-dnspod
4 |
5 | SUB_DOMAIN=$1
6 | BASE_DOMAIN=$2
7 | DOMAIN_ID=$3
8 | RECORD_ID=$4
9 | TOKEN=$5
10 |
11 | if [ -z $SUB_DOMAIN ] || [ -z $BASE_DOMAIN ] || [ -z $DOMAIN_ID ] || [ -z $RECORD_ID ] || [ -z $TOKEN ]; then
12 | echo "error auguments"
13 | echo "Usage: ddns-by-dnspod "
14 | exit 0
15 | fi
16 |
17 | DOMAIN="$SUB_DOMAIN.$BASE_DOMAIN"
18 | IP=$(curl -s https://ifconfig.me);
19 | C_IP=$(drill $DOMAIN | grep "^$DOMAIN" | awk '{print $5}')
20 |
21 | [ "$IP" = "$C_IP" ] && exit 0
22 | [ -z $IP ] && exit 0
23 |
24 | #record_list_json=$(curl -s https://dnsapi.cn/Record.List -d "domain=$BASE_DOMAIN&sub_domain=$SUB_DOMAIN&record_type=A&record_line=默认&login_token=$TOKEN&format=json")
25 |
26 | curl -s https://dnsapi.cn/Record.Modify -d "domain_id=$DOMAIN_ID&record_id=$RECORD_ID&sub_domain=$SUB_DOMAIN&record_type=A&record_line=默认&value=$IP&login_token=$TOKEN&format=json"
27 |
28 | # vim: set ft=sh:
29 |
--------------------------------------------------------------------------------
/local/bin/view-pyc-file:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import platform
4 | import time
5 | import sys
6 | import binascii
7 | import marshal
8 | import dis
9 | import struct
10 |
11 |
12 | def view_pyc_file(path):
13 | """Read and display a content of the Python`s bytecode in a pyc-file."""
14 |
15 | file = open(path, 'rb')
16 |
17 | magic = file.read(4)
18 | timestamp = file.read(4)
19 | size = None
20 |
21 | if sys.version_info.major == 3 and sys.version_info.minor >= 3:
22 | size = file.read(4)
23 | size = struct.unpack('I', size)[0]
24 |
25 | code = marshal.load(file)
26 |
27 | magic = binascii.hexlify(magic).decode('utf-8')
28 | timestamp = time.asctime(time.localtime(struct.unpack('I', b'D\xa5\xc2X')[0]))
29 |
30 | dis.disassemble(code)
31 |
32 | print('-' * 80)
33 | print(
34 | 'Python version: {}\nMagic code: {}\nTimestamp: {}\nSize: {}'
35 | .format(platform.python_version(), magic, timestamp, size)
36 | )
37 |
38 | file.close()
39 |
40 |
41 | if __name__ == '__main__':
42 | view_pyc_file(sys.argv[1])
43 |
44 | # vim: set ft=python:
45 |
--------------------------------------------------------------------------------
/local/bin/view-pyc-file3:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import platform
4 | import time
5 | import sys
6 | import binascii
7 | import marshal
8 | import dis
9 | import struct
10 |
11 |
12 | def view_pyc_file(path):
13 | """Read and display a content of the Python`s bytecode in a pyc-file."""
14 |
15 | file = open(path, 'rb')
16 |
17 | magic = file.read(4)
18 | timestamp = file.read(4)
19 | size = None
20 |
21 | if sys.version_info.major == 3 and sys.version_info.minor >= 3:
22 | size = file.read(4)
23 | size = struct.unpack('I', size)[0]
24 |
25 | code = marshal.load(file)
26 |
27 | magic = binascii.hexlify(magic).decode('utf-8')
28 | timestamp = time.asctime(time.localtime(struct.unpack('I', b'D\xa5\xc2X')[0]))
29 |
30 | dis.disassemble(code)
31 |
32 | print('-' * 80)
33 | print(
34 | 'Python version: {}\nMagic code: {}\nTimestamp: {}\nSize: {}'
35 | .format(platform.python_version(), magic, timestamp, size)
36 | )
37 |
38 | file.close()
39 |
40 |
41 | if __name__ == '__main__':
42 | view_pyc_file(sys.argv[1])
43 |
44 | # vim: set ft=python:
45 |
--------------------------------------------------------------------------------
/linux/.Xresources:
--------------------------------------------------------------------------------
1 | !Set background color and transparent property
2 | URxvt.background: rgba:0010/0010/0010/cccc
3 | URxvt.foreground: #CBCB7A
4 |
5 | !Black
6 | URxvt.color0: #000000
7 | URxvt.color8: #555753
8 | !Red
9 | URxvt.color1: #CC0000
10 | URxvt.color9: #EF2929
11 | !Green
12 | URxvt.color2: #4E9A06
13 | URxvt.color10: #8AE234
14 | !Yellow
15 | URxvt.color3: #C4A000
16 | URxvt.color11: #FCE94F
17 | !Blue
18 | URxvt.color4: #3465A4
19 | URxvt.color12: #729FCF
20 | !Magenta
21 | URxvt.color5: #75507B
22 | URxvt.color13: #AD7FA8
23 | !Cyan
24 | URxvt.color6: #06989A
25 | URxvt.color14: #34E2E2
26 | !White
27 | URxvt.color7: #D3D7CF
28 | URxvt.color15: #EEEEEC
29 |
30 | !Replace these font settings by your favorate
31 | URxvt*font: xft:Monospace:size=12:antialias=true
32 |
33 | URxvt.scrollbar: False
34 | ! Use shift+pageup/down to scroll in screen
35 | URxvt.secondaryScroll: true
36 |
37 | !!Enable the tab and link
38 | URxvt.perl-ext-common: default,matcher
39 | !!Set the default browser
40 | URxvt.urlLauncher: firefox
41 | URxvt.matcher.button: 1
42 |
43 | URxvt.depth: 32
44 |
45 | URxvt*keysym.Home: \033[1~
46 | URxvt*keysym.End: \033[4~
47 |
--------------------------------------------------------------------------------
/mac/phoenix/webpack.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | mode: "development",
3 | //mode: "production",
4 | //entry: "./src/phoenix.ts",
5 | entry: "./src/phoenix.ts",
6 | output: {
7 | filename: "./phoenix.js",
8 | },
9 |
10 | // Enable sourcemaps for debugging webpack's output.
11 | //devtool: "source-map",
12 |
13 | resolve: {
14 | // Add '.ts' and '.tsx' as resolvable extensions.
15 | extensions: [".ts", ".js"]
16 | },
17 |
18 | module: {
19 | rules: [
20 | {
21 | test: /\.ts(x?)$/,
22 | exclude: /node_modules/,
23 | use: [
24 | {
25 | //loader: "awesome-typescript-loader"
26 | loader: "ts-loader"
27 | }
28 | ]
29 | },
30 | // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
31 | {
32 | enforce: "pre",
33 | test: /\.js$/,
34 | loader: "source-map-loader"
35 | }
36 | ]
37 | },
38 |
39 | // Other options...
40 | };
41 |
--------------------------------------------------------------------------------
/local/bin/iterm2-send-zmodem.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Author: Matt Mastracci (matthew@mastracci.com)
3 | # AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
4 | # licensed under cc-wiki with attribution required
5 | # Remainder of script public domain
6 |
7 | osascript -e 'tell application "iTerm2" to version' >/dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
8 | if [[ $NAME = "iTerm" ]]; then
9 | FILE=$(osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")")
10 | else
11 | FILE=$(osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")")
12 | fi
13 | if [[ $FILE = "" ]]; then
14 | echo Cancelled.
15 | # Send ZModem cancel
16 | echo -e \\x18\\x18\\x18\\x18\\x18
17 | sleep 1
18 | echo
19 | echo \# Cancelled transfer
20 | else
21 | /usr/local/bin/sz "$FILE" -e -b
22 | sleep 1
23 | echo
24 | echo \# Received $FILE
25 | fi
26 |
--------------------------------------------------------------------------------
/linux/.config/fontconfig/fonts.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Noto Color Emoji
7 |
8 |
9 | true
10 |
11 |
12 | 18
13 |
14 |
15 |
16 |
17 | sans-serif
18 |
19 | Noto Color Emoji
20 |
21 |
22 |
23 |
24 | monospace
25 |
26 | Noto Color Emoji
27 |
28 |
29 |
30 |
31 | serif
32 |
33 | Noto Color Emoji
34 |
35 |
36 |
37 |
38 | Apple Color Emoji
39 |
40 | Noto Color Emoji
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/local/bin/homebrew-using-mirror:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | mirror=$1
6 |
7 | check_command_installed() {
8 | name=$1
9 | brew_name=$2
10 | if ! [ -x "$(command -v $name)" ]; then
11 | echo "Error: Required GNU $name, try \`brew install $brew_name\`"
12 | exit 1
13 | fi
14 | }
15 |
16 | if [ -z "$mirror" ]; then
17 | echo "Useage: homebrew-using-mirror mirror"
18 | echo "mirror example: https://mirrors.tuna.tsinghua.edu.cn/git/"
19 | echo "default example: https://github.com/"
20 | exit 0
21 | fi
22 | check_command_installed brew brew
23 |
24 | BREW_TAPS="$(
25 | BREW_TAPS="$(brew tap 2>/dev/null)"
26 | echo -n "${BREW_TAPS//$'\n'/:}"
27 | )"
28 | for tap in core cask{,-fonts,-drivers,-versions} command-not-found; do
29 | if [[ ":${BREW_TAPS}:" == *":homebrew/${tap}:"* ]]; then
30 | # 将已有 tap 的上游设置为本镜像并设置 auto update
31 | # 注:原 auto update 只针对托管在 GitHub 上的上游有效
32 | git -C "$(brew --repo homebrew/${tap})" remote set-url origin "${mirror}homebrew/homebrew-${tap}.git"
33 | git -C "$(brew --repo homebrew/${tap})" config homebrew.forceautoupdate true
34 | else # 在 tap 缺失时自动安装(如不需要请删除此行和下面一行)
35 | # brew tap --force-auto-update "homebrew/${tap}" "${mirror}/homebrew/homebrew-${tap}.git"
36 | echo -n ''
37 | fi
38 | done
39 |
--------------------------------------------------------------------------------
/local/bin/bing-wallpaper.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | export PATH=$PATH:/usr/local/bin
6 | PICTURE_DIR="$HOME/Pictures/bing-wallpapers"
7 | LOCALE=zh-CN
8 | mkdir -p "$PICTURE_DIR"
9 |
10 | check_command_installed() {
11 | NAME=$1
12 | BREW_NAME=$2
13 | if ! [ -x "$(command -v "$NAME")" ]; then
14 | echo "Error: Required GNU $NAME, try \`brew install $BREW_NAME\` or others pkg manager"
15 | exit 1
16 | fi
17 | }
18 |
19 | if [ $(uname) = 'Darwin' ]; then
20 | check_command_installed wget wget
21 | check_command_installed curl curl
22 | check_command_installed ggrep grep
23 | check_command_installed gsed gnu-sed
24 | GREP=ggrep
25 | SED=gsed
26 | elif [[ "$OSTYPE" == 'linux'* ]] || [[ "$OSTYPE" == 'cygwin'* ]]; then
27 | check_command_installed wget wget
28 | check_command_installed curl curl
29 | check_command_installed grep grep
30 | check_command_installed sed sed
31 | GREP=grep
32 | SED=sed
33 | fi
34 | check_command_installed jq jq
35 |
36 | for i in {0..7}; do
37 | URL="https://s.cn.bing.net"$(curl -s "https://www.bing.com/HPImageArchive.aspx?format=js&idx=$i&n=1&mkt=$LOCALE" | jq -r '.images[0].url')
38 | FILENAME=$(echo $URL | $GREP -oP '\K(id=[^=]+.jpg)' | $SED 's/id=//g' | $SED 's/OHR\.//g')
39 | wget -q -nc -O "$PICTURE_DIR/$FILENAME" "$URL"
40 | done
41 |
--------------------------------------------------------------------------------
/local/bin/iterm2-recv-zmodem.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Author: Matt Mastracci (matthew@mastracci.com)
3 | # AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
4 | # licensed under cc-wiki with attribution required
5 | # Remainder of script public domain
6 |
7 | osascript -e 'tell application "iTerm2" to version' >/dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
8 | if [[ $NAME = "iTerm" ]]; then
9 | FILE=$(osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")")
10 | else
11 | FILE=$(osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")")
12 | fi
13 |
14 | if [[ $FILE = "" ]]; then
15 | echo Cancelled.
16 | # Send ZModem cancel
17 | echo -e \\x18\\x18\\x18\\x18\\x18
18 | sleep 1
19 | echo
20 | echo \# Cancelled transfer
21 | else
22 | cd "$FILE"
23 | /usr/local/bin/rz -E -e -b
24 | sleep 1
25 | echo
26 | echo
27 | echo \# Sent \-\> $FILE
28 | fi
29 |
--------------------------------------------------------------------------------
/local/bin/sqlite3-to-mysql.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python
2 |
3 | import sys
4 |
5 |
6 | def main():
7 | print
8 | "SET sql_mode='NO_BACKSLASH_ESCAPES';"
9 | lines = sys.stdin.read().splitlines()
10 | for line in lines:
11 | processLine(line)
12 |
13 |
14 | def processLine(line):
15 | if (
16 | line.startswith("PRAGMA") or
17 | line.startswith("BEGIN TRANSACTION;") or
18 | line.startswith("COMMIT;") or
19 | line.startswith("DELETE FROM sqlite_sequence;") or
20 | line.startswith("INSERT INTO \"sqlite_sequence\"")
21 | ):
22 | return
23 | line = line.replace("AUTOINCREMENT", "AUTO_INCREMENT")
24 | line = line.replace("DEFAULT 't'", "DEFAULT '1'")
25 | line = line.replace("DEFAULT 'f'", "DEFAULT '0'")
26 | line = line.replace(",'t'", ",'1'")
27 | line = line.replace(",'f'", ",'0'")
28 | in_string = False
29 | newLine = ''
30 | for c in line:
31 | if not in_string:
32 | if c == "'":
33 | in_string = True
34 | elif c == '"':
35 | newLine = newLine + '`'
36 | continue
37 | elif c == "'":
38 | in_string = False
39 | newLine = newLine + c
40 | print
41 | newLine
42 |
43 |
44 | if __name__ == "__main__":
45 | main()
46 |
--------------------------------------------------------------------------------
/local/bin/csv2json:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import csv
4 | import json
5 | import time
6 | import sys
7 |
8 |
9 | def csv_to_json(csv_path, json_path):
10 | json_array = []
11 |
12 | # read csv file
13 | with open(csv_path, encoding='utf-8') as csvf:
14 | # load csv file data using csv library's dictionary reader
15 | csvReader = csv.DictReader(csvf)
16 |
17 | # convert each csv row into python dict
18 | for row in csvReader:
19 | # add this python dict to json array
20 | json_array.append(row)
21 |
22 | # convert python jsonArray to JSON String and write to file
23 | with open(json_path, 'w', encoding='utf-8') as jsonf:
24 | json_str = json.dumps(json_array, indent=4)
25 | jsonf.write(json_str)
26 |
27 |
28 | def main():
29 | if len(sys.argv) != 3:
30 | print("Usage: csv2json.py ")
31 | sys.exit(1)
32 |
33 | csv_file_path = sys.argv[1]
34 | json_file_path = sys.argv[2]
35 |
36 | start = time.perf_counter()
37 | csv_to_json(csv_file_path, json_file_path)
38 | finish = time.perf_counter()
39 |
40 | # print to stderr
41 | print(f"Conversion 100.000 rows completed successfully in {finish - start:0.4f} seconds", file=sys.stderr)
42 |
43 |
44 | if __name__ == '__main__':
45 | main()
46 |
--------------------------------------------------------------------------------
/local/bin/viscosity-to-ios-connect.rb:
--------------------------------------------------------------------------------
1 | # from: https://gist.github.com/iMerica/dfb1be6e2f664c716756
2 | Dir.glob("#{ENV['HOME']}/Library/Application Support/Viscosity/OpenVPN/*/config.conf").each do |file|
3 | certificate_files = ['ca', 'cert', 'key', 'tls-auth']
4 | config_dir = File.dirname(file)
5 | connection_name = nil
6 | new_config = []
7 |
8 | File.read(file).lines.each do |line|
9 | line.strip!
10 |
11 | if line.start_with?('#viscosity name')
12 | connection_name = line.match(/^#viscosity name (.*)/)[1]
13 | next
14 | end
15 |
16 | next if line.start_with?('#')
17 | (key, value) = line.split(/\s+/, 2)
18 |
19 | if certificate_files.include?(key)
20 | # Special case for tls-auth which is "key direction"
21 | if key == 'tls-auth'
22 | # add direction to config
23 | (value, direction) = value.split(/\s+/)
24 | new_config << "key-direction #{direction}" unless direction.nil?
25 | end
26 |
27 | certificate = File.read("#{config_dir}/#{value}")
28 | new_config << "<#{key}>"
29 | new_config << certificate
30 | new_config << "#{key}>"
31 | next
32 | end
33 | new_config << line
34 | end
35 | raise "Unable to find connection name in #{file}. Aborting." if connection_name.nil?
36 | new_config.unshift("# OpenVPN Config for #{connection_name}")
37 | out_file = "#{connection_name}.ovpn"
38 | File.open(out_file, 'w') { |f| f.write(new_config.join("\n") + "\n") }
39 | puts "wrote #{out_file}"
40 | end
41 |
--------------------------------------------------------------------------------
/local/bin/tree2fulltree:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python2
2 | # coding=utf-8
3 | """
4 | convert `tree` command output to file path output
5 | """
6 |
7 | from __future__ import unicode_literals, absolute_import, print_function
8 |
9 | import fileinput
10 | import re
11 | import urllib
12 | import sys
13 |
14 | REGEX_MATCH = r'([\| ]? )*[\||``]-- \[.+]\ (.+)'
15 |
16 |
17 | def main():
18 | last_level = 0
19 | parents = []
20 | last_name = None
21 | endpoint = None
22 |
23 | for line in fileinput.input():
24 | line = line.decode('utf-8')
25 | if endpoint is None:
26 | endpoint = line.strip()
27 |
28 | match = re.match(REGEX_MATCH, line)
29 | if not match:
30 | continue
31 | if len(match.groups()) != 2:
32 | continue
33 |
34 | level = len((match.groups()[0] or '')) / 4
35 | name = match.groups()[1]
36 | if level > last_level:
37 | parents.append(last_name)
38 | elif level < last_level:
39 | parents.pop()
40 |
41 | output = endpoint + '/' + '/'.join(parents + [name]) + '\n'
42 | output += ' => ' + endpoint + '/' + '/'.join(
43 | [urllib.quote(x.encode('gbk')) for x in parents + [name]]) + '\n'
44 | print(output.encode('utf-8'), end='')
45 |
46 | last_name = name
47 | last_level = level
48 | sys.stdout.flush()
49 |
50 |
51 | if __name__ == '__main__':
52 | try:
53 | main()
54 | except IOError:
55 | pass
56 |
57 | # vim: set ft=python:
58 |
--------------------------------------------------------------------------------
/mac/phoenix/src/mouse.ts:
--------------------------------------------------------------------------------
1 | import * as config from './config';
2 | import {heartbeatWindow} from './window';
3 |
4 | export function saveMousePositionForWindow(window: Window) {
5 | if (!window) {
6 | return;
7 | }
8 | heartbeatWindow(window);
9 | const pos = Mouse.location()
10 | // pos.y = 800 - pos.y; // fix phoenix 2.x bug
11 | config.MOUSE_POSITIONS[window.hash()] = pos;
12 | }
13 |
14 | export function setMousePositionForWindowCenter(window: Window | undefined) {
15 | if (window === undefined) {
16 | return;
17 | }
18 | Mouse.move({
19 | x: window.topLeft().x + window.frame().width / 2,
20 | y: window.topLeft().y + window.frame().height / 2,
21 | });
22 | heartbeatWindow(window);
23 | }
24 |
25 | export function restoreMousePositionForWindow(window: Window | undefined) {
26 | if (window === undefined) {
27 | return;
28 | }
29 | if (!config.MOUSE_POSITIONS[window.hash()]) {
30 | setMousePositionForWindowCenter(window);
31 | return;
32 | }
33 | const pos = config.MOUSE_POSITIONS[window.hash()];
34 | const rect = window.frame();
35 | if (pos.x < rect.x || pos.x > (rect.x + rect.width) || pos.y < rect.y || pos.y > (rect.y + rect.height)) {
36 | setMousePositionForWindowCenter(window);
37 | return;
38 | }
39 | // Phoenix.log(String.format('x: {0}, y: {1}', pos.x, pos.y));
40 | Mouse.move(pos);
41 | heartbeatWindow(window);
42 | }
43 |
44 | export function restoreMousePositionForNow() {
45 | const window = Window.focused();
46 | if (window === undefined) {
47 | return;
48 | }
49 | restoreMousePositionForWindow(window);
50 | }
51 |
--------------------------------------------------------------------------------
/.zshrc.etc.d/hosts-on-off.zshrc:
--------------------------------------------------------------------------------
1 | # hosts-on-off can managed your hosts files
2 | # Feature: one click / groups / managed by zshrc.etc.d
3 | #
4 | # Required: hostess:
5 | # brew install hostess
6 | # sudo chown root /usr/local/Cellar/hostess/*/bin/hostess
7 | # sudo chmod +s /usr/local/Cellar/hostess/*/bin/hostess
8 |
9 | # Usage:
10 | # put the following into ~/.zshrc.etc.d/hosts-sample.zshrc and `source ~/.zshrc.etc.d/hosts-sample.zshrc`
11 | #
12 | # test_com_hosts="
13 | # 127.0.0.1 a.test.com
14 | # 127.0.0.1 b.test.com
15 | # "
16 | # alias hosts-on-test="hosts-on test_com_hosts"
17 | # alias hosts-off-test="hosts-off test_com_hosts"
18 |
19 | function hosts-on {
20 | hosts="$1"
21 | if [ -z ${hosts} ]; then
22 | print "error read \$hosts"
23 | return
24 | fi
25 | hosts_content=$(printf '%s\n' "${(P)$(echo "$hosts")}")
26 |
27 | while read -r line; do
28 | ip=$(echo ${line} | awk '{print $1}')
29 | domain=$(echo ${line} | awk '{print $2}')
30 | if [ -z ${ip} ] || [ -z ${domain} ]; then
31 | continue
32 | fi
33 |
34 | # chmod-root-s-hostess first
35 | hostess add ${domain} ${ip}
36 | done <<< "${hosts_content}"
37 | }
38 |
39 |
40 | function hosts-off {
41 | hosts="$1"
42 | if [ -z ${hosts} ]; then
43 | print "error read \$hosts"
44 | return
45 | fi
46 | hosts_content=$(printf '%s\n' "${(P)$(echo "$hosts")}")
47 |
48 | while read -r line; do
49 | ip=$(echo ${line} | awk '{print $1}')
50 | domain=$(echo ${line} | awk '{print $2}')
51 | if [ -z ${ip} ] || [ -z ${domain} ]; then
52 | continue
53 | fi
54 |
55 | # chmod-root-s-hostess first
56 | hostess rm ${domain};
57 | done <<< "${hosts_content}"
58 | }
59 |
--------------------------------------------------------------------------------
/local/bin/paste-rtf-to-md:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
4 |
5 | $DIR/paste-rtf-to-html |
6 | perl -0777pe 's/class="[a-zA-Z0-9:;\. \s\(\)\-\,]*"//g' |
7 | pandoc -f html --wrap none -t "markdown+pipe_tables-simple_tables-multiline_tables-raw_html-link_attributes+lists_without_preceding_blankline" |
8 | gsed -E '/^$/d' |
9 | gsed -E '/^<\/div>$/d' |
10 | perl -0777pe 's/-
\n\n /-/g' |
11 | gsed -E '/^ <\/div>$/d' |
12 | gsed -E '/[ \s]*:::[ \s]*$/d' |
13 | gsed -E '/[ \s]*:::[ \s]* \{.+\}$/d' |
14 | perl -0777pe 's/[ \s]+$//g' |
15 | gsed -E '/^$/N;/^\n$/D' |
16 | gsed -E '/^\[\[\[\]\]\]$/d' |
17 | perl -0777pe 's/^\\$//g' |
18 | gsed -E 's/^ $//g' |
19 | gsed -E 's/^\\$//g' |
20 | perl -0777pe 's/{[^}]+}//g' |
21 | gsed -E 's/^- - - -/ -/g' |
22 | gsed -E 's/^- - -/ -/g' |
23 | gsed -E 's/^- -/ -/g' |
24 | gsed -E 's/^- -/ -/g' |
25 | perl -0777pe 's/\n\n\n\n( *-)/\n\1/g'
26 |
27 | # for yuque ul li merge
28 | # | gsed -E 's/^- - - -/ -/g' \
29 | # | gsed -E 's/^- - -/ -/g' \
30 | # | gsed -E 's/^- -/ -/g' \
31 | # | gsed -E 's/^- -/ -/g' \
32 | # | perl -0777pe 's/\n\n\n\n( *-)/\n\1/g'
33 |
34 | # vim: set ft=sh:
35 |
--------------------------------------------------------------------------------
/mac/phoenix/src/config.ts:
--------------------------------------------------------------------------------
1 | const MASH: Phoenix.ModifierKey[] = ['alt'];
2 | const MASH_CTRL: Phoenix.ModifierKey[] = ['alt', 'ctrl'];
3 | const MASH_SHIFT: Phoenix.ModifierKey[] = ['alt', 'shift'];
4 | const MASH_CTRL_SHIFT: Phoenix.ModifierKey[] = ['alt', 'ctrl', 'shift'];
5 | const MOUSE_POSITIONS: { [name: number]: Point } = {};
6 | const HIDE_INACTIVE_WINDOW_TIME = 10; // minitus
7 | const ACTIVE_WINDOWS_TIMES: { [name: number]: number } = {};
8 | const DEFAULT_WIDTH = 1280;
9 | const WORK_SPACE_INDEX_MAP: { [name: number]: number } = {
10 | 1: 0, // one display case
11 | 2: 3, // two display case
12 | }; // is a dict, key is display count, val is work space
13 | const SECOND_WORK_SPACE_INDEX_MAP: { [name: number]: number } = {
14 | 1: 0, // one display case
15 | 2: 0, // two display case
16 | }; // is a dict, key is display count, val is work space
17 | const PARK_SPACE_INDEX_MAP: { [name: number]: number } = {
18 | 1: 2,
19 | 2: 2,
20 | };
21 | const PARK_SPACE_APP_INDEX_MAP: { [name: string]: number } = {
22 | iTerm: 0,
23 | 'Google Chrome': 0,
24 | Chromium: 0,
25 | Firefox: 0,
26 | QQ: 1,
27 | Dingtalk: 1,
28 | WeChat: 2,
29 | 'Electronic WeChat': 2,
30 | Mail: 2,
31 | Airmail: 2,
32 | };
33 | const A_BIG_PIXEL = 10000;
34 | // TODO MAC_SCREEN_IN_THE_RIGHT to DISPLAYS_ORDER
35 | const MAC_SCREEN_IN_THE_RIGHT = true;
36 | const DISPLAYS_ORDER = {}
37 | // const MAC_SCREEN_IN_THE_RIGHT = false;
38 | const RESIZE_WITH_RATIO = false;
39 |
40 | export {
41 | MAC_SCREEN_IN_THE_RIGHT,
42 | MASH,
43 | MASH_CTRL,
44 | MASH_SHIFT,
45 | MASH_CTRL_SHIFT,
46 | MOUSE_POSITIONS,
47 | HIDE_INACTIVE_WINDOW_TIME,
48 | ACTIVE_WINDOWS_TIMES,
49 | DEFAULT_WIDTH,
50 | WORK_SPACE_INDEX_MAP,
51 | SECOND_WORK_SPACE_INDEX_MAP,
52 | PARK_SPACE_APP_INDEX_MAP,
53 | A_BIG_PIXEL,
54 | RESIZE_WITH_RATIO
55 | };
56 |
--------------------------------------------------------------------------------
/.pentadactylrc:
--------------------------------------------------------------------------------
1 | "let mapleader = ","
2 |
3 | "map
4 | "map
5 | "map
6 | "map
7 | "imap
8 | "imap
9 | "imap
10 | "imap
11 |
12 | "map j
13 | "map k
14 | "map J
15 | "map K
16 | "map -builtin j 10j
17 | "map -builtin k 10k
18 | noremap j 5j
19 | noremap k 5k
20 | map w
21 | map e
22 | map W
23 | map E
24 | map h gT
25 | map l gt
26 | map s :stop
27 | cmap
28 | cmap
29 |
30 | map da :tabopen about:addons
31 | map dp :dialog preferences
32 | map dd :downloads
33 | map ds :dialog pagesource
34 | map dc :dialog console
35 | map di :dialog pageinfo
36 |
37 | " use b for bookmarks
38 | map b :bmarks
39 |
40 | "干掉一些快捷键
41 | " map
42 | " map
43 |
44 | " set titlestring=Mozilla\ Firefox
45 |
46 | "命令行下拉菜单最多显示的条目数
47 | "set maxitems=6
48 |
49 | "Next Page and Previous Page超级的下一页,基本上是够用了.快捷键是[[和]]
50 | set nextpattern=\s*下一页|下一张|下一篇|下页|后页\s*,^\bnext\b,\\bnext\\b,^>$,^(>>|»)$,^(>|»),(>|»)$,\\bmore\\b
51 | set previouspattern=\s*上一页|上一张|上一篇|上页|前页\s*,^\bprev|previous\b,\\bprev|previous\\b,^<$,^(<<|«)$,^(<|«),(<|«)$
52 |
53 | set hintmatching=custom
54 | hi -a Hint font-size: 18pt !important;
55 | "set hintkeys=asdfg;lkjh
56 |
57 | "surround com and net可以直接先输入网站名,再用+快捷输入.com/.net
58 | "cnoremap .orgwww.
59 | " cnoremap .com
60 |
61 | set editor='/usr/local/bin/mvim -f + +"sil! call cursor(0, )" '
62 | "set yankencodedurl=true
63 |
64 | " ignorekeys add https://www.toodledo.com/tasks/index.php
65 | " ignorekeys add http://www.toodledo.com/tasks/index.php
66 | " ignorekeys add https://mail.google.com/
67 |
68 | " vim: set ft=vim:
69 |
--------------------------------------------------------------------------------
/.zshrc.etc.d/clean-cache.zshrc:
--------------------------------------------------------------------------------
1 | if [[ "$OSTYPE" == "darwin"* ]]; then
2 | alias clean-homebrew='du -sh $HOME/Library/Caches/Homebrew/; find $HOME/Library/Caches/Homebrew/ -maxdepth 1 -mindepth 1 -exec trash {} \; ; brew cleanup -s'
3 | alias clean-coursier='find $HOME/Library/Caches/Coursier/v1/http -maxdepth 1 -mindepth 1 -exec trash {} \; ; find $HOME/Library/Caches/Coursier/v1/https -maxdepth 1 -mindepth 1 -exec trash {} \;'
4 | alias clean-pip='find $HOME/Library/Caches/pip/http -maxdepth 1 -mindepth 1 -exec trash {} \;'
5 | alias clean-yarn='find $HOME/Library/Caches/Yarn -maxdepth 1 -mindepth 1 -exec trash {} \;'
6 | alias clean-docker-machne='docker-machine rm default'
7 | alias clean-minikube='minikube delete && rm -rf $HOME/.minikube/cache'
8 | alias clean-npm-cacache='du -sh $HOME/.npm/_cacache; trash $HOME/.npm/_cacache'
9 | alias clean-pnpm='du -sh $HOME/Library/pnpm; trash $HOME/Library/pnpm'
10 | alias clean-sbt-boot='du -sh $HOME/.sbt/boot; trash $HOME/.sbt/boot'
11 | alias clean-npm-tarball='du -sh $HOME/.npminstall_tarball; trash $HOME/.npminstall_tarball'
12 | alias clean-dev-go-pkg-mod='du -sh $HOME/dev/go/pkg/mod; trash $HOME/dev/go/pkg/mod'
13 | alias clean-dev-node-modules='gfind $HOME/dev -maxdepth 2 -name node_modules -exec trash {} \;'
14 | alias clean-dev-venv='gfind $HOME/dev -maxdepth 2 -name .venv -exec trash {} \;'
15 | alias clean-ws-go-pkg-mod='du -sh $HOME/ws/go/pkg/mod; trash $HOME/ws/go/pkg/mod'
16 | alias clean-ws-node-modules='gfind $HOME/ws -maxdepth 2 -name node_modules -exec trash {} \;'
17 | alias clean-ws-venv='gfind $HOME/ws -maxdepth 2 -name .venv -exec trash {} \;'
18 | alias clean-m2='du -sh $HOME/.m2/repository; trash $HOME/.m2/repository'
19 | alias clean-lima='du -sh $HOME/Library/Caches/lima; trash $HOME/Library/Caches/lima'
20 | alias clean-netease-music-cache='du -sh $HOME/Library/Caches/com.netease.163music/; trash $HOME/Library/Caches/com.netease.163music/'
21 | fi
22 |
--------------------------------------------------------------------------------
/.vimperatorrc:
--------------------------------------------------------------------------------
1 | let mapleader = ","
2 |
3 | "noremap
4 | "noremap
5 | "noremap
6 | "noremap
7 | "noremap
8 | "inoremap
9 | "inoremap
10 | "inoremap
11 | "inoremap
12 |
13 | "noremap j 4j
14 | "noremap k 4k
15 | noremap x d
16 | noremap d
17 | noremap j 5j
18 | noremap k 5k
19 | noremap J
20 | noremap K
21 | noremap w
22 | noremap e
23 | noremap W
24 | noremap E
25 | noremap h gT
26 | noremap l gt
27 | noremap s :stop
28 | noremap
29 |
30 | noremap da :tabopen about:addons
31 | noremap dp :dialog preferences
32 | noremap dd :downloads
33 | noremap ds :dialog pagesource
34 | noremap dc :dialog console
35 | noremap di :dialog pageinfo
36 |
37 | " use b for bookmarks
38 | noremap b :bmarks
39 |
40 | map S :source ~/.vimperatorrc:echo 'rc reloaded!'
41 |
42 | "map
43 | " map
44 |
45 | " set titlestring=Mozilla\ Firefox
46 |
47 | "命令行下拉菜单最多显示的条目数
48 | "set maxitems=6
49 |
50 | "Next Page and Previous Page超级的下一页,基本上是够用了.快捷键是[[和]]
51 | set nextpattern=\s*下一页|下一张|下一篇|下页|后页\s*,^\bnext\b,\\bnext\\b,^>$,^(>>|»)$,^(>|»),(>|»)$,\\bmore\\b
52 | set previouspattern=\s*上一页|上一张|上一篇|上页|前页\s*,^\bprev|previous\b,\\bprev|previous\\b,^<$,^(<<|«)$,^(<|«),(<|«)$
53 |
54 | "set gui=nonavigation
55 |
56 | "surround com and net可以直接先输入网站名,再用+快捷输入.com/.net
57 | "cnoremap .orgwww.
58 | cnoremap .com
59 |
60 | set 'editor=/usr/local/bin/mvim -f'
61 | set yankencodedurl=true
62 |
63 | " ignorekeys add https://www.toodledo.com/tasks/index.php
64 | " ignorekeys add http://www.toodledo.com/tasks/index.php
65 | " ignorekeys add https://mail.google.com/
66 |
67 | " vim: set ft=vim:
68 |
--------------------------------------------------------------------------------
/.obsidian.vimrc:
--------------------------------------------------------------------------------
1 | " vimrc for obsidian
2 | " plugin: https://github.com/esm7/obsidian-vimrc-support
3 | " remember link this file to you vault dir
4 |
5 |
6 | " # obcommand doc https://meleu.dev/notes/obcommand-list/
7 | "
8 | " nmap j gj
9 | " nmap k gk
10 | " I like using H and L for beginning/end of line
11 | " nmap H ^
12 | " nmap L $
13 | " Quickly remove search highlights
14 | " nmap :nohl
15 |
16 | " Yank to system clipboard
17 | " set clipboard=unnamed
18 |
19 | " Go back and forward with Ctrl+O and Ctrl+I
20 | " (make sure to remove default Obsidian shortcuts for these to work)
21 | " exmap back obcommand app:go-back
22 | " nmap :back
23 | " exmap forward obcommand app:go-forward
24 | " nmap :forward
25 |
26 |
27 | " Emulate Folding https://vimhelp.org/fold.txt.html#fold-commands
28 | exmap togglefold obcommand editor:toggle-fold
29 | nmap zo :togglefold
30 | nmap zc :togglefold
31 | nmap za :togglefold
32 |
33 | exmap unfoldall obcommand editor:unfold-all
34 | nmap zR :unfoldall
35 |
36 | exmap foldall obcommand editor:fold-all
37 | nmap zM :foldall
38 |
39 | " tab navigate
40 | exmap tabnext obcommand workspace:next-tab
41 | nmap gt :tabnext
42 | exmap tabprevious obcommand workspace:previous-tab
43 | nmap gT :tabprevious
44 |
45 | nmap gT
46 | nmap gt
47 |
48 | " tab group management
49 | exmap focusRight obcommand editor:focus-right
50 | nmap l :focusRight
51 |
52 | exmap focusLeft obcommand editor:focus-left
53 | nmap h :focusLeft
54 |
55 | exmap focusTop obcommand editor:focus-top
56 | nmap k :focusTop
57 | nmap :focusTop
58 |
59 | exmap focusBottom obcommand editor:focus-bottom
60 | nmap j :focusBottom
61 | nmap :focusBottom
62 |
63 | exmap splitVertical obcommand workspace:split-vertical
64 | nmap v :splitVertical
65 |
66 | exmap splitHorizontal obcommand workspace:split-horizontal
67 | nmap s :splitHorizontal
68 |
--------------------------------------------------------------------------------
/.cvimrc:
--------------------------------------------------------------------------------
1 | " let configpath = '/Users/alswl/.cvimrc'
2 | " set localconfig
3 |
4 | let mapleader = ","
5 |
6 | set noautofocus " The opposite of autofocus; this setting stops
7 |
8 | map h gT
9 | map l gt
10 | map s gq
11 |
12 | iunmap
13 | iunmap
14 | iunmap
15 | iunmap
16 | iunmap
17 | iunmap
18 | iunmap
19 | iunmap
20 | iunmap
21 | iunmap
22 | iunmap
23 | iunmap
24 |
25 |
26 | let searchengine t = "https://twitter.com/search/%s"
27 | let searchengine we = "http://en.wikipedia.org/wiki/Special:Search?search=%s"
28 | let searchengine zh = "http://www.zhihu.com/search?q=%s"
29 | let searchengine tb = "http://s.taobao.com/search?q=%s"
30 | let searchengine h = "http://dict.cn/search.php?q=%s"
31 | let searchengine k = "http://www.amazon.cn/s/ref=nb_sb_noss?__mk_zh_CN=%E4%BA%9A%E9%A9%AC%E9%80%8A%E7%BD%91%E7%AB%99&url=node%3D116169071&field-keywords=%s"
32 | let searchengine bing = "http://www.bing.com/search?q=%s&pc=MOZI"
33 | let searchengine etao = "http://s.etao.com/search?q=%s"
34 | let searchengine db = "http://www.douban.com/search?q=%s"
35 | let searchengine gh = "https://github.com/search?q=%s&ref=opensearch"
36 | let searchengine ip = "http://www.ip138.com/ips138.asp?ip=%s&action=2"
37 | let searchengine wb = "http://s.weibo.com/weibo/%s?topnav=1&wvr=6&b=1"
38 | let searchengine g = "https://www.google.com/#q=%s"
39 | let searchengine b = "https://www.baidu.com/s?wd=%s"
40 | let searchengine wc = "https://zh.wikipedia.org/w/index.php?title=Special:%E6%90%9C%E7%B4%A2&search=%s"
41 | let searchengine jd = "http://search.jd.com/Search?keyword=%s&enc=utf-8&wq=%s"
42 | let searchengine dk = "https://duckduckgo.com/?q=%s&atb=v17"
43 | let searchengine b = "http://www.baidu.com/#ie={inputEncoding}&wd=%s"
44 | let searchengine sogou = "http://www.sogou.com/web?ie={inputEncoding}&query=%s"
45 | let searchengine g = "https://www.google.com/search?q=%s"
46 | let searchengine google = "https://www.google.com/search?q=%s"
47 |
48 |
49 |
--------------------------------------------------------------------------------
/.tmux.conf:
--------------------------------------------------------------------------------
1 | set-option -g default-shell "/opt/homebrew/bin/zsh"
2 | #set-option -g default-path $HOME
3 | set -g default-terminal "screen-256color"
4 | set-option -sa terminal-overrides ',screen-256color:RGB'
5 |
6 | unbind C-b
7 | set -g prefix C-q
8 | bind C-q send-prefix
9 |
10 | # start window index of 1
11 | #set-option -g base-index 1
12 | #setw -g pane-base-index 1
13 |
14 | # active window title colors
15 | set -g window-status-current-format "#[fg=white,bg=red] #I:#W* "
16 |
17 | set-window-option -g mode-keys vi
18 | bind-key -T copy-mode-vi v send -X begin-selection
19 | # bind-key -T copy-mode-vi y send -X copy-selection-and-cancel
20 | # after 2025-03
21 | bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
22 | # TODO
23 | # run-shell "bash ~/.tmux_darwin.sh"
24 | # run-shell "bash ~/.tmux_linux.sh"
25 |
26 |
27 | # -n means no prefix
28 | bind -n F11 previous-window
29 | bind -n F12 next-window
30 |
31 | bind-key -r j select-pane -D
32 | bind-key -r k select-pane -U
33 | bind-key -r h select-pane -L
34 | bind-key -r l select-pane -R
35 |
36 | #set-option -g status-justify "centre"
37 |
38 | set-option -g status-left-length 60
39 | set-option -g status-right-length 90
40 | set-option -g set-titles on
41 |
42 | set-option -g history-limit 10000
43 |
44 | # active window title colors
45 | #set-window-option -g window-status-current-fg colour166 #orange
46 | #set-window-option -g window-status-current-bg default
47 | #set-window-option -g window-status-current-attr bright
48 |
49 | set -g status-right '#(hostname)'
50 |
51 | set-option -sg escape-time 10
52 |
53 | # pbcopy / pbpaste mac, https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
54 | # not need for Tmux 2.6+, https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/issues/66
55 | # set-option -g default-command "reattach-to-user-namespace -l zsh"
56 | # set-window-option -g mode-keys vi
57 | # bind-key -T copy-mode-vi v send -X begin-selection
58 | # bind-key -T copy-mode-vi y send -X copy-pipe "reattach-to-user-namespace pbcopy"
59 | # unbind -T copy-mode-vi Enter
60 | # bind-key -T copy-mode-vi Enter send -X copy-pipe "reattach-to-user-namespace pbcopy"
61 |
62 | # required by neovim
63 | set-option -g focus-events on
64 |
--------------------------------------------------------------------------------
/local/bin/remark:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # render markdown file with remark https://github.com/gnab/remark
4 |
5 | if [ $(uname) = 'Darwin' ]; then
6 | SED_BIN="gsed"
7 | elif [ $(uname -s) = 'Linux' ] || [ $(uname -o) = 'Cygwin' ]; then
8 | SED_BIN="sed"
9 | fi
10 |
11 | FILE_NAME=$1
12 |
13 | if [ ! -f $FILE_NAME ]; then
14 | echo "warnning: $FILE_NAME not exist!"
15 | echo ''
16 | echo 'Usage:'
17 | echo 'remark example.md'
18 | exit 0
19 | fi
20 |
21 | OUTPUT_FILE_NAME=$FILE_NAME.remark.generated.html
22 |
23 | check_command_installed() {
24 | NAME=$1
25 | BREW_NAME=$2
26 | if ! [ -x "$(command -v $NAME)" ]; then
27 | echo "Error: Required GNU $NAME, try \`brew install $BREW_NAME\`"
28 | exit 1
29 | fi
30 | }
31 |
32 | if [ $(uname) = 'Darwin' ]; then
33 | check_command_installed gsed gnu-sed
34 | fi
35 |
36 | cat >$OUTPUT_FILE_NAME <
38 |
39 |
40 | $FILE_NAME
41 |
42 |
52 |
53 |
54 |