Skip to content

Instantly share code, notes, and snippets.

@bdarcus
bdarcus / merton.ipynb
Last active January 14, 2026 12:03 — forked from moehle/merton.ipynb
Saving, Spending, and Investment Planning Using Convex Optimization
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from collections import Counter
import glob
import os
import xml.etree.ElementTree as ET
# from lxml import etree as ET
import yaml
CSL_STYLES_DIR = '../styles'
NSMAP = {'cs': 'http://purl.org/net/xbiblio/csl'}
@bdarcus
bdarcus / multi-level-sort.rs
Created June 9, 2023 21:14 — forked from chux0519/multi-level-sort.rs
multi level sort in rust
/// Multi-level sort a slice of Foobars according to [(field, reverse)]
fn sort_by_names(f: &mut [Foobar], orderings: &[(Foofields, bool)]) {
use std::cmp::Ordering;
f.sort_by(|a, b| {
let mut cmp = Ordering::Equal;
for (field, reverse) in orderings {
if cmp != Ordering::Equal {
break;
}
@bdarcus
bdarcus / .emacs
Last active October 3, 2022 11:54 — forked from DogLooksGood/.emacs
Meow dot emacs
(require 'package)
(package-initialize)
(setq package-selected-packages
'(modus-themes
vertico
meow
corfu
consult
orderless
(require 'citar)
(defvar bibtex-note-org-property "Key"
"The org-mode property which BibTeX keys are attached to")
(defun get-first-citar-notes-path ()
"Return 'citar-notes-paths' if it is a string, or its car
if it is a list (as 'citar' normally expects)"
(cond ((stringp citar-notes-paths) citar-notes-paths)
((listp citar-notes-paths) (car citar-notes-paths))
@bdarcus
bdarcus / academic.el
Created November 29, 2021 01:13 — forked from rka97/academic.el
Configuration I use in Doom Emacs as part of my academic reading/notetaking workflow
;; The following packages are needed:
;; 1. elfeed and elfeed-score (available from the rss doom module)
;; 2. citar
;; 3. org-ref
;; 4. org-roam and org-roam-bibtex
(defconst robo/bib-libraries (list "~/bib-lib/robo-lib.bib" "~/bib-lib/robo-temp-lib.bib")) ; All of my bib databases.
(defconst robo/main-bib-library (nth 0 robo/bib-libraries)) ; The main db is always the first
(defconst robo/main-pdfs-library-paths `("~/bib-lib/pdfs/" "/home/robo/bib-lib/temp-pdfs/")) ; PDFs directories in a list
@bdarcus
bdarcus / ..git-pr.md
Created October 26, 2021 12:22 — forked from gnarf/..git-pr.md
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@bdarcus
bdarcus / org-airmail.el
Last active September 2, 2021 14:13 — forked from ephsmith/org-airmail.el
org-airmail.el adds an org-hyperlink handler for Airmail email URLs
;;; org-airmail.el - Support for links to Airmail 3 messages in Org
(require 'org)
(org-link-set-parameters "airmail" :follow 'org-airmail-open)
(defun org-airmail-open (url)
"Visit the Airmail message referenced by URL.
URL should be a vaid Airmail message url retrieved from Airmail with
'Copy Message Link'."
@bdarcus
bdarcus / org-roam-configuration.el
Created August 24, 2021 12:33 — forked from jeremyf/org-roam-configuration.el
org-roam configuration
;; See
;; http://takeonrules.com/2021/08/22/ever-further-refinements-of-org-roam-usage/
;; for details on this configuration.
;;
;; See https://takeonrules.com/2021/08/23/diving-into-the-implementation-of-subject-menus-for-org-roam/
;; for a walk through of the implementation.
;;
;; A Property List of my `org-roam' capture templates.
(setq jnf/org-roam-capture-templates-plist
(list
@bdarcus
bdarcus / oc-csl.el
Created July 27, 2021 13:16 — forked from andras-simonyi/oc-csl.el
A patched version of oc-csl which supports a larger set of citation modes and variants plus adds biblatex support
;;; oc-csl.el --- csl citation processor for Org -*- lexical-binding: t; -*-
;; Copyright (C) 2021 Free Software Foundation, Inc.
;; Author: Nicolas Goaziou <[email protected]>
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.