Skip to content

Instantly share code, notes, and snippets.

@goldfita
goldfita / WSL Containers.md
Last active October 14, 2024 00:27
Custom containers for development using Linux namespaces

WSL Containers

A script for creating multiple development environments in a single WSL instance.

./dev-container.sh 1 up

Script variables

  • user - User to run the container.
@goldfita
goldfita / makeglobal.jl
Created December 20, 2017 22:24
Make variables in local scope global
macro maketoplevel(ex)
gather_vars(ex) = Vector{Expr}()
gather_vars(ex::Symbol) = isdefined(ex)? Vector{Expr}(): [:(global $ex)]
function gather_vars(ex::Expr)
if !(ex.head in (:line,:block))
unique(Iterators.flatten(map(gather_vars,ex.args)))
else
Vector{Expr}()
end
end
@goldfita
goldfita / partest.jl
Created February 3, 2017 02:14
Parallel Julia Loop with Single Protected Resource
using PyPlot
addprocs(Sys.CPU_CORES÷2)
@everywhere using DistributedArrays
function partest()
println("There are $(nworkers()) workers")
# Inspired by this question on stackoverflow (poster Thomas)