Skip to content

Instantly share code, notes, and snippets.

View jgosmann's full-sized avatar

Jan Gosmann jgosmann

View GitHub Profile
@jgosmann
jgosmann / broadcast.py
Last active August 29, 2015 13:56
List which broadcasts all operations to its elements.
class Broadcast(list):
"""List which broadcasts all operations to its elements."""
def __getattr__(self, name):
if name.startswith('__'):
# Necessary to allow easy casting to numpy arrays.
raise AttributeError(
"No implicit broadcast of attributes starting with '__'. Use "
"explicit call to broadcast().")
@jgosmann
jgosmann / ipylisting.py
Created February 6, 2014 22:15
Code to include formatted sources in IPython notebooks.
# Some code do include nicely formatted source code listings of external
# files. Unfortunately, these listings will not be included using
# nbconvert to convert the notebook to a PDF.
import IPython
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import HtmlFormatter
def include_listing(filename):
$pdflatex = "xelatex %O %S";
$pdf_mode = 1;
$postscript_mode = $dvi_mode = 0;
#!/bin/sh
if test -n "$(find /mnt/backup/last_daily -mtime 1)"; then
echo 'Daily backup.'
/usr/bin/rsnapshot daily
date > /root/backup_w/last_daily
fi
if test -n "$(find /mnt/backup/last_weekly -mtime 7)"; then
echo 'Weekly backup.'
@jgosmann
jgosmann / Tree.hs
Created May 31, 2014 21:47
This file provides a Haskell module with a data type for binary trees and functions to manipulate them.
-- File: Tree.hs
-- Date: 11-Nov-2008
-- Version: 1.0
--
-- Copyright (C) 2008 Julia Koslowski, Jan Gosmann <jan@hyper-world.de>
--
-- See: http://www.hyper-world.de
--
-- Description: This file provides a Haskell module with a data type for binary
-- trees and functions to manipulate them.
@jgosmann
jgosmann / Helpers.hs
Created May 31, 2014 21:48
Tree.hs 12 KiB This module contains some helper functions. For example a function to generate permutations (but this could be implemented in a more easy way) or a function to display long lists a little bit nicer.
-- File: Helpers.hs
-- Date: 15-Nov-2008
-- Version: 1.0
--
-- Copyright (C) 2008 Jan Gosmann <jan@hyper-world.de>
--
-- See: http://www.hyper-world.de
--
-- Description: This file provides a data structure to represent arithmetic
-- expressions.
@jgosmann
jgosmann / gist:6f8e357dee0ccf626335
Last active August 29, 2015 14:04
Enable ssh-agent in KDE
echo -e '#!/bin/sh\n[ -n "$SSH_AGENT_PID" ] || eval "$(ssh-agent -s)"' > ~/.kde/env/ssh-agent-startup.sh
echo -e '#!/bin/sh\n[ -z "$SSH_AGENT_PID" ] || eval "$(ssh-agent -k)"' > ~/.kde/shutdown/ssh-agent-shutdown.sh
chmod 755 ~/.kde/env/ssh-agent-startup.sh ~/.kde/shutdown/ssh-agent-shutdown.sh
### Keybase proof
I hereby claim:
* I am jgosmann on github.
* I am jgosmann (https://keybase.io/jgosmann) on keybase.
* I have a public key whose fingerprint is 8DBD 17B2 96E1 0C77 555E BB80 E739 2E7E 2D68 6DA1
To claim this, I am signing this object:
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
init-hook="
from pylint_venv import inithook
inithook()"
[default]
include_dirs = /opt/openblas/include
library_dirs = /opt/openblas/lib
[openblas]
libraries = openblas
include_dirs = /opt/openblas/include
library_dirs = /opt/openblas/lib
[lapack]