#import time
start = time.time()
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() { |
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 | |
# Download contiguous HTMLs using wget. | |
base='https://example.com/' | |
for i in {1..9}; do | |
wget -O "$i".html "$base""$i"/ | |
sleep 3 | |
done |
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 datetime import datetime | |
from pathlib import Path | |
import pandas as pd | |
from natsort import natsorted | |
from openpyxl import load_workbook | |
CWD = Path('.') |
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 hashlib | |
# noinspection PyPep8Naming | |
import xml.etree.ElementTree as ET | |
from datetime import datetime | |
from pathlib import Path | |
from time import sleep | |
import pandas as pd | |
import requests |
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 email.header import decode_header | |
def check_items(msg_): | |
"""Extract header items from a msg object and Display them. | |
Args: | |
msg_ (email.message.Message) | |
""" | |
decoded_header = decode_header(msg_.get('subject'))[0] # (b'\x##', 'utf-8') |
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 email | |
import email.utils | |
import smtplib | |
def load_eml(src_eml): | |
"""Load message from an EML file. | |
Returns: |
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 | |
# Move files using find command. | |
find <dir_src> -type f -iregex <pattern> -exec mv {} <dir_dst> \; |
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 mimetypes | |
from pathlib import Path | |
CWD = Path('.') | |
def file_mime_typer(fp): | |
"""Guess the MIME type of file. |
NewerOlder