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
@TauPan
TauPan / aptitude-update-home
Last active April 17, 2018 14:38
Some tmux scripts
#!/usr/bin/env bash
update_command='reset; while pgrep -f apt-get; do echo -n "O"; sleep 60; done;aptitude update; aptitude -y -d safe-upgrade --full-resolver; aptitude safe-upgrade --full-resolver; purge-old-kernels ; cat /var/run/reboot-required*'
reachable () {
netcat -w 1 -z $*
}
hosts='dirk thomas abrasax orion'
sudo wakeonlan -f /etc/wakeonlan/abrasax.wol
@TauPan
TauPan / transport.py
Created March 22, 2018 13:04 — forked from chrisguitarguy/transport.py
Python xmlrpc lib Transport that used Requests
# -*- coding: utf-8 -*-
"""
A replacement transport for Python xmlrpc library.
Usage:
>>> import xmlrpclib
>>> from transport import RequestsTransport
>>> s = xmlrpclib.ServerProxy('http://yoursite.com/xmlrpc', transport=RequestsTransport())
>>> s.demo.sayHello()
@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 / pastescreensize.sh
Created April 11, 2012 14:22
adapt terminal settings to a remote serial line
#!/bin/sh
stty size|awk '{print "export TERM=screen;export LINES=" $1 ";export \
COLUMNS=" $2 ";stty rows $LINES;stty cols $COLUMNS;reset"}'
# /etc/screenrc:
# register f '^A:exec .!. pastescreensize.sh^M'
# bind + process f
// ==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 / 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 ")