Skip to content

Instantly share code, notes, and snippets.

@tback
tback / migrate.py
Created May 18, 2025 13:06
Migrate secrets from pass/browserpass to 1password
import click
import datetime
import pathlib
import subprocess
from loguru import logger
import sys
LOG_FORMAT = "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level> | {extra}"
@tback
tback / notifications.yaml
Created September 5, 2022 08:54
Preview environments ApplicationSet
notifications:
argocdUrl: "https://cd.org.example"
secret: {} # redacted
triggers:
trigger.on-sync-running: |
- description: Application is being synced
send:
- app-sync-status
when: app.status.operationState.phase in ['Running']
@tback
tback / raritan.lua
Last active March 18, 2019 15:43
monitor outlets with memory leak :|
-- Count the power state from all outlets
require "Pdu"
local pdu = pdumodel.Pdu:getDefault()
local outlets = pdu:getOutlets()
for i, outlet in pairs(outlets) do
sensors[i] = outlets[i]:getSensors().activePower
@tback
tback / # restic - 2017-10-21_09-20-52.txt
Created October 21, 2017 07:28
restic on macOS 10.12.6 - Homebrew build logs
Homebrew build logs for restic on macOS 10.12.6
Build date: 2017-10-21 09:20:52
@tback
tback / thales.py
Last active December 28, 2015 08:51
Thales
#!/usr/bin/env python
class Thales(object):
N = None
RING_00 = [27, 20, 11, 27, 10, 19, 10, 13, 10, 2, 15, 23, 19, 3, 2, 3]
RING_01 = [ 2, 10, 9, 7, 3, 12, 24, 10, 9, 22, 9, 5, 10, 5, 1, 24]
RING_10 = [17, N, 2, N, 2, N, 10, N, 15, N, 6, N, 9, N, 16, N]
RING_11 = [14, 5, 6, 7, 8, 24, 8, 3, 6, 15, 22, 6, 1, 1, 11, 27]
RING_20 = [22, N, 2, N, 17, N, 15, N, 14, N, 5, N, 10, N, 2, N]
#!/usr/bin/env python
from collections import defaultdict
import random
import sys
def trigrams(seq):
seq_iter = iter(seq)
prev2 = next(seq_iter)
prev = next(seq_iter)
def date_choice_iterator():
today = date.today()
for months_back in range(4):
yield (today - relativedelta(day=1, months=months_back),today - relativedelta(day=1, months=months_back))
class BookingAdminForm(forms.ModelForm):
until_date = forms.DateField(widget=Select(choices=date_choice_iterator()))