Skip to content

Instantly share code, notes, and snippets.

View cjtexas's full-sized avatar
🌍
With Our Powers Combined...

Caleb Jenkins cjtexas

🌍
With Our Powers Combined...
View GitHub Profile
We can't make this file beautiful and searchable because it's too large.
grid_id,geom
1,"POLYGON ((-130 20, -130 20.25, -129.75 20.25, -129.75 20, -130 20))"
2,"POLYGON ((-129.75 20, -129.75 20.25, -129.5 20.25, -129.5 20, -129.75 20))"
3,"POLYGON ((-129.5 20, -129.5 20.25, -129.25 20.25, -129.25 20, -129.5 20))"
4,"POLYGON ((-129.25 20, -129.25 20.25, -129 20.25, -129 20, -129.25 20))"
5,"POLYGON ((-129 20, -129 20.25, -128.75 20.25, -128.75 20, -129 20))"
6,"POLYGON ((-128.75 20, -128.75 20.25, -128.5 20.25, -128.5 20, -128.75 20))"
7,"POLYGON ((-128.5 20, -128.5 20.25, -128.25 20.25, -128.25 20, -128.5 20))"
8,"POLYGON ((-128.25 20, -128.25 20.25, -128 20.25, -128 20, -128.25 20))"
9,"POLYGON ((-128 20, -128 20.25, -127.75 20.25, -127.75 20, -128 20))"
@cjtexas
cjtexas / minimal-wildfire-brms.R
Created February 28, 2024 15:20 — forked from mbjoseph/minimal-wildfire-brms.R
Minimal example of a Bayesian finite sample approach for wildfires using brms
library(tidyverse)
library(sf)
library(here)
library(brms)
library(lubridate)
library(reshape2)
# Get ecoregion data ------------------------------------------------------
download.file("ftp://newftp.epa.gov/EPADataCommons/ORD/Ecoregions/us/us_eco_l4.zip",
destfile = "ecoregions.zip")
@cjtexas
cjtexas / connected_ggiraph.R
Created October 25, 2023 21:27 — forked from AlbertRapp/connected_ggiraph.R
connected_ggiraph.R
library(dplyr)
library(ggplot2)
library(patchwork)
library(ggiraph)
dat <- gapminder::gapminder |>
janitor::clean_names() |>
mutate(
# ID that is shared for boxplots (this one uses factors, i.e. numbers, as ID instead of continents)
@cjtexas
cjtexas / word_frequency.r
Created August 7, 2023 22:00
My R Language "word frequency" entry in rosettacode.org
# https://rosettacode.org/wiki/Word_frequency#Version_2
word_frequency_pipeline <- function(file=NULL, n=10) {
file |>
vroom::vroom_lines() |>
stringi::stri_split_boundaries(type="word", skip_word_none=T, skip_word_number=T) |>
unlist() |>
tolower() |>
table() |>
@cjtexas
cjtexas / get_quote.r
Last active August 4, 2023 16:01
get_quote
get_quote <- function(symbol="SPY") {
url <- sprintf("https://query1.finance.yahoo.com/v8/finance/chart/%s?region=US&lang=pt-BR&includePrePost=false&interval=1m&useYfid=true&range=1d&corsDomain=finance.yahoo.com&.tsrc=finance", symbol)
res <- httr::GET(url)
json <- httr::content(res, "text")
ls <- jsonlite::fromJSON(json)
o <- ls$chart$result$indicators$quote[[1]]$open[[1]][1]
h <- max(ls$chart$result$indicators$quote[[1]]$high[[1]], na.rm = T)
@cjtexas
cjtexas / userDefineLang_Dockerfile.xml
Created July 31, 2023 20:29 — forked from centic9/userDefineLang_Dockerfile.xml
notepad++ syntax highlighting for Dockerfiles, store at something like C:\Users\[user]\AppData\Roaming\Notepad++\userDefineLangs\userDefineLang_Dockerfile.xml
<NotepadPlus>
<UserLang name="Dockerfile" ext="Dockerfile" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="1" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="yes" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00# 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@cjtexas
cjtexas / human_numbers.r
Created July 25, 2023 14:44
human_numbers
#' Human Numbers: Format numbers so they're legible for humans
#' Use this in ggplot for labels where you might use the comma or percent functions from the
#' Scales package.
#'
#' Checks whether numbers are positive or negative.
#' Allows up to 1 significant figure
#' sapply used for element-wise application of the humanity function as a vector may include
#' numbers where billions, millions or thousands are appropriate.
#'
#' @return a character vector the same length as the input vector
@cjtexas
cjtexas / sources.list
Created November 17, 2022 16:59 — forked from rhuancarlos/sources.list
Ubuntu 18.04 Bionic default /etc/apt/sources.list
#deb cdrom:[Ubuntu 18.04 LTS _Bionic Beaver_ - Release amd64 (20180426)]/ bionic main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
@cjtexas
cjtexas / try_null.r
Created October 26, 2022 20:51
try_null
try_null <- function(x) tryCatch(x, error = \(e) NULL)
@cjtexas
cjtexas / eastern_time.py
Last active March 18, 2025 19:02
eastern_time
Clock.bpm = 84
Scale.default = "blues"
d1 >> play("[xx] [^^] [##] ** ", sample = 10)
d2 >> play("[mm][vo]voo[----]", sample=10)
b1 >> dbass(
var([-4, -2, -1, 0, -2, -5]),
root = var([0, 2], 36),