Skip to content

Instantly share code, notes, and snippets.

@cryptoluks
cryptoluks / paperless_unlock_pdf.py
Last active August 3, 2025 18:03
Pre-consume hook for Paperless-ngx. This script checks if a PDF is password-protected, then tries a list of passwords from a dictionary file to unlock it. When successful, it saves the PDF with a deterministic ID so duplicate detection remains accurate.
#!/usr/bin/env python3
import os
import sys
import pikepdf
def log(message):
# Simple logging function; stdout and stderr are captured by Paperless-ngx
print(message)
@cryptoluks
cryptoluks / prepare_ubuntu_template.sh
Created January 4, 2024 20:42 — forked from reluce/prepare_ubuntu_template.sh
Prepare Ubuntu 22.04 Cloud Image and Template for Proxmox
# All commands will be executed on a Proxmox host
sudo apt update -y && sudo apt install libguestfs-tools -y
wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
# Install qemu-guest-agent on the image. Additional packages can be specified by separating with a comma.
sudo virt-customize -a jammy-server-cloudimg-amd64.img --install qemu-guest-agent
# Read and set root user password from file.
sudo virt-customize -a jammy-server-cloudimg-amd64.img --root-password file:password_root.txt
# Create an additional user.
sudo virt-customize -a jammy-server-cloudimg-amd64.img --run-command "useradd -m -s /bin/bash myuser"
# Set password for that user.
JwUZVpUxvNJlNr4NAAANdwAAAAAAAAAAWFSmuQUWBgBGaXhlZCBCb290AAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAADW8AAAAAcGFydCBzdGFydCBtbWMgJHtkZXZudW19IGhhc3Nvcy1ib290c3RhdGUg
bW1jX2VudgptbWMgZGV2ICR7ZGV2bnVtfQoKc2V0ZW52IGxvYWRib290c3RhdGUgIiBcCiAgICBl
Y2hvICdsb2FkaW5nIGVudi4uLic7IFwKICAgIG1tYyByZWFkICR7cmFtZGlza19hZGRyX3J9ICR7
bW1jX2Vudn0gMHg0MDsgXAogICAgZW52IGltcG9ydCAtYyAke3JhbWRpc2tfYWRkcl9yfSAweDgw
MDA7IgoKc2V0ZW52IHN0b3JlYm9vdHN0YXRlICIgXAogICAgZWNobyAnc3RvcmluZyBlbnYuLi4n
OyBcCiAgICBlbnYgZXhwb3J0IC1jIC1zIDB4ODAwMCAke3JhbWRpc2tfYWRkcl9yfSBCT09UX09S
REVSIEJPT1RfQV9MRUZUIEJPT1RfQl9MRUZUIE1BQ0hJTkVfSUQ7IFwKICAgIG1tYyB3cml0ZSAk
e3JhbWRpc2tfYWRkcl9yfSAke21tY19lbnZ9IDB4NDA7IgoKcnVuIGxvYWRib290c3RhdGUKdGVz
dCAtbiAiJHtCT09UX09SREVSfSIgfHwgc2V0ZW52IEJPT1RfT1JERVIgIkEgQiIKdGVzdCAtbiAi
@cryptoluks
cryptoluks / fuckForticlient.sh
Created October 16, 2023 09:02 — forked from nonamed01/fuckForticlient.sh
fuckForticlient, a command-line client to connect to SAML fortivpn servers by using openfortivpn and the --cookie-in-stdin parameter
#!/bin/bash
# Uncomment the following line to debug the script:
#set -x
#####################################################################################
# fuckForticlient.sh
#
# Script to authenticate against Fortinet SAML servers using Firefox and
# openfortivpn. This replaces Forticlient for GNU/Linux completely.
# Because openfortivpn does not support SAML login (yet), this script uses Firefox
# to authenticate, grabs SVPNCOOKIE and then calls openfortivpn to setup
@cryptoluks
cryptoluks / vpn.md
Created January 6, 2021 14:55 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.