Skip to content

Instantly share code, notes, and snippets.

@pfitzseb
pfitzseb / keyboardmacro.jl
Created June 16, 2019 07:46
keyboard macro prototype
using REPL
using REPL.LineEdit
macro keyboard()
quote
debugprompt(@__MODULE__, Base.@locals)
println()
end
end
PackageCompiler on  pathfix [?]
λ j1 juliac.jl -vasji `pwd`/hello.jl
Julia program file:
"/home/pfitzseb/.julia/dev/PackageCompiler/hello.jl"
Build directory:
"/home/pfitzseb/.julia/dev/PackageCompiler/builddir"
Build static library "hello.a":
atexit_hook_copy = copy(Base.atexit_hooks) # make backup
# clean state so that any package we use can carelessly call atexit
MbedTLS on  jq/1.2
λ rm -rf ./deps/usr
MbedTLS on  jq/1.2
λ julia -e 'using Pkg; Pkg.build("MbedTLS")'
Building MbedTLS → `~/.julia/dev/MbedTLS/deps/build.log`
Resolving package versions...
MbedTLS on  jq/1.2
λ ls -l ./deps/usr/lib
julia> using Revise, JuliaInterpreter, CodeTracking
julia> bps=breakpoint(min);
^[[B
julia> bps[1].framecode.scope
min(x::BigFloat, y::BigFloat) in Base.MPFR at mpfr.jl:693
julia> whereis(bps[1].framecode.scope)
[ Info: tracking Base
┌ Warning: error evaluating in module Base.MPFR: for (fJ, fC) = ((:si, :Clong), (:ui, :Culong))
@pfitzseb
pfitzseb / init.vim
Last active March 7, 2019 11:06
LanguageServer setup
call plug#begin('~/.config/nvim/plugged')
Plug 'JuliaEditorSupport/julia-vim'
Plug 'autozimu/LanguageClient-neovim', {'branch': 'next', 'do': 'bash install.sh'}
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
call plug#end()
let g:deoplete#enable_at_startup = 1
" julia
let g:default_julia_version = '1.0'
@pfitzseb
pfitzseb / juno_demo.jl
Created February 12, 2019 19:32
Juno Demo
# Juno
# http://junolab.org/
# http://docs.junolab.org/latest/man/installation.html
## Inline Evaluation
1+1
println(2+2)
rand(3)
@pfitzseb
pfitzseb / sleep_ns.jl
Created December 5, 2018 20:49
sleep ns julialang
# adapted from https://github.com/ArchieCall/AccurateSleep/blob/master/src/hybrid_sleep.jl
function sleep_ns(sleep_time::Float64, threshold::Float64 = 0.001)
tics_per_sec = 1_000_000_000.0
nano1 = time_ns()
nano2 = nano1 + (sleep_time * tics_per_sec)
min_true_sleep = 0.001
# normal sleep
if sleep_time > threshold
actual_sleep_time = max(min_true_sleep, sleep_time - threshold)
@pfitzseb
pfitzseb / Project.toml
Created November 9, 2018 10:06
LanguageServer setup
[deps]
CSTParser = "00ebfdb7-1f24-5e51-bd34-a7502290713f"
DocumentFormat = "ffa9a821-9c82-50df-894e-fbcef3ed31cd"
LanguageServer = "2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7"
StaticLint = "b3cc710f-9c33-5bdb-a03d-a94903873e97"
SymbolServer = "4cc854a7-cf14-540f-aa0e-47853c5fab2f"
@pfitzseb
pfitzseb / Manitfest.toml
Created November 9, 2018 09:31
LanguageServer setup
[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[CSTParser]]
deps = ["LibGit2", "Test", "Tokenize"]
git-tree-sha1 = "fac55d11171228b7101948abde613e769b9277d6"
repo-rev = "master"
repo-url = "https://github.com/ZacLN/CSTParser.jl.git"
uuid = "00ebfdb7-1f24-5e51-bd34-a7502290713f"
version = "0.5.0+"
julia> tryprint.(f[1].kwargs[:oldexprs])
call
Base.Docs.doc!
Libdl
call
Base.Docs.Binding
Libdl
:RTLD_NODELETE
call