This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Draw 'quantile contours': for instance, the 0.9 contour | |
# encloses roughly 90% of the points. | |
import scipy.stats | |
import numpy as np | |
import matplotlib.pyplot as plt | |
rng = np.random.default_rng() | |
x = 2 * rng.normal(size=10000) | |
y = rng.normal(size=10000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def pretty(x, n): | |
""" | |
Returns a "pretty" set of bin boundaries roughly of size n | |
that span x. Use, for instance, like: | |
plt.hist(x, bins=pretty(x, 40)) | |
""" | |
# see https://github.com/wch/r-source/blob/trunk/src/appl/pretty.c | |
# NOTE: still suffers from rounding error, so produces values like 10.000001 sometimes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\usepackage{lineno} | |
\usepackage{blindtext} | |
\usepackage{hyperref} | |
\linenumbers | |
%%%%% PUT THIS IN HEADER OF FILE | |
% % Responses to reviews: | |
% \input{review-response-commands} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USAGE="Split a file up into chunks of N columns. | |
Usage: | |
$0 N file | |
" | |
if [ $# -lt 2 ] | |
then | |
echo "$USAGE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
layout_heights <- function (k,dl=0,ncol=1) { | |
# to set up layout without 'dl' lines between plots | |
# use like layout(1:5,heights=layout_heights(5)) | |
if (k==1) return(1) | |
layout(matrix(seq_len(k*ncol),ncol=ncol)) # this changes par("csi") | |
ds <- dl*par("lheight")*par("csi") | |
eps=par("mai")[c(1,3)] | |
dh=(par("din")[2]-sum(eps)-(k-1)*ds)/k | |
return(c(eps[2]+dh+ds/2,rep(dh+ds,k-2),eps[1]+dh+ds/2)/par("din")[2]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage=" | |
Make a reveal.js slideshow, e.g. of the contents of directory | |
$0 (files to put on slides) > (output html document) | |
for instance, | |
make-slideshow.sh *png > index.html | |
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
URL="http://www.bibsonomy.org/bib/user/peter.ralph?items=1000&bibtex.start=" | |
OUTFILE="peter.ralph-bibsonomy-$(date '+%Y-%m-%d').bib" | |
TEMPFILE=$(mktemp "get-bib.tmpXXXX") | |
if [ -e $OUTFILE ] | |
then | |
echo "$OUTFILE already exists. Delete it first." | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# $1 is the file to extract layers from | |
# the rest are names of the layers to export | |
# modified from https://answers.launchpad.net/inkscape/+question/48164 | |
# | |
# needs xmlstarlet | |
# | |
# Notes: | |
# - doesn't deal with spaces in layer names |