Skip to content

Instantly share code, notes, and snippets.

View Ryo-N7's full-sized avatar

Ryo Nakagawara Ryo-N7

View GitHub Profile
library(tidyverse)
library(gt)
# create data
df <- data.frame(
stringsAsFactors = FALSE,
player = c("Evan Mobley",
"Sandro Mamukelashvili","Charles Bassey","Luka Garza",
"Moses Wright","Neeimisa Queta",
"Isaiah Jackson","Day'Ron Sharpe"),
#' Helper functions for styling with ggtext
#'
#' @param text The text which should be styled
#' @param ... Style options. For example `color="red"`
#' @param tag HTML tag to apply to the text. Defaults to `span`
#'
#' @export
tagged_text <- function(text, ..., tag = "span") {
glue::glue("<{tag} style='{parse_style_options(...)}'>{text}</{tag}>")
}
# 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
@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)
@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")
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))
# 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)) %>%
@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)
@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.

@veekaybee
veekaybee / chatgpt.md
Last active July 8, 2025 19:54
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