Skip to content

Instantly share code, notes, and snippets.

View jakebolewski's full-sized avatar
🌨️
⛷️

Jake Bolewski jakebolewski

🌨️
⛷️
View GitHub Profile
@andreasnoack
andreasnoack / gist:9f3f63d7f1d00a07359b
Created October 21, 2014 14:54
A new RNG for Julia
module XORShift
import Base.rand
type XORShiftStar1024 <: AbstractRNG
p::Int
state::Vector{Uint64}
end
XORShiftStar() = XORShiftStar1024(1, rand(Uint64, 16))
~/Documents/no-backup/julia/base$ lldb -- ../usr/bin/julia-debug --build x sysimg.jl
Current executable set to '../usr/bin/julia-debug' (x86_64).
(lldb) break set -n jl_throw
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb) r
Process 10078 launched: '../usr/bin/julia-debug' (x86_64)
1 location added to breakpoint 1
exports.jl
base.jl
require 'rugged'
repo = Rugged::Repository.init_at('./test-repo')
index = repo.index
base_commit_options = {
author: { name: "Matt", email: "matt@test.com" },
committer: { name: "Matt", email: "matt@test.com" },
update_ref: 'HEAD'
@MikeInnes
MikeInnes / startup.jl
Last active February 5, 2023 12:54
Some useful macros for Julia
# Repeat an operation n times, e.g.
# @dotimes 100 println("hi")
macro dotimes(n, body)
quote
for i = 1:$(esc(n))
$(esc(body))
end
end
end
@anthgur
anthgur / git2types.jl
Last active December 28, 2015 22:29
A quick test I created to interact with libgit2.
type GitAtomic
val::Clong
function GitAtomic()
new(zero(Clong))
end
end
type GitRefcount
refcount_val::Clong
owner::Ptr{Void}
@albop
albop / gist:7525675
Created November 18, 2013 10:26
zero_based_indexing
rewrite(x::Number) = x
rewrite(x::Symbol) = x
rewrite(x::String) = x
function rewrite(expr)
if expr.head == :ref
return Expr(expr.head, expr.args[1], [rewrite(:( 1 + $i)) for i in expr.args[2:end]]...)
else
return Expr(expr.head, [rewrite(i) for i in expr.args]...)
end
@sbos
sbos / HMM.jl
Created November 1, 2013 11:25
Hidden Markov Model in Julia
module HMM
using Distributions
import Distributions.rand
import Distributions.fit
immutable HiddenMarkovModel{TP, K}
theta::Vector{TP}
A::Matrix{Float64}
@houshuang
houshuang / gist:6748566
Created September 29, 2013 01:45
Automatically open function in Sublime Text (first Julia macro)
macro whichs(ex)
ex = expand(ex)
exret = Expr(:call, :error, "expression is not a function call")
if !isa(ex, Expr)
# do nothing -> error
elseif ex.head == :call
exret = Expr(:call, :whichs, map(esc, ex.args)...)
elseif ex.head == :body
a1 = ex.args[1]
if isa(a1, Expr) && a1.head == :call
@staticfloat
staticfloat / debugging.md
Last active February 24, 2017 03:11
Julia Debugging Procedures

Julia Debugging Procedures

So you managed to break Julia. Congratulations! Collected here are some general procedures you can undergo for common symptoms encountered when something goes awry. Including the information from these debugging steps can greatly help the maintainers when tracking down a segfault or trying to figure out why your script is running slower than expected.

If you've been directed to this page, find the symptom that best matches what you're experiencing and follow the instructions to generate the debugging information requested. Table of symptoms:

@simgt
simgt / host_device_transfer_bug.cpp
Last active December 18, 2015 16:39
Host-buffers to device transfer and mapping failure with an AMD GCN device
#include <CL/cl.h>
#include <iostream>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#define STRINGIFY(s) #s