Skip to content

Instantly share code, notes, and snippets.

View Pseudomanifold's full-sized avatar

Bastian Rieck Pseudomanifold

View GitHub Profile
@Pseudomanifold
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
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
@Pseudomanifold
Pseudomanifold / create_hdf5_test_file.py
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
Pseudomanifold / selection_without_replacement.cc
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
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
ASCII
DATASET STRUCTURED_GRID
DIMENSIONS 50 50 2
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
Pseudomanifold / embed_matrix_mds.py
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
Pseudomanifold / iris_scatterplot_matrix.gnuplot
Last active April 5, 2017 19:46
Creating a scatterplot matrix using `gnuplot`. Please see my blog (http://bastian.rieck.ru/blog/posts/2017/scatterplot_matrices_gnuplot) for more details.
set size square
unset key
unset xtics
unset ytics
binwidth=0.1
bin(x,width)=width*floor(x/width) + binwidth/2.0
set boxwidth 0.9*binwidth
@Pseudomanifold
Pseudomanifold / git_count_words_latex.sh
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, http://phdcomics.com/comics/archive.php?comicid=1915.
#!/bin/bash
#
# 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:
#

Keybase proof

I hereby claim:

  • I am pseudomanifold on github.
  • I am brieck (https://keybase.io/brieck) on keybase.
  • I have a public key ASCGmhrlUo3IPOtFqrK-i4LL8r9ZIOAkBeLzMCQBgePv6Qo

To claim this, I am signing this object: