Skip to content

Instantly share code, notes, and snippets.

// 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"
#include <iostream>
#include <sstream>
class Rational
{
private:
int a;
int b;
public:
@tux21b
tux21b / frame_test.go
Created July 16, 2014 20:11
stupid allocations...
//+build ignore
package gocql
import (
"fmt"
"io"
"io/ioutil"
"sync"
"testing"
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()
//------------------------------------------------------------------------------
// 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>
// 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,