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 REPL | |
using REPL.LineEdit | |
macro keyboard() | |
quote | |
debugprompt(@__MODULE__, Base.@locals) | |
println() | |
end | |
end |
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> 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)) |
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
# put this in your startup.jl | |
using InteractiveUtils | |
let | |
tmuxsession = nothing | |
sessions = split(String(read(`tmux list-panes -a -F '#{pane_tty} #{session_name}'`)), '\n') | |
io = IOBuffer() | |
run(pipeline(`tty`, stdout=io)) | |
tty = chomp(String(take!(io))) | |
for session in sessions | |
if occursin(tty, session) |
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
# Juno | |
# http://junolab.org/ | |
# http://docs.junolab.org/latest/man/installation.html | |
## Inline Evaluation | |
1+1 | |
println(2+2) | |
rand(3) |
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
module TraceCalls | |
using Cassette | |
mutable struct Trace | |
level::Int | |
cutoff::Int | |
end | |
Cassette.@context TraceCtx |
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
# 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) |
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
[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" |
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
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' |
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
[[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+" |
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 REPL | |
using REPL.LineEdit | |
# basically the same as Base's `display_error`, just with different frames removed | |
function display_error(io, err, st) | |
ind = findfirst(frame -> frame.file == Symbol(@__FILE__) && frame.func == :repleval, st) | |
st = st[1:(ind == nothing ? end : ind - 2)] | |
printstyled(io, "ERROR: "; bold=true, color=Base.error_color()) | |
showerror(IOContext(io, :limit => true), err, st) | |
println(io) | |
end |