- ssh your remote server:
ssh username@serverip
;
- source a Python environment which has the Jupyter installed;
- execute:
$ jupyter notebook --no-browser --port=8889 --NotebookApp.allow_origin="*" --ip=serverip --NotebookApp.token=''
"""Remove duplicate subtitles in a .srt file. | |
- What does the standard srt file look like? | |
- See https://www.3playmedia.com/2017/03/08/create-srt-file/ | |
- What does the duplicate subtitle look like? | |
- The duplicate subtitle is something like the addition of its previous and next subtitle. | |
- Which match pattern has been used in this script? | |
- Line 85, 87 | |
- What does the output srt file look like? | |
- [original_file_name]_changed.srt |
"""Translate .srt files using Google Translate Ajax API. | |
Usage | |
----- | |
$ python translate_srt.py *.srt [src=]en [dest=]zh-cn [-n *.srt] [-p 5] [-v] | |
Note: | |
- the available values to assign position arguments [src, dest] can be abtained from the below *AVAILABLE LANGUAGES* section. | |
- try to assign a high value to *patience* argument if you meet a high failure ratio. [-p 5] is recommended. [-p -1] expects no failures would be happen which instead requires a long period to bruce-force complete. |
# 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; |
# 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 |
#!/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 |
# 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, |
# 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. |
# 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. |
"""Speed up distance computation.""" | |
import numpy as np | |
###################################################################### | |
# _ _ _ # | |
# | \ | | ___ _ __ _ __ ___ __ _| | # | |
# | \| |/ _ \| '__| '_ ` _ \ / _` | | # | |
# | |\ | (_) | | | | | | | | (_| | | # |