Skip to content

Instantly share code, notes, and snippets.

Avatar
🔧

Abe Flansburg aflansburg

🔧
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am aflansburg on github.
  • I am aflansburg (https://keybase.io/aflansburg) on keybase.
  • I have a public key ASDRD9OAl-WrrItDis5f65_Hcj4uVQIz9hP0_8jKRtOz6wo

To claim this, I am signing this object:

@aflansburg
aflansburg / dd_excludes.json
Created Apr 20, 2022
Inject `dd-privacy-hidden` tag into specific inputs and inputs with autocomplete attribute
View dd_excludes.json
{
"exclusions": [
"email",
"firstName",
"lastName",
"phoneNumber",
"street1",
"street2",
"city",
"state",
@aflansburg
aflansburg / redact.js
Created Apr 8, 2022
Simple Redact/Hide/Obscure/Mask text content on page with JS
View redact.js
/* Finds text content in some element and redacts it
with the provided mask value
*/
function redactContent(textValue, tagType, maskValue){
for (const tag of document.querySelectorAll(tagType)) {
if (tag.textContent.includes(textValue)) {
tag.textContent = maskValue;
}}
}
@aflansburg
aflansburg / imports.py
Created Sep 15, 2021
standard_jupyter_notebook_imports
View imports.py
# import initial libs to do EDA
import pandas as pd
import numpy as np
import random
# viz libs
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
%matplotlib inline
@aflansburg
aflansburg / gist:f9a04ee5258b34d4cdd2ab63a6fc327b
Created Sep 2, 2021
Cyberpunk 2077 iTerm2 Profile + Colors
View gist:f9a04ee5258b34d4cdd2ab63a6fc327b
{
"Ansi 5 Color" : {
"Red Component" : 0.022819328308105468,
"Color Space" : "sRGB",
"Blue Component" : 0.8666666666666667,
"Alpha Component" : 1,
"Green Component" : 0.83805519318199617
},
"Tags" : [
@aflansburg
aflansburg / extract_runtime.py
Created Aug 5, 2021
Check GridSearchCV fit Runtime
View extract_runtime.py
# import time - not the abstract construct of 'time'
# but rather a library built into Python for
# dealing with time
from time import time
# ML stuff
ada_tuned_clf = AdaBoostClassifier(random_state=1)
# some canned params for hypertuning
parameters = {
@aflansburg
aflansburg / gridsearch_runtime.py
Last active Aug 1, 2021
Calculate GridSearchCV runtime
View gridsearch_runtime.py
# runtime info based on solution below and fit_time results of the gridsearchcv return object
# based on a response on StackExchange Data Science - Naveen Vuppula
# https://datascience.stackexchange.com/a/93524/41883
# from time import time
def gridsearch_runtime(grid_obj, X_train, y_train):
'''
Parameters:
grid_obj: GridSearchCV return object that has not yet been fit to training data
X_train: split training data independent variables
y_train: split training data containing dependent variable
@aflansburg
aflansburg / dual_plot.py
Last active Jul 14, 2021
Dual histogram + boxplot with KDE for univariate analysis + Mean & Median Lines
View dual_plot.py
# import libs
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
# this function will create a boxplot + histogram plot using Seaborn's Jointgrid
# we'll also provide Type annotations to provide hints to future users
def dual_plot(series: pd.Series, figsize: tuple = (16,8),
bins: int = None, return_plot: bool = False,
View 1_typing_docstrings_documentation.py
# function to iterate over specified variables and view their value counts
# add typing to help understand our function if reused elsewhere
from typing import List
def value_count_rep(columns: List, df: pd.DataFrame) -> None:
'''
Parameters: List of columns to iterate over
Returns: No return value. Prints the value counts of each column(feature) to stdout
'''
for column in columns:
@aflansburg
aflansburg / structural-pattern-matching.py
Created Jun 18, 2021
Naive Use Case of Structural Pattern Matching (Python 3.10)
View structural-pattern-matching.py
# https://www.python.org/dev/peps/pep-0634/
# PEP 634 proposed (and was accepted) Structural Pattern Matching (switch/case)
# for Python (available in 3.10) - as of this Gist,
# prerelease 3.10.0b2 is available
import inspect
F = [
lambda x,y: x+y,
lambda x: x+1,