Skip to content

Instantly share code, notes, and snippets.

@mrizvic
mrizvic / auth.py
Last active June 15, 2024 11:11
Static password and OTP authentication for OpenVPN in with custom python scripts
#!/usr/bin/env python3
import os
import sys
import datetime
import pyotp
import hashlib
### TO ALLOW ACCSSS CALL sys.exit(0)
### TO DENY ACCESS CALL sys.exit(1)
@bmhatfield
bmhatfield / check-recent-oom
Created April 16, 2016 15:10
A simple, time-based OOM check script for use with riemann-sumd
#!/bin/bash
# Run on a minutely basis by https://github.com/bmhatfield/riemann-sumd/
LAST_OOM_WINDOW=5;
LAST_OOM="$(grep 'Out of memory' /var/log/kern.log | tail -n 1)";
LAST_OOM_TIME=${LAST_OOM:0:15};
if [ -n "${LAST_OOM_TIME}" ]; then
if [ $(($((`date +%s` - `date --date="${LAST_OOM_TIME}" +%s`)) / 60 )) -le ${LAST_OOM_WINDOW} ]; then
echo "CRITICAL: OOM within last ${LAST_OOM_WINDOW} minutes!"
echo ${LAST_OOM}
@a-vasyliev
a-vasyliev / example.com.conf
Created March 25, 2015 11:42
Nginx: proxy cache without utm_* parameters (remove query parameter, remove utm tags nginx)
server {
listen 443;
server_name example.com;
error_log /var/log/nginx/example_com_error.log warn;
ssl on;
ssl_certificate /etc/nginx/ssl/your.crt; #certificate chains
ssl_certificate_key /etc/nginx/ssl/your.key; #private key