Skip to content

Instantly share code, notes, and snippets.

View orbekk's full-sized avatar

Kjetil Ørbekk orbekk

  • NTNU
  • Trondheim, Norway
View GitHub Profile
@orbekk
orbekk / abcde.conf
Created December 4, 2011 17:12
Abcde configuration
LAME=lame
ID3V2=id3v2
LAMEOPTS='--preset standard'
CDROM=/dev/sr0
OUTPUTTYPE=mp3
MAXPROCS=4
LOWDISK=n
@orbekk
orbekk / gist:1298622
Created October 19, 2011 15:24
LaTeX \todo macro.
%% \todo{} command.
%
% Outputs red TODOs in the document. Requires \usepackage{color}.
%
% Usage: \todo{Document the TODO command.}
%
% Comment out second line to disable.
\newcommand{\todo}[1]{}
\renewcommand{\todo}[1]{{\color{red} TODO: {#1}}}
@orbekk
orbekk / build.sh
Created October 13, 2011 12:35
Simple continous build script for XeLaTeX document
#!/bin/bash
declare -r MAIN=main
declare -r SOURCES=main.tex
declare -r OUTPUT_DIR=build
# Options
declare CONTINUOUS
function launch() {
@orbekk
orbekk / gist:1030240
Created June 16, 2011 20:49
C++ ownership
class MyClass {
public:
// Takes ownership.
explicit MyClass(Dependency* dependency) : dependency(dependency) {}
private:
scoped_ptr<Dependency> dependency;
}
@orbekk
orbekk / template_question.cc
Created May 23, 2011 18:11
C++ template question
#include <vector>
using std::vector;
template <typename T>
void f() {
// Why is this illegal?
// vector<T>::iterator it;
// What does typename do here?
@orbekk
orbekk / DataBindingLogic.java
Created May 23, 2011 14:07
DataBindingLogic
public class DataBindingLogic {
private Property<String> input1 = new Property<String>(null);
private Property<String> input2 = new Property<String>(null);
private Property<String> output = new Property<String>(null);
private CalculatorLogic logic = new CalculatorLogic();
private Property<Object> button = new Property<String>(null) {
@Override protected void onChange(Object unused) {
output.set(logic.addStrings(input1.get(), input2.get()));
}
#include "tour.h"
#include <stdio.h>
#define IN_BOUND(x,y) ((x)>=0 && (y)>=0 && (x) < size && (y) < size)
int movesx[] = { -2, -1, 1, 2, 2, 1, -1, -2 };
int movesy[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
int tour_length_f1(int size, int startx, int starty, int *moves) {
int curx = startx;
klatreplante:~% cat .synergy.conf
section: screens
klatreplante:
vannlilje:
end
section: links
klatreplante:
left = vannlilje
vannlilje: