Skip to content

Instantly share code, notes, and snippets.

View juftin's full-sized avatar
🤠
wranglin' data

Justin Flannery juftin

🤠
wranglin' data
View GitHub Profile
@juftin
juftin / cohorting.py
Last active April 8, 2022 15:00
Reproducible Cohorting
"""
Reproducible Cohorting for Experiments
"""
import hashlib
import logging
from typing import Dict, Optional, Tuple
import numpy as np
from pandas import DataFrame
@juftin
juftin / month_completion.py
Created September 5, 2020 20:49
Python: Retrieve Percent Through Month
#!/usr/bin/env python3
# Author:: Justin Flannery (mailto:[email protected])
"""
An Easy Script for Retrieving the Percent Through the Current Month
"""
from calendar import monthrange
from datetime import datetime
@juftin
juftin / finite_state_machine_example.py
Created June 18, 2020 04:41
Here is an quick example of a finite state machine from the Python transitions package
#!/usr/bin/env python3
# Author:: Justin Flannery (mailto:[email protected])
"""
State Machine Example.
"""
import logging
from enum import Enum
@juftin
juftin / logger.py
Created November 18, 2019 20:08
Easy Logging Setup
#!/usr/bin/env python
import logging
from os import environ
def logger(level="info", timestamp=True, filename=None,
custom_format=None, inherit_env=True):
"""
Default Logging Method. This takes multiple
@juftin
juftin / yml_reader.py
Created November 16, 2019 23:21
A safe way to read yml files with environmental variable integration
#!/usr/bin/env python
from os import environ
from re import compile
from yaml import SafeLoader, load
def yml(path=None, data=None, tag=None):
"""