Skip to content

Instantly share code, notes, and snippets.


Abe Flansburg aflansburg

View GitHub Profile

Keybase proof

I hereby claim:

  • I am aflansburg on github.
  • I am aflansburg ( on keybase.
  • I have a public key ASDRD9OAl-WrrItDis5f65_Hcj4uVQIz9hP0_8jKRtOz6wo

To claim this, I am signing this object:

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": [
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 /
Created Sep 15, 2021
# 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 / 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 /
Created Aug 5, 2021
Check GridSearchCV fit Runtime
# 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 /
Last active Aug 1, 2021
Calculate GridSearchCV runtime
# 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
# from time import time
def gridsearch_runtime(grid_obj, X_train, y_train):
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 /
Last active Jul 14, 2021
Dual histogram + boxplot with KDE for univariate analysis + Mean & Median Lines
# 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,
# 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 /
Created Jun 18, 2021
Naive Use Case of Structural Pattern Matching (Python 3.10)
# 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,