Skip to content

Instantly share code, notes, and snippets.

View Ryo-N7's full-sized avatar

Ryo Nakagawara Ryo-N7

View GitHub Profile
library(tidycensus)
library(tidyverse)
options(tigris_use_cache = TRUE)
state_names <- c(state.name, "District of Columbia")
names(state_names) <- state_names
tictoc::tic()
age_maps <- map(state_names, ~{
@ikashnitsky
ikashnitsky / world-cup-odds.R
Last active December 26, 2022 07:37
Were there too many unlikely results in Qatar? -- https://ikashnitsky.github.io/2022/exceptional-world-cup
#===============================================================================
# 2022-12-25 -- ik-q
# World cups -- was Qatar that exceptional?
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
library(tidyverse)
library(magrittr)
library(wdman)
library(RSelenium)
@veekaybee
veekaybee / chatgpt.md
Last active April 12, 2024 20:16
Everything I understand about chatgpt

ChatGPT Resources

Context

ChatGPT appeared like an explosion on all my social media timelines in early December 2022. While I keep up with machine learning as an industry, I wasn't focused so much on this particular corner, and all the screenshots seemed like they came out of nowhere. What was this model? How did the chat prompting work? What was the context of OpenAI doing this work and collecting my prompts for training data?

I decided to do a quick investigation. Here's all the information I've found so far. I'm aggregating and synthesizing it as I go, so it's currently changing pretty frequently.

Model Architecture

@koenvo
koenvo / README.md
Last active November 3, 2022 08:15

Cronjob and docker?

Some applications consist of multiple services. In those cases it can be useful to use a tool like docker-compose. With docker-compose you can define all your services within a single docker-compose yaml file, and add the file to your repository. This way you keep all services definition at a single place, with version control.

But what if you want to run a cronjob?

Cron on the host

One solution is to add a call to docker-compose to the crontab in the host system. In this example we would like to run a script called cleanup-old-files.py.

@jeroen
jeroen / app.R
Last active October 23, 2022 02:25
Reoder pdf with drag and drop in shiny
# https://twitter.com/henrikbengtsson/status/1583520708470067201
library(shiny)
library(sortable)
library(pdftools)
library(magick)
# The file to manipulate
pdffile <- tempfile(fileext = '.pdf')
download.file('https://www.uscis.gov/sites/default/files/document/forms/i-9-paper-version.pdf', pdffile)
# to create the plots in this Twitter thread: https://twitter.com/MeghanMHall/status/1560411406935138305
library(tidyverse)
library(ggrepel)
library(scales)
df1 <- txhousing %>%
filter(city %in% c("Houston","Austin")) %>%
group_by(year, city) %>%
summarize(avg = mean(median, na.rm = TRUE)) %>%
library(tidyverse)
## this r code is taking from here: https://github.com/mkearney/pkguse
read_r_files <- function(...) {
dirs <- unlist(list(...))
r <- unlist(lapply(dirs, list.files,
pattern = "\\.(R|Rmd|Rmarkdown|rmd|r|Rhistory)$",
recursive = TRUE,
full.names = TRUE,
all.files = TRUE))
@andrewbtran
andrewbtran / wpdatateam-ridge
Last active March 2, 2023 17:06
wpdatateam logo generator
# code from https://github.com/gkaramanis/aRtist/blob/main/genuary/2021/2021-3/2021-3.R
library(ggplot2)
library(dplyr)
library(magick)
library(ggridges)
# Read in image and convert to grayscale
img <- image_read(here::here("MRlWzfMH_400x400.jpg")) %>%
image_convert(colorspace = "gray")
@BenjaminWolfe
BenjaminWolfe / curl.R
Last active April 3, 2022 21:31
Create Pages in Notion with R
# See `curl.md`. Here is the R equivalent.
library(httr)
library(jsonlite)
make_page <- function(url, headers, data) {
response <- POST(
url = url,
body = toJSON(data, auto_unbox = TRUE),
config = add_headers(.headers = headers)
# Levante UD Rolling xG Plot
# Owen Thompson
# 2022-01-18
# -- Load libraries
library(tidyverse)
library(ggtext)
# -- Resources ----------------------------------.
# Adjust Transparency (alpha) of stat_smooth lines, not just transparency of Confidence Interval