Skip to content

Instantly share code, notes, and snippets.

View TauPan's full-sized avatar
🏠
Working from home

Friedrich Delgado TauPan

🏠
Working from home
View GitHub Profile
// ==UserScript==
// @name Archiv nur Buxtehuder Tageblatt
// @namespace http://tampermonkey.net/
// @version 0.2
// @download https://gist.githubusercontent.com/TauPan/9b723469c2893fbefaff4cbe9845e34e/raw/tageblatt-archiv-buxtehude.js
// @description Begrenzt die Archivansicht beim tageblatt.de E-Paper auf Buxtehuder Tageblatt
// @author Friedrich Delgado <taupan@gmail.com>
// @match http://www.tageblatt.de/index.php?pageid=573
// @grant none
// ==/UserScript==
@TauPan
TauPan / subspam.py
Created August 18, 2016 07:26 — forked from iMilnb/subspam.py
Automatic SpamCop report validation with python mechanize
#!/usr/bin/env python2
# adapted from https://gist.github.com/iMilnb/75d65d88ce649b1f191a
import ConfigParser
import mechanize
import os
CONFIG = os.environ.get('SPAMCOP_CONFIG',
os.path.expanduser('~/secret/spamcop-config.ini'))
config = ConfigParser.SafeConfigParser()
@TauPan
TauPan / queryset_iterator.py
Last active April 27, 2016 12:57
My Version of queryset_iterator from https://djangosnippets.org/snippets/1949/ (adds .exists() in the beginning and resetting db queries in debug mode)
from django import db
import gc
# from https://djangosnippets.org/snippets/1949/
def queryset_iterator(queryset, chunksize=1000):
'''''
Iterate over a Django Queryset ordered by the primary key
This method loads a maximum of chunksize (default: 1000) rows in it's
memory at the same time while django normally would load all rows in it's
memory. Using the iterator() method only causes it to not preload all the
@TauPan
TauPan / .mailcap snippet
Created January 11, 2016 10:55
Displaying and replying to ms-tnef / winmail.dat attachments from #outlook in #mutt
application/ms-tnef; tnefsmime %s; copiousoutput
@TauPan
TauPan / window-manager-hydra.el
Last active August 29, 2015 14:16
The fearsome hydra for managing emacs windows
;;; from http://www.emacswiki.org/emacs/ToggleWindowSplit (last example as of 2015-02-19)
(defun window-toggle-split-direction ()
"Switch window split from horizontally to vertically, or vice versa.
i.e. change right window to bottom, or change bottom window to right."
(interactive)
(require 'windmove)
(let ((done))
(dolist (dirs '((right . down) (down . right)))
(unless done
@TauPan
TauPan / config.py
Last active February 7, 2024 20:31
My current qtile config
# -*- coding: utf-8 -*-
import distutils.spawn
import os
import re
import socket
import subprocess
import xcffib.xproto
from libqtile import layout, bar, widget, hook
from libqtile.command import lazy
@TauPan
TauPan / elpy-test-pdb-config.el
Last active December 11, 2017 06:27
Emacs configuration snippet for testing python with elpy, nosetests and django-nose with pdb in a gud-buffer
(use-package elpy
:config
(progn (elpy-enable)
(defun elpy-nose-test-spec (module test)
(cond (test
(format "%s:%s" module test))
(module module)
(t "")))
(defun elpy-test-nose-pdb-runner (top file module test)
"Test the project using the nose test runner with the --pdb arg.
@TauPan
TauPan / mutt2remember.pl
Created April 30, 2013 12:40
mutt2remember.pl a script to help integration of emacs-org-mode and mutt
#!/usr/bin/perl
# $Id: mutt2remember.pl,v 1.5 2008/09/27 11:25:41 friedel Exp friedel $
# Variations on a theme given by Russell Adams http://lists.gnu.org/archive/html/emacs-orgmode/2008-09/msg00300.html
$ENV{TMPDIR} = $ENV{TMP};
# Install:
# ========
@TauPan
TauPan / .screenrc.pgupcopy
Created February 15, 2013 12:43
Get the Shift-PGUP/PGDOWN keys to scroll in screen's copy mode
# Get the Shift-PGUP/PGDOWN keys to scroll in screen's copy mode
bindkey [5;2~ eval "copy" "stuff \002"
bindkey -m [5;2~ stuff \002
bindkey -m [6;2~ stuff \006
bindkey -m ^[[5~ stuff \002
bindkey -m ^[[6~ stuff \006
@TauPan
TauPan / .emacs snippet
Created January 28, 2013 12:09
discipline M-x grep + git-grep
;; grep-mode is stupid and does its parsing too early
(pushnew (lambda (buffer string)
(when (eq major-mode 'grep-mode)
(grep-mode)))
compilation-finish-functions)
(defun git-grep ()
(interactive)
(require 'grep)
(let ((grep-command "git --no-pager grep -nH -e ")