alpha commit

This commit is contained in:
2025-11-29 08:35:09 -05:00
parent 54838d85a7
commit 12c4d3c46e
14 changed files with 340 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,13 @@
local footer = {}
footer.render = function(std)
return table.concat({
std.h2("Other resources"),
std.tl({
std.external("https://git.vxserver.dev/fSD", "Git Trees"),
std.external("https://git.vxserver.dev/fSD", "Documentation"),
}),
})
end
return footer

View File

@@ -0,0 +1,15 @@
local header = {}
header.render = function(std)
return table.concat({
std.center(std.ha("/", std.h1("Free Software Distributions"))),
std.center(table.concat({
std.nav("about", "About"),
std.nav("faq", "FAQ"),
std.nav("release", "Releases"),
std.nav("news", "Site news"),
}))
})
end
return header

View File

@@ -0,0 +1,77 @@
local M = {}
local snippet = {
[[
#include <stdio.h>
int main()
{
long x = 470020878965;
puts((void*)&x); // le representation
return 0;
}
]],
[[
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
return y;
}
]],
[[
#include <stdio.h>
int main(int argc, char **argv)
{
return printf("%s: Comma operator\n", argv[0]), 2;
}
]],
[[
void welford(double x, double *n, double *mean, double *m2)
{
(*n)++;
double d = x - *mean;
*mean += d / *n;
*m2 += d * (x - *mean);
}
]],
[[
#define ever (;;)
for ever {
...
}
]],
[[
void *xmalloc(size_t size)
{
void *ret = malloc(size);
if (!ret)
die("memory exhausted");
return ret;
}
]],
}
M.daily_random = function()
local day = tonumber(os.date("%d"))
local n = #snippet
local a = 1664525
local c = 1013904223
local m = 2^32
local v = (a * day + c) % m
local r = v / m
return snippet[math.floor(r * n) + 1]
end
return M