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
# 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
"""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. |
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
"""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 |
NewerOlder