Skip to content

Instantly share code, notes, and snippets.

class { 'nginx::service': }
class { 'nginx::config':
http_cfg_append => {
'log_format' => 'proxylog \'$http_x_real_ip - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"\'',
'fastcgi_cache_path' => '/var/lib/nginx/tmp/fastcgi/ levels=1:2 keys_zone=microcache:10m max_size=1024m inactive=1h',
},
gzip => true,
names_hash_max_size => '2048',
names_hash_bucket_size => '256',
confd_purge => true,
@jowrjowr
jowrjowr / test.py
Created January 26, 2019 17:46
example use case of telethon
import common.logger as _logger
import common.request_esi
import urllib
import time
import threading
import logging
import traceback
from telethon import TelegramClient
from telethon.tl.types import UpdatesTg
@jowrjowr
jowrjowr / slack.py
Created February 7, 2019 05:10
slack forwarding
from slackclient import SlackClient
from time import sleep
import requests
import re
import time
import threading
def start_slack(logger, discord_queue, credentials):
username = credentials['username']
@jowrjowr
jowrjowr / update_r10k.py
Created February 15, 2019 00:25
uwsgi app to run r10k updating
import subprocess
import logging
from systemd import journal
from flask import Flask, jsonify, request
app = Flask(__name__)
@app.route('/update_r10k', methods=['GET', 'POST'])
def update_r10k():
# constants
@jowrjowr
jowrjowr / README.md
Created June 4, 2019 20:52
pidgin puppet docu
filter {
if [syslog_program] == "asterisk" {
# All asterisk logs will have the following fields
# log_level: DEBUG|NOTICE|WARNING|ERROR|VERBOSE|DTMF|FAX|SECURITY
# thread_id: Channel thread ID within brackets after the log_level
# (if in a call) call_thread_id: Call thread ID. Second set of brackets after log_level
# module_name: name of the C module that outputs the log message
Compressed Arkonor,28367,22000,0,0,2500,0,0,320
Compressed Crimson Arkonor,28385,23100,0,0,2625,0,0,336
Compressed Prime Arkonor,28387,24200,0,0,2750,0,0,352
Compressed Bistot,28388,0,12000,0,0,0,450,100
Compressed Monoclinic Bistot,28389,0,13200,0,0,0,495,110
Compressed Triclinic Bistot,28390,0,12600,0,0,0,473,105
Compressed Crokite,28391,21000,0,0,0,760,135,0
Compressed Crystalline Crokite,28392,23100,0,0,0,836,149,0
Compressed Sharp Crokite,28393,22050,0,0,0,798,142,0
Compressed Dark Ochre,28394,10000,0,1600,0,120,0,0
@jowrjowr
jowrjowr / policy.tf
Created February 28, 2020 18:32
protect RDS against accidental deletion independent of its own deletion protection setting
data "aws_iam_policy_document" "deletion_protection" {
statement {
sid = "DenyRDSDeletion"
effect = "Deny"
actions = [
"rds:DeleteDBInstance",
"rds:DeleteDBCluster"
]
resources = ["*"]
condition {
@jowrjowr
jowrjowr / alert.js
Created March 31, 2020 16:01
slack alert
var https = require('https');
var util = require('util');
exports.handler = function(event, context) {
console.log(JSON.stringify(event, null, 2));
// the SNS message contains the actual details of importance
// which is always going to be json from guard duty and cloudwatch
// should only parse one message at a time?