Skip to content

Instantly share code, notes, and snippets.

View USMortality's full-sized avatar

USMortality.com USMortality

View GitHub Profile
@USMortality
USMortality / chart_us.r
Last active February 16, 2026 18:07
Stocks SP500 [USA]
#!/usr/bin/env Rscript
# ═══════════════════════════════════════════════════════════════
# US Equity (S&P 500 TR / VTI) — Log-Trend & Super-Cycle Analysis
# Charts: 1_ Price+Trend, 2_ Deviation+Supertrend, 3_ Normalized
# Data: ERN SWR Toolbox (1871–2025) + Yahoo Finance (recent)
# ═══════════════════════════════════════════════════════════════
library(tidyverse)
library(quantmod)
library(ggrepel)
@USMortality
USMortality / chart_world.r
Last active February 16, 2026 18:07
World Equity (Blended US + ex-US / VT) — Log-Trend & Super-Cycle Analysis | ERN historical data from 1971 + Yahoo Finance
#!/usr/bin/env Rscript
# ═══════════════════════════════════════════════════════════════
# World Equity (Blended US + ex-US / VT) — Log-Trend & Super-Cycle
# Charts: 1_ Price+Trend, 2_ Deviation+Supertrend, 3_ Normalized
# Data: ERN SWR Toolbox (1871–2025) + Yahoo Finance (recent)
# Blend uses time-varying US market-cap weights (approx.)
# ═══════════════════════════════════════════════════════════════
library(tidyverse)
library(quantmod)
@USMortality
USMortality / chart_exus.r
Last active February 16, 2026 18:07
Ex-US Equity (World ex-US / VXUS) — Log-Trend & Super-Cycle Analysis | ERN historical data from 1971 + Yahoo Finance
#!/usr/bin/env Rscript
# ═══════════════════════════════════════════════════════════════
# Ex-US Equity (World ex-US / VXUS) — Log-Trend & Super-Cycle
# Charts: 1_ Price+Trend, 2_ Deviation+Supertrend, 3_ Normalized
# Data: ERN SWR Toolbox (1871–2025) + Yahoo Finance (recent)
# ═══════════════════════════════════════════════════════════════
library(tidyverse)
library(quantmod)
library(ggrepel)
@USMortality
USMortality / chart_us.r
Last active February 16, 2026 18:07
US Equity (S&P 500 TR / VTI) — Log-Trend & Super-Cycle Analysis | ERN historical data from 1971 + Yahoo Finance
#!/usr/bin/env Rscript
# ═══════════════════════════════════════════════════════════════
# US Equity (S&P 500 TR / VTI) — Log-Trend & Super-Cycle Analysis
# Charts: 1_ Price+Trend, 2_ Deviation+Supertrend, 3_ Normalized
# Data: ERN SWR Toolbox (1871–2025) + Yahoo Finance (recent)
# ═══════════════════════════════════════════════════════════════
library(tidyverse)
library(quantmod)
library(ggrepel)
@USMortality
USMortality / .chart_usa_measles.r
Last active February 14, 2026 16:37
Measles Cases & Deaths [USA]
library(readr)
library(dplyr)
library(fable)
library(ggplot2)
library(ggrepel)
sf <- 2
width <- 600 * sf
height <- 335 * sf
@USMortality
USMortality / .chart_ca-santa-clara_covid19_cases_tests_positivity.r
Last active February 13, 2026 19:50
7-Day Moving Average of Cases, Tests, and Positivity [Santa Clara County, CA]
library(ggplot2)
library(slider)
library(scales)
library(dplyr)
library(readr)
library(tsibble)
sf <- 2
width <- 600 * sf
height <- 335 * sf
@USMortality
USMortality / .chart_usa_elections_president_percentage_eligible_d_r.r
Last active February 13, 2026 19:49
Democratic & Republican Votes as Percentage of Voting Eligible Population [USA]
# Required libraries
library(ggplot2)
library(dplyr)
library(tsibble)
library(fable)
library(feasts)
library(readr)
sf <- 2
width <- 600 * sf
@USMortality
USMortality / .chart_usa_democratic_votes.r
Last active February 13, 2026 19:49
Democratic Popular Votes by Presidential Election (with Forecasts) [USA]
library(ggplot2)
library(dplyr)
library(tsibble)
library(fable)
library(feasts)
sf <- 2
width <- 600 * sf
height <- 335 * sf
@USMortality
USMortality / .chart_usa_elections_president_percentage_eligible.r
Last active February 13, 2026 19:49
Votes as Percentage of Voting Eligible Population [USA]
# Required libraries
library(ggplot2)
library(dplyr)
library(tsibble)
library(fable)
library(feasts)
library(readr)
sf <- 2
width <- 600 * sf
@USMortality
USMortality / exec_chart_gists.sh
Last active December 30, 2025 21:07
Execute Chart Gists
#!/bin/bash
set -euo pipefail
USER="USMortality"
CHARTS_JSON="out/charts.json"
BASE_URL="https://s3.mortality.watch/charts"
ERROR_LOG="error.log"
# Delay between processing each gist (seconds)