Skip to content

Instantly share code, notes, and snippets.

View ipmb's full-sized avatar

Peter Baumgartner ipmb

View GitHub Profile
# er/sites/site1.sls
SITE_ID: 14
EMAIL: support@site1.com
LOG_FILE_DIR: /var/log/er_site1
@ipmb
ipmb / Procfile
Created January 10, 2017 16:39
broken buildpack
web: server.py
@ipmb
ipmb / cloudwatch_sysstats.py
Created March 3, 2017 03:59
Send system stats to AWS Cloudwatch with Python
# -*- coding: utf-8 -*-
import os
# pip install boto3 psutil requests
import boto3
import psutil
import requests
NAMESPACE = 'Sys'
os.environ.setdefault('AWS_DEFAULT_REGION', 'us-east-1')
@ipmb
ipmb / create_test_instance.sls
Last active June 13, 2017 23:12
Salt orchestration
{% set branch = pillar.name.split('.', 1)[0] %}
{{ branch }} db:
salt.function:
- name: state.apply
- tgt: salt.example.local
- arg:
- projects.test.dbs.generate_from_template
- kwarg:
pillar:
@ipmb
ipmb / 0_default_tree.md
Last active May 17, 2022 00:37
Django Logging Variations

Default Django Logging Tree

app.py

#!/usr/bin/env python
import os

import django
import logging_tree
@ipmb
ipmb / settings.py
Last active November 24, 2023 20:25
Django logging example
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({
from __future__ import unicode_literals
import logging
# built-in attributes on LogRecord. Used to determine what is passed in `extras`
RESERVED_ATTRS = (
'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')
#!/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__)
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.INFO)
@ipmb
ipmb / logs_log
Created January 2, 2018 22:43
\d 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) |
@ipmb
ipmb / Dockerfile
Created March 28, 2018 18:28
Building header vmod for varnish 3 on Trusty
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 https://varnish-cache.org/_downloads/varnish-3.0.7.tgz && \
tar xvzf varnish-3.0.7.tgz && cd varnish-3.0.7 && \
./configure && make
RUN curl -sLO https://github.com/varnish/libvmod-header/archive/3.0.tar.gz && \