Skip to content

Instantly share code, notes, and snippets.

@mdbraber
mdbraber / save-safari-pdf.swift
Last active February 20, 2025 19:46
Save Safari website as PDF (with syncing cookies)
#!/usr/bin/swift
@preconcurrency import WebKit
@preconcurrency import Foundation
@preconcurrency import Darwin
// Disable everything written to stderr
freopen("/dev/null", "w", stderr)
struct Cookie {
@mdbraber
mdbraber / 12wy-calendar.py
Created August 20, 2019 20:25
A quick hack to output a 12-week year calendar (well actually, 13 weeks per quarter) - can be directly copied to Workflowy
from datetime import datetime
import locale
locale.setlocale(locale.LC_TIME, "nl_NL")
year = "2019"
for q in range (1,5):
qfirst = datetime.strptime(f"{year}-W{((q-1)*13)}-1", "%Y-W%W-%w").strftime("%a %d %b").capitalize()
qlast = datetime.strptime(f"{year}-W{((q-1)*13+12)}-0", "%Y-W%W-%w").strftime("%a %d %b").capitalize()
print(f"{year} Q{q}: {qfirst} - {qlast} {year}")
@mdbraber
mdbraber / interfaces
Last active December 20, 2022 17:38
Network interfaces setup (/etc/network/interfaces)
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto ens18
# remove networks
docker network rm traefik
docker network rm trusted mgmt vpnout
docker network rm trusted_macvlan mgmt_macvlan vpnout_macvlan
# remove shims
ip link del mgmtshim
ip link del trustedshim
ip link del vpnoutshim
Verifying that +mdbraber is my Bitcoin username. You can send me #bitcoin here: https://onename.io/mdbraber