Skip to content

Instantly share code, notes, and snippets.

View uribo's full-sized avatar
🍉
fine

Shinya Uryu uribo

🍉
fine
View GitHub Profile
@strengejacke
strengejacke / Positron-Setup
Last active March 19, 2025 21:03
Positron-Setup
Positron Version: 2025.03.0 (system setup) build 116
Code - OSS Version: 1.96.0
Commit: 7f0f93873e8b24c9f393bb3586724f4783c5e72c
Date: 2025-03-01T18:59:57.025Z
Electron: 32.2.6
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.26100
@tylermorganwall
tylermorganwall / india_historical_map.R
Last active February 25, 2024 18:22
Historical Map of India with 3D elevation
library(raster)
library(rayshader)
#Load QGIS georeference image (see https://www.qgistutorials.com/en/docs/3/georeferencing_basics.html)
testindia = raster::stack("1870_southern-india_modified.tif")
#Set bounding box for final map (cut off edges without data, introduced via reprojection)
india_bb = raster::extent(c(68,92,1,20))
cropped_india = raster::crop(testindia, india_bb)
#Convert to RGB array
pacman::p_load(tidyverse, scales, glue, extrafont, rvest, ggtextures, cowplot, polite)
# Roboto Condensed font (from hrbrmstrthemes or just Google it)
loadfonts()
# web scrape
topg_url <- "https://en.wikipedia.org/wiki/AFC_Asian_Cup_records_and_statistics"
session <- bow(topg_url)
ac_top_scorers <- scrape(session) %>%
@etachov
etachov / nyt_style_buildings.R
Created October 14, 2018 16:23
Making NYT-style building maps with data from Microsoft
library(tidyverse)
library(sf)
library(tigris)
# start by picking a state from https://github.com/Microsoft/USBuildingFootprints
# WARNING: these files can be pretty big. using arizona for its copious subdivisions and reasoanable 83MB.
url_footprint <- "https://usbuildingdata.blob.core.windows.net/usbuildings-v1-1/Arizona.zip"
download.file(url_footprint, "Arizona.zip")
unzip("Arizona.zip")
@rCarto
rCarto / mtq.R
Last active August 21, 2023 19:06
library(raster)
library(cartography)
library(sf)
library(SpatialPosition)
mtq <- st_read(system.file("shape/martinique.shp", package="cartography"))
# use WGS84 proj
mtq_latlon <- st_transform(mtq, 4326)
# this call throw an error but seems to work...
getData('SRTM', lon=-61, lat=14)
library(sf)
library(spatstat)
library(sp)
library(maptools)
library(raster)
library(cartography)
library(SpatialPosition)
## import dataset
feat <- sf::st_read("https://gist.githubusercontent.com/rCarto/747164575e3f216a123c3092d0ce9162/raw/f12390464f255b5f9760c577ab6bf5456cf61a40/iris75.geojson")
@thomasp85
thomasp85 / seal_tracking.R
Last active December 9, 2020 18:23
Animating Elephant Seal movement
library(sf)
library(ggplot2)
library(gganimate)
# Data from personal correspondance
# Collapse all dates to the same year
d$year <- format(d$date, '%Y')
d$stand_time <- as.POSIXct(paste0('2000-', format(d$date, '%m-%d %T')))
@eliocamp
eliocamp / erebus.md
Last active June 8, 2018 09:09
Plot a terrain relief of Erebus volcano with contour lines.
library(data.table)
library(ggplot2)
library(metR)

out.file <- "~/Downloads/erebus_atm_2001_dem_v5.tif"
if (!file.exists(out.file)) {
   # data => https://www.pgc.umn.edu/data/elevation/
   # ~ 90Mb   
   download.file("http://data.pgc.umn.edu/elev/dem/atm/2001/erebus_atm_2001_dem_v5.tif",
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
iris = sns.load_dataset('iris')
f, ax = plt.subplots(figsize=(10, 8))
species_list = np.unique(iris.species)
color_list = ['r', 'g', 'b']
data = [np.array(iris[iris.species==s].sepal_length) for s in species_list]
library(tidycensus)
library(tmap)
library(tmaptools)
library(sf)
library(tigris)
library(magick)
library(tidyverse)
options(tigris_use_cache = TRUE)
ctys <- c("Dallas", "Tarrant", "Collin County", "Denton",