Skip to content

Instantly share code, notes, and snippets.

View schlady's full-sized avatar

schlady schlady

  • Greifswald, Germany
View GitHub Profile
@schlady
schlady / unique.sh
Created January 15, 2015 13:20
Perl oneliner to find unique lines
perl -ne '$H{$_}++ or print'
@schlady
schlady / filestream.py
Created February 3, 2015 15:54
continuously stream a file line by line like 'tail -f'
def filestream(file, interval=1.0):
with open(file) as f:
while True:
where = f.tell()
line = f.readline()
if not line:
time.sleep(interval)
f.seek(where)
else:
yield line
@schlady
schlady / update-texmf-cache.sh
Created December 8, 2011 09:48
Update the texmf cache
#!/bin/sh
sudo update-texmf
sudo texhash
sudo mktexlsr
@schlady
schlady / New iTerm Window.workflow
Created September 29, 2015 16:12
Create a new iTerm window wherever you are. Save this gist as an Automator Service and assign a shortcut to it.
if application "iTerm" is running then
tell application "iTerm"
activate
set myterm to (make new terminal)
tell myterm
launch session "Default"
end tell
end tell
else
activate application "iTerm"
@schlady
schlady / isiterable.py
Created February 13, 2012 16:03
Find out if a python object is iterable
def isiterable(obj):
return hasattr(obj, '__contains__')
@schlady
schlady / Makefile
Created February 23, 2012 09:35 — forked from yy/Makefile
A sample makefile for a paper in LaTeX.
TEX = pdflatex -interaction nonstopmode
BIB = bibtex
GS = gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite
COVER = cover
PAPER = paper_main
SUPP = paper_supp
BIBFILE = temp.bib
BUNDLE = paper_bundle.pdf
@schlady
schlady / dsmcad.sh
Created July 11, 2012 11:05
Debian/Ubuntu init script for Tivoli Storage Manager Client Schedule (dsmcad)
#!/bin/bash
########################################################################
## This script is used to start/stop the dsmcad under ubuntu
## The original script was: start/stop mldonkey p2p client
## 2007 by Christoph Langner, published under the GPL v3
## published on http://wiki.ubuntuusers.de/MLDonkey
## Changed the script to start/stop the dsmcad for ubuntu
## 2008 by Timo Scheller, published under the GPL v3
## Modified, Feb. 2009 for Ubuntu Server 8.04.2
## Modified, Feb. 2010, Fixed to change this ANS4042E: http://www-01.ibm.com/support/docview.wss?uid=swg21290640
@schlady
schlady / Makefile
Created October 15, 2012 13:43
Makefile with release and debug mode
CXXFLAGS=-Wall -Wextra -Werror -DLINUX
CXX_DEBUG_FLAGS=-g3 -DDEBUG_ALL
CXX_RELEASE_FLAGS=-O3
.PHONY: debug
debug: CXXFLAGS+=$(CXX_DEBUG_FLAGS)
debug: HelloWorldD
.PHONY: release
release: CXXFLAGS+=$(CXX_RELEASE_FLAGS)
'''
Code snippet to plot multiple triangle's in Matplotlib using different methods.
'''
import time
import sys
import matplotlib.pyplot as pp
import numpy as np
from matplotlib.collections import PolyCollection
import random
@schlady
schlady / bind.conf.local
Last active May 8, 2016 16:49
bind config for muehlentor.greifswald.freifunk.net (10.143.0.5)
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
masters "ns-master-hgw" {
82.193.238.154; 2a01:a380:8408:1:216:3eff:fe2b:63b9;