Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
😷 🌍 Programmer 📱 🍏 🐫. Fostering the indieweb.org/POSSE.

Marcus Rohrmoser mro

💭
😷 🌍 Programmer 📱 🍏 🐫. Fostering the indieweb.org/POSSE.
View GitHub Profile
@mro
mro / RedlandStorage.cc
Last active Oct 30, 2015 — forked from rtravis/build_instructions.txt
replicate cleanup issue
View RedlandStorage.cc
// Based on https://gist.github.com/rtravis/d5a6b1b15972a8ce6d87
//
// Compile:
// $ gcc -std=c99 -D DEBUG=1 -I /usr/include/raptor2 -I /usr/include/rasqal -c -o rdf_storage_sqlite_mro.o ../rdf_storage_sqlite_mro.c
// $ g++ -std=c++0x -I/usr/include/raptor2 -I/usr/include/rasqal -O0 -g3 -Wall -c -fmessage-length=0 -o RedlandStorage.o RedlandStorage.cc
//
// Link:
// $ g++ -o RedlandStorage RedlandStorage.o rdf_storage_sqlite_mro.o -lsqlite3 -lrdf
//
// Run:
@mro
mro / loader.c
Last active Oct 26, 2015 — forked from abargnesi/loader.c
Load an RDF file into a SQLite database without journaling.
View loader.c
// see https://github.com/mro/librdf.sqlite/issues/10#issuecomment-151000843
//
// Perpare (on debian wheezy):
// $ git clone https://github.com/mro/librdf.sqlite.git
// $ cd librdf.sqlite/demo
// $ sudo apt-get install gcc librdf0-dev librdf-storage-sqlite raptor2-utils
// $ rapper --output turtle --input rdfxml http://tatort.rdf.mro.name/episodes.rdf > loader.ttl
// rapper: Parsing URI http://tatort.rdf.mro.name/episodes.rdf with parser rdfxml
// rapper: Serializing with serializer turtle
// rapper: Parsing returned 100430 triples
@mro
mro / fft.rb
Created Apr 4, 2011
Discrete Fast Fourier Transform from 'Meyberg, Vachenauer: Hoehere Mathematik II, Springer Berlin, 1991, page 332'
View fft.rb
#!/usr/bin/env ruby
require 'complex'
class Array
# DFT and inverse.
#
# Algorithm from
# 'Meyberg, Vachenauer: Hoehere Mathematik II, Springer Berlin, 1991, page 332'
#
# See http://blog.mro.name/2011/04/simple-ruby-fast-fourier-transform/
@mro
mro / port-deps2dot.rb
Created Jan 25, 2011
turn MacPorts dependencies into dot file for graphviz
View port-deps2dot.rb
#!/usr/bin/ruby -w
# visualize macports dependencies: http://blog.mro.name/2010/08/visualise-macports-dependencies/
# pipe the result through graphviz, e.g.
# $ ./port-deps2dot.rb | dot -Tpdf -o port-deps.pdf ; open port-deps.pdf
def scan_deps
pat = /^([^:]+):(.+)$/
name = ''
deps = []
View RagelParser.h
//
// RagelParser.h
//
// Created by Marcus Rohrmoser on 24.06.10.
// Copyright 2010 Marcus Rohrmoser mobile Software. All rights reserved.
//
#define RAGEL_ERROR_DOMAIN @"_RAGEL_ERROR_DOMAIN_"
#define RAGEL_ERROR_CODE 110
View Makefile
# ##############################################################
# ragel stuff. http://www.complang.org/ragel/
DOT ?= dot
RAGEL ?= ragel
RAGEL_SOURCES := $(wildcard ./ragel/*.rl)
./Generated/%.m : ./ragel/%.rl
$(RAGEL) -e -s -G2 -C -o $@ $<
./Generated/%.dot : ./ragel/%.rl
View UILabelWithCGFont.h
//
// UILabelWithCGFont.h
//
// Created by Marcus Rohrmoser on 26.08.10.
// Copyright 2010 Marcus Rohrmoser mobile Software. All rights reserved.
//
/** <a href="http://www.devx.com/tips/Tip/13829">Function pointer</a> for unicode -> glyph conversion.
*
* Example implementation:
View programm.rb
#
# Bayern2 Programmseite abgrasen
#
require 'time'
# sudo gem install scrapi
#
# http://exceptionz.wordpress.com/2009/11/03/scrapi-on-snow-leopard/
require 'scrapi'
require 'cgi'
require 'sqlite3'
View filmfest.flatv1.rnc
default namespace = "http://filmfestapp.com/schema/festival/v1"
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
start =
## Flat Xml Schema for http://filmfestapp.com festival catalogues.
##
## This is a http://relaxng.org/ compact schema, to convert to RelaxNG regular or w3c-xsd use
## http://www.thaiopensource.com/relaxng/trang.html
##
@mro
mro / BinarySearchTC.m
Created Jan 12, 2010
Binary search Cocoa NSArray
View BinarySearchTC.m
//
// BinarySearchTC.m
//
// Created by Marcus Rohrmoser on 12.01.10.
// Copyright 2009 Marcus Rohrmoser mobile Software. All rights reserved.
//
#define USE_APPLICATION_UNIT_TEST 0
#import <SenTestingKit/SenTestingKit.h>