Skip to content

Instantly share code, notes, and snippets.

View ericphanson's full-sized avatar

Eric Hanson ericphanson

View GitHub Profile
@ericphanson
ericphanson / exp.jl
Last active August 28, 2021 01:06
Naive Julia port of rlibm32's exp implementation
# https://github.com/rutgers-apl/rlibm-32/blob/44560acbd2ee22242989bdac259ad3665fa85d06/source/float/exp.c
include("constants.jl")
function rlibm_exp_ported(x::Float32)
# u is fx.x in the original code
u = reinterpret(UInt32, x)
# Take care of special cases
if (0x42b17218 <= u <= 0xb3000000)
@ericphanson
ericphanson / Cancel.yml
Created October 17, 2021 14:05
GitHub actions workflow for cancelling CI when a newer commit is pushed
name: Cancel
on:
push:
branches:
- main
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
cancel:
@ericphanson
ericphanson / examples.txt
Created January 20, 2022 03:10
Julia script to run processes with 2 second timeout
❯ ./timeout.jl ps
PID TTY TIME CMD
697 ttys000 0:00.16 -zsh
1132 ttys001 0:00.09 /bin/zsh --login
3115 ttys002 0:00.09 /bin/zsh -l
3632 ttys003 0:00.32 /bin/zsh -l
11816 ttys003 0:00.32 /Users/eph/.asdf/installs/julia/1.7.1/bin/julia --color=yes --startup-file=no -O0 --compile=min ./timeout.jl ps
❯ ./timeout.jl sleep 3 && echo "done"
@ericphanson
ericphanson / Basic IPC with named pipes: REPL
Last active October 13, 2023 09:38
Basic IPC with named pipes
julia> include("consumer.jl");
Python started
Python done
Julia done: got hello world
@ericphanson
ericphanson / Arrow IPC with named pipe: REPL
Last active October 13, 2023 21:20
Arrow IPC with named pipe
julia> include("consumer.jl");
Julia done: got Arrow.Table with 4 rows, 3 columns, and schema:
:f0 Union{Missing, Int64}
:f1 Union{Missing, String}
:f2 Union{Missing, Bool}