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 json | |
import uuid | |
import subprocess | |
from pathlib import Path | |
age_identity = Path("~/.passage/identities").expanduser() | |
store_dir = Path("~/.passage/store").expanduser() | |
folders = [] | |
items = [] |
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
module Jekyll | |
class RawTag < Liquid::Block | |
def parse(tokens) | |
@nodelist ||= [] | |
@nodelist.clear | |
while token = tokens.shift | |
if token =~ FullToken | |
if block_delimiter == $1 | |
end_tag |
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
$(nix-build -A packages.odoo.config.lock.refresh --no-out-link)/bin/refresh | |
nix-build -A packages.odoo |
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
# https://stackoverflow.com/questions/7136385/calculate-day-number-from-an-unix-timestamp-in-a-math-way | |
# https://howardhinnant.github.io/date_algorithms.html#civil_from_days | |
let | |
t = builtins.currentTime; | |
z = t / 86400 + 719468; | |
era = (if z >= 0 then z else z - 146096) / 146097; | |
doe = (z - era * 146097); | |
y' = (yoe) + era * 400; | |
doy = doe - (365 * yoe + yoe / 4 - yoe / 100); | |
yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; |
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
{ name ? "hello" | |
, text ? "echo 'Hello World'" | |
, pkgs ? import <nixpkgs> {} | |
}: | |
builtins.derivation { | |
inherit name; | |
inherit (pkgs) system; | |
builder = "${pkgs.busybox}/bin/busybox"; | |
args = [ | |
"sh" |
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
#!/usr/bin/env bash | |
# TODO: run in nix shell gitlab:abstract-binary/nix-nar-rs, nix-shell does not support | |
# flakes, nix shell no shebangs atm. | |
STORE_PATH="/nix/store/4q7ij8ivy09vbhini8j0gzd7f77z0bwn-disk-image" | |
FILE_NAME="nixos.root.qcow2" | |
CACHE_URL="https://nix-dabei.cachix.org" | |
HASH="$(echo "$STORE_PATH" | sed 's|^/nix/store/\([^-]*\)-.*$|\1|')" | |
NAR_INFO_URL="$CACHE_URL/$HASH.narinfo" |
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
{ pkgs, lib, config, ... }: | |
let | |
cfg = config.my.secrets; | |
makeSecretServiceUnit = name: value: | |
lib.nameValuePair "secret-${value.secret}" { | |
description = "template for secret ${value.secret}"; | |
serviceConfig = { | |
Type = "oneshot"; | |
RemainAfterExit = true; | |
}; |
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 sys | |
import json | |
from collections import OrderedDict | |
from contextlib import contextmanager | |
def resolve_json_pointer(spec, reference): | |
prefix, definitions, name = reference.split('/') | |
return spec.get(definitions).get(name) |
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
#!/usr/bin/env python3 | |
""" | |
Pandocs Org-Parser does not handle generic multi-line metadata keys. Only | |
their last line ends up in the AST and so this can't be solved (easily) with | |
lua filters. | |
We use python to extract org metadata keys before the first non-metadata line | |
and output them in YAML for use with pandoc's --metadata-file. E.g. | |
#+TITLE: Letter |
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
#!/usr/bin/env python3 | |
""" | |
A simple script to pipe URIs through youtube-dl and into musicpd. | |
pip3 install python-mpd2 youtube-dl | |
""" | |
import sys | |
import mpd | |
import youtube_dl |
NewerOlder