Skip to content

Instantly share code, notes, and snippets.

View Pseudomanifold's full-sized avatar

Bastian Rieck Pseudomanifold

View GitHub Profile
Pseudomanifold / fix_bibliography_links_springer.js
Last active December 5, 2023 10:26
This is a user script (to be used with Greasemonkey, Violentmonkey, and similar packages. It automatically adds a download button for `.bib` citation export to Springer Link publications. Enjoy!
Pseudomanifold /
Last active April 27, 2023 14:58
Counting words in TeX files under version control in order to depict the temporal evolution of the document. Useful for creating graphs such as the one shown in PhD comics #1915,
# This script traverses all commits of a git repository in the current directory
# and counts the number of words that are changed, i.e. added or deleted for all
# TeX files. The output contains a time-stamp (YYYY-MM-DD). Next, there are some
# counts, viz. the number of added, deleted, and total words.
# You can use `gnuplot`, for example, to create nice visualizations from the raw
# data. For this, it may be useful to specify the first column as a date column:
Pseudomanifold / neurips_2021.sty
Created May 28, 2021 18:35
Workaround for potential issues with NeurIPS 2021 style and newer versions of TexLive. This is *not* an official fix.
% partial rewrite of the LaTeX2e package for submissions to the
% Conference on Neural Information Processing Systems (NeurIPS):
% - uses more LaTeX conventions
% - line numbers at submission time replaced with aligned numbers from
% lineno package
% - \nipsfinalcopy replaced with [final] package option
% - automatically loads times package for authors
% - loads natbib automatically; this can be suppressed with the
% [nonatbib] package option

Keybase proof

I hereby claim:

  • I am pseudomanifold on github.
  • I am brieck ( on keybase.
  • I have a public key ASCGmhrlUo3IPOtFqrK-i4LL8r9ZIOAkBeLzMCQBgePv6Qo

To claim this, I am signing this object:

Pseudomanifold /
Created December 5, 2017 12:18
Creating a simple HDF5 test file with a single group and a single simple data set using the `h5py` Python bindings
#!/usr/bin/env python3
# Creates a simple 3x3 HDF5 test file. The file will contain
# a single group and a single *simple* data set. The numbers
# from 1 to 9 will be distributed over the data.
import h5py
f = h5py.File("Simple.hdf5", "w")
d = f.create_dataset("Simple", (3,3), dtype='f')
Pseudomanifold /
Created October 8, 2017 18:47
Selection sampling without replacement (following Knuth's algorithm S)
#include <iostream>
#include <limits>
#include <random>
#include <vector>
int main(int, char**)
std::random_device r;
std::default_random_engine e( r() );
Pseudomanifold / 3_peaks_ridge.vtk
Created August 1, 2017 11:06
A simple 2D scalar field with three peaks, connected in a symmetrical fashion or in the form of a ridge
# vtk DataFile Version 3.0
vtk output
POINTS 5000 float
0 0 0 0.020408 0 0 0.040816 0 0
0.061224 0 0 0.081633 0 0 0.102041 0 0
0.122449 0 0 0.142857 0 0 0.163265 0 0
0.183673 0 0 0.204082 0 0 0.22449 0 0
Pseudomanifold /
Created July 3, 2017 12:30
A simple example script that embeds a matrix of distances into 2D using MDS
#!/usr/bin/env python3
# Embeds a distance matrix into 2D using MDS. Distances are normalized
# to [0,1] in order to facilitate comparing embedded matrices.
import numpy
import sys
from sklearn.manifold import MDS
Pseudomanifold / iris_scatterplot_matrix.gnuplot
Last active April 5, 2017 19:46
Creating a scatterplot matrix using `gnuplot`. Please see my blog ( for more details.
set size square
unset key
unset xtics
unset ytics
bin(x,width)=width*floor(x/width) + binwidth/2.0
set boxwidth 0.9*binwidth