Skip to content

Instantly share code, notes, and snippets.

View theyorubayesian's full-sized avatar

Akintunde Oladipo theyorubayesian

View GitHub Profile
import re
CURRENCY_LIST = {"£": "pounds", "$": "dollars", "€": "euros"}
CURRENCY_PATTERN = fr"((?:[{''.join(CURRENCY_LIST.keys())}]+\d*)(?:\,*\d+)(?:\.\d+)?(?i:[km])*)|(\d+(?:\,*\d+)(?:\.\d+)?(?i:[km])*(?:[{''.join(CURRENCY_LIST.keys())}]+))|((?:[{''.join(CURRENCY_LIST.keys())}]+))"
def _currency_to_text(text: str) -> str:
clean = (
lambda x: x.lower()
.replace(",", "")
from collections import defaultdict
from pprint import pprint
from django.db.models.query import QuerySet
def parse_annotated_query_set(qs: QuerySet, nest_level: int = 1) -> dict:
"""
This function parses annotated query sets and returns a nested dictionary.
"""
Download the latest wiki dump files for a language,
If from_date is passed, the latest before that date is downloaded
"""
import requests
from datetime import datetime
from datetime import timedelta
from string import Template
from tqdm import tqdm
@theyorubayesian
theyorubayesian / args_script_template.sh
Created June 26, 2023 03:05 — forked from rragundez/args_script_template.sh
Template of bash script with mandatory and optional arguments
#!/bin/bash
set -e
usage="$(basename "$0") [-h] [-i PROJECT] [-v VM] [-p PYTHON] [-d NOTEBOOKS]
Make a user provide SSH key and jupyter notebooks (in roles/bootstrap/files/notebooks) to each user listed in var/common.yml
where:
-h show this help text
-i google cloud project id
-v name of instance/virtual machine
-p python path