Skip to content

Instantly share code, notes, and snippets.

View schlady's full-sized avatar

schlady schlady

  • Greifswald, Germany
View GitHub Profile
@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 / tivoli.sh
Created December 16, 2011 14:07
Debian/Ubuntu init script for IBM Tivoli Storage Manager Client Schedule
#!/bin/bash
### BEGIN INIT INFO
# Provides: dsmc
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $network $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Start and stop the Tivoli Storage Client
# Description: Control the IBM Tivoli Storage Manager Client Schedule instance
### END INIT INFO
@schlady
schlady / peakdetect.py
Created January 7, 2012 21:18 — forked from sixtenbe/analytic_wfm.py
Peak detection in Python
import numpy as np
def peakdetect(y_axis, x_axis = None, lookahead = 500, delta = 0):
"""
Converted from/based on a MATLAB script at http://billauer.co.il/peakdet.html
Algorithm for detecting local maximas and minmias in a signal.
Discovers peaks by searching for values which are surrounded by lower
or larger values for maximas and minimas respectively
@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 / 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