Skip to content

Instantly share code, notes, and snippets.

@pao
pao / iface_test.jl
Created April 20, 2012 23:10
Julia interfaces prototype
load("interface.jl")
type Blah; end
type Bluh; end
@interface FooBar{T} [
(:foo, :(T, Integer,))
(:bar, :(T, String, Integer))
]
@pao
pao / README.md
Last active October 5, 2015 16:07
Using strpack.jl as an FFI

Note

strpack.jl is deprecated. Use the StrPack package or Julia's native C struct interop instead, depending on your needs.

Using strpack.jl as an FFI

This gist demonstrates calling C code which expects a structure pointer by writing and reading a buffer using the functions provided by strpack.jl. This takes advantage of the new align_native alignment strategy, which queries libLLVM for the platform-preferred alignment of the standard bits types.

Build the shared library

@pao
pao / monads.md
Last active July 29, 2019 15:15
Work in progress overkill solution to final 7L7W exercise
@pao
pao / CONTRIBUTING.md
Created September 18, 2012 15:38
Julia CONTRIBUTING file (started by Jeffrey Sarnoff)

Contributing

We welcome contributions to Julia and appreciate your interest. There are capabilities to grow, interfaces to write, and bugs to squish. Area experts may contribute by writing software that supports work in their own field. To keep things percolating as smoothly as possible, we ask that you follow the advice and guidelines given here.

ready, get set

Before contributing to Julia, you should join the dev list, read the user manual and library guide, and create a free GitHub account. Follow these steps to get Julia copied to your machine in a way that lets you to work locally, rewind your edits, keep a remote backup, and safely contribute to Julia.

@pao
pao / ccall_wrapper.jl
Created September 19, 2012 12:46 — forked from dcampbell24/gist:3470851
julia ccall macro
macro ccallWrap(lib, fnSym, retType, argTypes)
args = [gensym() for i in 1:length(argTypes.args)]
fnArgs = [:($(args[i])::$(argTypes[i]))
for i in 1:length(argTypes)]
:(($fnSym)($fnArgs...) = ccall(dlsym($lib, $fnSym), $retType, $argTypes, $args...))
end
@pao
pao / qc.md
Last active October 11, 2015 10:17
An in-development Julia implementation of QuickCheck

Now being developed at https://github.com/pao/QuickCheck.jl and available via Pkg as "QuickCheck".

Package documentation is at https://quickcheckjl.rtfd.org/.

# A Julia implementation of QuickCheck, a randomized specification-based tester
#
# QuickCheck was originally written for Haskell by Koen Claessen and John Hughes
# http://www.cse.chalmers.se/~rjmh/QuickCheck/
@pao
pao / Code-Patterns.md
Created February 11, 2013 19:31
Former contents of Julia wiki page on code patterns.

Code Patterns in Julia

Climbing the type hierarchy

The base library of Julia contains a method which finds the element type of an array. This dispatch is fine for instances of AbstractArray or any of its children.

eltype{T,n}(::AbstractArray{T,n}) = T
@pao
pao / requirements.txt
Created May 27, 2013 18:05
JuliaDoc requirements.txt file.
-e git+https://github.com/JuliaLang/JuliaDoc.git#egg=JuliaDoc
@pao
pao / gist:8072640
Created December 21, 2013 17:58
Sample log output from a DumbBot instance
(dumbirc) PS C:\Users\patrick\dumbirc\src> python ..\Scripts\twistd.py -noy dumbirc.tac
2013-12-21 11:46:39-0600 [-] Log opened.
2013-12-21 11:46:39-0600 [-] twistd 13.2.0 (C:\Users\patrick\dumbirc\Scripts\python.exe 2.7.3) starting up.
2013-12-21 11:46:39-0600 [-] reactor class: twisted.internet.selectreactor.SelectReactor.
2013-12-21 11:46:39-0600 [-] Starting factory <dumbbot.DumbIRCFactory instance at 0x02C8C4E0>
2013-12-21 11:46:39-0600 [-] Starting factory <dumbbot.DumbIRCFactory instance at 0x02D29350>
2013-12-21 11:46:39-0600 [-] Starting factory <dumbbot.DumbIRCFactory instance at 0x02D293A0>
2013-12-21 11:46:39-0600 [Uninitialized] connectionMade
2013-12-21 11:46:39-0600 [Uninitialized] connectionMade
2013-12-21 11:46:39-0600 [DumbBot,client] signed on; joining channel #desertbus
@pao
pao / crash-2014-05-16_22.11.13-server.txt
Created May 17, 2014 04:08
Ag Skies 2.1.5 crash reports
---- Minecraft Crash Report ----
// You're mean.
Time: 5/16/14 10:11 PM
Description: Exception ticking world
java.lang.NoSuchMethodError: exaliquo.bridges.Mariculture.SkyFish.SkyFishDamsel.getRodNeeded()Lmariculture/api/fishery/EnumRodQuality;
at exaliquo.bridges.Mariculture.SkyFish.SkyFishDamsel.canCatch(SkyFishDamsel.java:30)
at mariculture.fishery.LootHandler.getFishForLocation(LootHandler.java:119)
at mariculture.fishery.LootHandler.getLoot(LootHandler.java:91)