Skip to content

Instantly share code, notes, and snippets.

View clauswilke's full-sized avatar

Claus Wilke clauswilke

View GitHub Profile
@clauswilke
clauswilke / degen-analysis.R
Created March 29, 2024 19:14
DEGEN token price chart
library(tidyverse)
library(cowplot)
# download historical data in csv format from here:
# https://www.coingecko.com/en/coins/degen-base/historical_data
data <- read_csv("degen-usd-max.csv")
make_date_number <- function(x) {
as.numeric(difftime(x, ymd_hms(data$snapped_at[1]), units="days"))
}
---
title: "World maps"
output:
html_document:
df_print: paged
---
```{r echo = FALSE, message = FALSE}
library(tidyverse)
library(sf)
@clauswilke
clauswilke / followers.html
Last active January 17, 2024 15:51
Warpcast webscraping and selection of winner
<!DOCTYPE html>
<!-- saved from url=(0047)https://warpcast.com/~/channel/ai-art/followers -->
<html lang="en" class=""><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="icon" href="https://warpcast.com/favicon.png"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><meta name="description" content="A decentralized social network"><meta name="theme-color" content="#17101f" media="(prefers-color-scheme: dark)"><meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><link rel="apple-touch-icon" href="https://warpcast.com/logo192.png"><link rel="manifest" href="https://warpcast.com/manifest.json"><title>Users following /ai-art</title><link rel="preconnect" href="https://fonts.googleapis.com/"><link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin=""><link href=
@clauswilke
clauswilke / normal.R
Created March 7, 2022 03:41
Deterministically generated normal variates
# Deterministically generated normal variates, implemented here in R but more
# useful for GLSL programming.
library(ggplot2)
fract <- function(x) x - floor(x)
rand <- function(x) fract(3482954.234 * sin(24934.342 * x + 12394.32))
norm <- function(x) {
@clauswilke
clauswilke / message.txt
Last active February 26, 2022 19:24
Tezos profile verification
I am attesting that this GitHub handle clauswilke is linked to the Tezos account tz1XTr7d3FZ19KndZ1HX3iav8fqKeZwGx8bZ for tzprofiles
sig:edsigu1GvDvbQoaUf51om2PgLtFvWX3sirA4NcVs7jj2nNganXtuk6mKEZCHFm2gSvGCkXA3L4y6ZjsVyTdnACwqL6kmsa36bHx
@clauswilke
clauswilke / GLSL-Noise.md
Created January 16, 2022 22:56 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@clauswilke
clauswilke / animate_labels.R
Created May 15, 2018 14:25
rotate plot labels
library(ggplot2) # requires 2.3.0
library(purrr)
make_plot <- function(frame) {
ggplot(mtcars, aes(mpg, hp, color = factor(cyl))) +
geom_point() +
scale_color_brewer(
palette = 2, type = "qual", name = "cyl",
guide = guide_legend(
direction = "horizontal",
@clauswilke
clauswilke / correlation_matrix.R
Last active May 12, 2020 14:11
Tidyverse approach to calculating and plotting correlation matrices
library(dplyr)
library(tidyr)
library(purrr)
library(ggplot2)
library(colorspace)
# data to analyze
data <- select(MASS::fgl, -type, -RI, -Si)
# cluster
@clauswilke
clauswilke / CFR.Rmd
Created March 17, 2020 02:57
COVID-19 Case Fatality Rate (CFR) by age
---
title: "COVID-19 Case Fatality Rate (CFR) by age"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
```
library(sf)
library(dplyr)
library(ggplot2)
library(gganimate) # needs development version from github
# helper function to place a geometric object at a desired position
# and scale
place_geometry <- function(geometry, position, scale = 1) {
(geometry - st_centroid(geometry)) * scale +
st_sfc(st_point(position))