Skip to content

Instantly share code, notes, and snippets.

View hartwork's full-sized avatar

Sebastian Pipping hartwork

View GitHub Profile
@hartwork
hartwork / komodo_ide_billion_laughs_exploit.py
Created January 4, 2015 03:47
Demonstrate that Komodo IDE with debugger listening can be frozen with one CPU at 100% for longer, remotely
#! /usr/bin/env python
# Copyright (C) 2013 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL v3 or later
#
# Demonstrate that Komodo IDE with debugger listening
# can be frozen with one CPU at 100% for longer, remotely
#
# https://community.activestate.com/node/10396
import argparse
@hartwork
hartwork / progress-dd
Created January 30, 2015 18:05
"dd status=progress" substitute for coreutils <8.24
#! /usr/bin/env python
# Wrapper around dd(1)
# .. saving you to run "kill -USR1 <pid>" in another shell
#
# Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL v3 or later
#
# 2011-02-23 04:48 UTC+1
import subprocess
@hartwork
hartwork / git-move-tags-up
Created January 31, 2015 21:05
Post-process Git tags (Bash)
#! /usr/bin/env bash
# Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL v3 or later
#
# 2011-04-01
GIT='git --no-pager'
# Require Git repository in reach
${GIT} show --oneline >/dev/null || exit 1
@hartwork
hartwork / stddump
Created January 31, 2015 21:08
Capture another program's std{in,out,err} (Python)
#! /usr/bin/env python
#
# stddump - A command line tool to capture std{in,out,err}
#
# Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL v3 or later
#
# 2011-03-01 14:30 UTC+1
import subprocess
@hartwork
hartwork / mimetest.c
Created February 1, 2015 16:51
Tool to query which installed applications handle a given MIME type
/*
** Copyright (C) Sebastian Pipping <sebastian@pipping.org>
** Licensed under GPL v2 or later
**
** 2013-06-01
**
** Compilation
** ===========
**
** # gcc $(pkg-config --libs --cflags-only-I gio-2.0) -o mimetest mimetest.c
@hartwork
hartwork / to-file-extension-patterns.awk
Created February 9, 2015 12:54
Group filenames fed to stdin into wildcard patterns (e.g. "*.txt", "*.pdf")
#! /usr/bin/awk -f
# Copyright (C) 2009 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPLv3 or later
# 2009-04-09
#
# Input
# one.txt
# two.pdf
# three.txt
#
@hartwork
hartwork / createcustomsuperuser.py
Created March 30, 2018 16:03
Django management command to script creation of superusers
# Django management command to create custom superusers
# Version 2018.03.18
#
# Core benefits over existing command `createsuperuser` are:
# - Scriptability
# - Ignorance of `settings.AUTH_PASSWORD_VALIDATORS`
# - Idempotency
#
# Store as `<app>/management/commands/createcustomsuperuser.py` to activate.
# Originally written for Django 1.9.9.
@hartwork
hartwork / .pre-commit-config.yaml
Created January 10, 2019 21:58
Sample .pre-commit-config.yaml of an actual Django project
exclude: ^myDjangoApp/static/
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v1.11.0
hooks:
- id: pyupgrade
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.4.3
@hartwork
hartwork / decode_jwt_token.sh
Last active January 5, 2020 01:11
Decode JWT token
decode-jwt-token() { python3 -c 'import sys, json, base64; [print(json.dumps(json.loads(base64.urlsafe_b64decode(e + (len(e)%3)*"=")), indent=2)) for e in sys.argv[1].split(".")[:2]]' "$1"; }
@hartwork
hartwork / libxspf-1-2-compile.patch
Created March 2, 2020 13:55
Patch to get vanilla libxspf 1.2 to compile
diff --git a/Makefile.am b/Makefile.am
index 0d7257f..a3f948e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in
-AUTOMAKE_OPTIONS = 1.10.1 gnu dist-zip dist-bzip2 dist-lzma subdir-objects
+AUTOMAKE_OPTIONS = 1.10.1 foreign dist-zip dist-bzip2 subdir-objects
ACLOCAL_AMFLAGS = -I m4