This commit is contained in:
2025-12-02 21:10:34 -05:00
parent 12c4d3c46e
commit 76eb4809e2
15 changed files with 327 additions and 103 deletions

View File

@@ -0,0 +1,5 @@
[app]
name = "docs.vxserver.dev"
version = "0.0.1"
authors = ["vx-clutch"]

View File

@@ -0,0 +1,9 @@
local header = {}
header.render = function(std)
return table.concat({
std.center(std.h1("Free Software Distributions Documentation")),
})
end
return header

View File

@@ -0,0 +1,17 @@
local fes = require("fes")
local std = fes.std
local u = fes.util
local site = fes.fes()
site.title = "Free Software Distributions Documentation"
site.copyright = fes.util.copyright("https://git.vxserver.dev/fSD", "fSD")
site:banner(fes.app.header.render(std))
site:note(u.cc({
std.h1("Free Software Distributions Documentation"),
std.blockquote(std.h1("NOT IMPLEMENTED")),
}))
return site

View File

@@ -1,9 +1,5 @@
[site] [app]
name = "site" name = "fsd.vxserver.dev"
version = "0.0.1" version = "0.0.1"
authors = ["owen"] authors = ["owen"]
[fes]
version = "1.0.0"
CUSTOM_CSS =

View File

@@ -1,10 +0,0 @@
### Site version alpha release
This is the alpha version of the fSD website, this site
contains many cool and interesting features which I
suggest that you navigate and learn more about.
If you think that this experience can be improved
send you suggestion or report to <https://git.vxserver.dev/fSD/site>.
2025-28-11

View File

@@ -1,3 +0,0 @@
### Holiday Season
Merry Christmas and Happy Holidays!

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -5,7 +5,7 @@ footer.render = function(std)
std.h2("Other resources"), std.h2("Other resources"),
std.tl({ std.tl({
std.external("https://git.vxserver.dev/fSD", "Git Trees"), std.external("https://git.vxserver.dev/fSD", "Git Trees"),
std.external("https://git.vxserver.dev/fSD", "Documentation"), std.external("https://docs.vxserver.dev", "Documentation"),
}), }),
}) })
end end

View File

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

View File

@@ -0,0 +1,7 @@
# Happy Holidays
Merry Christmas and Happy Holidays!
This article mostly exists to test the article system at `news`
2025-02-12

View File

@@ -0,0 +1,32 @@
# Alpha Release
# Pages
This is the first release of this site so far we have the following pages:
* About
* FAQ
* Releases
* Site news
### About
This page contains information about fSD.
### FAQ
Answers common questions about fSD and things pertaining to it.
### Releases
A list of fSD with a short description and link to repository.
### Site news
A location for news about this website, fSD, etc.
## Future
I hope that this gets expanded and polished as to expand the usefulness to the fSD project.
2025-02-12

View File

@@ -13,7 +13,33 @@ site:banner(fes.app.header.render(std))
site:note(u.cc({ site:note(u.cc({
std.h2("Free Software Distributions"), std.h2("Free Software Distributions"),
std.p("Free Software Distributions are a collection of free, minimal, and hackable packages desinged for the similar developer: someone who values freedom in software and a partition from corporation.") std.p([[
&ensp;The Free Software Distributions, stylized as fSD, Project is a collection of
free, minimal, and hackable packages for the similar developer: a person who
desires freedom in their tooling and a the ability to easily continue their
industry. Packages from fSD are built with a philosphy driven devlopment as
their core, this process of a strong idealical foundtion makes for consistant,
good, and dogmatic software.
]]),
std.p([[
&ensp;Our philosphy has three core points: freedom, minimalism, and hackabliting:
]]),
std.ul({
std.p(std.highlight("freedom: ") .. "the ability to see, touch, and smell our source code."),
std.p(std.highlight("minimalism: ") .. ""),
std.p(std.highlight("hackability: ") .. "packages should be easy to modify beyond their open-sourceness."),
}),
std.p([[
&ensp;These core points help derive awesome software ( at least I think so ) and keep a unified focus from other developers whilst they contribute.
]]),
std.br(),
std.blockquote([[
Most of the good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. - Linus Torvalds
]]),
std.br(),
std.p([[
&ensp;We hope that you enjoy our software and gain somethin from our time here.
]])
})) }))
site:note(u.cc({ site:note(u.cc({
std.h2("Copyright and License"), std.h2("Copyright and License"),

View File

@@ -7,55 +7,100 @@ local site = fes.fes()
local title = "Free Software Distributions" local title = "Free Software Distributions"
site.title = title .. " - Site news" site.title = title .. " - Site news"
site.copyright = u.copyright("https://git.vxserver.dev/fSD", "fSD") site.copyright = u.copyright("[https://git.vxserver.dev/fSD](https://git.vxserver.dev/fSD)", "fSD")
site:banner(fes.app.header.render(std)) site:banner(fes.app.header.render(std))
local articles_dir = "article" local function url_encode(s)
if not s then return "" end
s = s:gsub("([^%w%-_.~])", function(c) return string.format("%%%02X", string.byte(c)) end)
return s
end
local function list_files_in_dir(dir)
local files = {} local files = {}
local ok, lfs = pcall(require, "lfs")
local p = io.popen("ls -1 " .. articles_dir) if ok and lfs then
if p then for name in lfs.dir(dir) do
for file in p:lines() do if name ~= "." and name ~= ".." then
if file:match("%.md$") then local attr = lfs.attributes(dir .. "/" .. name)
files[#files + 1] = file if attr and attr.mode == "file" then
end table.insert(files, name)
end end
p:close() end
end
table.sort(files)
return files
end
local p = io.popen('ls -1 "' .. dir:gsub('"','\"') .. '" 2>/dev/null')
if not p then return files end
for line in p:lines() do
if line ~= "." and line ~= ".." then
local f = dir .. "/" .. line
local fh = io.open(f, "r")
if fh then
fh:close()
table.insert(files, line)
end
end
end
p:close()
table.sort(files)
return files
end end
table.sort(files, function(a, b) return a > b end) local function read_file(path)
local f = io.open(path, "r")
local news_html = {} if not f then return nil end
local news_titles = {} local data = f:read("*a")
f:close()
for _, file in ipairs(files) do return data
local path = articles_dir .. "/" .. file
local f = io.open(path, "r")
if f then
local content = f:read("*a")
f:close()
news_html[#news_html + 1] = fes.markdown_to_html(content)
local title_line = content:match("^#+%s*(.-)%s*\n") or ""
news_titles[#news_titles + 1] = std.h3(title_line)
end
end end
site:note(u.cc({ local dir = "news"
std.h1("Site news - Latest"), local files = list_files_in_dir(dir)
std.blockquote(std.p(news_html[1] or "")),
}))
local other_titles = {} local params = fes.bus.params or {}
local article = params.article
for i = 2, #news_titles do if type(article) == "table" then
other_titles[#other_titles + 1] = news_titles[i] article = article[1]
end end
site:note(u.cc({ if article then
std.center(std.h2("Other")), local candidates = {article, article .. ".txt", article .. ".md", article .. ".html"}
table.concat(other_titles, "") local body
})) for _, c in ipairs(candidates) do
local p = dir .. "/" .. c
body = read_file(p)
if body then break end
end
site.title = article
if body then
site:custom(fes.markdown_to_html(body))
else
site:note(u.cc {
std.h1(article),
std.p("article not found"),
})
end
site:note(fes.app.footer.render(std))
return site
end
local articles = {}
local n = 0
for _, v in ipairs(files) do
local display = v:gsub("%.[^%.]+$", "")
local link = "/news?article=" .. url_encode(display)
table.insert(articles, std.a(link, display))
n = n + 1
end
if n > 0 then
site:h1("Site news")
site:note(std.ul(articles))
else
site:h1("No articles")
end
site:note(fes.app.footer.render(std)) site:note(fes.app.footer.render(std))

View File

@@ -1,25 +1,34 @@
local fes = require("fes") local fes = require("fes")
local std = fes.std local std = fes.std
local u = fes.util local u = fes.util
local site = fes.fes() local site = fes.fes()
local title = "Free Software Distributions" local title = "Free Software Distributions"
site.title = title .. "- FAQ" site.title = title .. " - Release"
site.copyright = u.copyright("https://git.vxserver.dev/fSD", "fSD") site.copyright = u.copyright("https://git.vxserver.dev/fSD", "fSD")
site:banner(fes.app.header.render(std)) site:banner(fes.app.header.render(std))
site:note(u.cc({ local pkgs = {
std.h1("Frequently Asked Questions"), { "yait", "Highly opinionated C and SH project generator." },
std.p("Welcome to the world of fSD, come here ye before thou ask thy stupid questions."), { "fes", "A lightweight, static, and opinionated microframework." },
std.h2("Why is it called fSD?"), }
std.p([[
The name "Free Software Distributions" is dervided from exactly what we do, we distribute free software. for i, pkg in pairs(pkgs) do
This name stems from the Berkeley Software Distribution (BSD) specifically the Software Distribution part. pkgs[i] = std.note(u.cc({
]]), std.h2(pkg[1]),
std.p('It is worth pointing out that the word "free" is being used in two ways here: one meaning "at no cost" and the other meaning "do whatever you like".'), std.muted(pkg[2] or "Could not find a description."),
std.br(),
std.ul({
std.rl(pkg[1], std.external("https://git.vxserver.dev/fSD/" .. pkg[1], "Download")),
}),
}))
end
site:custom(u.cc({
u.cc(pkgs),
})) }))
site:note(fes.app.footer.render(std)) site:note(fes.app.footer.render(std))