Skip to content

Instantly share code, notes, and snippets.

import multiprocessing
def functionality(arg1):
import sys
print("arg1: " + str(arg1))
print("sys.executable: " + str(sys.executable))
print("-----\n")
return sys.executable
def worker(queue, arg1):
@goretkin
goretkin / hex.svg
Created May 13, 2021 01:45
matplotlib polycollection svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@goretkin
goretkin / robot.jl
Last active May 12, 2021 17:02
swept volume computation for GridVAMP
using LazySets: UnionSetArray, LineSegment, BallInf
using ReachabilityAnalysis
using Colors: @colorant_str
import LinearAlgebra
using CartesianIndexSets: CartesianIndexSet
import PlotUtils
using PlotUtils: RGBA
using RecipesBase
# https://github.com/JuliaReach/ReachabilityAnalysis.jl/issues/464
@goretkin
goretkin / atom-boot-repl.jl
Last active April 16, 2021 01:11
atom-boot-repl.jl
# from https://raw.githubusercontent.com/JunoLab/atom-julia-client/a61023683d0a926d3496d1396c667c064e27bdd4/script/boot_repl.jl
using Pkg
let
# NOTE: No single quotes. File needs to be shorter than 2000 chars.
#=
if VERSION > v"0.7-"
port = parse(Int, popfirst!(Base.ARGS))
else

sentence-per-line, no em-dash spaces:

The food—which was delicious—reminded me of home. The food, which was delicious, reminded me of home.

clause-per-line, inconsistent em-dash spaces:

The food —which was delicious—

@goretkin
goretkin / laz.jl
Created June 16, 2020 03:49
lazy map field access
using Test
using BenchmarkTools
using DataStructures: OrderedDict
using MappedArrays: mappedarray
# use the iterator interface
function foo(a)
r = nothing
for x in a
@goretkin
goretkin / curry.jl
Last active June 7, 2020 17:38
Julia `Bind`, defer evaluation for some symbolic reasoning
# See https://github.com/JuliaLang/julia/pull/36180
using Base: tail
interleave(bind::Tuple{}, args::Tuple{}) = ()
interleave(bind::Tuple{}, args::Tuple) = error("more args than positions")
interleave(bind, args) = _interleave(first(bind), tail(bind), args)
# `nothing` indicates a position to be bound
_interleave(firstbind::Nothing, tailbind::Tuple, args::Tuple) = (
first(args), interleave(tailbind, tail(args))...)
@goretkin
goretkin / short-circuit-trivalent.jl
Last active April 23, 2020 00:48
short circuit trivalent logic
import PrettyTables
macro and(p, q)
quote
vp = $(esc(p))
if !ismissing(vp)
if vp
$(esc(q))
else
false
using LinearAlgebra: norm
using Zygote
using Plots
A = rand(2,2)
b = rand(2)
A = [0.511125 0.493421; 0.987115 0.260349]
b = [0.205398, 0.282329]
using LinearAlgebra
using PyPlot
using GeometryTypes
using EnhancedGJK
using Setfield # https://github.com/jw3126/Setfield.jl
import Polyhedra
import CoordinateTransformations