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 | |
import time | |
import pandas as pd | |
from openpyxl import load_workbook | |
from openpyxl.utils import coordinate_to_tuple | |
from openpyxl.workbook.views import BookView | |
def populate_template_excel( |
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 | |
"""Mimic do-while loop with an emergency brake feature. | |
""" | |
def dummy_func(): | |
for i in range(8): | |
yield i | |
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 | |
import csv | |
def is_sql_kwd(word_in): | |
"""Check if the word is an SQL keyword or reserved word. | |
Args: | |
word_in (str): | |
Returns: | |
bool: If word_in is a SQL keyword/reserved word (True) or not (False). |
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 zsh | |
# Begin Help block | |
my_name=$(basename "$0") | |
display_help() { | |
cat <<EOF | |
*** Run Sphinx "make html" in a subshell. *** | |
usage: $my_name <No args are required> |
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 zsh | |
# Begin Help block | |
my_name=$(basename "$0") | |
display_help() { | |
cat <<EOF | |
*** Open Sphinx reSt file from the project root. *** | |
usage: $my_name <filestem> |
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 zsh | |
display-help() { | |
echo List content of the specified directories. | |
} | |
main() { | |
dir0='/path/to/directory_01' | |
dir1='/path/to/directory_02' | |
dir2='/path/to/directory_03' |
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 zsh | |
# Reference: | |
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html | |
display_help() { | |
cat <<EOF | |
*** Remove the first n characters from the file content. *** | |
Use me when dos2unix nor nkf doesn't work. |
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 | |
import shutil | |
from datetime import datetime | |
from pathlib import Path | |
def backup_a_file(fpath, action='c'): | |
"""Make a backup/copy of a file (NOT a directory) in the subdirectory. | |
Args: | |
fpath (str): Path to the source file. |
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 | |
import re | |
import time | |
from datetime import datetime, timezone | |
class FnameWithEpoch: | |
"""Create a filename with the epoch time / Parse an epoch-filename. | |
Reference: | |
File Naming Conventions |
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 zsh | |
display_help() { | |
printf "\033[93m*** Display git status of the projects under the CWD. ***\033[0m\n" | |
} | |
main() { | |
display_help | |
sleep 3 | |
for project in */; do |
NewerOlder