save
This commit is contained in:
@@ -1,168 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
local snippet = {
|
|
||||||
[[
|
|
||||||
#include <stdio.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
long x = 470020878965;
|
|
||||||
puts((void *)&x);
|
|
||||||
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;
|
|
||||||
i = 0x5f3759df - (i >> 1);
|
|
||||||
y = *(float *)&i;
|
|
||||||
y = y * (threehalfs - (x2 * y * y));
|
|
||||||
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 *r = malloc(size);
|
|
||||||
if (!r)
|
|
||||||
abort();
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#include <stdint.h>
|
|
||||||
uint32_t rotl32(uint32_t x, uint32_t n)
|
|
||||||
{
|
|
||||||
return (x << n) | (x >> (32 - n));
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#include <stddef.h>
|
|
||||||
void memzero(void *p, size_t n)
|
|
||||||
{
|
|
||||||
unsigned char *t = p;
|
|
||||||
while (n--)
|
|
||||||
*t++ = 0;
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#include <stdio.h>
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int a = 0;
|
|
||||||
if (a++ == 0 && a++ == 1 && a++ == 2)
|
|
||||||
printf("chain ok\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
static unsigned long next = 1;
|
|
||||||
int lrand(void)
|
|
||||||
{
|
|
||||||
next = next * 1103515245 + 12345;
|
|
||||||
return (unsigned)(next / 65536) & 32767;
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
|
|
||||||
[[
|
|
||||||
#!/bin/sh
|
|
||||||
set -eu
|
|
||||||
printf '%s\n' "$1"
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#!/bin/sh
|
|
||||||
if [ "$#" -eq 0 ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
printf '%s\n' "$@"
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#!/bin/sh
|
|
||||||
x=0
|
|
||||||
while :; do
|
|
||||||
x=$((x + 1))
|
|
||||||
[ "$x" -gt 3 ] && break
|
|
||||||
done
|
|
||||||
printf '%s\n' "$x"
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#!/bin/sh
|
|
||||||
exec 3>&1
|
|
||||||
printf 'ok\n' >&3
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#!/bin/sh
|
|
||||||
f() {
|
|
||||||
printf '%s\n' "$1"
|
|
||||||
}
|
|
||||||
f "${1:-none}"
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#!/bin/sh
|
|
||||||
for i in a b c; do
|
|
||||||
printf '%s\n' "$i"
|
|
||||||
done
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#!/bin/sh
|
|
||||||
x=$(printf '%s' foo)
|
|
||||||
printf '%s\n' "$x"
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#!/bin/sh
|
|
||||||
read x
|
|
||||||
printf '%s\n' "$x"
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#!/bin/sh
|
|
||||||
PATH=/bin:/usr/bin
|
|
||||||
export PATH
|
|
||||||
printf '%s\n' "$PATH"
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#!/bin/sh
|
|
||||||
trap 'printf trap\n' HUP INT TERM
|
|
||||||
sleep 1
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
|
|
||||||
M.daily_random = function()
|
|
||||||
local t = os.date("*t")
|
|
||||||
local seed = t.day + t.month * 31 + t.year * 997
|
|
||||||
local a = 1103515245
|
|
||||||
local c = 12345
|
|
||||||
local m = 2 ^ 31
|
|
||||||
seed = (a * seed + c) % m
|
|
||||||
local r = seed / m
|
|
||||||
local n = #snippet
|
|
||||||
return snippet[math.floor(r * n) + 1]
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
13
fsd.vxserver.dev/news/02-prospects.md
Normal file
13
fsd.vxserver.dev/news/02-prospects.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# fSD Prospects
|
||||||
|
|
||||||
|
In the future I hope to the fsdproject.org domain. fsd.org is owned by someone,
|
||||||
|
yet they do not do anything with it. So is fsd.dev, fsd.com, fsd.xyz, fsd.io,
|
||||||
|
fsd.cc. So I have very few options.
|
||||||
|
|
||||||
|
Here they are:
|
||||||
|
- fsdproject.org
|
||||||
|
- fsd.site
|
||||||
|
|
||||||
|
As I stated I am leaning towards fsdproject.org because I like that .org.
|
||||||
|
|
||||||
|
2025-17-12
|
||||||
@@ -12,17 +12,18 @@ site.favicon = "/static/favicon.ico"
|
|||||||
|
|
||||||
site:banner(fes.app.header.render(std))
|
site:banner(fes.app.header.render(std))
|
||||||
|
|
||||||
site:note(std.blockquote([[
|
site:custom(fes.markdown_to_html([[
|
||||||
"UNIX is very simple" - Dennis Ritchie
|
News
|
||||||
<br>
|
===
|
||||||
"GNU's Not UNIX" - Richard Stallman
|
|
||||||
]] ))
|
|
||||||
|
|
||||||
site:note(u.cc({
|
2025-12-17
|
||||||
std.h2("Daily Random Snippet"),
|
----------
|
||||||
std.p("The following is a random code snippet that features a unique feature or syntax."),
|
Some changes were made to this site.
|
||||||
std.blockquote(std.pre(fes.app.snippet.daily_random())),
|
|
||||||
}))
|
[sites](https://git.vxserver.dev/fSD/sites)
|
||||||
|
* General improvments and fixes
|
||||||
|
* Moving the news page to here.
|
||||||
|
]]))
|
||||||
|
|
||||||
site:note(fes.app.footer.render(std))
|
site:note(fes.app.footer.render(std))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user