Skip to content

Instantly share code, notes, and snippets.

Avatar

Gunnar Farnebäck GunnarFarneback

  • ContextVision AB
  • Linköping, Sweden
View GitHub Profile
@GunnarFarneback
GunnarFarneback / Makefile
Created Oct 22, 2016
Embedding Julia with dynamic loading
View Makefile
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 Apr 6, 2016
Multiple break/continue in Julia, proof of concept
View example.jl
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 Jan 4, 2014
Pure Julia implementation of decompression of zlib and gzip compressed data, as specified by RFC 1950-1952.
View Inflate.jl
# 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.
View go_benchmark.c
/* 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 Jun 28, 2012
Symbol collision in Julia
View build.sh
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