Skip to content

Instantly share code, notes, and snippets.

View USMortality's full-sized avatar

USMortality.com USMortality

View GitHub Profile
@USMortality
USMortality / deploy.sh
Created June 6, 2024 12:50
Deploy latest SFTPGo on Dokku Server
# Variables
APP_NAME="sftpgo"
DOMAIN="ftp.example.com"
EMAIL="your-email@example.com"
ENABLE_LETS_ENCRYPT=true # Set to false to disable Let's Encrypt setup
# Create Dokku app
dokku apps:create $APP_NAME
# Set up domain
@USMortality
USMortality / cleanup.sh
Last active August 26, 2024 23:31
Ubuntu Cleanup Script
#!/bin/bash
# Update the package list and upgrade installed packages
sudo apt-get update && sudo apt-get upgrade -y
# Clean up APT cache
sudo apt-get clean
# Remove unnecessary packages
sudo apt-get autoremove -y
@USMortality
USMortality / data.csv
Last active September 17, 2024 18:27
Umfragen & Wahlergebnisse [Deutschland] - Data
party institute value date
CDU/CSU Allensbach 0.35 2010-01-15
CDU/CSU Emnid 0.33 2010-01-15
CDU/CSU Forsa 0.35 2010-01-15
CDU/CSU Forsch’gr.Wahlen 0.35 2010-01-15
CDU/CSU GMS 0.36 2010-01-15
CDU/CSU Infratestdimap 0.34 2010-01-15
DIE LINKE Allensbach 0.115 2010-01-15
DIE LINKE Emnid 0.14 2010-01-15
DIE LINKE Forsa 0.13 2010-01-15
@USMortality
USMortality / puhach_et_al_2022.r
Last active October 5, 2024 20:24
Reanalysis Puhach et al, 2022
# Study: https://www.nature.com/articles/s41591-022-01816-0
library(readxl)
library(dplyr)
library(ggplot2)
sf <- 2
options(vsc.dev.args = list(width = 600 * sf, height = 335 * sf, res = 72 * sf))
download.file(
@USMortality
USMortality / pdf-ocr.sh
Last active October 21, 2024 15:43
OCR PDF
#!/bin/bash
# Ensure the required tools are installed
command -v pdftoppm >/dev/null 2>&1 || {
echo "pdftoppm is not installed. Exiting."
exit 1
}
command -v tesseract >/dev/null 2>&1 || {
echo "Tesseract is not installed. Exiting."
exit 1
@USMortality
USMortality / x_stats.sh
Last active October 22, 2024 22:39
Get X Stats
#!/bin/sh
### Prerequisites: MacOS: Homebrew & NodeJS
# brew install n # Homebrew: https://brew.sh
# n install lts
npm install -g playwright
playwright install chromium
export NODE_PATH=$(npm root -g)
@USMortality
USMortality / standard_population.r
Created October 24, 2024 15:23
Standard Population
# Standard Populations from SEER.gov
# Helper Functions:
## Splits an age group string by its start and end year.
split_age_group <- function(age_group) {
ages <- strsplit(age_group, "-")
c(as.integer(ages[[1]][1]), as.integer(ages[[1]][2]))
}
## Split weights for an age group uniformly.
@USMortality
USMortality / chart_usa_median_sales_price_house.r
Last active October 25, 2024 00:08
Median Sales Price of Houses Sold [USA]
library(readr)
library(dplyr)
library(ggplot2)
library(lubridate)
library(tsibble)
library(scales)
sf <- 2
width <- 600 * sf
height <- 335 * sf
@USMortality
USMortality / chart_usa_disability.r
Last active October 25, 2024 00:08
Population with a Disability [USA]
library(readr)
library(dplyr)
library(ggplot2)
library(tsibble)
library(lubridate)
library(fable)
library(scales)
sf <- 2
width <- 900 * sf
@USMortality
USMortality / chart_germany_ari_ili.r
Last active October 25, 2024 00:08
ARI & ILI [Germany]
library(readr)
library(dplyr)
library(tsibble)
library(fable)
library(ggplot2)
library(scales)
sf <- 2
width <- 900 * sf
height <- 450 * sf