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
# Install dependencies | |
sudo pkgutil -i cmake libssh2_dev libssl_dev | |
# Download latest release | |
cd ~/Desktop | |
curl -OL https://github.com/libgit2/libgit2/releases/download/v1.1.0/libgit2-1.1.0.tar.gz | |
gtar xzf libgit2-1.1.0.tar.gz | |
cd libgit2-1.1.0 | |
# Patch to use C99 instead of C90 |
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(cranlogs) | |
library(dplyr) | |
library(lubridate) | |
library(ggplot2) | |
library(hrbrthemes) | |
pkgs <- c("curl", "RCurl") | |
df <- cranlogs::cran_downloads(pkgs, from = '2015-01-01', to = '2020-10-31') | |
monthly <- df %>% group_by(package = package, date=floor_date(date, "month")) %>% | |
summarize(count=sum(count)) |
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/[email protected]/dist/flatgeobuf-geojson.min.js") | |
ct$source("https://cdn.jsdelivr.net/npm/[email protected]/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 <- |