Skip to content

Instantly share code, notes, and snippets.

# Parse the output of a duplicati run and upload to prometheus. Assumes duplicati is running in kubernetes and the gateway is as well.
# Also requires that duplicati is run with the following commands:
# --run-script-after=/scripts/upload_results_to_prometheus.sh --run-script-result-output-format=json
import os
import prometheus_client
import json
json_filename = os.environ.get('DUPLICATI__RESULTFILE', '/tmp/latest_duplicati_resultfile.json')
@eddieparker
eddieparker / postgresql_format_blocked_pids_into_tree
Last active July 8, 2022 20:50
Format postgresql's blocked pids into a tree so you can see which root query is blocking which children.
'''
Generates a tree on the command line showing you which pid and query is blocking which. Looks like:
Blocking and Blocked Query Tree
===============================
2022-06-09 21:14:06.707790 [15257]: (SELECT item.id AS item_id, item.itemid AS item_id)
-> 2022-06-09 21:14:17.785848 [15536]: (UPDATE item SET foo_id=187 WHERE item.id = 37454797)
-> 2022-06-09 21:14:07.364804 [15280]: (UPDATE item SET foo_id=187 WHERE item.id = 37454797)
-> 2022-06-09 21:14:09.445913 [15344]: (UPDATE item SET foo_id=1 WHERE item.id = 37460570)
-> 2022-06-09 21:14:07.059882 [15275]: (UPDATE item SET foo_id=1 WHERE item.id = 37460570)
@eddieparker
eddieparker / playbook.yml
Last active December 4, 2021 11:21
KeeAgent ansible playbook for ubuntu on WSL
# Instructions forged into playbook from https://gist.github.com/strarsis/e533f4bca5ae158481bbe53185848d49
# To use:
# - Install ansible (apt-get update -y && apt-get install -y ansible)
# - Run "ansible-playbook playbook.yml" wherever you downloaded this gist to.
# - Don't forget to "Enable agent for Windows OpenSSH (experimental)" in keepass to allow this to work.
---
- name: Setup for keepass
hosts: localhost
remote_user: root
@eddieparker
eddieparker / easybuttons_propertydrawer.cs
Last active May 24, 2023 15:30
easy buttons property drawer version
using UnityEngine;
using UnityEditor;
using System.Reflection;
using System.Linq;
using EasyButtons;
using System;
using System.Collections.Generic;
using System.Collections;
@eddieparker
eddieparker / convert.py
Created September 2, 2019 21:25
Recursive handbrake ripping python script
# Searches for all .mkv files in the current directory and below, and converts them using handbrake.
import subprocess
import os
import sys
g_preset = "Super HQ 1080p30 Surround"
g_output_extension = "m4v"
g_output_root_dir = "e:/VideoConverted"
@eddieparker
eddieparker / bootstrap_windows.bat
Last active April 19, 2021 17:37
bootstrap new windows machine
@echo off
goto check_Permissions
:check_Permissions
echo Administrative permissions required. Detecting permissions...
net session >nul 2>&1
if %errorLevel% == 0 (
echo Success: Administrative permissions confirmed; continuing.