Skip to content

Instantly share code, notes, and snippets.

@NHDaly
NHDaly / gist:84b685d302dd77e67dbbe56cf3f2fe06
Created March 14, 2022 13:45
`@code_llvm make_str("hi")`
julia> @code_llvm make_str("hi")
; @ REPL[20]:1 within `make_str`
define [1 x {}*] @julia_make_str_596({}* nonnull %0) #0 {
top:
; @ REPL[20]:2 within `make_str`
; ┌ @ Base.jl:178 within `sizeof`
%1 = bitcast {}* %0 to i64*
%2 = load i64, i64* %1, align 8
; └
; ┌ @ int.jl:83 within `<`
@NHDaly
NHDaly / day1.delve
Created December 21, 2021 00:19
NHD advent of code 2020 delve
// def input = load_csv["/Users/nathandaly/Documents/delve/adventofcode/day1-input"]
// def nums = input[_, :Numbers]
// ic {count[nums] = 200}
def input_example = {
1721;
979;
366;
299;
675;
@NHDaly
NHDaly / gist:9377dab0cb5e1f3cecedce1e4de0e59e
Created December 21, 2021 00:17
salsa infinite recursion crash
julia> using Salsa
julia> @derived foo(rt, x) = foo(rt, x+1)
foo (generic function with 1 method)
julia> rt = Runtime()
Salsa.Runtime(Salsa.DefaultStorage(0, ...))
julia> foo(rt, 1)
[ Info: DOUBLING SALSA TRACE FREELIST ON THREAD 1
@NHDaly
NHDaly / Project.toml
Last active December 21, 2021 00:13
A script through the GitHub API to subscribe a new user to all the threads that an old user was subscribed to.
[deps]
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
using CSV
#using UnicodePlots
"""
plot_snoopl(func_csv_file, llvm_csv_file; out_csv_path="")
Print a barplot to stdout, optionally output a CSV file with the results, and return a
table with the results.
# Example
{"version":1,"resource":"file:///Users/daly/Documents/developer/code/deep/JuliaDeep/src/Plots-pkg-customchanges.jl","entries":[{"id":"4UvC.jl","timestamp":1665780705047}]}
@NHDaly
NHDaly / jupyter_notebook_config.py
Created November 28, 2019 03:51
Jupyter configuration to auto-export scripts with markdown->comments, even for non-python languages (Julia)
import io
import os
from notebook.utils import to_api_path
_script_exporter = None
_html_exporter = None
def script_post_save(model, os_path, contents_manager, **kwargs):
if model['type'] != 'notebook':
return
@NHDaly
NHDaly / MultithreadingBenchmarks.jl-7ff486-ec2-r5d.24xlarge.output
Created August 27, 2019 21:31
Output from running MultithreadingBenchmarks.jl/test/runbench.jl at 7ff486 on EC2 `r5d.24xlarge`
unpacking sources
unpacking source archive /nix/store/zwgb1rq126al7lbkxlbnwlfwqkn9h2h2-multithreading
source root is multithreading
patching sources
configuring
no configure script, doing nothing
building
processor : 0
vendor_id : GenuineIntel
cpu family : 6
promote_type(Type{T}, Type{UInt64}) where {T}
promote_type(Type{Bool}, Type{S}) where {S}
promote_type(Type{Bool}, Type{#s55} where #s55<:Integer)
promote_type(Type{T}, Type{UInt32}) where {T}
promote_type(Type{UInt64}, Type{S}) where {S}
_is_convertible_Int(Integer)
_promote(Real, Integer)
_promote(Real, Real)
iterate(Core.Compiler.Iterators.Zip2{_, _} where _ where _)
iterate(Core.Compiler.Iterators.Zip2{_, _} where _ where _, Tuple{Any, Any})
13:10:10  ~/src/julia   v1.0.3-inline-investigation ✘ ✹ ✭  make -j 6
JULIA usr/lib/julia/corecompiler.ji
essentials.jl
some.jl
ctypes.jl
generator.jl
reflection.jl
options.jl
promotion.jl
tuple.jl