Skip to content

Instantly share code, notes, and snippets.

@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created February 12, 2012 20:40
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@7596ff
7596ff / dotabrag.py
Created August 11, 2014 17:33
quick dotabrag tweet thing
import urllib
import json
import string
import sys
import ConfigParser
import tweepy
def craftTweet(match_id, level, hero, kills, deaths, assists):
unformatted = 'Just played a match: Hero: Lvl. {} {} K/D/A: {}/{}/{}\nDotabuff: {}'
@CMCDragonkai
CMCDragonkai / bash_scoping.md
Last active February 8, 2025 17:37
Bash: The Scoping Rules of Bash

The Scoping Rules of Bash

There are 5 types of scopes in Bash:

  • Environment Scope - export x=1; echo "$x"; command
  • Shell Scope - x=1; echo "$x"
  • Function Scope - f () { local x=1; echo "$x"; }; f
  • Command Scope - x=1 command
  • Subshell Scope - x=1; (echo "$x"; y=2); echo $y
@nrdmn
nrdmn / ipcollapse.py
Last active February 9, 2024 13:57
collapse a list of IP addresses
#!/usr/bin/python3
# reads a list of IP subnets in CIDR notation from stdin and collapses it
import sys
import ipaddress
subnets6 = []
subnets4 = []
input_list = sys.stdin.readlines()
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active August 19, 2025 03:10 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Exporting your 2FA tokens from Authy to transfer them into another 2FA application

IMPORTANT - Update regarding deprecation of Authy desktop apps

Past August 2024, Authy stopped supported the desktop version of their apps:
See Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August for details.

And indeed, after a while, Authy changed something in their backend which now prevents the old desktop app from logging in. If you are already logged in, then you are in luck, and you can follow the instructions below to export your tokens.

If you are not logged in anymore, but can find a backup of the necessary files, then restore those files, and re-install Authy 2.2.3 following the instructions below, and it should work as expected.

@hjbotha
hjbotha / free_ports.sh
Last active May 20, 2025 14:10
Free ports 80 and 443 on Synology NAS
#! /bin/bash
# NEWLY ADDED BACKUP FUNCTIONALITY IS NOT FULLY TESTED YET, USE WITH CARE, ESPECIALLY DELETION
# Developed for DSM 6 - 7.0.1. Not tested on other versions.
# Steps to install
# Save this script in one of your shares
# Edit it according to your requirements
# Backup /usr/syno/share/nginx/ as follows:
# # cd /usr/syno/share/
# # tar cvf ~/nginx.tar nginx
#!/usr/bin/env python3
import os
import bencode
import re
import sys
# Inspired by https://github.com/ctminime/QB_Migrate_to_Linux
# Need `pip3 install bencode.py`.
# Run in folder like "/home/user/.local/share/data/qBittorrent/BT_backup/" (configured in qBitTorrent).
# Takes 2 parameters:
@Roxedus
Roxedus / prowlarr-migration.md
Last active June 16, 2025 21:54
Writeup on setting up Prowlarr with Postgres

So you hate SQLite

This document will go over the key items for migrating and setting up Postgres support in Prowlarr.

Creation of initial database

We do this also when migrating, this is to ensure Prowlarr sets up the required schema.

Setting up Postgres

select setval('public."AutoTagging_Id_seq"', (SELECT MAX("Id")+1 FROM "AutoTagging"));
select setval('public."Commands_Id_seq"', (SELECT MAX("Id")+1 FROM "Commands"));
select setval('public."Config_Id_seq"', (SELECT MAX("Id")+1 FROM "Config"));
select setval('public."CustomFilters_Id_seq"', (SELECT MAX("Id")+1 FROM "CustomFilters"));
select setval('public."CustomFormats_Id_seq"', (SELECT MAX("Id")+1 FROM "CustomFormats"));
select setval('public."DelayProfiles_Id_seq"', (SELECT MAX("Id")+1 FROM "DelayProfiles"));
select setval('public."DownloadClientStatus_Id_seq"', (SELECT MAX("Id")+1 FROM "DownloadClientStatus"));
select setval('public."DownloadClients_Id_seq"', (SELECT MAX("Id")+1 FROM "DownloadClients"));
select setval('public."DownloadHistory_Id_seq"', (SELECT MAX("Id")+1 FROM "DownloadHistory"));
select setval('public."EpisodeFiles_Id_seq"', (SELECT MAX("Id")+1 FROM "EpisodeFiles"));