Skip to content

Instantly share code, notes, and snippets.

View mkborregaard's full-sized avatar

Michael Krabbe Borregaard mkborregaard

View GitHub Profile
@mkborregaard
mkborregaard / TraceCalls2.jl
Last active March 1, 2022 12:29
Create call trace graphs for julia calls. Based mostly on code and input by Tim Holy (https://github.com/cstjean/TraceCalls.jl/issues/61)
module TraceCalls2
using JuliaInterpreter, OrderedCollections, LightGraphs
const callchains = OrderedSet{Vector{Method}}()
const modules = Set{Module}()
function callchain(frame::JuliaInterpreter.Frame)
chain = Method[]
sc = JuliaInterpreter.scopeof(frame)
while sc isa Method
@mkborregaard
mkborregaard / Attendants.txt
Last active February 27, 2020 18:32
Attendants for VizCon 2, Berlin 12-16 March
Name Github
Kristoffer Carlsson kristofferc
Thibaut Lienart tlienart
Anshul Singvi asinghvi
Sebastian MC SebastianM-C
Pietro Vertechi piever
Logan Kilpatrick logankilpatrick
Chris Foster c42f
Daniel Schwabeneder daschw
Sebastian Pfitzer pfitzseb
library(raster)
#1 open a raster file as memory-mapped on-disk object
bio1 <- raster("bio1.bil") # the 1st bioclimatic variable from the Chelsa dataset
#2 get the projection
proj4string(bio1)
#3 plot it
plot(bio1)
module GGThemr
using AbstractPlotting, Colors
function ggthemr_style()
Theme(
linewidth = 3,
axis = Theme(
frame = Theme(
linewidth = 5,
frames = ((true, false), (true, false))
@mkborregaard
mkborregaard / TraceGraph.jl
Created September 11, 2017 19:31
Trace trees
module TraceGraphs
import TraceCalls: Trace
import PlotRecipes: GraphPlot
using RecipesBase
type MyGraph
source::AbstractVector{Int}
destiny::AbstractVector{Int}
end
@mkborregaard
mkborregaard / Color2ANSI.jl
Last active April 27, 2017 08:55
find the nearest terminal color
module Color2ANSI
import Colors: colordiff, Colorant
export color2ansi
# the first 16 are ["#000000", "#800000", "#008000", "#808000", "#000080", "#800080", "#008080", "#c0c0c0", "#808080", "#ff0000", "#00ff00", "#ffff00", "#0000ff", "#ff00ff", "#00ffff", "#ffffff"], ignored here as they are duplicated below
hexcodes = parse.([Colorant], ["#000000", "#00005f", "#000087", "#0000af", "#0000d7", "#0000ff", "#005f00", "#005f5f", "#005f87", "#005faf", "#005fd7", "#005fff", "#008700", "#00875f", "#008787", "#0087af", "#0087d7", "#0087ff", "#00af00", "#00af5f", "#00af87", "#00afaf", "#00afd7", "#00afff", "#00d700", "#00d75f", "#00d787", "#00d7af", "#00d7d7", "#00d7ff", "#00ff00", "#00ff5f", "#00ff87", "#00ffaf", "#00ffd7", "#00ffff", "#5f0000", "#5f005f", "#5f0087", "#5f00af", "#5f00d7", "#5f00ff", "#5f5f00", "#5f5f5f", "#5f5f87", "#5f5faf", "#5f5fd7", "#5f5fff", "#5f8700", "#5f875f", "#5f8787", "#5f87af", "#5f87d7", "#5f87ff", "#5faf00", "#5faf5f", "#5faf87", "#5fafaf", "#5fafd7", "#5fafff", "#5fd700", "#5fd75f",
@mkborregaard
mkborregaard / DepsPlot.jl
Created March 2, 2017 20:49
A Plots recipe for the dependency structure of julia packages
type MyGraph
source::AbstractVector{Int}
destiny::AbstractVector{Int}
end
type DepsGraph
g::MyGraph
d::Int
names::Vector{String}
end