This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run in an R terminal window (not GUI) | |
con <- socketConnection('towel.blinkenlights.nl', 23, open = 'rb') | |
repeat{ | |
buf <- readBin(con, raw(), 10) | |
if(length(buf)) | |
cat(rawToChar(buf)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <math.h> | |
#include <string.h> | |
#include <unistd.h> | |
int main() { | |
float A = 0, B = 0; | |
float i, j; | |
int k; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ make 32-bit | |
make --no-print-directory -C front-ends Rpwd | |
make -C ../../include -f Makefile.win version | |
make Rpwd.exe | |
/mingw32/bin/gcc -std=gnu99 -I../../include -DR_ARCH='"i386"' -O3 -Wall -pedantic -c rpwd.c -o rpwd.o | |
/mingw32/bin/windres -i rcico.rc -o rcico.o | |
/mingw32/bin/gcc -std=gnu99 -s -o Rpwd.exe rpwd.o rcico.o | |
cp front-ends/Rpwd.exe Rpwd.exe | |
-------- Building ../../../library/base/R/Rprofile from ../../library/profile/Common.R ../../library/profile/Rprofile.windows-------- | |
mkdir -p ../../../library/base/R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl_multihash <- function(con, algos = c('md5', 'sha1', 'sha256', 'sha384', 'sha512')){ | |
if(!isOpen(con)){ | |
open(con, "rb") | |
on.exit(close(con)) | |
} | |
states <- lapply(algos, function(algo){ | |
structure(openssl:::md_init(algo), algo = algo) | |
}) | |
while(length(data <- readBin(con, raw(), 512*1024))){ | |
lapply(states, openssl:::md_feed, data = data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plot_x <- function(x){ | |
x11() | |
image(x) | |
dev.off() | |
} | |
plot_png <- function(x){ | |
png(width = 800, height = 600) | |
image(x) | |
dev.off() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(V8) | |
library(mapview) | |
library(geojsonsf) | |
ct$source("https://cdn.jsdelivr.net/npm/flatgeobuf@2.0.1/dist/flatgeobuf-geojson.min.js") | |
ct$source("https://cdn.jsdelivr.net/npm/text-encoding@0.6.4/lib/encoding.min.js") | |
json = sf_geojson(franconia) | |
ct$call('flatgeobuf.serialize', JS(json)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' My roxy | |
#' | |
#' This is an example of how you would use roxygen. | |
#' | |
#' ```{r} | |
#' #' Test example | |
#' #' | |
#' #' This is an example. Here is how you embed R code: | |
#' #' | |
#' #' ```{r} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sampling frequency and audio length | |
freq <- 400 | |
duration <- 5 | |
# radian constant for sin/cos | |
tau <- 2*pi | |
# Generate a composite signal (4, 6, 9 hz) | |
x <- seq(0, duration, length.out = freq*duration) | |
y <- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <v8.h> | |
#include <libplatform/libplatform.h> | |
using v8::HandleScope; | |
using v8::Isolate; | |
using v8::MemorySpan; | |
using v8::WasmModuleObject; | |
using v8::Context; | |
using v8::Local; | |
using v8::Value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(V8) | |
ctx <- v8() | |
ctx$eval(" | |
let bytes = new Uint8Array([ | |
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x07, 0x01, | |
0x60, 0x02, 0x7f, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, | |
0x07, 0x01, 0x03, 0x61, 0x64, 0x64, 0x00, 0x00, 0x0a, 0x09, 0x01, | |
0x07, 0x00, 0x20, 0x00, 0x20, 0x01, 0x6a, 0x0b | |
]); | |
let module = new WebAssembly.Module(bytes); |