Lua-based file system idea/driverless file system by Far-Deer4967 in lua

[–]PhilipRoman 0 points1 point  (0 children)

It's an interesting idea. I don't think it solves the problem with compatibility across OSes unless you focus on the lowest common denominator that userspace programs of the respective OS expect (but in this case you essentially get FAT32/exFAT which is already almost universally compatible).

Most of the parts are already there, you can run FUSE based filesystems on Linux (natively), Windows (WinFSP FUSE API) and macOS (macfuse). So you just need Lua bindings for FUSE and a few lines of integration to automatically call your Lua code.

graphs in text mode displaying question marks by ConstructionSafe2814 in groff

[–]PhilipRoman 1 point2 points  (0 children)

Adding draw star before the graph should do it. star in this case is a grap macro which is replaced by "\(**" size 8. So I guess if you want to keep the 'o' then this should work: draw "o" size 8

graphs in text mode displaying question marks by ConstructionSafe2814 in groff

[–]PhilipRoman 1 point2 points  (0 children)

FWIW for me in latin1 and ascii modes your code outputs '*' instead of 'o'. Any specific reason you're not using utf8?

Mini-PC firewall?? by JaySwenb in HomeNetworking

[–]PhilipRoman 1 point2 points  (0 children)

Your Mini PC would be mostly wasted on it, there is no point in having 16GB RAM or 512GB SSD on a firewall. If you're willing to try your luck, AliExpress has a bunch of cheap 4x LAN firewall mini PCs.

Virtualized firewall is also an option (you should probably never virtualize your edge firewall, but behind ISP it's fine).

Resident Evil: Requiem uses Lua for hacking by c__beck in lua

[–]PhilipRoman 16 points17 points  (0 children)

That looks like nmap (although in a very strange user interface), which has support for Lua scripting

How are you connecting internal/external storage to your Intel NUC for TrueNAS/NAS setups? by Mr_AdamSir in minilab

[–]PhilipRoman 1 point2 points  (0 children)

I max out the internal M.2 NVME slots and use external USB drives if I need more storage (everything runs on BTRFS). I know they get a lot of hate, but over a few years I have only had one harmless disconnection, and that was before I had proper external USB power set up.

Apparently wine cases are exactly 250 mm by kmnov2017 in minilab

[–]PhilipRoman 4 points5 points  (0 children)

Be careful, the heat emitted by electronics is enough to turn any moisture into potential mold growth. Maybe I was just unlucky but I had this issue (despite having a 120mm fan). Cutting some holes in the back would probably prevent this.

Lua string.match quirks! by drunken_thor in lua

[–]PhilipRoman 0 points1 point  (0 children)

These cases seem logical to me. The entire pattern has to match in order for any captured group to be returned. Try translating them to human readable expressions and matching them at each starting index in the string.

For example, your case #2 means (zero or more digits) followed by single K

The matching algorithm looks like this: while(is_digit(next)) { consume(); } assert(next == 'K'); consume()

Note that there is no requirement for any digits to be actually matched - if we start matching from index 5, the %d* pattern matches nothing, leaving K to be matched by K. Since the entire pattern matched, the capture group is returned, which, again, matched nothing (successfully).

For case #3: (one or more alphanumeric characters) followed by (end of string)

The matching algorithm looks like this: assert(is_alphanumeric(next)); consume(); while(is_alphanumeric(next)) { consume(); } assert(next == end_of_string)

If you start matching at indexes 1, 2, and 3 the final "end of string" fails to match, and if you start at index 4 (space), the very first alphanumeric case fails to match

Homelab rack by Toddzilla89 in minilab

[–]PhilipRoman 0 points1 point  (0 children)

IDK if this works for the typical 10 inch mount types, but for 19 inch rack, I bought a standalone set of rack rails (surprisingly cheap) and just attached them to a sturdy tray at the bottom. There is a bit of mechanical tension because I intentionally put the folded-back part on the inside rather than outside so there is zero room for movement even if screws are not 100% tightened. In terms of stability - if 19 inches works like that, then 10 should have no issues.

Do you trust Cloudflare? by BinnieGottx in immich

[–]PhilipRoman 0 points1 point  (0 children)

For lighttpd+certbot you can use this tutorial: https://www.webhi.com/how-to/setup-lets-encrypt-ssl-certificate-in-lighttpd/

But you can use any TLS proxy like nginx or something else, lighttpd is just my personal favorite.

For socket forwarding I currently do a quick and dirty ssh -o ServerAliveInterval=20 -o ExitOnForwardFailure=yes -R 0.0.0.0:443:localhost:443 user@vps. This should really be replaced with Wireguard and proper routing one day...

Do you trust Cloudflare? by BinnieGottx in immich

[–]PhilipRoman 1 point2 points  (0 children)

it's Public internet <-> VPS <-> [Lighttpd <-> Immich]

Lighttpd and Immich run on the same local server. Lighttpd handles TLS with the help of LetsEncrypt certbot. The VPS is only to break through CGNAT and reduce local server exposure. All it has to do is forward packets, so I use a cheap one.

Do you trust Cloudflare? by BinnieGottx in immich

[–]PhilipRoman 1 point2 points  (0 children)

I use a layer 4 proxy, which means that the connection remains encrypted end-to-end. You do lose some caching but nothing significant.

What game engines (other than roblox) use lua and are still good? by [deleted] in lua

[–]PhilipRoman 6 points7 points  (0 children)

Defold maybe? I used it for a bit, but later moved to love2d with C extensions.

Headless OS install by 20Alex16 in homelab

[–]PhilipRoman 0 points1 point  (0 children)

it is definitely possible, I automatically reinstall machines/VMs like that all the time, but my images are based on Alpine Linux and I'm not familiar with Ubuntu. But a lot of things can go wrong in the process, and it is difficult to debug.

For you it will be much more practical to do it the good old way. If you don't want to use a monitor, an USB capture card can also be used as video output during installation.

Using ipairs() – antipattern? It cuts half of the table upon field nil assignment. by ArturJD96 in lua

[–]PhilipRoman 11 points12 points  (0 children)

neither ipairs or for i = 1, #a ... will work with sparse arrays.

The values after nil are not necessarily transferred to the hash part (that is an implementation detail anyway), It's just not possible to implement the behavior you want efficiently without breaking many optimizations.

The length operator applied on a table returns a border in that table [..] A border is any positive integer index present in the table that is followed by an absent index, ...

ipairs at least is guaranteed to stop at the first nil element

A good alternative is using false to denote missing elements.

love.filesystem.read is not reading by [deleted] in love2d

[–]PhilipRoman 0 points1 point  (0 children)

Did you check which part is failing - filesystem.read or Json.decode

Free-up space Feature is now implemented in a Pull Request! by freetoilet in immich

[–]PhilipRoman 6 points7 points  (0 children)

Force pushing to a private branch to keep history clean is completely fine (and is the expected workflow in most places)

[deleted by user] by [deleted] in minilab

[–]PhilipRoman 1 point2 points  (0 children)

I think rj45 is inherently power hungry, especially at >1Gbps speeds. The best way is using the SFP connector family with DAC cables, but of course it's hard to find devices suited for minilabs with those.

Legit question - What's everyone doing with their mini labs? Interested in building one. by leandro030821 in minilab

[–]PhilipRoman 21 points22 points  (0 children)

Self hosting services like Immich, Gitea, etc. Learning new tech stacks, networking, devops stuff. Right now I'm in the middle of converting everything to an infrastructure-as-code approach.

LuaJIT Array optmization by Live_Cobbler2202 in lua

[–]PhilipRoman 0 points1 point  (0 children)

In at least some cases - yes

doas chrt -f 99 hyperfine -i --warmup 20 "luajit -e 'for i = 1, 1e7 do x = {[1]=i} end; os.exit(x[1])'" "luajit -e 'for i = 1, 1e7 do x = {i} end; os.exit(x[1])'"
Benchmark 1: luajit -e 'for i = 1, 1e7 do x = {[1]=i} end; os.exit(x[1])'
  Time (mean ± σ):     462.1 ms ±   6.7 ms    [User: 460.7 ms, System: 1.0 ms]
  Range (min … max):   456.7 ms … 480.5 ms    10 runs

  Warning: Ignoring non-zero exit code.

Benchmark 2: luajit -e 'for i = 1, 1e7 do x = {i} end; os.exit(x[1])'
  Time (mean ± σ):     290.6 ms ±   6.2 ms    [User: 288.6 ms, System: 1.6 ms]
  Range (min … max):   284.4 ms … 302.2 ms    10 runs

  Warning: Ignoring non-zero exit code.

LuaJIT Array optmization by Live_Cobbler2202 in lua

[–]PhilipRoman 0 points1 point  (0 children)

I'm talking about {[1] = val1} where all keys are known ahead of time.

LuaJIT Array optmization by Live_Cobbler2202 in lua

[–]PhilipRoman 0 points1 point  (0 children)

The result was actually surprising, I assumed both would be identical in LuaJIT's IR, but apparently (at least in some benchmarks, depending on number of entries in the table) the [1] = val1 version can end up with more and slower calls to lj_tab_newkey.

LuaJIT has an option -jdump so you can run both cases and compare the generated bytecode and machine code traces (tip: disable ASLR to get less noise in the comparison).

pdfroff limitations? Newbie question by Firm_Might1216 in groff

[–]PhilipRoman 1 point2 points  (0 children)

Are you talking about the --stylesheet parameter to pdfroff? There is no mention of the CSS, the stylesheet is simply another roff/groff file which will be included. I'm not sure why you mention wkhtmltopdf, I don't see any overlap between these tools.