Skip to content

Instantly share code, notes, and snippets.

@dchiji
dchiji / jit-bf.c
Created May 27, 2009 09:57
JIT Brainfuck
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DEBUG
#ifdef DEBUG
unsigned char *mem;
int mem_size;
#endif
#include <stdarg.h>
void cps(int a, int b, ...)
{
void *p;
void *m;
va_list ap;
va_start(ap, b);
p = va_arg(ap, void *);
-module(euclidean).
-export([euclidean/2]).
euclidean(M, 0) -> M;
euclidean(M, N) when M rem N == 0 -> N;
euclidean(M, N) -> euclidean(N, M rem N).
-module(heron).
-export([heron/3]).
heron(A, B, C) ->
S = (A + B + C) / 2,
math:sqrt(S * (S - A) * (S - B) * (S - C)).
#include <stdio.h>
#include <stdlib.h>
#define MAX 100000
int main()
{
int lis[MAX];
int n = 0;
int j = 0;
// name: curve.cpp
// compile: $ g++ curve.cpp `pkg-config gtkmm-2.4 --cflags --libs`
#include <cairomm/context.h>
#include <gtkmm/drawingarea.h>
#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <gtkmm.h>
#include <iostream>
#include <pthread.h>
#include <stdio.h>
#include <time.h>
void *func(void *param_p)
{
int *p = (int *)param_p;
printf("## start: %u\n", (unsigned int)pthread_self());
for(int i = 0; i < 100000; i++) {
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <iostream>
#include <map>
#define LEVEL 128
/*
* <Skip List>
@dchiji
dchiji / Makefile
Created December 2, 2009 10:58
KVS
.SUFFIXES: .erl .beam .yrl
.erl.beam:
erlc -W +'{parse_transform, smart_exceptions}' $<
.yrl.erl:
erlc -W +'{parse_transform, smart_exceptions}' $<
ERL = erl
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <alloca.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>