Skip to content

Instantly share code, notes, and snippets.

View onjin's full-sized avatar

Marek Wywiał onjin

View GitHub Profile
#############################################################################
# Configuration file for Let's Encrypt ACME Challenge location
# This file is already included in listen_xxx.conf files.
# Do NOT include it separately!
#############################################################################
#
# This config enables to access /.well-known/acme-challenge/xxxxxxxxxxx
# on all our sites (HTTP), including all subdomains.
# This is required by ACME Challenge (webroot authentication).
# You can check that this location is working by placing ping.txt here:
@onjin
onjin / auto_notify.sql
Last active December 14, 2015 11:14
pubsub using postgres listen/notify
CREATE OR REPLACE FUNCTION object_notify() RETURNS trigger AS $$
DECLARE
BEGIN
PERFORM pg_notify('object_updated',CAST(NEW.id AS text));
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER object_post_insert_notify AFTER UPDATE ON objects FOR EACH ROW EXECUTE PROCEDURE object_notify();
#!/usr/bin/env python
# encoding: utf-8
"""
$ ./export_confulence_space.py -l http://wiki.some.com -u username -p password -s SPACEKEY
$ ./export_confulence_space.py -l http://wiki.some.com -u username -p password -a # all spaces available for given user
"""
import os
#!/usr/bin/env python
"""
# nagios configuration
define contact {
contact_name slack
alias Slack
service_notification_period 24x7
host_notification_period 24x7
{
"title": "Syslog",
"services": {
"query": {
"list": {
"0": {
"query": "severity=info",
"alias": "",
"color": "#7EB26D",
"id": 0,
@onjin
onjin / settitle
Created February 19, 2015 08:52
set shell title
#!/bin/bash
echo -ne "\033]0;${1}\007"
import os
import re
import subprocess
from time import sleep
from threading import Thread
import logging
from logging.handlers import RotatingFileHandler
from libqtile.config import Key, Screen, Group, Drag, Click, Match
from libqtile.command import lazy
@onjin
onjin / slackme
Last active June 15, 2018 07:49
Send msgs to slack using incoming webhook
#!/usr/bin/env python
"""
Usage:
using ~/.slackmerc file:
$ slackme some info # with `default` profile
$ slackme --profile alert some info # using `alert` profile
put profile in filename:
@onjin
onjin / Makefile
Created December 4, 2014 08:15
long running job notification
job:
longjob()
if [ -f /usr/bin/notify-send ]; then /usr/bin/notify-send -t 60000 -u critical -a "frontend" -c docker,frontend "Docker build" "Frontend docker build at<br/>`pwd`"; fi
@onjin
onjin / business_rules_example.py
Created November 19, 2014 10:28
python business_rules package example
# pip install business-rules
from decimal import Decimal
from pprint import pprint
from business_rules import (
variables, actions, fields, export_rule_data, run_all
)