Grilled Cheese

ExploreLog inSign up
Terms of UsePrivacy PolicyCommunity StandardsHelpGet the app

Grilled Cheese is a product of Village Compute

Version devBuilt at: 2026-12-03 22:42:33 EST

PhotosVideosAllPeople
LatestRanked
Photo, no description
Blog post image
Photo, no description
Photo, no description
Blog post image
Me trying to run `quarto preview` in an R console and getting an error
Map for Nov 19 (Smell): Where does the smell go, and who is there?, by Cinco Yu.
Title card. Day 3 of 25, #RCLIAdvent2026: processx::run(). Arguments as a vector. No shell. Real errors.
# For a given #A....#B in a row it is a square if 
# A = (r,c) B = (r,c+d) C = (r+d,c) D = (r+d,c+d) where D = Ac - Bc
input = readLines("input.txt")
# Build logical grid
grid <- do.call(
  rbind,
  lapply(
    input,
    function(x) strsplit(x, "", fixed = TRUE)[[1]] == "#"
  )
)
n_rows <- nrow(grid)
n_cols <- ncol(grid)
square_count <- 0
for (d in 1:140) { #140 is max gap
  # rows participating in a square of edge d
  upper_rows <- seq_len(n_rows - d)
  lower_rows <- upper_rows + d
  # columns participating in a square of edge d
  left_cols  <- seq_len(n_cols - d)
  right_cols <- left_cols + d
  #if hypothetical squares exist increase count
  square_count <- square_count +
    sum(
      grid[upper_rows, left_cols,  drop = FALSE] &
        grid[upper_rows, right_cols, drop = FALSE] &
        grid[lower_rows, left_cols,  drop = FALSE] &
        grid[lower_rows, right_cols, drop = FALSE]
    )
}
square_count
#Star2
trees <- which(grid, arr.ind = TRUE)
n_trees <- nrow(trees)
square_count <- 0L
for (i in seq_len(n_trees - 1)) {
  r1 <- trees[i, 1]
  c1 <- trees[i, 2]
  for (j in (i + 1):n_trees) {
    r2 <- trees[j, 1]
    c2 <- trees[j, 2]
    dx <- r2 - r1
    dy <- c2 - c1
    # 1st direction
    r3 <- r1 - dy
    c3 <- c1 + dx
    r4 <- r2 - dy
    c4 <- c2 + dx
    if (
      r3 >= 1 && r3 <= n_rows &&
      r4 >= 1 && r4 <= n_rows &&
      c3 >= 1 && c3 <= n_cols &&
      c4 >= 1 && c4 <= n_cols
    ) {
      if (
        grid[r3, c3] &&
        grid[r4, c4]
      ) {
        square_count <- square_count + 1L
      }
    }
    # other direction
    r3 <- r1 + dy
    c3 <- c1 - dx
    r4 <- r2 + dy
    c4 <- c2 - dx
    if (
      r3 >= 1 && r3 <= n_rows &&
      r4 >= 1 && r4 <= n_rows &&
      c3 >= 1 && c3 <= n_cols &&
      c4 >= 1 && c4 <= n_cols
    ) {
      if (
        grid[r3, c3] &&
        grid[r4, c4]
      ) {
        square_count <- square_count + 1
      }
    }
  }
}
# squares not edges
square_count <- square_count %/% 4
square_count
Photo, no description
library(atrrr)
library(dplyr)
library(purrr)
library(lubridate)
library(stringr)
baccount = "thoughtfulnz.bsky.social"
# authentication hidden
#I figure I can't have made more than 6000 posts in the year, will then subset
sixthou <- get_skeets_authored_by(actor=baccount,limit=6000)
thoughtful_posts <- sixthou |>
  mutate(
    created_at = map_chr(post_data, "createdAt"),
    created_at = ymd_hms(created_at)
  ) |>
  filter(
    year(created_at) == year(Sys.Date()),
    author_handle == baccount
  )
words <- thoughtful_posts$text |>
  str_c(collapse = " ") |>
  str_split("\\s+") |>
  unlist()
words <- ifelse(
  str_detect(words, "^https?://"),
  words,
  str_replace_all(words, "^[[:punct:]]+|[[:punct:]]+$", "")
)
words <- words[words != ""]
length(words)
length(unique(words))
Photo, no description
Photo, no description
Photo, no description
Photo, no description
Photo, no description
Photo, no description
Photo, no description
Photo, no description
Photo, no description
Load more