Skip to content

Instantly share code, notes, and snippets.

View stevengj's full-sized avatar

Steven G. Johnson stevengj

View GitHub Profile
@stevengj
stevengj / gist:0dd4927f019bf504df47
Created May 15, 2014 15:30
allowed unicode identifiers in Julia
I would suggest at least: ⅀∂∇∆∏∐∑∞∟∫∬∭∮∯∰∱∲∳⊾♯⦰⦱⦲⦳⦴⨊⨋⨌⨍⨎⨏⨐⨑⨒⨓⨔⨕⨖⨛⨜𝛁𝛛𝛻𝜕𝜵𝝏𝝯𝞉𝞩𝟃
and probably the various "angle" symbols too: ∠∡∢⦛⦜⦝⦞⦟⦠⦡⦢⦣⦤⦥⦦⦧⦨⦩⦪⦫⦬⦭⦮⦯
(I guess things like √ and ∛ should be unary prefix operators and are handled separately.)
@stevengj
stevengj / loggingterminal.jl
Created July 4, 2014 17:26
LoggingTerminal
import Base.Terminals: TextTerminal, writepos, cmove, getX, getY, reseteof, cmove_up, cmove_down, cmove_left, cmove_right, cmove_line_up, cmove_line_down, cmove_col, hascolor, clear, clear_line, raw!, beep, enable_bracketed_paste, disable_bracketed_paste
import Base: size, flush, write, read, readuntil, start_reading, stop_reading
# wrapper around a TextTerminal that also logs all output to log
type LoggingTerminal <: TextTerminal
t::TextTerminal
log::IO
end
size(t::LoggingTerminal) = size(t.t)
0000..001F; 0
0020..007E; 1
007F..009F; 0
00A0..00AC; 1
00AD; 0
00AE..02FF; 1
0300..036F; 0
0370..0377; 1
0378..0379; 0
037A..037F; 1
@stevengj
stevengj / runtests.jl
Last active August 29, 2015 14:24
draft runtests for IJulia
for (repo,tag) in (("ipython/traitlets","master"), ("ipython/ipython_genutils","master"), ("jupyter/jupyter_core","master"), ("jupyter/jupyter_client","master"), ("jupyter/jupyter_kernel_test","master"))
if !isdir(basename(repo))
run(`git clone https://github.com/$repo`)
end
cd(basename(repo)) do
run(`git checkout $tag`)
end
end
jupyter=joinpath(pwd(), "jupyter")
function cmatshell(m::C.Mat, y::C.Vec, x::C.Vec)
f_ = MatGetContext(m)
f = Function(unsafe_object_ptr(f_)) # get actual Julia function
f(Vec(y), Vec(x))
end
function Mat(f::Function, ...)
m = MatCreate(...)
m.data = f
MatSetContext(f)
@stevengj
stevengj / log.txt
Created September 20, 2016 14:31
failed Travis log for #18599
travis_fold:start:worker_info
Worker information
hostname: worker-jupiter-brain:976bac5b-3f4a-44b7-a940-0ab84177ce2b
version: v2.3.1-52-ga9eb435 https://github.com/travis-ci/worker/tree/a9eb4353f9171a7762f88eeeb57cce31bed8dbb8
instance: 2b324e1f-20ce-4318-8c93-11c1e8347f71:travis-ci-osx10.10-xcode7.0-1458077962
startup: 2m12.241359433s
travis_fold:end:worker_info
travis_fold:start:system_info
Build system information
  • Bullet
  • level 2
  • level 3
@stevengj
stevengj / log.txt
Created December 18, 2016 14:56
appveyor timeout
[00:00:00] Build started
[00:00:00] git config --global core.autocrlf input
[00:00:00] git clone -q --depth=50 https://github.com/JuliaLang/julia.git C:\projects\julia
[00:00:06] git fetch -q origin +refs/pull/17623/merge:
[00:00:08] git checkout -qf FETCH_HEAD
[00:00:10] Restoring build cache
[00:00:10]
[00:00:11] Cache 'x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z' - Downloading (63,558,997 bytes)...1%
[00:00:11] Cache 'x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z' - Downloading (63,558,997 bytes)...10%
[00:00:11] Cache 'x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z' - Downloading (63,558,997 bytes)...20%
@stevengj
stevengj / sobolbench.cpp
Created March 29, 2017 01:07
sobol benchmark code
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include "sobol.hpp"
int main(int argc, char **argv)
{
int ndim = atoi(argv[1]);
int i, N = atoi(argv[2]);
; from libctl/base/utils.scm:
(define (vector-map func . v)
(list->vector (apply map (cons func (map vector->list v)))))
(define (first list) (list-ref list 0))
(define (second list) (list-ref list 1))
(define (third list) (list-ref list 2))
; functions from libctl/base/vector3.scm:
(define (ctl-exact->inexact x)
(if (real? x) (exact->inexact x) x))
(define (vector3->inexact v) (vector-map ctl-exact->inexact v))