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
program <- "roygbvroygbvroygbv" 

program <- program |> 
  strsplit("") |> 
  unlist() |> 
  c("^", ..2 = _)

names <- c("^", "r", "o", "y", "g", "b", "v")
m <- matrix(
  c(
    0, 6, 1, 2, 3, 4, 5,
    6, 6, 1, 2, 3, 4, 5,
    5, 5, 6, 1, 2, 3, 4,
    4, 4, 5, 6, 1, 2, 3,
    3, 3, 4, 5, 6, 1, 2,
    2, 2, 3, 4, 5, 6, 1, 
    1, 1, 2, 3, 4, 5, 6
  ),
  byrow = TRUE, 
  nrow = 7
)

colnames(m) <- names
rownames(m) <- names
answer1 <- m[program, program][, -1] |> diag() |> sum()

long_way <- c("r", "v", "b", "g", "y", "o")
program2 <- program[-1] |> 
  factor(levels = long_way) |> 
  sort() |> 
  as.character() |> 
  c("^", ..2 = _)
answer2 <- m[program2, program2][, -1] |> diag() |> sum()
p1 <- readLines("~/Downloads/aoc-day1.txt") |> 
 table() |> 
  sort(T) |> 
  head(3) |> 
  names() |> 
  as.integer() |> 
  prod()


p2 <- readLines("~/Downloads/aoc-day1.txt") |> 
 table() |> 
  sort() |> 
  head(3) |> 
  names() |> 
  as.integer() |> 
  prod()
Screenshot of blog post at https://dirk.eddelbuettel.com/blog/2026/12/02#myman_0.16.0 describing release 0.16.0 of CRAN package 'myman'.
Photo, no description
Blog post image
Photo, no description
Image of a flyer for RLadies+ talk “Hacking GenAI usage amongst Hackathon goers in a Hackathon” to be held virtually on Wednesday, December 2nd from noon to 1 PM EST. RSVP tinyurl.com/rladies-hack.
Blog post image
Photo, no description
library(tidyverse)

code <- str_split_1("roygbv", "")

#Part 1
program <- 
  as_tibble(read_lines("./day2/input.txt")) %>%
  separate_rows(value, sep = "") %>%
  filter(value != "") 

program %>%
  mutate(prev = lag(value, default = "r"),
         pos = match(value, code),
         prev_pos = match(prev, code),
         dist = (pos - prev_pos) %% length(code),
         dist = if_else(dist == 0, length(code), dist)) %>%
  pull(dist) %>% 
  sum()

#Part 2
sort_order <- c(code[1], rev(code[-1])) 

rev_program <- program %>%
  mutate(new_arrange = match(value, sort_order)) %>% 
  arrange(new_arrange)

rev_program %>% 
  mutate(prev = lag(value, default = "r"),
         pos = match(value, code),
         prev_pos = match(prev, code),
         dist = (pos - prev_pos) %% length(code),
         dist = if_else(dist == 0, length(code), dist)) %>%
  pull(dist) %>%
  sum()
Map for Nov 13 (Interactions): The World in Motion, by Rashi Karkoon.
Title card. Day 2 of 25, #RCLIAdvent2026: system() vs system2(). Two base R ways to run a command.
Screenshot of Positron in Linux in a browser with a little plot from plot(1:10)
Photo, no description
# Star 1
cols <- strsplit("roygbv", "")[[1]]
n <- length(cols)

# Position of each colour in the cycle
pos <- setNames(seq_len(n), cols)

# All ordered pairs
pairs <- expand.grid(a = cols, b = cols, stringsAsFactors = FALSE)
# Distance to the next waypoint, named by colour combo
distance <- with(pairs, {
  d <- (pos[b] - pos[a]) %% n
  d[d == 0] <- n
  setNames(d, paste0(a, b))
})

input <- readLines("input.txt")
waypoints <- paste0("r",input) #missed the red 1st time
waypairs <- substring(waypoints, 1:(nchar(waypoints) - 1), 2:nchar(waypoints))
sum(distance[waypairs])
#####
# Star 2
# can see bug if input doesn't have a colour, won't fix if don't have to
(nchar(gsub("[^r]", "", input))-1) * 6 + 6 + # + 6 for from r start
(nchar(gsub("[^v]", "", input))-1) * 6 + 5 + # + 5 for from r to v
(nchar(gsub("[^b]", "", input))-1) * 6 + 5 + # + 6 for from v to b
(nchar(gsub("[^g]", "", input))-1) * 6 + 5 + # etc
(nchar(gsub("[^y]", "", input))-1) * 6 + 5 +
(nchar(gsub("[^o]", "", input))-1) * 6 + 5 
# didn't have to as it accepted the answer as is
prod(as.numeric(names(sort(table(readLines("input.txt")),decreasing = TRUE)[1:3])))
prod(as.numeric(names(sort(table(readLines("input.txt")))[1:3])))
Blog post image
A linux desktop in a web browser with a terminal open with R running inside it where I just ran 1 + 1
Gallery of the four spring shapes in steel blue, each drawn compressed (short) and stretched (long). Zigzag: sharp textbook zigzags. Wave: a smooth sine wave. Coil: round loops when compressed, opening into a looser wave when stretched. Helix: tilted loops whose back halves are faded, so the wire looks wound in 3D.
Load more