A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| #!/bin/bash | |
| # Baidu Yun Command Line Interface | |
| # Depends: bash, curl, grep, awk, sed, od | |
| # (They are basicly builtin tools of any *nix system.) | |
| # Additionally, fastupload depends: head, wc, md5sum or md5, cksum | |
| # (Which are also builtin tools) | |
| #### Variables #### |
| urlencode() { | |
| # urlencode <string> | |
| old_lc_collate=$LC_COLLATE | |
| LC_COLLATE=C | |
| local length="${#1}" | |
| for (( i = 0; i < length; i++ )); do | |
| local c="${1:$i:1}" | |
| case $c in |