Skip to content

Instantly share code, notes, and snippets.

@ccritchfield
ccritchfield / _sql_sample.readme
Last active February 5, 2020 18:19
SQL Examples
--------------------------------------------
Examples of SQL code from my last job.
--------------------------------------------
While I did analytics / BI work, I also wrote a lot of SQL's
to audit data. Due to the nature of telecom work, we had
a few tools used by provisioning department that allowed
them to break business rules. When you're running numbers,
and find out things don't add up, you start digging. So,
I would come across this, and then get with the IT / IS
@ccritchfield
ccritchfield / _coronavirus_model.readme
Last active June 16, 2020 04:30
Python - Coronavirus Model
Created a viral model, b/c I wanted to see the chance of getting
infected on a daily basis. This is a "brute force" model that
simulates each individual in a population (and lets you run
multiple populations at a time, each interacting with the
others). The code files contain a lot of notes to explain
both the science behind why I did something, and they python
behind why I coded it as I did. I was shooting to be as
simple as possible, to keep the code from obfuscating
what was going on, and to keep the science from confusing
the code. So, it may not be coded the "Pythonic Way", but,
@ccritchfield
ccritchfield / _coronavirus_model_v2.readme
Last active July 5, 2020 20:48
Python - Coronavirus Model v2 - Dynamic People Lists
v2 of the model adds and removes "attributes" from a person's list
as-needed to try to cut down on memory use.
EG: so a person won't be a list[0,0,0,0] tracking all 4 attributes
(status, incubation days, symptoms, transmission rate) all the time.
Instead, if they're uninfected, they'll simply be a 1 element list
with their status. As they get infected and incubate, then an
incubation attribute is added to count down. As they finish
incubating, the incubation attr will then get re-used to see
what symptom they have. As they become contagious, they get
@ccritchfield
ccritchfield / _coronavirus_model_v3.readme
Last active July 5, 2020 20:48
Python - Coronavirus Model v3 - People as Aggregates
v3 of the model gets rid of tracking each individual as a list,
and simply tracks aggregate pools of population based on status,
incubation days, etc.
This reduces memory footprint greatly, b/c now we're just dealing
with integer variables instead of massive lists. So, we can now
process massive populations, like US or World population.
But, we lose detail.. if we wanted to add more features to the
model or individuals, we'd have to start bending over backwards
@ccritchfield
ccritchfield / _object_example.readme
Last active July 16, 2021 16:50
Python - Object-Oriented Programming Demo
--------------------------------------------
Python Object-Oriented Programming Walk-Thru
--------------------------------------------
.py files that demonstrate Object-Oriented programming
in Python in step-by-step fashion.
Python class in college was mix of undergrads and grads,
because Python was turned into the Intro to Programming
class for undergrads (due to push towards data sci), but
@ccritchfield
ccritchfield / _function_test.readme
Last active July 16, 2021 16:57
Python - Declaring Functions (Experiments)
--------------------------------------------
Python User-Defined-Function (UDF) Walk-Thru
--------------------------------------------
.py files that test out making (and breaking) functions in Python.
Python class in college was taught in "sink or swim" fashion,
so I took it upon myself to be an unofficial TA for the class.
Prof would blow through code, then I'd head home to hammer out
samples for the class, find issues, resolve them, and explain