Skip to content

Instantly share code, notes, and snippets.

View avonmoll's full-sized avatar

Alexander Von Moll avonmoll

View GitHub Profile
@avonmoll
avonmoll / .gitignore
Last active October 6, 2024 12:47
Categorized Bibliography in Typst
library.yaml
@avonmoll
avonmoll / 0_readme.md
Last active May 19, 2024 15:38
typst IEEE-style equation references

Problem: the default typst references for math.equation labels appears as "Equation 1". One may provide a supplement argument when referencing as in: <someEquation>[Eq.] which renders "Eq. 1" in the text. However, this is insufficient for meeting the IEEE specification for equation references which should be rendered "(1)".

Solution: I modified the thmref function provided by typst-theorems (see here) in order to provide the level of customization necessary.

@avonmoll
avonmoll / 0_how-I-use-papis.md
Last active April 3, 2024 18:30
A Guide on How to Use papis Sensibly

Installation

Easiest, if you have pip:

$ pip install papis

Adding Documents

Most of the time I add documents via their DOI. For example, I'll be on IEEExplore or ResearchGate and see a paper that I either want to read or know for sure I'll want to cite. So I simply copy the DOI and run

@avonmoll
avonmoll / ranger-mupdf.md
Created February 28, 2020 15:03
ranger with MuPDF for PDF preview

ranger is a great terminal-based file manager. For a long time, I used pdftoppm for image-based PDF previews which is the recommended approach. However, I found it was difficult to install pdftoppm everywhere (particularly, macos) and finally turned to MuPDF, which was much easier to get.

In order to use MuPDF, I changed the PDF case within the handle_image() function inside scope.sh to the following:

application/pdf)
    mutool draw -F png -o "${IMAGE_CACHE_PATH}" "${FILE_PATH}" 1 \
 &amp;&amp; exit 6 || exit 1;;
#! /bin/sh
git clone --bare https://github.com/avonmoll/.dotfiles.git $HOME/.dotfiles
function config {
/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}
mkdir -p .dotfiles-backup
config checkout
if [ $? = 0 ]; then
echo "Checked out dotfiles.";
@avonmoll
avonmoll / 00-startup.py
Created December 10, 2018 14:21
Startup file for IPython
# The main purpose of this file is to force matplotlib to use XeLaTeX with the fonts specified. Matplotlib's default
# font handling for PDF is really bad on macOS and the file sizes end up being massive
import numpy as np
import matplotlib as mpl
import importlib
from matplotlib.backends.backend_pgf import FigureCanvasPgf # For PGF or PDF export (uses TeX to render everything, no Type 3 fonts)
mpl.backend_bases.register_backend('pdf', FigureCanvasPgf) #
pgf_with_rc_fonts = { # Comment these lines in order to go back to matplotlib's mathtex (Type 3 or Type 42 fonts)
# Some slopeless formulations for working with line segments
# Author: @avonmoll
# There are two functions, each with two versions, one which computes the slope
# and one which circumvents direct calculation of the slope.
import numpy as np
def closestPointOnLineToPoint(start, end, point):
"""Find the point on the line that is closest to the given
@avonmoll
avonmoll / gitgutter.log
Created March 14, 2018 18:05
Profile for vim-gitgutter
SCRIPT /Users/vonmolal/.vim/bundle/vim-gitgutter/plugin/gitgutter.vim
Sourced 1 time
Total time: 0.001729
Self time: 0.000896
count total (s) self (s)
1 0.000004 scriptencoding utf-8
1 0.000008 if exists('g:loaded_gitgutter') || !has('signs') || &cp
finish
@avonmoll
avonmoll / better-BibTeX-citation-key-format.md
Last active December 13, 2017 13:51
Better BibTeX citation key format for Zotero's BBT Addon

[auth:lower][year][Title:skipwords:select,1,1:lower]

This produces Google Scholar-like citation keys like vonmoll2014review for the paper A Review of Exhaust Gas Temperature Sensing Techniques for Modern Turbine Engine Controls by Alexander Von Moll published in 2014.

@avonmoll
avonmoll / extremely-simple-pandoc-memo.md
Last active September 29, 2021 14:57
Extremely Simple Pandoc Memo

Instructions

  1. Put makememo on path somewhere
  2. Make sure pandoc-crossref and pandoc-citeproc are somewhere on your path
  3. Set the location of your bibliography file in metadata of memo-template.md
  4. Set the location of your CSL file in metadata of memo-template.md
  5. Create a markdown file such as memo-example.md
    • The metadata fields (title, subtitle, author, date) are optional
  • Other metadata fields set here will not be used