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
$(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
#!/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
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
# See https://wikidata.org/wiki/P348 https://wikidata.org/wiki/Q83, https://wikidata.org/wiki/Q13166 for a | |
# definition of the arguments. Or paste the query to https://query.wikidata.org for a nice online editor. | |
curl -sSH 'Accept: application/sparql-results+json' --data-urlencode query@- https://query.wikidata.org/sparql <<EOF \ | |
| jq '.results.bindings | map({"key": .softwareLabel.value, "value": .version.value}) | from_entries' | |
SELECT ?softwareLabel ?version WHERE { | |
?software wdt:P348 ?version; | |
FILTER ( ?software IN (wd:Q13166, wd:Q83)) | |
SERVICE wikibase:label { | |
bd:serviceParam wikibase:language "en" . | |
} |
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
# filter setup module through jq. | |
ansible -i inventory '*' -m setup -o | sed 's/^\(.*\) | SUCCESS => \(.*\)/{"\1": \2}/' | jq . |
NewerOlder