Skip to content

Instantly share code, notes, and snippets.

@dece
dece / smolcgi.py
Created June 28, 2021 15:37
Gemini CGI helper compatible with gmnisrv
#!/bin/false
from os import environ
def getenv(name):
return environ.get(name, "")
version = getenv("GATEWAY_INTERFACE")
protocol = getenv("SERVER_PROTOCOL")
software = getenv("SERVER_SOFTWARE")
url = getenv("GEMINI_URL")
@dece
dece / leebot.py
Last active May 27, 2021 21:47
Announce to every joining users that you moved to greener pastures (you need the "irc" Python3 package to run it). Beware, I got a server klined after using it.
import argparse
try:
import irc.client
except ImportError:
exit("You need the IRC package to run this bot: pip3 install irc")
def main():
argparser = argparse.ArgumentParser(description="\"pick up that chan, leetizen\"")
@dece
dece / ida_demangle.py
Created September 29, 2019 20:49
IDAPython plugin to demangle the string under the cursor and set the result as comment.
""" IDAPython plugin to demangle the string under the cursor and set the result
as comment. This relies on the DbgHelp DLL on your system, so it should work for
most recent VC versions. This can be run as a standalone tool as well. """
import argparse
import ctypes
import ctypes.util
import platform
try:
@dece
dece / android_ecdh.java
Last active September 29, 2019 20:47 — forked from zcdziura/Crypto Test
Encryption using Elliptic Curves and Diffie-Hellman key exchanges
import java.io.UnsupportedEncodingException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.PublicKey;
@dece
dece / mailspring-remove-id-registration.patch
Created June 6, 2019 15:13
Patch to remove Mailspring ID registration wall at start-up (from 06d2e4546, master 2019-06-06).
From 5de9b0584edbb214a062386526ff464e4f011cad Mon Sep 17 00:00:00 2001
From: Dece <[email protected]>
Date: Thu, 6 Jun 2019 16:58:50 +0200
Subject: [PATCH] Remove onboarding Webview from firing at startup
By removing the onboarding view it prevents the application from forcing
you to register a Mailspring ID. A side effect is it removes the whole
welcoming process and initial setup of accounts, but nothing that can't
be set afterwards.
@dece
dece / spoupsify.py
Last active May 5, 2019 14:33
Spoupsify - Mute Spotify ads automatically
#!/usr/bin/env python3
#
# Spoupsify - Mute Spotify ads automatically
# WTFPL - github @dece - twitter @postdroned
#
# Run this script to automatically mute the Linux Spotify desktop application
# when it plays an audio ad. If your Spotify is not in English, you will need to
# add to the TITLES_TO_MUTE list the Spotify window title shown during ads.
#
# Please note that this script needs the Spotify window to be kept open or
@dece
dece / gallery-gen.go
Last active June 15, 2018 13:02
EmlGallery - Elementary Masonry & Lightbox Gallery - Generate JSON metadata with gallery-gen.go, serve gallery.html with your files for friends & family.
@dece
dece / firefox-update.sh
Last active June 12, 2018 13:32
FirefoxUpdate - Update a Firefox version from shell, e.g. newest Firefox stable on Debian stable (which is otherwise stuck with ESR).
#!/bin/bash
# Update a Firefox version from shell.
# Useful for Debian stable and its ESR shenanigans.
# Can break due to a lot of things but w/e get off my lawn.
FFX_DIR="/opt/firefox"
INSTALL_DIR="$(dirname $FFX_DIR)"
# You can add a 'lang' query param to URL if you want (e.g. 'fr', 'it', ...)
BASE_URL="https://download.mozilla.org/"
@dece
dece / ob-lobat.py
Created May 21, 2017 16:18
ObLobat - Send a DBus notification on low battery
#!/usr/bin/env python3
""" Send a DBus notification on low battery.
Install Dependencies:
$ sudo apt-get install libdbus-glib-1-dev
$ sudo pip3 install batinfo python-daemon dbus-python notify2
"""
import subprocess
import sys
@dece
dece / ob-exit.py
Created May 21, 2017 16:17
ObExit - Adaptation of the original cb-exit script found in the Crunchbang distribution to work with SystemD
#!/usr/bin/env python
""" Adaptation of the original cb-exit script found in the Crunchbang
distribution to work with SystemD.
I replaced "cb" with "ob" to match the Openbox tool names (obconf, obmenu)
because that script fits well with the Openbox WM.
"""
import os