Skip to content

Instantly share code, notes, and snippets.

@jbernhard
jbernhard / lesskey
Created April 11, 2019 14:28
lesskey dvorak
#command
\r forw-line
\n forw-line
e forw-line
t forw-line
\kd forw-line
^E forw-line
^N forw-line
n back-line
y back-line
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbernhard
jbernhard / make-plots
Last active November 16, 2015 18:44
Python plotting script
#!/usr/bin/env python3
import argparse
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as tick
aspect = 1/1.618
@jbernhard
jbernhard / corrected-woods-saxon
Last active October 13, 2015 16:38
Correct Woods-Saxon distribution diffusivity (surface thickness) for finite nucleon size.
#!/usr/bin/env python3
"""
Determine how finite nucleon size affects the Woods-Saxon distribution.
Specifically, finite nucleons increase the effective diffusivity $a$ (surface
thickness). This script computes the change by convolving the radial
Woods-Saxon function with a Gaussian of width $w$, then fitting the resulting
convolution to a Woods-Saxon with corrected diffusivity $a'$.
@jbernhard
jbernhard / oscar2013.md
Created September 15, 2015 13:54
OSCAR 2013 format specification

OSCAR 2013

This document specifies new formats for

  • hydro full evolution
  • hydro hypersurfaces
  • particle evolution

These formats aim to be as simple and flexible as possible while still containing all necessary information. Ideally, existing files should be convertible by simply prepending several comment lines.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import sys
import numpy as np
import h5py
import subprocess
# Read a gzipped file from within Python.
# Faster than the standard library gzip module.
# Require Python 3.2+ for context manager support.
with subprocess.Popen(('zcat', filename), stdout=subprocess.PIPE) as proc:
for l in proc.stdout:
pass
#!/usr/bin/env python3
""" Read an array from stdin and write to a numpy file. """
import sys
import numpy as np
def main():
#!/usr/bin/bash
# Provides a command-line interface to generate a bibtex file using Inpire's web tool
# https://inspirehep.net/submit?doctype=bibtex&act=SBI
# Usage: ./generate-bibtex.sh file.tex
curl --silent \
--form "step=1" \
--form "access=`date +%s_%N`" \
--form "act=SBI" \
#!/usr/bin/env python3
"""
Reduce event-by-event observables (multiplicity, Qn vectors) to batch
quantitities (<mult>, flow cumulants) for each design point and centrality.
Creates files <IC name>_<observable>.dat.
"""
import glob