This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#upper triangular indices - iterates over upper triangular indices in a list of | |
#indices. | |
type uppertriangular; iterable; end | |
Base.start(x::uppertriangular) = (1, 1) | |
function Base.next(x::uppertriangular, state) | |
(idx1, idx2) = state | |
next1 = idx1 | |
next2 = idx2 + 1 | |
if next2 > length(x.iterable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GeometryTypes, Reactive, GLVisualize | |
using GLPlot;GLPlot.init() | |
""" | |
Lorenz function | |
""" | |
function lorenz(t0, a, b, c, h) | |
Point3f0( | |
t0[1] + h * a * (t0[2] - t0[1]), | |
t0[2] + h * (t0[1] * (b - t0[3]) - t0[2]), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Plots;glvisualize() | |
using GLVisualize, FileIO, Colors, Images | |
using GeometryTypes, GLAbstraction | |
x = ["(。◕‿◕。)", "◔ ⌣ ◔","(づ。◕‿‿◕。)づ", "┬──┬ ノ( ゜-゜ノ)", "(╯°□°)╯︵ ┻━┻", "¯\\_(ツ)_/¯"] | |
y = [-4, -3, -2, -1, 6, 0] | |
scatter(x, y) | |
t = bounce(linspace(-1.0f0,1f0, 20)) | |
translation = map(t) do t | |
rotationmatrix_y(1f0)*rotationmatrix_z(deg2rad(90f0)) * translationmatrix(Vec3f0(3,3,t)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Raspberry Pi ZRAM script | |
# Tuned for quad core, 1 GB RAM models | |
# put me in /etc/init.d/zram.sh and make me executable | |
# then run "sudo update-rc.d zram.sh defaults" | |
modprobe zram | |
echo 3 >/sys/devices/virtual/block/zram0/max_comp_streams | |
echo lz4 >/sys/devices/virtual/block/zram0/comp_algorithm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Julia is fully unicode aware and if you use your variable and function | |
# names just right, you can express your anger like no other language. | |
⋰┛ಠДಠ┛⋱彡┻━┻(n) = n < 2 ? n : ⋰┛ಠДಠ┛⋱彡┻━┻(n - 1) + ⋰┛ಠДಠ┛⋱彡┻━┻(n - 2) | |
@elapsed ⋰┛ಠДಠ┛⋱彡┻━┻(25) # 0.00266 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HOSTS = ASCIIString["hd$(i)" for i = 1:19] | |
const SEPARATOR = "#" ^ 79 | |
separator() = (println(); print_with_color(:cyan, SEPARATOR); println()) | |
function ssh_all(command, commands...; hosts=HOSTS) | |
separator() | |
for host in hosts | |
println() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
push!(LOAD_PATH, pwd()) | |
# Run _init.jl at runtime if it exists | |
if VERSION < v"0.4-" | |
if isinteractive() && isfile("_init.jl") | |
info("Found ", joinpath(pwd(),"_init.jl")) | |
include(joinpath(pwd(),"_init.jl")) | |
end | |
else | |
atreplinit() do repl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Installation: | |
# - Put this in your .bash_profile | |
# - Replace my directory with your exobrain directory on line 10 | |
# | |
# What you get: | |
# A Jupyter notebook open on a well-defined port that is always | |
# on for exobrain-ing your ideas... | |
exec 6<>/dev/tcp/localhost/10000 || ( | |
source activate py27 && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Installation: | |
# - Put this in your .bash_profile | |
# - Replace my directory with your exobrain directory on line 10 | |
# | |
# What you get: | |
# A Jupyter notebook open on a well-defined port that is always | |
# on for exobrain-ing your ideas... | |
exec 6<>/dev/tcp/localhost/10000 || ( | |
source activate py27 && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requested gist of code to produce: | |
# https://www.scribd.com/doc/271871142/Julia-Type-Hierarchy | |
# | |
# I just redirected the output to a dot file, then executed: | |
# dot -Tpdf julia.dot -o julia.pdf | |
function print_type_tree(t, parent=Any, seen=Set{DataType}()) | |
# Avoid redundant edges. | |
t ∈ seen && return | |
push!(seen, t) | |