Skip to content

Instantly share code, notes, and snippets.

View jdtournier's full-sized avatar

J-Donald Tournier jdtournier

View GitHub Profile
@jdtournier
jdtournier / test_memfd_create.cpp
Last active April 13, 2023 13:41
demo for using memfd_create() to shared raw memory between processes
//#include <sys/memfd.h>
#include <sys/syscall.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
@jdtournier
jdtournier / README.md
Last active February 11, 2023 07:26
short demo of explicit instantiation of templates, and avoiding parsing the full definition in every compilation unit

A short demo showing the explicit instantiation of templates, and how to avoid parsing the full definition(s) in every compilation unit. The limitation is that it will only be possible to use the specific specialisations explicitly instantiated in the cpp file.

@jdtournier
jdtournier / plotdir.py
Last active October 27, 2020 15:39
Python/matplotlib script to plot DW schemes
#!/usr/bin/python
opacity_of_negative_direction = 0.2
size_of_markers = 30
range_of_b = [0.0, 1.0e99]
colormap = 'hsv'
import matplotlib.pyplot as plt
import numpy as np
import sys
@jdtournier
jdtournier / Run_vector_bool_tests.sh
Last active April 18, 2019 09:56
vector<bool> tests
#!/bin/bash
function run {
echo "==========================================="
echo "$@"
echo "==========================================="
"$@" vector_bool.cpp -o vector_bool
time ./vector_bool
echo ""
}
@jdtournier
jdtournier / test_sync.cpp
Created August 27, 2018 10:08
Sample code to sync via filesystem
#include <iostream>
#include <string>
#include <stdexcept>
#include <stdexcept>
#include <sstream>
#include <cstring>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@jdtournier
jdtournier / module
Last active July 16, 2018 09:57
bash script to simplify handling of MRtrix3 modules
#!/bin/bash
if [[ $# != 2 ]]; then
cat <<EOD
usage: ./module action target
where:
- action is one of: install update remove
@jdtournier
jdtournier / README.md
Created March 14, 2018 21:57
generate changelog

This script guesses the numbers for the merged pull requests from the last tag, then fetches the corresponding information from GitHub and formats it into markdown format suitable for use in e.g. Discourse.

To use, please add create a 'fetch_changelog_settings' file in the toplevel of your repo folder, with the correct information:

repo = 'MRtrix3/mrtrix3'
user = 'jdtournier'
@jdtournier
jdtournier / install_from_source
Last active March 5, 2018 15:39
a script to download and compile all dependencies for MRtrix3 for installation on older distributions
#!/bin/bash
# to be used for installation on older systems when all else fails...
#
# Notes:
#
# - to prevent unnecessary downloads, dependencies are only fetched if the
# 'source_install_files' folder does not already exist. Delete it if you want to
# fetch them again.
#
@jdtournier
jdtournier / read_deps.sh
Created September 26, 2017 09:49
work out dependencies of executable
#!/bin/bash
readelf -d "$1" 2>/dev/null | sed -n -e 's/^.*NEEDED.*\[\(\S*\)\]/\1/p'