This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define DEBUG | |
#ifdef DEBUG | |
unsigned char *mem; | |
int mem_size; | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(sg). | |
-export([start/0, start/1, get_node/0, find_/1, put_/2, get_/1, get_/2]). | |
-define(error(X), (begin io:format("*** ERROR ~p ~p ~p~n", [?MODULE, ?LINE, X]) end)). | |
-define(debug(X), (begin io:format("*** DEBUG ~p ~p ~p~n", [?MODULE, ?LINE, X]) end)). | |
start() -> register(node_loop, spawn(fun() -> node_loop(boot(dummy_node(), 0, 0)) end)). | |
start(Init) -> | |
Pid = rpc:call(Init, sg, get_node, []), | |
register(node_loop, spawn(fun() -> node_loop(Pid) end)). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 *); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(heron). | |
-export([heron/3]). | |
heron(A, B, C) -> | |
S = (A + B + C) / 2, | |
math:sqrt(S * (S - A) * (S - B) * (S - C)). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#define MAX 100000 | |
int main() | |
{ | |
int lis[MAX]; | |
int n = 0; | |
int j = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <time.h> | |
#include <stdio.h> | |
#include <iostream> | |
#include <map> | |
#define LEVEL 128 | |
/* | |
* <Skip List> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.SUFFIXES: .erl .beam .yrl | |
.erl.beam: | |
erlc -W +'{parse_transform, smart_exceptions}' $< | |
.yrl.erl: | |
erlc -W +'{parse_transform, smart_exceptions}' $< | |
ERL = erl |
OlderNewer