Skip to content

Instantly share code, notes, and snippets.

@ihnorton
Last active December 15, 2015 12:29
Show Gist options
  • Save ihnorton/5260913 to your computer and use it in GitHub Desktop.
Save ihnorton/5260913 to your computer and use it in GitHub Desktop.
Bits of useful Julia code
# find, chomp, split, and return a list of matching files
[splitdir(splitext(chomp(x))[1])[2] for x in readlines(`sh -c "ls /usr/lib/libvtk*.so"`)]
julia> macro m1()
quote
function $(esc(:f1))(a1, a2)
ccall( fptr, thiscall, Void, (Ptr{Void},Ptr{Void}), a1, a2)
end
end
end
julia> macro m2()
rett = :Void
argt = :(Ptr{Void}, Ptr{Void})
args = (:a1, :a2)
quote
function $(esc(:f2))(a1, a2)
ccall( fptr, thiscall, $(rett), $argt, $(args...))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment