Skip to content

Instantly share code, notes, and snippets.

View erictleung's full-sized avatar
👨‍💻
Data sciencing

Eric Leung erictleung

👨‍💻
Data sciencing
View GitHub Profile
@erictleung
erictleung / slopsquatting_diagram.mermaid
Created June 10, 2025 19:20
Create rendition of slopsquatting flowchart
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@erictleung
erictleung / spark_r_notes.md
Last active June 17, 2025 16:10
SparkR, sparklyr, and Databricks notes
@erictleung
erictleung / bbg_tree_bloom_2025.csv
Last active May 20, 2025 15:38
Scrape and track Brooklyn Botanical Garden cherry blossom blooms
date alt tree id bloom
2025-04-14 Prunus ‘Taki-nioi’ taki_nioi 163 First Bloom
2025-04-14 Prunus pendula ‘Pendula Rosea ’ pendula 128 Peak Bloom
2025-04-14 Prunus pendula ‘Pendula Plena Rosea’ yae_beni_shidare 126 Peak Bloom
2025-04-14 Prunus × sieboldii sieboldii 160 First Bloom
2025-04-14 Prunus ‘Hata-zakura’ hatazakura 106 First Bloom
2025-04-14 Prunus ‘Ariake’ ariake 154 First Bloom
2025-04-14 Prunus ‘Ukon’ ukon 162 Prebloom
2025-04-14 Prunus × sieboldii sieboldii 161 First Bloom
2025-04-14 Prunus ‘Fudan-zakura’ fudan_zakura 107 Post-Peak Bloom
@erictleung
erictleung / rotten_tomatoes_christmas_rankings.R
Last active December 10, 2024 15:19
Plot critics and audience ratings from Rotten Tomatoes
library(tidyverse)
library(rvest)
library(ggtext)
library(extrafont)
rt <- read_html("https://editorial.rottentomatoes.com/guide/best-christmas-movies/")
film_regex <- regex(
"^([A-Za-z0-9.' ,-:&]* \\([0-9]{4,4}\\))\\n\\s+([0-9]{0,4})\\%\\n\\s+([0-9]{0,4})\\%"
)
@erictleung
erictleung / check_associated_acts.py
Created January 30, 2024 04:01
Help audit, remove, and update musician infoboxes on Wikipedia
#!/usr/bin/env python3
"""
Help audit, remove, and update musician infoboxes.
https://en.wikipedia.org/wiki/Category:Pages_using_infobox_musical_artist_with_associated_acts
"""
import re
import requests
@erictleung
erictleung / extract_zoom_urls.sh
Last active January 25, 2024 18:15
Extract URls from Zoom chat
#!/usr/bin/env bash
# Description: Extract unique URLs from the plain text output from Zoom chat and
# save links to new file.
# Usage: bash extract_zoom_urls.sh
# Set path to where Zoom chat is, or `cd` to the directory itself
FILE=meeting_saved_chat.txt
# Get list of unique links shared in Zoom chat
@erictleung
erictleung / setup.sh
Last active October 28, 2022 19:22
Setup Exercism in Replit
# Follow instructions here for more:
# https://exercism.io/cli-walkthrough
# Releases:
# https://github.com/exercism/cli/releases
# Download and move around
# Change URL as needed for new versions
wget https://github.com/exercism/cli/releases/download/v3.1.0/exercism-3.1.0-linux-x86_64.tar.gz
mkdir bin
mv exercism bin/
@erictleung
erictleung / big_book_r_logo.R
Created June 13, 2022 16:57
Quick logo for Big Book of R
# Make logo
library(hexSticker)
library(showtext)
# Add Google Font
font_add_google(name = "Open Sans", family = "Open Sans")
showtext_auto() # Use this font in all rendering
# Picture of book that was quickly screenshot
imgurl <- "~/Downloads/Screenshot 2022-06-13 092720.png"
@erictleung
erictleung / smartphone_users.R
Last active May 4, 2022 19:55
Plot number of smartphone users over time, data from a tweet
library(dplyr)
library(stringr)
library(ggplot2)
d <- rtweet::search_tweets("from:stats_feed", n = 30) %>%
filter(status_id == "1521871339908263937") %>%
pull(text) %>%
str_split("\n") %>%
as_tibble(.name_repair = "universal") %>%
rename("data" = "...1") %>%
@erictleung
erictleung / example_data.csv
Created March 15, 2022 21:08
For each row, count number of other rows that fall within a time interval
start_date stop_date
1999-07-15 1999-11-15
1999-11-15 2000-02-15
1999-12-15 2000-02-15
2000-09-15 2002-02-15
2002-02-15 2003-12-15
2002-02-15 2003-12-15
2003-02-15 2004-03-15
2004-04-15 2004-08-15
2004-08-15 2005-04-15