Skip to content

Instantly share code, notes, and snippets.

@Invisi
Invisi / ClassObject.py
Last active March 19, 2020 13:30
Simple, stupid implementation for (pydantic-like) class-based definitions in Python 3
import enum
import json
from pathlib import Path
class Encoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, enum.Enum):
return o.value
return o.__dict__
@Invisi
Invisi / ideolog.md
Last active October 28, 2020 22:38
Ideolog config for python's logging

Message pattern

^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\s-\s(\w+)\s-\s([\w.]+)\s-\s(.+)

Message start pattern

^\d

Time format

yyyy-MM-dd HH:mm:ss

Capture groups

  • Time: 1
  • Severity: 3
  • Category: 2
@Invisi
Invisi / supervisord.sh
Created July 26, 2016 06:46 — forked from danmackinlay/supervisord.sh
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.