Skip to content

Instantly share code, notes, and snippets.

@tux21b
tux21b / disruptor.go
Created September 15, 2011 02:22
Disruptor
// Copyright (C) 2011 by Christoph Hack. All rights reserved.
// Use of this source code is governed by the New BSD License.
/*
This program contains a simple micro-benchmark for a Disruptor [1] like
event buffer (or at least what I think that Disruptor might be). There
isn't any kind of API yet and this test is currently limited to a
single producer - single consumer architecture, but generally the
architecture of Disruptor is also well suited for multiple producers and
consumers.
// Problem:
// The green and red area (and the intersection) receive
// click events (press and release).
// The green area also receives hover events (enter and leave),
// but the red one does not.
package main
import (
"image"
//------------------------------------------------------------------------------
// siren.c
//
// A small example program to demonstrate the handling of binary files.
//
// Compile with:
// gcc -Wall -lm -o siren siren.c
//
// Group: 11 study assistant Christoph Hack
// Authors: Christoph Hack <prog-tutor-hack@iicm.tugraz.at>
package main
import (
"fmt"
"log"
"reflect"
"tux21b.org/v1/gocql"
)
package main
import (
"html/template"
"log"
"net/http"
)
var tmpl = template.Must(template.New("").Parse(`
{{define "index"}}<!DOCTYPE HTML>
def dreitermrek(s, n):
if n == 0:
return 1
r1 = dreitermrek(s, n-1)
a = s(x*r1, r1) / s(r1, r1)
if n == 1:
return x - a
r2 = dreitermrek(s, n-2)
b = s(r1, r1) / s(r2, r2)
return ((x - a) * r1 - b * r2).expand()
// The "atomic.h" file provides low-level atomic memory primitives for the
// x86 plattform. All functions in this file provide sequential memory
// consistency.
// atomic_load atomically loads *addr.
static inline int atomic_load(int *addr)
{
int val = *(volatile const int*)(addr);
__asm__ __volatile__ ("" ::: "memory");
@tux21b
tux21b / weierbot.go
Created September 30, 2012 13:26
Weierbot
package main
import (
"fmt"
irc "github.com/fluffle/goirc/client"
"html/template"
"io/ioutil"
"log"
"net/http"
"net/url"
@tux21b
tux21b / CQL 3
Created August 26, 2012 19:47
LIMIT isn't working as expected...
DROP KEYSPACE gocql_wiki;
CREATE KEYSPACE gocql_wiki
WITH strategy_class = 'SimpleStrategy'
AND strategy_options:replication_factor = 1;
USE gocql_wiki;
CREATE TABLE page (
title varchar,
@tux21b
tux21b / tc08.in
Created June 2, 2012 08:30
Ganz gemeiner TC (Entwurf)
a b c d e f g h
8 . . r . . . . . 8
7 . . . . . . . . 7
6 . . . . . . . . 6
5 . . . k . . . . 5
4 . . . . . . . . 4
3 . . . . . N . r 3
2 . K . . . P . . 2
1 . . . . . . . q 1
a b c d e f g h