Skip to content

Instantly share code, notes, and snippets.

View klmr's full-sized avatar
📦
Making your R code easier to reuse

Konrad Rudolph klmr

📦
Making your R code easier to reuse
View GitHub Profile
@klmr
klmr / preg_helper.php
Created December 7, 2008 21:36
Function to merge several regular expressions into one single expression.
<?php
/**
* Copyright 2008-2009 Konrad Rudolph
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@klmr
klmr / texit
Created July 28, 2010 18:33
Continuous build file for LaTeX
#!/bin/bash
# Author: Konrad Rudolph
# Original idea: Paul Biggar
#
# Usage: texit [--latex] target
#
# --latex: Use pdflatex instead of xelatex as the processor. Optional
# target: The name of the target (i.e. the source file without trailing `.tex`)
@klmr
klmr / thesis.log
Created January 28, 2011 11:24
Log file for an issue with unicode-math 2011/01/25
This is XeTeX, Version 3.1415926-2.2-0.9997.4 (TeX Live 2010) (format=xelatex 2010.11.13) 28 JAN 2011 12:18
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**thesis.tex
(./thesis.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2009-06-19, ngerman-x-2009-06-19, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
@klmr
klmr / enum.hpp
Created May 9, 2011 20:39
Smart, strongly-typed enums in C++
#include <iosfwd>
#include <string>
#include <vector>
#include <boost/preprocessor.hpp>
template <typename T>
T atomic_inc(volatile T& value) {
#pragma omp atomic
value += 1;
@klmr
klmr / nopod.cpp
Created May 9, 2011 21:07
Global non-POD in C++
#include <iostream>
struct nopod {
int x;
nopod() : x(42) { }
};
nopod foo;
int main() {
@klmr
klmr / List.cs
Created May 31, 2011 16:15
LazyList in C#
using System;
namespace LazyList {
public sealed class Fit : Exception {
public Fit(string message) : base(message) { }
}
public static class List {
public static Nil<T> Nil<T>() {
return List<T>.Nil();
@klmr
klmr / gist:1164541
Created August 23, 2011 07:15
Properly indented Dinkumware STL code
else if (_DEBUG_LT_PRED(this->comp,
_Key(_Where._Mynode()), this->_Kfn(_Val))
&& (++(_Next = _Where) == end()
|| _DEBUG_LT_PRED(this->comp,
this->_Kfn(_Val), _Key(_Next._Mynode()))))
{ // insert after _Where
...
}
@klmr
klmr / Example.java
Created October 11, 2011 20:48
JComboBox with custom label
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.ListDataListener;
import javax.swing.plaf.basic.BasicComboBoxEditor;
public class Example extends JPanel {
static class ActiveComboItem {
private final Object item;
@klmr
klmr / features.md
Created February 24, 2012 11:35
Feature list for a notebook app

Feature list for a “Notebook” app

Attention Work in progress!

Rationale

Existing notebook apps (such as [Evernote][]) have diverse shortcomings. A note-taking application is probably open all the time so it shouldn’t get in the way, should be lightweight, encourage and make it easy to take (and later look up!) notes. This implies great searchability.

Furthermore, notes are taken in various ways. The application should facilitate that by supporting rich documents with as many formats as possible (HTML5 as document format?)

@klmr
klmr / gist:2001569
Created March 8, 2012 15:42
How to install Python with matplotlib on OS X

How to install Python with matplotlib on OS X

The following instructions are based on a blog post with some tweaks to install the patched pip packages in the default path rather than leaving them in a local source folder.

The following set of instructions is provided with some annotations. However, the code in each step can (and should!) just be pasted into the terminal window (except for the first part, which belongs in .bashrc).

Successfully tested with

  • Python 2.7.2
  • NumPy 1.6.1