Skip to content

Instantly share code, notes, and snippets.

Avatar

Leonard Ritter paniq

  • Duangle GbR
View GitHub Profile
View resize.sc
using import testing
# test alignment
inline test-alignment (T)
let size alignment =
ptrtoint (getelementptr (nullof (mutable pointer T)) 1) u64
ptrtoint (getelementptr (nullof (mutable pointer (tuple bool T))) 0 1) u64
print T size alignment
if (size != (sizeof T))
View pipetiles.sc
using import itertools
using import Set
let TILEX = 4
let TILEY = 3
let NUMTILES = (TILEX * TILEY)
let TILEBITS = 4
let TILEBITMASK = 0xf:u64
View test_bullet.sc
using import C.string
import ..tukan.use
using import tukan.bullet.C
let datadir =
.. module-dir "/../build/src/bullet/data"
local dofCount : i32
local posVarCount : i32
View SSAT.txt
// classical SSA structure
function (%1 %2)
main:
%3 = icmp %1 %2
condbr %3 branch1 branch2
branch1:
%4 = add %1 %2
br merge
branch2:
%5 = mul %1 %2
View gist:fb6aff95fb2cdf6e5fd358f3069f25ad
do
using import struct
struct T
a = 0
RcT := (Rc T)
struct Container
data : RcT
View corona_per_capita.txt
using data from https://coronavirus.jhu.edu/map.html: 3/13/2020 3:53:03 p.m.
infected population per capita^-1
US 1,268 327,200,000 258,044
japan 639 126,800,000 198,435
UK 593 66,440,000 112,040
austria 302 8,822,000 29,211
germany 3,059 82,790,000 27,064
View cast_ray.sc
fn iCube (ro rd)
""""For ``ro + rd * t`` returns near and far ``t`` that intersect with
a cube of unit size at origin, as well as a boolean indicating
whether a hit was made, and normal vectors for entry and exit point
which can also be used as integer offsets into the neighboring cubes.
let stp = (sign rd)
# avoid a situation where inf - inf = nan
let p = ((- ro) * stp)
let rdinv = (/ (abs rd))
let h0 = ((p - 0.5) * rdinv)
View oligarchy.sc
using import ..tukan.random
local rnd : (Random)
'seed rnd 1234
let NUM_PLAYERS = 4
let NUM_ROUNDS = 32
let START_MONEY = 100
View gist:57f5ddf3bf4b1b24a29d5d66a14043a3
fn... linear->sRGB
case (x : f32,)
mix
1.055 * (x ** (1.0 / 2.4)) - 0.055
12.92 * x
step x 0.0031308
case (x : vec3,)
mix
1.055 * (x ** (vec3 (1.0 / 2.4))) - 0.055
12.92 * x
View cl.sc
#!/usr/bin/env scopes
using import console
#using import ...conspire.module
let source-path argc argv = (script-launch-args)
# transform command line to symbolic list
let cmd =
fold (cmd = '()) for i in (rrange 0 argc)
let arg = (argv @ i)
You can’t perform that action at this time.