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 | |
# Constants | |
tgt='filename.txt' # target file, as always. | |
dst='[email protected]:directory' # destination | |
pnr=#### # port number | |
idf="/path/to/identity_file" # identity file | |
display_help() { | |
cat <<EOF |
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() { | |
cat <<EOF | |
Extract URL strings from webloc files in a directory. | |
EOF | |
} | |
extract_urls() { | |
# Prepare an output filename |
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 | |
from pathlib import Path | |
from pprint import pprint | |
from random import sample | |
from natsort import natsorted | |
def sampler(orig, dest, size, ptn='*'): |
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 sqlite3 | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import seaborn as sns | |
# https://hellomyworld.net/posts/matplotlib-how-to-resolve-missing-from-current-font-japanese/ | |
plt.rcParams['font.family'] = 'Hiragino Maru Gothic Pro' |
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 | |
# Decode X.509 certificates and keys: PEM, CRT, etc. | |
decode_x509() { openssl x509 -in "$1" -text -noout } | |
display_help() { echo '\033[93musage: decode509 <pem file>\033[0m\n' } | |
main() { | |
[[ -f "$1" ]] && decode_x509 "$1" && return 0 | |
display_help } |
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 | |
# Description: Download a remote eml file and extract an attached zip file. | |
src='user@server:path/to/source.eml' | |
port_num=<ssh port number> | |
id_file=</path/to/pubkey> | |
display_help(){ | |
cat <<EOF | |
check_remote_eml [get cline conv] |
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 numpy as np | |
def str2list(text_in: str, delimiter=';') -> list: | |
"""Convert a string to a list. | |
c.f. ast.literal_eval() | |
""" | |
crude_list = text_in.split(delimiter) # 'foo; bar' -> ['foo', ' bar'] | |
return [i.strip() for i in crude_list] # ['foo', ' bar'] -> ['foo', 'bar'] |
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() { | |
cat <<EOF | |
SQL Runner | |
---------- | |
Run a SQL script of choice for the designated DB. | |
Usage: run_sql <foobar.sql> | |
Prerequisite: DB name: <qux.db> |
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 | |
from pathlib import Path | |
import pandas as pd | |
from sklearn.preprocessing import MultiLabelBinarizer | |
def add_multi_hot_to_df(df_in, target_col: str): | |
"""Multi-hot-encode the target column data |
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 | |
# References: https://stackoverflow.com/a/16596385/11042987 | |
display_intro() { | |
printf "\033[93m** Convert a reST file into an HTML5 file **\n" | |
printf "** using rst2html5.py. **\033[0m\n" | |
return 0 | |
} | |
main() { |