Skip to content

Instantly share code, notes, and snippets.

View relthyg's full-sized avatar

Martin Güthler relthyg

View GitHub Profile
@relthyg
relthyg / gist:e2bc0b2ef698ba42399bfff541543418
Created August 14, 2023 07:36
Redirect to old.reddit.com
// ==UserScript==
// @name Good o'l Reddit
// @description Makes sure you're using Good o'l Reddit. (C) TheNH813 2018. License WTFPLV2
// @version 1.0
// @match *://www.reddit.com/*
// @run-at document-start
// @grant none
// ==/UserScript==
if (window.location.href.indexOf("www.reddit.com/media") > -1) {
@relthyg
relthyg / Mac SSH Autocomplete
Created November 23, 2022 09:03 — forked from aliang/Mac SSH Autocomplete
Add auto complete to your ssh, put into your .bash_profile
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@relthyg
relthyg / mail.py
Created January 25, 2022 09:08
simple Python script for testing SMTP conenctions
# mail.py
# simple Python script for testing smtp connections
# see https://realpython.com/python-send-email/#sending-a-plain-text-email
import smtplib, ssl
smtp_server = "<your-smtp-hostname>"
smtp_username = "<your-smtp-username>"
sender_email = "<sender-email-address>"
receiver_email = "<receiver-email-address>"
port = 587
@relthyg
relthyg / process_audio.sh
Last active December 13, 2021 10:54
ffmpeg cheat sheet
#!/bin/bash
# Downmix 5.1 to stereo, compress dynamic range and normalize an audio track using ffmpeg.
#
# This comes in handy when you're constantly fiddling with your volume control while watching a movie
# because the dialogues are too silent and the explosions too loud.
#
# Firstly, Surround sound is mixed down to stereo. Then, audio is normalized with the intention to "fit"
# the "points" of the following DRC process using the compand filter. The last step is to ensure that the end
# result is normalized.
@relthyg
relthyg / mysql-dsn
Last active October 11, 2021 21:54
mysql-dsn: Connect to a mysql database from the command line using a DSN as argument
#!/usr/bin/env python3
#
# mysql-dsn
# Takes a DSN as argument and tries to connect to the specified database using the "mysql"-command.
# Passwords must be quoted ("url-encoded").
#
# Example:
# $ mysql-dsn mysqli://me:top_secret@hostname:33006/db-name
import re
@relthyg
relthyg / packages.md
Created May 14, 2019 06:28
List packages installed from non-Debian sources

aptitude search "?narrow(?installed,?not(?origin(Debian)))" | sed "s/^i\sA*\s//" | cut -d " " -f 1 | while read package; do echo -n "$package "; apt-cache policy $package | awk "/\*/{getline; print}" | sed "s/ *[0-9]* //" | cut -d " " -f 1; done | column -t

@relthyg
relthyg / 60aptchecker
Created May 12, 2019 08:57
How to get notified about available apt updates in your shell
// /etc/apt/apt.conf.d/60aptchecker
// runs aptchecker after dpkg (e.g. apt upgrade)
DPkg::Post-Invoke {'/opt/bin/aptchecker';};
@relthyg
relthyg / reddit.style
Last active August 19, 2023 11:16
uBlock Origin filters for blocking reddit's stylesheets
||s3.amazonaws.com$stylesheet,domain=old.reddit.com
||thumbs.redditmedia.com$stylesheet,domain=old.reddit.com
||a.thumbs.redditmedia.com$stylesheet,domain=old.reddit.com
||b.thumbs.redditmedia.com$stylesheet,domain=old.reddit.com
old.reddit.com##.listingsignupbar.infobar
old.reddit.com###header-img
old.reddit.com##.email-collection-banner
@relthyg
relthyg / -
Created January 3, 2016 12:49 — forked from anonymous/-
Restart Network Manager
#!/bin/sh
#
# Filename: /etc/pm/sleep.d/10_restart_network_manager
#
# Restarts Network Manager on resume from suspend.
# Useful if NM takes too long to find your wireless Network.
# Needs to be executable for root.
case $1 in
resume|thaw)
@relthyg
relthyg / packages.sh
Last active December 9, 2015 17:25
List all packages with priorities "required", "important" and "standard"
#!/bin/bash
priorities=(required important standard)
for priority in "${priorities[@]}"
do
dpkg-query -W --showformat='${Package}\t${Priority}\n' | grep "$priority$" | sed "s/\t$priority//g"
done