Skip to content

Instantly share code, notes, and snippets.

View robertodr's full-sized avatar
🤡
Clowning around

Roberto Di Remigio Eikås robertodr

🤡
Clowning around
View GitHub Profile
@LnL7
LnL7 / configuration.nix
Last active July 10, 2024 03:34
NixOS configuration overlays
{ config, pkgs, ... }:
let
# Import unstable channel.
# sudo nix-channel --add http://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable
# sudo nix-channel --update nixpkgs-unstable
unstable = import <nixpkgs-unstable> {};
in
{
@sixy6e
sixy6e / README.md
Last active March 4, 2024 13:08
mpi-logging-example

A simple MPI logging and compute example

The simple logging example can be run via:

  • mpiexec -n 4 python mpi_logger.py

For the compute and logging example:

  • mpiexec -n 4 python mock_execution.py
@lelemmen
lelemmen / main.cpp
Created November 30, 2017 09:49
Undocumented behavior of Eigen::Tensor contractions
#include <iostream>
#include <unsupported/Eigen/CXX11/Tensor>
// Inspired by my question and its accepted answer on StackOverflow (https://stackoverflow.com/questions/47556726), I've decided to create this in a little gist.
// This Gist is about some undocumented (https://bitbucket.org/eigen/eigen/src/default/unsupported/Eigen/CXX11/src/Tensor/README.md?fileviewer=file-view-default) behavior of Eigen::Tensor contractions.
/** Print the contents of a rank-four tensor in a fashionable way
*/
void print(const Eigen::Tensor<double, 4>& T) {
@mbinna
mbinna / effective_modern_cmake.md
Last active July 4, 2025 17:13
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@peti
peti / README.md
Last active January 29, 2024 00:21
Make NixOS provide version-specific LOCALE_ARCHIVE environment variables

This NixOS code ensures that the system provide version-specific $LOCALE_ARCHIVE environment variables to mitigate the effects of NixOS/nixpkgs#38991.

To deploy it, copy the file into your /etc/nixos folder using a file name like multi-glibc-locale-paths.nix. Then edit your configuration.nix file to contain the attribute:

imports = [ ./multi-glibc-locale-paths.nix ];
@matt-bailey
matt-bailey / github-pages-custom-domain-gandi-dns-records.md
Last active June 13, 2025 16:36
How to set up DNS records on gandi.net to use a custom domain on Github Pages

How to set up DNS records on gandi.net to use a custom domain on Github Pages

You would think it would be easy to find this information, but none of the Github or Gandi documentation is clear so I have recorded the required steps here.

Create the following A records:

@ 1800 IN A 185.199.108.153
@ 1800 IN A 185.199.109.153
@ 1800 IN A 185.199.110.153
@bast
bast / delete-appveyor-cache.sh
Created July 20, 2018 14:40
Delete Appveyor cache using curl.
#!/usr/bin/env bash
# adjust APPVEYOR_TOKEN, username, and projectname
APPVEYOR_TOKEN=....................
curl -H "Authorization: Bearer $APPVEYOR_TOKEN" \
-H "Content-Type: application/json" \
-X "DELETE" \
https://ci.appveyor.com/api/projects/username/projectname/buildcache
@project-tuva
project-tuva / MPIFileHandler.py
Created July 23, 2018 21:14
logging with mpi4py
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 14 16:17:38 2018
This handler is used to deal with logging with mpi4py in Python3.
@author: cheng
@reference:
https://cvw.cac.cornell.edu/python/logging
https://groups.google.com/forum/#!topic/mpi4py/SaNzc8bdj6U
@mgoldey
mgoldey / mkl.dockerfile
Created August 6, 2018 19:52
install basic mkl libraries in debian docker image
# install mkl
RUN apt update && apt install -y --force-yes apt-transport-https && \
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list' && \
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install cpio intel-mkl-64bit-2018.3-051 && \
(find /opt/intel -name "ia32*" -exec rm -rf {} \; || echo "removing ia32 binaries") ; \
(find /opt/intel -name "examples" -type d -exec rm -rf {} \; || echo "removing examples") ; \
(find /opt/intel -name "benchmarks" -exec rm -rf {} \; || echo "removing benchmarks") ; \
(find /opt/intel -name "documentation*" -exec rm -rf {} \; || echo "removing documentation") ; \
@GeorgeWeb
GeorgeWeb / sycl_dev_profile.hpp
Last active April 18, 2022 11:55
Simple example of a 'SYCL profiling' wrapper class for kernels running on a device with OpenCL support
#include <chrono>
#include <vector>
#include <CL/sycl.hpp>
namespace sycl = cl::sycl;
using wall_clock_t = std::chrono::high_resolution_clock;
using time_point_t = std::chrono::time_point<wall_clock_t>;
template <typename T, class Period>
using time_interval_t = std::chrono::duration<T, Period>;