Skip to content

Instantly share code, notes, and snippets.

View GunnarFarneback's full-sized avatar

Gunnar Farnebäck GunnarFarneback

  • ContextVision AB
  • Linköping, Sweden
View GitHub Profile
@GunnarFarneback
GunnarFarneback / Makefile
Created October 22, 2016 16:39
Embedding Julia with dynamic loading
test_static_loading: test_static_loading.c
gcc -Wall test_static_loading.c -ljulia -I ../src -I ../src/support -I../usr/include -L../usr/lib -Wl,-rpath,../usr/lib -o test_static_loading -DJULIA_ENABLE_THREADING=1 -fPIC
test_dynamic_loading: test_dynamic_loading.c
gcc -Wall test_dynamic_loading.c -ldl -I ../src -I ../src/support -I../usr/include -o test_dynamic_loading -DJULIA_ENABLE_THREADING=1 -fPIC
@GunnarFarneback
GunnarFarneback / example.jl
Created April 6, 2016 18:32
Multiple break/continue in Julia, proof of concept
include("multibreak.jl")
println("standard Julia")
for i = 1:5
for j = 1:3
if i == 1 && j == 1
continue
elseif i == 2 && j == 2
break
elseif i == 3 && j == 2
@GunnarFarneback
GunnarFarneback / Inflate.jl
Created January 4, 2014 11:41
Pure Julia implementation of decompression of zlib and gzip compressed data, as specified by RFC 1950-1952.
# Pure Julia implementation of decompression of zlib and gzip
# compressed data, as specified by RFC 1950-1952.
module Inflate
export decompress, gunzip
# Huffman codes are internally represented by Vector{Vector{Int}},
# where code[k] are a vector of the values with code words of length
# k. Codes are assigned in order from shorter to longer codes and in
# the order listed. E.g.
/* Benchmark implementing the board logic for the game of go and
* exercising it by playing random games. Derived from
* http://www.lysator.liu.se/~gunnar/gtp/brown-1.0.tar.gz
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_BOARD 23
@GunnarFarneback
GunnarFarneback / build.sh
Created June 28, 2012 19:40
Symbol collision in Julia
gcc -Wall -fPIC -O3 -c test_move.c
gcc -shared -Wl,-soname,libtest_move.so -o libtest_move.so test_move.o
gcc -o test_move test_move.c