Skip to content

Instantly share code, notes, and snippets.

View ianhinder's full-sized avatar

Ian Hinder ianhinder

View GitHub Profile
@ianhinder
ianhinder / storing-git-version-doc.txt
Created June 18, 2020 13:44
How to store and output git version information in a CMake code
===============================================================================================
CMakeLists.txt:
add_custom_target(git_version.h
COMMAND
${CMAKE_CURRENT_SOURCE_DIR}/git_version.sh ${CMAKE_CURRENT_BINARY_DIR}/git_version.h)
add_dependencies(<exe> git_version.h)
commit 17373894e87a467743326ea22a4193be80efc187
Author: Einstein Toolkit Git Server <[email protected]>
Date: Mon Mar 14 16:04:42 2016 +0000
Updated submodules:
* arrangements/ExternalLibraries/HDF5 4c43b7b...a7a5b55 (1):
> fix another typo
commit 91bb27b682e2ce328c9c1012a0c7f2839df2bfbc
@ianhinder
ianhinder / CT_BrillAnalytic.m
Created September 4, 2015 14:07
Kranc source file demonstrating duplicated reads/writes entries in schedule.ccl
Clear["`*"];
(* ::Package:: *)
(**************************************************************************************)
(* *)
(* Copyright 2013 Eloisa Bentivegna *)
(* *)
(* Analytic.m is a simple Kranc script used to create grid functions which will be *)
(* used as coefficients (or initial guesses, or exact solutions) by CT_MultiLevel. *)
(* It is distributed under the General Public License, version 3 or higher. *)
# Component list for Cactus
# $Revision$
# $Date$
# $HeadURL$
!CRL_VERSION = 1.0
!DEFINE ROOT = Cactus
!DEFINE ARR = $ROOT/arrangements
@ianhinder
ianhinder / FileMemo.m
Created July 6, 2014 17:26
File-backed memoisation for Mathematica
BeginPackage["FileMemo`"];
WithFileMemo::usage = "WithFileMemo[f[args] := body] defines a function f with arguments args and body body such that the result of the function is stored on disk the first time it is called. This is used to cache data that is expensive to read or compute. The data is stored in $FileMemoDirectory under a filename which is a hash of f[args].";
$FileMemoDirectory = "cache";
Begin["`Private`"];
(****************************************************************)
(* Internal *)
@ianhinder
ianhinder / git-submodule-fetch
Created March 20, 2014 15:25
Parallel submodule fetch
#!/bin/bash
set -e
set -u
if [ $# -eq 0 ]; then
git submodule -q foreach 'echo $name' | xargs -n 1 -P 10 git-submodule-fetch
else
while [ $# -gt 0 ]; do
(cd $1; git fetch -q || echo "Failed to fetch $1">&2)
@ianhinder
ianhinder / log.css
Created May 1, 2012 08:50
Git super-repository changelog
table
{
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size: 10pt;
background: #fff;
margin: 10px;
width: 90%;
border-collapse: collapse;
text-align: left;