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> resp = HTTP.get("https://googles.com") | |
ERROR: HTTP.Exceptions.ConnectError("https://googles.com", DNSError: googles.com, unknown node or service (EAI_NONAME)) | |
Stacktrace: | |
[1] (::HTTP.ConnectionRequest.var"#1#4"{HTTP.ConnectionRequest.var"#1#2#5"{HTTP.TimeoutRequest.var"#1#4"{HTTP.TimeoutRequest.var"#1#2#5"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}})(req::HTTP.Messages.Request; proxy::Nothing, socket_type::Type, kw::Base.Pairs{Symbol, Union{Nothing, Integer}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Bool, Int64}}}) | |
@ HTTP.ConnectionRequest ~/.julia/dev/HTTP/src/clientlayers/ConnectionRequest.jl:78 | |
[2] (::HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#4"{HTTP.ConnectionRequest.var"#1#2#5"{HTTP.TimeoutRequest.var"#1#4"{HTTP.TimeoutRequest.var"#1#2#5"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(H |
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
function generate(json) | |
x = JSON3.read(json) | |
structs = [] | |
generate!(structs, x) | |
return generatejulia(structs) | |
end | |
struct Struct | |
name::String |
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
long double powers[] = {1.0e0L, 1.0e1L, 1.0e2L, 1.0e3L, 1.0e4L, 1.0e5L, 1.0e6L, 1.0e7L, | |
1.0e8L, 1.0e9L, 1.0e10L, 1.0e11L, 1.0e12L, 1.0e13L, 1.0e14L, 1.0e15L, | |
1.0e16L, 1.0e17L, 1.0e18L, 1.0e19L, 1.0e20L, 1.0e21L, 1.0e22L, 1.0e23L, | |
1.0e24L, 1.0e25L, 1.0e26L, 1.0e27L, 1.0e28L, 1.0e29L, 1.0e30L, 1.0e31L, | |
1.0e32L, 1.0e33L, 1.0e34L, 1.0e35L, 1.0e36L, 1.0e37L, 1.0e38L, 1.0e39L, | |
1.0e40L, 1.0e41L, 1.0e42L, 1.0e43L, 1.0e44L, 1.0e45L, 1.0e46L, 1.0e47L, | |
1.0e48L, 1.0e49L, 1.0e50L, 1.0e51L, 1.0e52L, 1.0e53L, 1.0e54L, 1.0e55L, | |
1.0e56L, 1.0e57L, 1.0e58L, 1.0e59L, 1.0e60L, 1.0e61L, 1.0e62L, 1.0e63L, | |
1.0e64L, 1.0e65L, 1.0e66L, 1.0e67L, 1.0e68L, 1.0e69L, 1.0e70L, 1.0e71L, | |
1.0e72L, 1.0e73L, 1.0e74L, 1.0e75L, 1.0e76L, 1.0e77L, 1.0e78L, 1.0e79L, |
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
] add CSV#jq/lazystrings | |
using CSV | |
source = joinpath(dirname(pathof(CSV)), "../randoms.csv") | |
header = 1 | |
normalizenames = false | |
datarow = -1 | |
skipto = nothing | |
footerskip = 0 | |
limit = typemax(Int64) | |
transpose = false |
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 ScopedEnums | |
using StructTypes | |
export @scopedenum | |
macro scopedenum(T, args...) | |
blk = esc(:( | |
module $(Symbol("$(T)Module")) | |
using StructTypes |
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 Workers | |
const WORK_QUEUE = Channel{Task}(0) | |
macro async(thunk) | |
esc(quote | |
tsk = @task $thunk | |
# the next line passes along task-local storage to the spawned task | |
# may not be desirable in all use-cases | |
tsk.storage = current_task().storage |
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 BinaryTrees | |
mutable struct Node{K, T} | |
value::K | |
data::T | |
left::Union{Node, Nothing} | |
right::Union{Node, Nothing} | |
end | |
Node(x) = Node(typemax(UInt) >> 1, x, nothing, nothing) | |
Node(x, data) = Node(x, data, nothing, nothing) |
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
rowitr = Tables.Map(x->(id=x.id, y=x.salary*2), df); | |
rowitr = Tables.Map(fff, df); | |
T = typeof(rowitr) | |
state = iterate(rowitr) | |
row, st = state | |
nms = Tuple(propertynames(row)) | |
len = Base.haslength(T) ? length(rowitr) : 0 | |
sch = Tables.Schema(nms, nothing) | |
columns = Tuple(Tables.EmptyVector(len) for _ = 1:length(nms)) | |
updated = Ref{Any}(columns) |
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 Foo | |
delimlen(delim::UInt8) = 1 | |
delimlen(delim::Tuple{Ptr{UInt8}, Int}) = delim[2] | |
checkdelim(delim::UInt8, b, buf, pos, eof) = delim == b | |
@inline function checkdelim(delim::Tuple{Ptr{UInt8}, Int}, b, buf, pos, eof) | |
startptr = pointer(buf, pos) | |
if pos + delim[2] <= eof | |
match = memcmp(startptr, delim[1], delim[2]) | |
if match |
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> code_typed(DataFrame, (typeof(m),); debuginfo=:source) | |
1-element Array{Any,1}: | |
CodeInfo( | |
1 ─── goto #3 if not false | |
2 ─── nothing::Nothing | |
3 ┄── %3 = π (false, Const(false, false)) | |
└──── goto #5 if not %3 | |
4 ─── nothing::Nothing | |
5 ┄── %6 = (DataFrames.applicable)(DataFrames.iterate, x)::Bool | |
└──── goto #61 if not %6 |
NewerOlder