Skip to content

Instantly share code, notes, and snippets.

View jsteemann's full-sized avatar
🥑

Jan jsteemann

🥑
  • ArangoDB GmbH
  • Cologne, DE
  • 11:56 (UTC +01:00)
View GitHub Profile
$ cat x.cpp; g++ -O3 x.cpp && ./a.out | head -n 10
#include <iostream>
int main()
{
for (int i = 0; i < 4; ++i) {
std::cout << i*1000000000 << std::endl;
}
}
@jsteemann
jsteemann / htmlDecode.js
Created August 11, 2020 20:39
Decode HTML entities in a string
/*
* decode HTML entities in a string
* usage examples:
* htmlDecode('foo &amp; bar') => 'foo & bar'
* htmlDecode('foo&#x2F;bar') => 'foo/bar'
*/
let htmlDecode = function(str) {
const map = {
'&amp;' : '&',
'&gt;' : '>',
@jsteemann
jsteemann / import-movies.js
Created April 30, 2018 08:37
Movie data setup
/* script to set up movie data into an ArangoDB database
run from the ArangoShell by executing this command:
require("internal").load("/path/to/this/file");
*/
(function() {
let print = require("internal").print;
let db = require("@arangodb").db;
@jsteemann
jsteemann / test-disk-write-performance.c
Created January 30, 2018 11:40
quick test program to assess disk write performance with and without fdatasync
/*
write performance test
tests disk write performance with and without fdatasync
will write a configurable amount of 1MB data blocks to disk
and then optionally call fdatasync after each
usage:
compile with
@jsteemann
jsteemann / git-log-to-json.php
Created March 11, 2015 11:41
script to convert local git commit log into JSON
<?php
// script to convert local git commit log history into JSON format
// usage: cd git-repository && php git-log-to-json.php > commits.json
// script might take a while to execute
$tags = [ ];
$lines = shell_exec('git show-ref --tags');
foreach (array_filter(explode("\n", $lines)) as $line) {
list($commit, $ref) = explode(" ", $line, 2);
@jsteemann
jsteemann / config.php
Created October 18, 2013 23:34
Configuration for BulkInsertBenchmark using ArangoDB, CouchDB, and MongoDB
<?php
$renderers = array(
new RendererConsole(),
new RendererCsvFile("./results.csv", ";"),
);
// chunk/bulk/batch size (number of documents to be loaded at once)
$chunkSize = 10000;
$datasetPath = "/performancetest/datasets/";
@jsteemann
jsteemann / dumperror.c
Created February 7, 2013 23:05
small helper program to print the error messages for integer system error codes. use as follows: ./dumperror <code>
/*
small helper program to print the error messages for
integer error codes. use as follows:
gcc -Wall -Wextra -pedantic dumperror.c
./dumperror <code>
where code is the error number you're interested in
*/