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 <[email protected]>
# 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 <[email protected]>
# Licensed under GPL v3 or later
#
# 2011-02-23 04:48 UTC+1
import subprocess
@hartwork
hartwork / getrlimit_all.c
Created January 30, 2015 19:09
Simple tool to dump values of RLIMIT_* resources using getrlimit(2)
/* Simple tool to dump values of RLIMIT_* resources using getrlimit(2)
*
* Copyright (C) Sebastian Pipping <[email protected]>
* Licensed under GPL v2 or later
*
* 2013-11-13
*
* Example output:
* RLIMIT_AS : -1 soft -1 hard
* RLIMIT_CORE : 0 soft -1 hard
@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 <[email protected]>
# 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 <[email protected]>
# 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 <[email protected]>
** 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 <[email protected]>
# Licensed under GPLv3 or later
# 2009-04-09
#
# Input
# one.txt
# two.pdf
# three.txt
#
@hartwork
hartwork / clean-all-but.py
Created June 16, 2016 09:02
Small tool to do poor-man's logrotate and update a "latest" symlink
#! /usr/bin/env python2
# Copyright (C) 2016 Sebastian Pipping <[email protected]>
# Licensed under AGPL v3 or later
from __future__ import print_function
import argparse
import errno
import os
import re
@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