Skip to content

Instantly share code, notes, and snippets.

@Siguza
Siguza / debianize.sh
Last active November 30, 2025 20:54
# debianize
# My notes of migrating a Ubuntu system to Debian, incrementally and (mostly) live.
# The way this works is:
# 1. Bootstrap a Debian install into /debian.
# 2. Boot that as a container with systemd-nspawn.
# 3. Set up kernel, bootloader and sshd inside the container.
# 4. Boot into recovery, move all root-level folders under /ubuntu and move
# everything under /debian to the root folder, then reboot.
# (This should be the only downtime.)
# 5. Run /ubuntu as a container, gradually move one service after another out
@wilmtang
wilmtang / cancelAmazonSub.js
Last active November 23, 2025 08:23
Cancels all subscriptions in Amazon Subscribe and Save
// This script cancels all subscriptions in Amazon Subscribe and Save, which is fairly annoying to do manually one by one (it's def intentional)
// Inspired by reddit post https://www.reddit.com/r/amazonprime/comments/1d3agri/mass_cancel_move_all_subscribe_save_items_in_bulk
// Improved on getting subscriptionId, and fetching the urls (so it doesn't open a new tab on every unsub)
// Ussage
// 1. Visit this URL showing all subs: https://www.amazon.com/auto-deliveries/subscriptionList?listFilter=active
// 2. Press the "Show more subscriptions" button until you can see every item you're subscribed to
// 3. Open developer tool(cmd + opt + i) and paste the following into Javascript console. Then hit Enter
// 4. Profit
@helgatheviking
helgatheviking / add-win-terminal-ubuntu-profile-to-context-menus.reg
Last active December 27, 2024 09:58
Add "Open Ubuntu Terminal Here" to context menus - Launches Windows Terminal's Ubuntu profile.
Windows Registry Editor Version 5.00
Replace <<Username>> with your user name!
[HKEY_CLASSES_ROOT\Directory\Background\shell\ubuntu]
@="Open Ubuntu Terminal here"
"Icon"="%USERPROFILE%/AppData/Local/WindowsTerminal/ubuntu.ico"
[HKEY_CLASSES_ROOT\Directory\Background\shell\ubuntu\command]
@="C:\\Users\\<<Username>>\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe -d . --profile=\"Ubuntu-18.04\""
@RichardBronosky
RichardBronosky / 0-TLDR.md
Last active August 24, 2025 14:31 — forked from datagrok/git-serve.md
How to easily launch a temporary one-off git server from any local repository, to enable a peer-to-peer git workflow.

User 1

remote_server=172.31.0.1
git daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/ > /tmp/git-serve.log 2>&1 &
ssh -R 9418:localhost:9418 ec2-user@$remote_server
git clone git://localhost/ local-repo-name

Repo from workstation is cloned onto server.

User 2

@Ciantic
Ciantic / dirname-filename-basename.bat
Created April 1, 2016 15:11
How to get filename, dirname, and basename in bat?
set filepath="C:\some path\having spaces.txt"
for /F "delims=" %%i in (%filepath%) do set dirname="%%~dpi"
for /F "delims=" %%i in (%filepath%) do set filename="%%~nxi"
for /F "delims=" %%i in (%filepath%) do set basename="%%~ni"
echo %dirname%
echo %filename%
echo %basename%
@whistler
whistler / ofx2csv.py
Created April 19, 2015 23:32
Convert QFX/OFX to CSV
from csv import DictWriter
from glob import glob
from ofxparse import OfxParser
DATE_FORMAT = "%m/%d/%Y"
def write_csv(statement, out_file):
print "Writing: " + out_file
fields = ['date', 'payee', 'debit', 'credit', 'balance']
with open(out_file, 'w') as f:
@ndarville
ndarville / secret-key-gen.py
Created August 24, 2012 17:01
Generating a properly secure SECRET_KEY in Django
"""
Two things are wrong with Django's default `SECRET_KEY` system:
1. It is not random but pseudo-random
2. It saves and displays the SECRET_KEY in `settings.py`
This snippet
1. uses `SystemRandom()` instead to generate a random key
2. saves a local `secret.txt`