This file contains hidden or 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
--- | |
# Pathline with the following settings: | |
# 3116 7 0.02 298 nsteps ictrl eqincr temp | |
schema: | |
delimiter: ' ' | |
missing: '-' | |
fields: | |
- name: step | |
type: integer |
This file contains hidden or 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
\documentclass{minimal} | |
\usepackage{pifont} | |
\begin{document} | |
U+2701 \ding{"21}%[✁] | |
\par U+2702 \ding{"22}%[✂] | |
\par U+2703 \ding{"23}%[✃] | |
\par U+2704 \ding{"24}%[✄] | |
\par U+260E \ding{"25}%[☎] | |
\par U+2706 \ding{"26}%[✆] | |
\par U+2707 \ding{"27}%[✇] |
This file contains hidden or 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 re | |
import csv | |
import pdfplumber | |
# Create a list of minerals as classified by the IMA. | |
# Get PDF from http://cnmnc.main.jp/ | |
pdf = pdfplumber.open("IMA_MineralList_202207.pdf") |
This file contains hidden or 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
using Pkg | |
using TerminalPager | |
using UnicodePlots | |
# Reduce color space of most REPL components from 16 to 8. | |
# Line numbers is stacktraces are still unreadable in dark themes... | |
Base.text_colors[:white] = Base.text_colors[:yellow] | |
Base.text_colors[:light_cyan] = Base.text_colors[:cyan] | |
Base.text_colors[:light_red] = Base.text_colors[:red] | |
Base.text_colors[:light_magenta] = Base.text_colors[:magenta] |
This file contains hidden or 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
src := $(wildcard *.tex) | |
bib := $(wildcard *.bib) | |
all: $(src:%.tex=%.pdf) | |
%.pdf: $(src) out/%.bbl | |
@ 1>/dev/null lualatex --output-directory=out --interaction=batchmode --halt-on-error --file-line-error $< \ | |
|| echo "LuaLaTeX run 2/3 failed, check log files in out/ for details" | |
@ lualatex --output-directory=out --halt-on-error --file-line-error $<|rg -v '/usr/share/' | |
@ mv out/$@ $@ |
This file contains hidden or 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
using LinearAlgebra | |
function inverse(a::AbstractMatrix{BigInt}, modulus) | |
m, n = size(a) | |
if m - n != 0 | |
error("cannot find modular inverse of non-square matrix") | |
end | |
det_inv = invmod(BigInt(det(a)), modulus) | |
if det_inv == 0 |
This file contains hidden or 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
using TOML | |
using HTTP | |
""" | |
get_ref(key) | |
Get HTML-formatted reference text for the given referernce key. | |
The key must match either a key in the `_assets/refcache.toml` | |
or the `_assets/doilist.toml` file. The text will be formatted with |
This file contains hidden or 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/sh | |
# Copy or link this script into .git/hooks/ | |
# It runs automatically in the project root directory (parent of .git/). | |
# Code formatting | |
if black --check src/pydrex; then | |
exit 0 | |
else | |
black src/pydrex | |
git add -u |
This file contains hidden or 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
from fractions import Fraction | |
def fspread(count, start, end=None, step=None, mode=1): | |
"""Generate evenly-spaced floats. | |
Yields a sequence of evenly-spaced numbers. Optional `mode` controls | |
endpoint behaviour. Requires the stdlib class `fraction.Fraction`. Source: | |
http://code.activestate.com/recipes/577881-equally-spaced-floats-part-2/ |
This file contains hidden or 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
"""Read columns of a delimited file into a namedtuple. | |
Supports column type parsers, e.g. | |
def parser(colname, data): | |
if colname == "foo": | |
return map(float, data) | |
return data | |
""" |
NewerOlder