Skip to content

Instantly share code, notes, and snippets.

View rossholmberg's full-sized avatar

Ross Holmberg rossholmberg

View GitHub Profile
library( holmberg )
holmberg::pkgLoad( c( "data.table", "doMC", "plyr", "dplyr", "utils", "parallel" ) )
logicalCores <- parallel::detectCores( logical = FALSE )
virtualCores <- parallel::detectCores( logical = TRUE )
if( virtualCores > logicalCores ) {
doMC::registerDoMC( cores = logicalCores )
} else if( logicalCores > 2 ) {
doMC::registerDoMC( cores = logicalCores - 1L )
} else {
doMC::registerDoMC( cores = 1L )
@rossholmberg
rossholmberg / receive_post_data.php
Created April 12, 2018 21:55
PHP to receive any POST request, and write it to file on the server.
<?php
/*
#### Tested using PHP 7 under Apache.
A script to capture a json POST request, and print it
(nearly*) as is to an output text file. Outputs are