Skip to content

Instantly share code, notes, and snippets.

Peter Baumgartner ipmb

  • Lincoln Loop
Block or report user

Report or block ipmb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ipmb /
Last active Apr 24, 2018
DNS zonefile -> terraform dyn
from blockstack_zones import parse_zone_file
with open('/path/to/your/zonefile') as f:
full =
ZONE = ''
record_template = """
resource "dyn_record" "{slug}" {{
zone = "{zone}"
name = "{name}"
ipmb /
Created Apr 19, 2018
Running systemd in docker with Ubuntu 18.04

Trying to use kitchen-docker. It works great when passing privileged: true to the driver, but some hosted CI systems won't let you do that for security reasons. After trying a million different incantations, I got very close with:

image: ubuntu:18.04
run_options: --tmpfs=/run --tmpfs=/run/lock -v /sys/fs/cgroup/systemd:/sys/fs/cgroup/systemd --stop-signal=SIGRTMIN+3
run_command: /sbin/init

note: kitchen does some extra things like including -e container=docker

View build and install wheel
$ time python bdist_wheel > /dev/null
warning: build_py: byte-compiling is disabled, skipping.
warning: install_lib: byte-compiling is disabled, skipping.
real 0m0.922s
user 0m0.664s
sys 0m0.236s
ipmb / Dockerfile
Created Mar 28, 2018
Building header vmod for varnish 3 on Trusty
View Dockerfile
FROM ubuntu:14.04
RUN apt-get update && \
apt-get -yq install varnish libvarnishapi-dev build-essential pkg-config \
libpcre3-dev automake autogen libtool libreadline6-dev \
libeditline0 libeditline-dev python-docutils curl
RUN curl -sLO && \
tar xvzf varnish-3.0.7.tgz && cd varnish-3.0.7 && \
./configure && make
RUN curl -sLO && \
View logs_log
Table "public.logs_log"
Column | Type | Modifiers
id | integer | not null default nextval('logs_log_id_seq'::regclass)
bot_id | integer |
timestamp | timestamp with time zone | not null
nick | character varying(255) | not null
text | text | not null
action | boolean | not null
command | character varying(50) |
#!/usr/bin/env python
"""Example of the speed-up allowed by logging's string handling"""
from __future__ import division
import logging
import string
import time
logger = logging.getLogger(__name__)
from __future__ import unicode_literals
import logging
# built-in attributes on LogRecord. Used to determine what is passed in `extras`
'args', 'asctime', 'created', 'exc_info', 'exc_text', 'filename',
'funcName', 'levelname', 'levelno', 'lineno', 'module',
'msecs', 'message', 'msg', 'name', 'pathname', 'process',
'processName', 'relativeCreated', 'stack_info', 'thread', 'threadName')
ipmb /
Last active Oct 7, 2019
Django logging example
import logging.config
import os
from django.utils.log import DEFAULT_LOGGING
# Disable Django's logging setup
LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper()
ipmb /
Last active May 2, 2019
Django Logging Variations

Default Django Logging Tree

#!/usr/bin/env python
import os

import django
import logging_tree
ipmb / create_test_instance.sls
Last active Jun 13, 2017
Salt orchestration
View create_test_instance.sls
{% set branch ='.', 1)[0] %}
{{ branch }} db:
- name: state.apply
- tgt: salt.example.local
- arg:
- projects.test.dbs.generate_from_template
- kwarg:
You can’t perform that action at this time.