This file contains hidden or 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
open Lwt.Infix | |
open Websocket_lwt | |
open Ppx_lwt | |
open Frame | |
let ip_port = ("127.0.0.1", 3000);; | |
let clients = Hashtbl.create 10;; | |
let section = Lwt_log.Section.make "stream_shape";; | |
Lwt_log.(add_rule "*" Debug);; |
This file contains hidden or 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 |
This file contains hidden or 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
# connection_plugin for Ansible and FreeBSD jails, connecting | |
# through ssh on the jailhost. | |
# inspiration: https://github.com/austinhyde/ansible-sshjail | |
from ansible.errors import AnsibleError | |
from ansible.plugins.connection import ConnectionBase | |
from ansible.plugins.connection import ssh | |
try: | |
from __main__ import display | |
except ImportError: |
This file contains hidden or 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
#include <IRremote.h> | |
#include <Keypad.h> | |
const byte ROWS = 4; | |
const byte COLS = 4; | |
// define the symbols of the buttons on the keypads. | |
const char hexaKeys[ROWS][COLS] = { | |
{'1','2','3','A'}, | |
{'4','5','6','B'}, |
This file contains hidden or 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 litte tool to generate a .mrconfig file for https://myrepos.branchable.com/ | |
from a https://gitea.io/ account. | |
sudo apt install python3 python3-requests | |
Check possible values for your MR_REPO_TEMPLATE with | |
$ curl --user ${GITEA_USER}:{$GITEA_PASS} https://${GITEA_HOST}/api/v1/user/repos | jq . | |
""" |
This file contains hidden or 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 . |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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; | |
}; |