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
ipmb / settings.py
Last active Oct 7, 2019
Django logging example
View settings.py
import logging.config
import os
from django.utils.log import DEFAULT_LOGGING
# Disable Django's logging setup
LOGGING_CONFIG = None
LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper()
logging.config.dictConfig({
@ipmb
ipmb / doh-on-mac.md
Created May 31, 2018
DNS over HTTP (DOH) on MacOS
View doh-on-mac.md

Install

brew install dnscrypt-proxy

Configure

Edit /usr/local/etc/dnscrypt-proxy.toml as needed. I added/modified the following lines:

View django_logging.py
import logging.config
from django.utils.log import DEFAULT_LOGGING
# =======
# LOGGING
# =======
LOGGING_CONFIG = None
LOGLEVEL = os.getenv("LOGLEVEL", "info").upper()
@ipmb
ipmb / uwsgi_cors_router.ini
Last active Aug 6, 2019
Add CORS headers for domains matching a regex in uWSGI
View uwsgi_cors_router.ini
# Add CORS header for Origin's which match a regexp
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin#Examples
route-if = regexp:${HTTP_ORIGIN};^.*\.example\.com$ addheader:Access-Control-Allow-Origin: ${HTTP_ORIGIN}
@ipmb
ipmb / notes.md
Created Apr 19, 2018
Running systemd in docker with Ubuntu 18.04
View notes.md

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

@ipmb
ipmb / ratelimit.nginxconf
Last active May 23, 2019
Nginx reverse proxy with rate limiting
View ratelimit.nginxconf
upstream myapp {
server 127.0.0.1:8081;
}
limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s;
server {
listen 443 ssl spdy;
server_name _;
@ipmb
ipmb / 0_default_tree.md
Last active May 2, 2019
Django Logging Variations
View 0_default_tree.md

Default Django Logging Tree

app.py

#!/usr/bin/env python
import os

import django
import logging_tree
View pyproject.toml
[tool.poetry]
name = "tmp"
version = "0.1.0"
description = ""
authors = ["User <user@example.com>"]
[tool.poetry.dependencies]
python = "^3.7"
requests = "^2.21"
sentry-sdk = "^0.7.11"
@ipmb
ipmb / Dockerfile
Created Apr 4, 2019
Build vmods on Ubuntu from Varnish repo
View Dockerfile
FROM ubuntu:18.04
ARG REPO=varnish60lts
RUN set -ex && \
apt-get update -qq && \
apt-get -yq install curl apt-transport-https build-essential libtool autotools-dev automake gnupg && \
echo "deb https://packagecloud.io/varnishcache/${REPO}/ubuntu/ bionic main" > /etc/apt/sources.list.d/varnish.list && \
curl -L https://packagecloud.io/varnishcache/${REPO}/gpgkey | apt-key add && \
apt-get update -qq && \
apt-get -yq install varnish varnish-dev
View keybase.md

Keybase proof

I hereby claim:

  • I am ipmb on github.
  • I am ipmb (https://keybase.io/ipmb) on keybase.
  • I have a public key ASAhIL1zFberH0RNfVsAfqZOpwcXxLWpcQgGfaSywHmS0wo

To claim this, I am signing this object:

You can’t perform that action at this time.