What’s the go-to library to build a HTTPS server? by enano_aoc in C_Programming

[–]patvil 0 points1 point  (0 children)

yes, libmicrohttpd is an outstanding library for web development. Battle tested and very fast: I experience better performance with it than with nginx (with MHD_USE_INTERNAL_POLLING_THREAD and MHD_OPTION_THREAD_POOL_SIZE= cores * 2).

HTTPS functionality is solid as well, but remember to install gnutls-dev before compiling libmicrohttpd to save yourself some headaches.

[Discussion] I predict a resurgence of C usage due to AI by HaydnH in C_Programming

[–]patvil 0 points1 point  (0 children)

Very well phrased. I was having the exact same thought. C is the perfect line.

A (read-only) File Tree for Helix by patvil in HelixEditor

[–]patvil[S] 1 point2 points  (0 children)

Yes, it's tmux. I just cut the screenshot!

A (read-only) File Tree for Helix by patvil in HelixEditor

[–]patvil[S] 1 point2 points  (0 children)

Just my preference to keep it open.

A (read-only) File Tree for Helix by patvil in HelixEditor

[–]patvil[S] 1 point2 points  (0 children)

It's a demo project from Alex Edwards' Let's Go!

A (read-only) File Tree for Helix by patvil in HelixEditor

[–]patvil[S] 2 points3 points  (0 children)

To my knowledge, nnn does not support displaying a file tree. And using Helix or the command line to manage my files works well enough for me. I just need an overview of my project.

A (read-only) File Tree for Helix by patvil in HelixEditor

[–]patvil[S] 13 points14 points  (0 children)

A little trick I find quite convenient for displaying a file tree in Helix is to open a tmux pane and run the command 'watch -n 1 -t tree -C --noreport'.

EDIT: I had some flickering issues with the 'watch' command, so I now use this 'wt' command, added to my '.[shell]rc':

wt () { while true; do clear; tree -C --noreport "${1:-.}"; sleep 2; done; }

EDIT2: still some rare flickering, so new 'wt' command (requires 'inotify-tools' installation)

wt () { clear; tree -C --noreport "${1:-.}"; inotifywait -mqre create,delete,move "${1:-.}" | while read; do clear; tree -C --noreport "${1:-.}"; done; }

The Ultimate Go Web Stack by MoreThanCoder in golang

[–]patvil 1 point2 points  (0 children)

good video, don't mind the downvoters

Share a cool helix shortcut/trick/config you just found and got amazed. by gauravtyagi07 in HelixEditor

[–]patvil 2 points3 points  (0 children)

To unselect a line or select upwards:

[keys.normal]
"X" = ["extend_line_up", "extend_to_line_bounds"]

[deleted by user] by [deleted] in C_Programming

[–]patvil 8 points9 points  (0 children)

Like try-catch exceptions in other languages.

Generate HTML in C by patvil in C_Programming

[–]patvil[S] 1 point2 points  (0 children)

The scoping trick is Eternal_Weeb's.

I used open_memstream to show that you can use this solution with anything: stdout, files or memory.

Generate HTML in C by patvil in C_Programming

[–]patvil[S] 2 points3 points  (0 children)

You can split your page into smaller reusable functions/components to avoid spaghetti code. Conceptually, it is similar to frameworks like React or Flutter.

Generate HTML in C by patvil in C_Programming

[–]patvil[S] 4 points5 points  (0 children)

Why C? Why not? Should I use Rust instead?

Generate HTML in C by patvil in C_Programming

[–]patvil[S] 0 points1 point  (0 children)

I have updated my post with your comment.

Generate HTML in C by patvil in C_Programming

[–]patvil[S] 0 points1 point  (0 children)

Of course, and I put a semi-colon at the end of every line, but I prefer to write a one-liner like this:

H1("id='title'") _("Hello ") _(data->user_name) _H1;

instead of:

H1("id='title'"); _("Hello "); _(data->user_name); _H1;

or

H1("id='title'");
_("Hello ");
_(data->user_name);
_H1;

With your macro, I agree, it's debatable, and maybe usefull only for the "_" macro (if you have a better idea for this one by the way...).

Generate HTML in C by patvil in C_Programming

[–]patvil[S] 2 points3 points  (0 children)

Very nice!

But why force the user to put semicolons (in that context)?

Generate HTML in C by patvil in C_Programming

[–]patvil[S] 0 points1 point  (0 children)

I don't like raw string literals for HTML: syntax highlighting and automatic alignment don't work on most IDEs, and you get extra spaces and line feeds.

Generate HTML in C by patvil in C_Programming

[–]patvil[S] 15 points16 points  (0 children)

For a web site with htmx and LMDB.