Skip to content

Instantly share code, notes, and snippets.

@mxgrn
mxgrn / audit-logs.sql
Created December 9, 2024 10:13
Track Postgres table changes in audit_logs
-- Step 1: Create the audit logs table
CREATE TABLE audit_logs (
id SERIAL PRIMARY KEY,
table_name TEXT NOT NULL,
operation TEXT NOT NULL,
json_diff JSONB,
inserted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Step 2: Create the trigger function
@mikegerber
mikegerber / Fix WSL2 vs VPN networking.md
Last active January 1, 2025 18:20
Fix WSL2 vs VPN networking

The problem

WSL2 uses a random network from the 172.16.0.0/12 RFC1918 private IP address block. And our VPN uses that address block, too, with a route metric of 1 (= most preferred.)

This breaks networking for WSL2. Meh!

The solution

While messing around with the interface/route metric of the VPN network may work around the problem, it also reduces the priority of the VPN. We do not really want this. Additionally, changing the interface metric does not seem to be permanent, so it requires more work when it breaks again.

@drego85
drego85 / upload_wpa-sec.py
Last active January 1, 2025 18:18
Script for automatic upload of handshakes to Distributed WPA PSK auditor (wpa-sec.stanev.org)
#!/usr/bin/env python3
#
# Script for automatic upload of handshakes captured
# by Pwnagotchi, Flipper Zero or Marauder to
# Distributed WPA PSK auditor (wpa-sec.stanev.org).
#
# The script is progressive, not sending to WPA Sec
# handshaske already analysed.
#
# The script also saves the detected WPA keys locally.
@topheman
topheman / .vimrc
Last active January 1, 2025 18:15
vim-config on Mac OS X
" Vundle config
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@rjchatfield
rjchatfield / ArrayBuilder.swift
Last active January 1, 2025 18:14
ArrayBuilder - Swift ~~FunctionBuilder~~ ResultBuilder
@resultBuilder
public struct ArrayBuilder<Element> {
public static func buildPartialBlock(first: Element) -> [Element] { [first] }
public static func buildPartialBlock(first: [Element]) -> [Element] { first }
public static func buildPartialBlock(accumulated: [Element], next: Element) -> [Element] { accumulated + [next] }
public static func buildPartialBlock(accumulated: [Element], next: [Element]) -> [Element] { accumulated + next }
// Empty Case
public static func buildBlock() -> [Element] { [] }
// If/Else
@jhaddix
jhaddix / all.txt
Last active January 1, 2025 18:09
all wordlists from every dns enumeration tool... ever. Please excuse the lewd entries =/
This file has been truncated, but you can view the full file.
.
..
........
@
*
*.*
*.*.*
🐎
@bahadiraraz
bahadiraraz / Git_Commit_Freeze_Solution.md
Last active January 1, 2025 18:08
Git Commit Freeze Due to GPG Lock Issues (Solution)

Git Commit Freeze Due to GPG Lock Issues

If you encounter a problem where you cannot commit changes in Git – neither through the terminal nor via the GitHub Desktop application – the issue might be a freeze during the Git commit process. This is often caused by GPG lock issues. Below is a concise and step-by-step guide to resolve this problem.

Solution Steps

1. Check for GPG Lock Messages

Open your terminal and try to perform a GPG operation (like signing a test message). If you see repeated messages like gpg: waiting for lock (held by [process_id]) ..., it indicates a lock issue.

@darktable
darktable / MiniJSON.cs
Created November 30, 2011 23:08
Unity3D: MiniJSON Decodes and encodes simple JSON strings. Not intended for use with massive JSON strings, probably < 32k preferred. Handy for parsing JSON from inside Unity3d.
/*
* Copyright (c) 2013 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining
@GreepTheSheep
GreepTheSheep / Install VBox Guest On Debian.md
Last active January 1, 2025 18:07
Install VBox Guest On Debian
  1. Install VirtualBox Extention Pack
  2. Prepare Linux kernel for VirtualBox: sudo apt install gcc make perl dkms
  3. Mount the Guest Additions disk
  4. Install Guest Additions: sudo sh /media/cdrom0/VBoxLinuxAdditions.run
  5. Reboot
  6. Enjoy
@rsnemmen
rsnemmen / save-url-safari-tabs.scpt
Last active January 1, 2025 18:07
Apple script to save the URLs of all currently open tabs in Safari to a text file
-- Set up the initial document
set output to ("List of open tabs in Safari" & linefeed as string) & "=======================" & linefeed as string
tell application "Safari"
-- Count the number of Windows
set numWindows to number of windows
repeat with w from 1 to numWindows