Skip to content

Instantly share code, notes, and snippets.

View inkydragon's full-sized avatar

CY Han inkydragon

View GitHub Profile
IEEE 754 floating-point formatter using the Dragonbox algorithm
f32(%a) uint32 int64 str(f32)
0x1p+25 0x2000000 33554432 33554432.000000
0x1.000008p+25 0x2000010 33554448 33554448.000000
0x1.00008p+25 0x2000100 33554688 33554688.000000
0x1p+26 0x4000000 67108864 67108864.000000
0x1.000008p+26 0x4000020 67108896 67108896.000000
0x1.00000cp+26 0x4000030 67108912 67108912.000000
0x1.00001p+26 0x4000040 67108928 67108928.000000
0x1.000014p+26 0x4000050 67108944 67108944.000000
@inkydragon
inkydragon / 2024-Julia-Source-Code-Count.md
Last active February 11, 2024 17:35
Julia Source Code Count: Counts the lines of code in folders `base/`, `src/`, `test/`, in descending order.
@inkydragon
inkydragon / parser-test.jl
Last active February 3, 2024 20:55
Julialang/julia #parser issue tag; Maybe those tests could be add to JuliaSyntax.jl.
# SPDX-License-Identifier: MIT
using Test
using Base.JuliaSyntax
using Base.JuliaSyntax: Diagnostic
# copy from: https://github.com/JuliaLang/JuliaSyntax.jl/blob/a6f2d1580f7bbad11822033e8c83e607aa31f100/test/diagnostics.jl#L1-L12
function diagnostic(str; only_first=false, allow_multiple=false, rule=:all, version=v"1.6")
stream = JuliaSyntax.ParseStream(str; version=version)
JuliaSyntax.parse!(stream, rule=rule)
if allow_multiple
#const forecast_samples = [randn(30) for i in 1:10_000];
const forecast_samples_adj = [randn(30) for i in 1:10_000]';
function f(arr)
reduce(vcat, arr)
GC.gc(true)
GC.gc(false)
return Base.gc_live_bytes() / 2^20
end
@inkydragon
inkydragon / libgettextlib-0-21.dll.txt
Created March 2, 2023 08:18
Gettext-v0.21.0+0 Win Dll export
Microsoft (R) COFF/PE Dumper Version 14.29.30145.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file libgettextlib-0-21.dll
File Type: DLL
Section contains the following exports for libgettextlib-0-21.dll
@inkydragon
inkydragon / win-build-time.md
Created July 29, 2022 06:22
MSYS2 v.s. Cygwin build time

mingw64

build

Sysimage built. Summary:
Base ────────  26.613768 seconds 47.5633%
Stdlibs ─────  29.338653 seconds 52.4332%
Total ───────  55.954380 seconds
make[1]: Leaving directory '/v/julia/julia-mingw64'
Reading symbols from usr/bin/julia-debug...
(gdb) r
Starting program: /cygdrive/v/julia/usr/bin/julia-debug tmp/seg.jl
[New Thread 8292.0x9e8]
[New Thread 8292.0x56f8]
[New Thread 8292.0x6530]
[New Thread 8292.0x944]
[New Thread 8292.0x35d8]
[New Thread 8292.0x6af0]
[New Thread 8292.0x7474]

Keybase proof

I hereby claim:

  • I am inkydragon on github.
  • I am woclass (https://keybase.io/woclass) on keybase.
  • I have a public key ASA6eez34ZwRpzVcIc0aNZ0yZhybRA-WEZoc0LVZKgqtAAo

To claim this, I am signing this object:

@inkydragon
inkydragon / LSystem.py
Created August 28, 2019 05:34
Lindenmayer system
from math import sin, cos, pi
import matplotlib.pyplot as pl
from matplotlib import collections
class L_System(object):
def __init__(self, rule):
info = rule['S']
for i in range(rule['iter']):
ninfo = []
for c in info:
@inkydragon
inkydragon / deep-into-repr.jl
Created July 10, 2019 06:13
Why `repr(Expr(:$, :a))` gives `":(\$(Expr(:\$, :a)))"`.
# TL; DR:
#= 1 - AST printing Rules =#
# https://github.com/JuliaLang/julia/blob/master/base/show.jl#L741-L763
## Abstract Syntax Tree (AST) printing ##
# Summary:
# print(io, ex) defers to show_unquoted(io, ex)