This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Implement Auto-suggestion/auto-complete conda environment activation workflow combining conda env manager and fzf fuzzy find method. | |
# | |
# Note | |
# ---- | |
# The command *conda init base* can help you initialize your terminal with the base env, | |
# in which setting your default Python interpreter is always the base one. | |
# | |
# Usage | |
# ----- | |
# 1. include this function in your ~/.bashrc or ~/.zshrc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Auto-update requirements.txt with custom pip command. | |
# | |
# Usage | |
# ----- | |
# 1. save functions to your ~/.*shrc or save this file to the root of your project; | |
# 2. source file; | |
# 3. test in your terminal: $ pip-install [modules]; $ pip-uninstall [modules]; | |
# 4. check out the requirements.txt in the predefined directory. | |
PROJECT_ROOT=path/to/project # or you can directly use $PYTHONPATH if it exists and with a proper setting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Speed up distance computation.""" | |
import numpy as np | |
###################################################################### | |
# _ _ _ # | |
# | \ | | ___ _ __ _ __ ___ __ _| | # | |
# | \| |/ _ \| '__| '_ ` _ \ / _` | | # | |
# | |\ | (_) | | | | | | | | (_| | | # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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 | |
""" | |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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 | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
"""Combine multiple screenshots with the same shape. | |
Usage | |
----- | |
1. Specify a list of screenshots. | |
stitch-videoshots screenshot1 screenshot2 screenshot3 | |
2. Specify a dictionary contains screenshots. | |
stitch-videoshots -d ./mypath [--sort] |
OlderNewer