Skip to content

Instantly share code, notes, and snippets.

@frozolotl
frozolotl / 01_README.md
Last active April 1, 2024 15:09
A reimplementation of the default enum layout directly in Typst.

Note

It is more complex than it needs to be for most uses because it tries to be as feature-complete as possible.

@frozolotl
frozolotl / README.md
Last active January 29, 2024 23:32
American Medical Association (no et al), (sort order reverse chronological)
@frozolotl
frozolotl / 7zx.nu
Created January 5, 2024 23:43
A utility to extract archives using 7-Zip more easily
# Extract an archive using 7-Zip.
export def main [
file: path
--output (-o): path
] {
let extension = $file | path parse | get extension
let compressor = match $extension {
bz2 | tb2 | tbz | tbz2 | tz2 => "bzip2"
gz | taz | tgz => "gzip"
lz => "lzip"
@frozolotl
frozolotl / banger-config.json
Last active December 8, 2023 11:18
My Banger configuration for Kagi
{
"luckyBangUrl": "https://kagi.com/search?q=!+%q",
"siteFormat": "site:%d",
"orOperator": "OR",
"bangPrefix": "!",
"luckyBang": "!",
"siteBangSep": "@",
"superLuckyBangPrefix": "!!",
"multiBangDelim": ";",
"multiSiteBangDelim": ",",
@frozolotl
frozolotl / example.typ
Last active September 16, 2023 15:04
An incomplete implementation of JSONPath in Typst
#let data = (
books: (
(title: "The Final Empire", author: "Brandon Sanderson"),
(title: "The Sword of Kaigen", author: "M.L. Wang"),
),
query: 0,
)
#faux-jsonpath(data, "$.books[0].author")
#faux-jsonpath(data, "$.books[$.query].title")
@frozolotl
frozolotl / insert_slice_at.rs
Last active July 28, 2023 08:48
Inserts a slice at a specific location in a vec.
/// Inserts a slice at a specific location in a vec.
pub fn insert_slice_at<T: Copy>(vec: &mut Vec<T>, index: usize, slice: &[T]) {
unsafe {
assert!(index <= vec.len());
vec.reserve(slice.len());
let insert_ptr = vec.as_mut_ptr().offset(index as isize);
std::ptr::copy(
insert_ptr,
insert_ptr.offset(slice.len() as isize),
vec.len() - index,