Skip to content

Instantly share code, notes, and snippets.

View joaomlneto's full-sized avatar

João Neto joaomlneto

View GitHub Profile
@joaomlneto
joaomlneto / gist:46f82b1f0ed5b4b0a6d0b3ec2ff4d0a5
Created January 2, 2019 15:18
Compile perf from Ubuntu source
################################################
# Stolen from Michal Fapso's answer: #
# https://stackoverflow.com/a/34061874/4288486 #
################################################
sudo apt-get install libiberty-dev binutils-dev
mkdir ~/install
cd ~/install
# If the following apt-get doesn't work on your system,
# uncomment deb-src lines in your /etc/apt/sources.list,
@joaomlneto
joaomlneto / boost_program_options_undecl_env.cpp
Last active May 17, 2023 09:34
Boost Program Options: ignore undeclared when reading environment variables
/* When using Boost's program_options to load environment variables,
* there is no way of telling boost to ignore those that were not
* specified in the `options_description` object.
*
* This snippet shows how to get similar behavior to the
* `allow_unregistered()` option available to command line and
* configuration file parsers.
*
*
* For example, if you try to read MYLIB_ONE by specifying an option
@joaomlneto
joaomlneto / detect_worker_nodes.c
Last active October 20, 2018 00:19
Quirks of `mbind` `MPOL_INTERLEAVE`
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <numa.h>
#include <numaif.h>
void printmask(char *name, struct bitmask *mask) {
printf("%s: ", name);
@joaomlneto
joaomlneto / bibtex.png
Created April 29, 2018 18:48 — forked from max-mapper/bibtex.png
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
@joaomlneto
joaomlneto / gist:50b5db37f36ea7117ad55df44f4c913f
Created April 11, 2018 23:23 — forked from psayre23/gist:c30a821239f4818b0709
Runtime Complexity of Java Collections
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
root@ubuntu:~# ./a.out
Reading 40 bytes:
Reading at malicious_x = 0xffffffffffdfeba8... Unclear: 0x54='T' score=980 (second best: 0x02 score=706)
Reading at malicious_x = 0xffffffffffdfeba9... Unclear: 0x68='h' score=929 (second best: 0x02 score=709)
Reading at malicious_x = 0xffffffffffdfebaa... Unclear: 0x65='e' score=973 (second best: 0x02 score=786)
Reading at malicious_x = 0xffffffffffdfebab... Unclear: 0x20=' ' score=928 (second best: 0x02 score=784)
Reading at malicious_x = 0xffffffffffdfebac... Unclear: 0x4D='M' score=746 (second best: 0x02 score=730)
Reading at malicious_x = 0xffffffffffdfebad... Unclear: 0x61='a' score=978 (second best: 0x02 score=749)
Reading at malicious_x = 0xffffffffffdfebae... Success: 0x67='g' score=39 (second best: 0x02 score=17)
Reading at malicious_x = 0xffffffffffdfebaf... Unclear: 0x69='i' score=972 (second best: 0x02 score=748)