Skip to content

Instantly share code, notes, and snippets.

library(nara)
library(grid)
x11(type = 'dbcairo', antialias = 'none', width = 8, height = 6)
dev.control('inhibit')
w<-400
h<-300
nr <- nr_new(w, h, 'black')
l1 <- c(floor(runif(1,0,w)),floor(runif(1,0,h)))
Dungeon Crawl Stone Soup version 0.30.0 (webtiles) character file.
Game seed: 10533382479493230744
41318 ozjimbob the Warrior (level 14, -10/143 HPs)
Began as a Hill Orc Fighter on Dec 28, 2023.
Was a Follower of Uskayaw.
Mangled by a spark wasp (shapeshifter) (15 damage)
... on level 13 of the Dungeon on Dec 29, 2023.
The game lasted 01:09:43 (16934 turns).
# Day 15
library(sf)
#Sensor at x=1943362, y=12808: closest beacon is at x=1861152, y=-42022
data <- readLines("data_15.txt")
ll = list()
# for each data line, get coordinates, draw a diamond based on manhattan distance
for (i in seq_along(data)) {
d2 = strsplit(data[[i]], "[=,:]")[[1]]
library(tidyverse)
library(terra)
tas <- vect("E:/geodata/Aus_Coastline/tasmania/csttascd_r.shp")
bclm <- rast(list.files("E:/geodata/bioclim/2_5m/",full.names=TRUE))
bclm <- crop(bclm,tas)
ext <- extract(bclm,tas)
ext <- ext[complete.cases(ext),]
@ozjimbob
ozjimbob / day_07.r
Last active December 7, 2022 10:12
data <- readLines("data_07.txt")
files <- data.frame(id=1,parent=0,name="/",type="dir",size=0)
find_next <- function(x){
while(x < length(data)){
x=x+1
if(strsplit(data[x]," ")[[1]][1]=="$" || x > length(data)){
return(x)
}
Prompt:
Can you tell me a story? There are a group of foxes living underground near a mystical pond in a wood. The foxes have adventures and battle a mysterious malevolent presence.
Response:
Once upon a time, in a dense forest far from civilization, there was a mystical pond hidden among the trees. It was said that the pond had magical properties and was guarded by a group of wise and cunning foxes. These foxes had lived underground near the pond for many generations, and they had developed a rich culture and society of their own.
The foxes were led by a wise and just king named Aspen. He was a strong and honorable fox, and he was loved and respected by all the members of the fox community. Under his guidance, the foxes thrived and lived in harmony with each other and the forest around them.
But one day, a dark and malevolent presence began to stir in the depths of the forest. It was a powerful and evil being that had been sealed away for centuries, but now it had regained its strength and was determine
data <- readLines("data_05.txt")
# find separator line
blank <- which(data == "")
stacks <- data[1:(blank-1)]
instructions <- data[(blank+1):length(data)]
stacks <- strsplit(stacks,"")
rowlen <- length(stacks[[1]])
data <- readLines("data_03.txt")
letters_all <- c(letters,LETTERS)
process_line <- function(x){
this_line <- data[x]
sl = nchar(this_line)
str1 <- substr(this_line,1,sl/2)
str2 <- substr(this_line,(sl/2)+1,sl)
chars1 <- strsplit(str1,"")[[1]]
# Data file is as provided
data <- read.delim("data_02.txt",header=FALSE,sep=" ")
# Simple lsit to look up scores for Rock/Paper/Scissors
scores <- list(X=1, Y=2, Z=3)
# Look-up matrix for win/lose/draw conditions, R/P/S in rows/columns
WLD <- matrix(c(3,0,6,
6,3,0,
0,6,3),nrow=3)
<html><head><title>Test Page</title>
<script type="text/javascript">
// Example POST method implementation:
async function postData(url = '', data = {}) {
const response = await fetch(url, {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'no-cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit