Skip to content

Instantly share code, notes, and snippets.

Jeroen Ooms jeroen

Block or report user

Report or block jeroen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jeroen
jeroen / v8-wasm.cpp
Created Sep 29, 2019
Run wasm in V8 version 7.7
View v8-wasm.cpp
#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;
View wasm.R
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);
@jeroen
jeroen / arrow-ubuntu.sh
Last active Aug 12, 2019
Install arrow on Ubuntu
View arrow-ubuntu.sh
# Import the GPG key
wget https://dist.apache.org/repos/dist/dev/arrow/KEYS
apt-key add < KEYS
# Install libarrow
DISTRO=$(lsb_release --codename --short)
add-apt-repository "deb [arch=amd64] http://dl.bintray.com/apache/arrow/ubuntu $DISTRO main"
apt-get install libarrow-dev libparquet-dev
# Install the R package
View _script.sh
# To start the docker container
docker run -it wch1/r-debug
# Run this inside docker:
cd ~
wget https://dist.apache.org/repos/dist/dev/arrow/KEYS
apt-key add < KEYS
add-apt-repository 'deb [arch=amd64] http://dl.bintray.com/apache/arrow/ubuntu bionic main'
apt-get install libarrow-dev libparquet-dev
View clang.txt
Attaching package: ‘arrow’
The following object is masked from ‘package:testthat’:
matches
The following object is masked from ‘package:utils’:
timestamp
@jeroen
jeroen / CMakeError.log
Last active Mar 7, 2019
Build poppler on Xenial x64
View CMakeError.log
Determining if the pthread_create exist failed with the following output:
Change Dir: /root/poppler-0.74.0/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_aa88c/fast"
make[2]: Entering directory '/root/poppler-0.74.0/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTC_aa88c.dir/build.make CMakeFiles/cmTC_aa88c.dir/build
make[3]: Entering directory '/root/poppler-0.74.0/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_aa88c.dir/CheckSymbolExists.c.o
/usr/bin/cc -std=c99 -D_DEFAULT_SOURCE -o CMakeFiles/cmTC_aa88c.dir/CheckSymbolExists.c.o -c /root/poppler-0.74.0/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_aa88c
View parse_events.R
parse_streamer <- function(url, cb = print){
con <- curl::curl(url = url)
open(con)
on.exit(close(con))
repeat{
txt <- readLines(con, 1)
if(!length(txt)){
print("All done!")
cb(NULL)
break;
@jeroen
jeroen / example.c
Last active Jan 8, 2019
libcurl fd bug
View example.c
/* Test program to verify that CURLMOPT_MAX_TOTAL_CONNECTIONS works as expected */
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <math.h>
#include <curl/curl.h>
/* Configure max concurrent connections */
@jeroen
jeroen / rate_captcha.R
Last active Nov 10, 2018
Rating captchas
View rate_captcha.R
# install.packages(c("magick", "tesseract"))
stopifnot(packageVersion('magick') >= 2.0)
stopifnot(packageVersion('tesseract') >= 4.0)
# Use in rstudio to see captcha images
rate_captcha <- function(n = 10){
success <- rep(NA, n)
for(i in seq_len(n)){
repeat{
img <- magick::image_read('https://issues.apache.org/jira/captcha')
@jeroen
jeroen / reinstall.R
Created Aug 16, 2018
Reinstall all opencpu apps (on current or new server)
View reinstall.R
# Run as user opencpu!! sudo su opencpu
dir.create('/tmp/ocpu-temp')
tmp <- tempfile('session', tmpdir = '/tmp/ocpu-temp')
dir.create(tmp, recursive = TRUE)
sys:::set_tempdir(tmp)
setwd(tempdir())
Sys.setenv(TMPDIR=tempdir(), HOME=tempdir())
# Load Sandbox
sys:::aa_change_profile("opencpu-main")
You can’t perform that action at this time.