Skip to content

Instantly share code, notes, and snippets.

@ccritchfield
ccritchfield / _coronavirus_model_v3.readme
Last active Jul 5, 2020
Python - Coronavirus Model v3 - People as Aggregates
View _coronavirus_model_v3.readme
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 / _coronavirus_model_v2.readme
Last active Jul 5, 2020
Python - Coronavirus Model v2 - Dynamic People Lists
View _coronavirus_model_v2.readme
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.readme
Last active Jun 16, 2020
Python - Coronavirus Model
View _coronavirus_model.readme
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,
View _sql_sample.readme
--------------------------------------------
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 / _samplesize.readme
Last active Dec 13, 2019
Python - Sample Sizing Big Data To Reduce Processing
View _samplesize.readme
-----------------------------------------
Sample Sizing Big Data to Reduce Processing
-----------------------------------------
When grinding massive data sets, it'd be nice to
figure out a statistically supported subset sample
size you could come up with and run instead, that
way you could cut down on the time and resources
needed to come up with some results. IE: instead
of spending tons of time and resources grinding
View _vba_excel_utils.readme
---------------------------------------
VBA Excel Utilties
---------------------------------------
Excel is a great tool for quick-n-dirty analysis.
But, staring at raw data in it can be a pain. So,
I created misc utilities to pull in data from SQL
servers, format data, border-split rows to group
similar data together, dupe-check data (made this
before MS got smart and built a version into later
@ccritchfield
ccritchfield / _zip_backup.readme
Last active Dec 5, 2019
VBS - Zip Up Folder (using FBZip.exe)
View _zip_backup.readme
--------------------------------------------
Windows Command-line Zip Automation
--------------------------------------------
VBS / VBScript / WScript that uses FBZip.exe to automate zipping
up folders and archiving them into a folder. Runs from DOS commandline,
and can task schedule to fire off and run after-hours for archiving /
back-ups.
Uses FBZip, b/c it's a small free zip program that has easy-to-use
@ccritchfield
ccritchfield / _backup_folders.readme
Last active Dec 5, 2019
DOS - Backup Folders (XCOPY)
View _backup_folders.readme
----------------------------------------------
Windows Command-line Folder Copy Automation
----------------------------------------------
DOS / Windows Commandline script to automate folder copies / backups.
Can task schedule to do folder archiving after-hours.
IT would have a nightly backup of things, but created some backup
scripts to copy whole project folders into backups. This let me
quickly restore something if I was working on things or someone
@ccritchfield
ccritchfield / _compacter.readme
Last active Dec 5, 2019
DOS - MS Access Compacting Script
View _compacter.readme
----------------------------------------------
Windows Command-line MS Access DB Compact Automation
----------------------------------------------
DOS / Windows Command-line script that compacts MS Access databases.
Checks if db is open (.ldb file exists) and skips compacting that db
if it does. Can task schedule to run after-hours for maintenance.
Purpose ...
@ccritchfield
ccritchfield / market_basket_analysis.r
Last active Dec 5, 2019
R - Affinity Analysis (Market Basket Analysis)
View market_basket_analysis.r
#--------------------------------------------
# R affinity / market-basket analysis
#--------------------------------------------
# if someone picks X, how likely would they
# be to pick Y or YZ. Or, if they picked XY
# together, how likely they'd pick Z. Etc.
#
# This serves two fold purpose..
# 1) we can make a recommender system.. based on
# things they picked together, or picked one and