Auto-add docstrings by entering the newline when it's needed.
- Package Control
"""Print out the current directory's tree structure to console. | |
Inspired by the `colorls --tree` command from the open source codebase Colorls | |
references | |
---------- | |
https://github.com/athityakumar/colorls/blob/a7006a5fd3eba6945ee29a499e4db72bdcc26114/lib/colorls/core.rb#L351 | |
""" |
"""Plot 3d figures with Python. | |
References | |
---------- | |
1. https://stackoverflow.com/questions/8722735/i-want-to-use-matplotlib-to-make-a-3d-plot-given-a-z-function | |
2. https://stackoverflow.com/questions/31768031/plotting-points-on-the-surface-of-a-sphere-in-pythons-matplotlib | |
""" | |
"""Speed up distance computation.""" | |
import numpy as np | |
###################################################################### | |
# _ _ _ # | |
# | \ | | ___ _ __ _ __ ___ __ _| | # | |
# | \| |/ _ \| '__| '_ ` _ \ / _` | | # | |
# | |\ | (_) | | | | | | | | (_| | | # |
# cd-with-auto-project-env.sh | |
# | |
# Wrap up the project environment activate/deactivate methods in the cd command. | |
# | |
# Custom | |
# ------ | |
# 1. env : environment directory contained in the project root. | |
# 2. conda activate ./env : method to activate the target environment. | |
# 3. conda deactivate : method to deactivate the current environment. |
# Instantly create a gist and save it as a local repo. | |
# Prerequisites: brew install hub | |
# Usage: gist [file-to-share] | |
function gist() { | |
hub gist create --public -o -c "$1" | |
__url=$(pbpaste) | |
git clone "$__url" && mv "${__url##*/}" "${1%.*}" && rm "$1" && cd "${1%.*}" | |
} | |
# Move files to the system trash. |
# Print out all PATH environment variables with \newline separated. | |
alias path='echo -e ${PATH//:/\\n}' | |
# Get today's date and pipe it to the system clipboard. | |
alias today='date +"%Y%m%d" | pbcopy' | |
# Update all packages managed by homebrew and gem (if you've installed them). | |
alias updateall='brew update && brew upgrade && brew cleanup && gem update && gem cleanup && brew doctor' | |
# Instantly create a public gist and open it with the default browser, |
#!/usr/bin/env python3 | |
"""Create the target directory tree structure based on an indent-aligned text file. | |
Usage | |
----- | |
python mktree.py tree[.txt] | |
Test demo | |
----------------- | |
$ cat tree |