Skip to content

Instantly share code, notes, and snippets.

View jgoldfar's full-sized avatar

Max G jgoldfar

View GitHub Profile
-------------------------------------------------------------------
--Hammerspoon config to replace Cinch & Size-up (Microsoft Windows style) window management for free
--By Jayden Pearse (spartanatreyu)
--Sort of messy, forgive me. Never scripted in lua before
-------------------------------------------------------------------
-------------------------------------------------------------------
--Options, feel free to edit these
-------------------------------------------------------------------
doc"""
`gen_code` rejigs the standard julia `@generate` macro so that it creates a `code`
expression variable that can be extended using the `@code` macro. At the end of
the function it automatically outputs the result.
"""
macro gen_code(f)
#make sure this macro precedes a function definition.
isa(f, Expr) || error("gen_code macro must precede a function definition")
(f.head == :function) || error("gen_code macro must precede a function definition")
@jgoldfar
jgoldfar / Dockerfile
Last active August 30, 2015 18:36 — forked from anonymous/Dockerfile
# Minimal Dockerfile for downloading and running
# generic Linux Julia binaries on Ubuntu 14.04
# Or pick any other distribution and adjust the apt-get lines
FROM ubuntu:14.04
MAINTAINER Tony Kelman <tony@kelman.net>
RUN apt-get update && \
apt-get install git curl -y && \
mkdir -p /home/user/julia && \
curl -s -L https://status.julialang.org/stable/linux-x86_64 | \
@jgoldfar
jgoldfar / README.md
Last active August 29, 2015 14:18
Yeppp.jl Test

A bit interested in @ViralBShah's announcement on julia-users about Yeppp.jl and had to take a look at possible performance improvements in a project I am working on. Looks like his assessment is about right, based on the two implemented test functions here.

-------
With log:
elapsed in Yeppp: 2.152373e-02
elapsed in Julia, vectorized: 1.557364e-01. Yeppp speedup: 7.235570e+00
elapsed in Julia, devectorized: 1.428047e-01. Yeppp speedup: 6.634756e+00
-------
-------
@jgoldfar
jgoldfar / LocalExperiment.jl
Created December 4, 2014 23:29
segfault->error
cd(dirname(@__FILE__))
include(joinpath("src", "ISP.jl"))
function doISP()
include("ex3.jl")
ed=ISP.ExData(a,b,c,s,u,ux,ut,sp,γf)
sd=ISP.SolvData(ed,10)
@jgoldfar
jgoldfar / backtrace
Last active August 29, 2015 14:10
Backtrace for ISP-JCode error on 12/2/2014
* thread #1: tid = 0x130f8c, 0x0000000100016874 libjulia-debug.dylib`jl_method_table_assoc_exact(mt=0x00000001040308c0, args=0x00007fff5fbfe590, n=1) + 84 at gf.c:245, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
* frame #0: 0x0000000100016874 libjulia-debug.dylib`jl_method_table_assoc_exact(mt=0x00000001040308c0, args=0x00007fff5fbfe590, n=1) + 84 at gf.c:245
frame #1: 0x0000000100017000 libjulia-debug.dylib`jl_apply_generic(F=0x00000001040c18c0, args=0x00007fff5fbfe590, nargs=1) + 64 at gf.c:1396
frame #2: 0x00000001017913f3
frame #3: 0x0000000101790f88
frame #4: 0x0000000101790e2b
frame #5: 0x0000000100021885 libjulia-debug.dylib`jl_apply(f=0x000000010f849fc0, args=0x00007fff5fbfe978, nargs=3) + 69 at julia.h:980
frame #6: 0x0000000100023a2e libjulia-debug.dylib`jl_trampoline(F=0x000000010f849fc0, args=0x00007fff5fbfe978, nargs=3) + 558 at builtins.c:781
frame #7: 0x0000000100015195 libjulia-debug.dylib`jl_apply(f=0x000000010f849fc0, args
@jgoldfar
jgoldfar / gist:8889183
Last active August 29, 2015 13:56
Simple plot for flux limiters in MATLAB.
% Define sample points
thetav=linspace(0,3,200);
% Function defining upper bound of TVD region
tvdregion_ub=@(theta)min(2*theta, 2*ones(size(theta)));
% Function defining lower bound of TVD region
tvdregion_lb=@(theta)zeros(size(theta));
% Put your flux limiter as a function of theta here...
psi=@(theta)...;