Skip to content

Instantly share code, notes, and snippets.

View coolbutuseless's full-sized avatar

mikefc coolbutuseless

View GitHub Profile
# There is some explanation for why the bitwise operator functions do what they do here:
# https://inventwithpython.com/blog/2021/08/02/algorithmic-art-with-the-bitfielddraw-module/
# ignore the warnings, THIS IS ART!
library(ggplot2)
cols <- c("#b8e1c5", "#3ac9fb", "#fadacc","#fcb2c6",
"#002f88", "#fd7a5d","#00B850", "#091a22")
@coolbutuseless
coolbutuseless / render_pointcloud.R
Created September 27, 2024 10:24 — forked from wiesehahn/render_pointcloud.R
Example how to render pointclouds in R with rayrender
##___________________________________________________
##
## Script name: render_pointcloud.R
##
## Purpose of script:
## render forest plot pointcloud with raytracing
##
## Author: Jens Wiesehahn
## Copyright (c) Jens Wiesehahn, 2023
## Email: [email protected]
@coolbutuseless
coolbutuseless / pong.R
Created July 24, 2022 00:57 — forked from Enchufa2/pong.R
Pong in R
# remotes::install_github("coolbutuseless/eventloop")
Pong <- R6::R6Class(
"pong",
public = list(
initialize = function(width=10, height=7, speed=0.02) {
require(grid)
private$width <- width
private$height <- height
@coolbutuseless
coolbutuseless / mutate.listframe
Created April 19, 2021 09:47 — forked from MyKo101/mutate.listframe
Application of the mutate method to a listframe
listframe <- function(...){
structure(
tibble(...),
class = c("listframe","tbl_df","tbl","data.frame")
)
}
lf <- listframe(
a = list(1,c("a","b","c"),matrix(1:4,2,2)),
require(ggplot2)
ggplot() + annotate(x = -10, y=1, xend = -1.38, yend=3, geom='segment', col='white') +
geom_segment(data = data.frame(x = -1.38, y = seq(3.0, 3.0, len=30),
xend = seq(1.4, 1.1, len=30), yend = seq(3.0, 3.5, len=30)),
aes(x, y, xend=xend, yend=yend), col='#ffffff10') +
geom_segment(data = data.frame(id=1:30, x = seq(1.1, 1.35, len=30), y = seq(3.5, 3.0, len=30),
xend = seq(10, 10, len=30), yend = seq(2.0, 1.0, len=30)),
aes(x, y, xend = xend, yend = yend, col = factor(id))) +
geom_path(data=NULL, aes(c(-3, 0, 3, -3), y = c(0,5.5,0,0)), col='white') +
@coolbutuseless
coolbutuseless / reinstall-CRAN.R
Created May 30, 2020 01:05 — forked from tjmahr/reinstall-CRAN.R
maybe reinstall the github packages?
df <- as.data.frame(installed.packages(fields = c("RemoteType", "Repository")))
to_reinstall <- df[df$Repository %in% "CRAN", "Package"]
install.packages(to_reinstall)
#remotes::install_cran(c("anglr", "silicate"))

library(silicate)
library(anglr)
library(rgl)
## volcano is heightmap, doesn't exist in geo-space in R so we map it do the extent of
## these spatial polygons 
poly <- silicate::minimal_mesh
# xmin : 0