Skip to content

Instantly share code, notes, and snippets.

# purpose: use changepoint algorithm to determine
# appropriate history range for statistical control charts
# 0.0 Packages ----
library(ggplot2) # for visualizations
library(gridExtra) # for plotting charts together
library(lubridate) # for data manipulations
library(tidyverse) # for piping data
library(reshape2) # for wide to long data transform
library(changepoint) # for finding change points in ts data
# purpose: use changepoint algorithm to benchmark
# Piketty's time buckets for inflationary periods
# 0.0 Packages ----
library(ggplot2) # for visualizations
library(gridExtra) # for plotting charts together
library(lubridate) # for data manipulations
library(tidyverse) # for piping data
library(reshape2) # for wide to long data transform
library(changepoint) # for finding change points in ts data
@FrankRuns
FrankRuns / vision-to-data.R
Created June 20, 2021 21:20
Turning vision docs into data
# packages
library(syuzhet)
library(dplyr)
library(ggplot2)
# subset of text (to start)
limiting_beliefs <- "I never had a plan for my career and now it’s too late.
I wanted to be X, but didn’t start early enough in life and now it’s too late.
I go to work to support my family, not to be fulfilled.
I can’t make enough money doing a job I want to do.
@FrankRuns
FrankRuns / scen-planning-mc-starter.R
Created May 12, 2021 12:14
Script to support scenario planning article
# purpose: support article on scenario planning with monte carlo
# caution: this is a learning script (for me, and you)
# read packages
library(dplyr)
library(ggplot2)
library(tidyr)
library(EnvStats)
library(MASS)
@FrankRuns
FrankRuns / uno-sim.ipynb
Last active January 16, 2024 10:18
Python sim for the card Uno
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
library(tidyverse)
library(ggplot2)
# create holder data frame
data <- data.frame(magic_number=numeric(), equity_fraction=numeric(),
mgmt_span=numeric(), ps_fit=numeric(),
salary_growth=numeric())
# create ranges for variables
s_set <- 1:20
@FrankRuns
FrankRuns / pa-sim.r
Created December 29, 2020 12:21
Simple Sim to Understand Preferential Attachment
# load packages
library(tidyverse)
library(ggplot2)
library(gganimate)
# define initialization parameters
the_step <- rep(0, 5)
the_options <- c(1,2,3,4,5)
print(the_options)
@FrankRuns
FrankRuns / get_running_hotspots.py
Last active December 25, 2019 01:16
this gist helps parse an osm file to identify good running nodes in an area of interest
# python3
# this gist helps parse an osm file to identify good
# running nodes in an area of interest
import xml.etree.cElementTree as ET # to parse OSM file
import folium # to create map
from folium.plugins import MarkerCluster # to create map
import os # to view map
import webbrowser # to view map
# Weather Underground API history call format example
# http://api.wunderground.com/api/<YOUR_API_KEY>/history_20060405/q/CA/San_Francisco.json
start_string = "http://api.wunderground.com/api/<YOUR_API_KEY>/history_"
end_string = "/q/MN/Minneapolis.json"
the_dates = ['2015-05-24', '2015-10-29', '2015-11-06', '2015-09-27',
'2015-04-01', '2015-06-16', '2015-08-28', '2015-08-30',
'2015-05-15', '2015-03-06', '2015-01-24', '2015-05-07',
'2015-01-02', '2015-09-01', '2015-10-17', '2015-08-10',
@FrankRuns
FrankRuns / centos_python_env_setup
Created May 18, 2016 10:40 — forked from floer32/centos_python_env_setup
CentOS 6: Install Python 2.7.4, pip, virtualenv, and virtualenvwrapper on CentOS (plus some bonus items at the end if you want). You should probably run with `sudo`.
#!/bin/bash
# Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/
# Install stuff #
#################
# Install development tools and some misc. necessary packages
yum -y groupinstall "Development tools"
yum -y install zlib-devel # gen'l reqs