Skip to content

Instantly share code, notes, and snippets.

Avatar
🥑

Jan jsteemann

🥑
  • ArangoDB GmbH
  • Cologne, DE
View GitHub Profile
View ub-with-love
$ 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 Aug 11, 2020
Decode HTML entities in a string
View htmlDecode.js
/*
* 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;' : '>',
View import-movies.js
/* 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 Jan 30, 2018
quick test program to assess disk write performance with and without fdatasync
View test-disk-write-performance.c
/*
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 Mar 11, 2015
script to convert local git commit log into JSON
View git-log-to-json.php
<?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 Oct 18, 2013
Configuration for BulkInsertBenchmark using ArangoDB, CouchDB, and MongoDB
View config.php
<?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 Feb 7, 2013
small helper program to print the error messages for integer system error codes. use as follows: ./dumperror <code>
View dumperror.c
/*
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
*/