Skip to content

Instantly share code, notes, and snippets.

@eliasp
eliasp / salt#master.sls
Last active December 27, 2015 20:29
Saltmaster Dockerfiles
python-pip:
pkg.installed
docker-py:
pip.installed:
- require:
- pkg: python-pip
# TODO: ensure docker-py is declared a requirement for all dockerio states without having to explicitely declare the requirement in each container state again
diff -ruN scripts/test/HTMLUtils/LinkQuote.t.orig scripts/test/HTMLUtils/LinkQuote.t
--- scripts/test/HTMLUtils/LinkQuote.t.orig 2013-12-01 16:04:54.920957053 +0000
+++ scripts/test/HTMLUtils/LinkQuote.t 2013-12-01 16:07:08.909366227 +0000
@@ -300,6 +300,14 @@
Name => 'LinkQuote - just TLD given;',
Target => '',
},
+ {
+ Input =>
+ 'http://geizhals.de/?cat=prl&xf=720_LAN+10%2F100~1435_HP~2899_Farblaser~721_Duplexeinheit#xf_top',
@eliasp
eliasp / use-cases.md
Last active January 4, 2016 12:59
Describing some use-cases for hooks in Taskwarrior (task + taskd)

Use cases for hooks in task/taskd

General notes on hooks

While outlining the use-cases below, the following general requirements came up:

RC integration

Each hook should have its own configuration namespace which allows the hook to read its own RC values. Not only root-items should be allowed in the hooks RC, so hooks.hookname.some.thing could be used instead of hooks.hookname.some_thing.

mkdir -p /var/tmp/machines
debootstrap jessie /var/tmp/machines/debian-jessie http://httpredir.debian.org/debian
cd /var/tmp/machines/debian-jessie
# https://github.com/systemd/systemd/issues/2728
tar cf - . | machinectl import-tar - debian-jessie
systemd-nspawn -D /var/lib/machines/debian-jessie passwd -d root
systemd-nspawn -D /var/lib/machines/debian-jessie apt-get update
systemd-nspawn -D /var/lib/machines/debian-jessie apt-get install -y wget ca-certificates dbus
# https://github.com/systemd/systemd/issues/852#issuecomment-127759667

Package: dbus Version: 1.8.20-0+deb8u1

When trying to boot a Debian Jessie container using systemd-nspawn - dbus.service fails as the directive OOMScoreAdjust=-900 can't be applied due to missing privileges in container environments.

dbus.service will report on startup: Starting D-Bus System Message Bus... Started D-Bus System Message Bus.

{% if not 'systemd.sd_booted' in salt %} <======================
# for non-booted systems (e.g. a container during bootstrapping), `timedatectl` can't work
# and `systemd-firstboot` needs to be used instead
{% if not salt['file.is_link']('/etc/localtime') %}
systemd-firstboot-timedate:
cmd.run:
[...]
---
[CRITICAL] Rendering SLS 'base:linux.systemd.timedate' failed: Jinja error:
Traceback (most recent call last):
Oct 05 08:41:56 dev-api-00000000 systemd[1]: Starting Network Service...
Oct 05 08:41:56 dev-api-00000000 systemd-networkd[834]: timestamp of '/etc/systemd/network' changed
Oct 05 08:41:56 dev-api-00000000 systemd-networkd[834]: timestamp of '/lib/systemd/network' changed
Oct 05 08:42:21 dev-api-00000000 systemd[1]: systemd-networkd.service: main process exited, code=exited, status=1/FAILURE
Oct 05 08:42:21 dev-api-00000000 systemd[1]: Failed to start Network Service.
Oct 05 08:42:21 dev-api-00000000 systemd[1]: Unit systemd-networkd.service entered failed state.
Oct 05 08:42:21 dev-api-00000000 systemd[1]: systemd-networkd.service has no holdoff time, scheduling restart.
Oct 05 08:42:21 dev-api-00000000 systemd[1]: Stopping Network Service...
Oct 05 08:42:21 dev-api-00000000 systemd[1]: Starting Network Service...
Oct 05 08:42:21 dev-api-00000000 systemd-networkd[835]: timestamp of '/etc/systemd/network' changed
@eliasp
eliasp / IDEAS.md
Created January 14, 2017 23:51
Servo GSoC Ideas

DBus interface

Adding a DBus interface would allow a lot of different things on Linux DEs.

Usecases

MPRIS

MPRIS is a standardized interface to control media playback.

Having MPRIS capabilities in a browser would allow for global media playback control, which is already possible with nearly every Linux mediaplayer. Making this possible for media playback in browsers follows the trend of more and more applications/platforms becoming web-based.

  • Pause/continue playback of a video without having to open the browser window and locate the corresponding tab
[Unit]
Description=Backup %I using 'restic'
ConditionFileNotEmpty=/etc/restic/%i/restic.env
ConditionPathExists=/etc/restic/%i/backup.exclude
[Service]
# /run, /tmp are intentionally not --exclude'd as those are tmpfs anyways and therefore already excluded by --one-file-system
ExecStart=/usr/local/bin/restic backup --cache-dir=/var/cache/restic/%i --one-file-system --exclude-file=/etc/restic/%i/backup.exclude --exclude=/var/cache/* --exclude=/var/tmp/* --exclude=/home/*/.cache/* /
Type=simple
EnvironmentFile=/etc/restic/%i/restic.env
@eliasp
eliasp / jinja2_test.py
Created October 12, 2018 12:26
Test Jinja2 templates in a REPL
from jinja2 import Template
text = """
hi
"""
template = Template(text)
template.render() # passing variables here to the text template if needed