💾 Archived View for rawtext.club › ~sloum › geminilist › 002186.gmi captured on 2020-09-24 at 01:22:36. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Gary Johnson lambdatronic at disroot.org
Fri Jul 10 19:38:28 BST 2020
- - - - - - - - - - - - - - - - - - -
Hi Hannu,
Thanks for the feedback. I also write Clojure+Clojurescript for aliving doing full stack web development and scientific modelling in theenvironmental arena.
To control RAM consumption by the JVM, you can set -D-Xmx in Space Age'stoplevel deps.edn file. Outside of embedded environments (e.g.,Raspberry Pis), I suspect the default of a few hundred MBs of RAMshouldn't be too much of a burden for most laptops, desktops, or VMs,but with that flag, you can set the JVM's max memory to whatever youwant. GraalVM could be an interesting build target though, so let meknow if have any success compiling Space Age on it.
I'll take a look at java.net.URI to see if it provides any benefit overmy current approach. I suspect I'll still need to perform stringtrimming, selective lower-casing for some URI components, and defaultvalues for missing elements as I am doing currently, but if it shaves afew lines off the code base, that's certainly nothing to complain about.;)
In other news, I just added a primitive CLJ script running facility toSpace Age. Now all you have to do is drop an executable <whatever>.cljfile into your ~/public_gemini folder (or the document root directory),and you're off to the races! Any query params from the request URL areavailable to the script in a global variable called (creatively)"request-params". Anything you print to stdout in your script will bereturned as the body of a text/gemini response to the client.
I'm still thinking through just how much additional info I want to passto these scripts and how/whether I should let them send non-successresponses, but that's half the fun of it after all.
(hack 'the :planet) Gary
Hannu Hartikainen <hannu.hartikainen+gemini at gmail.com> writes:
On Fri, Jul 10, 2020, 00:39 Gary Johnson <lambdatronic at disroot.org> wrote:
Space Age is a Gemini server written in Clojure (https://clojure.org/).
It implements Gemini protocol specification v0.14.2 (July 2nd 2020), all
except for client certificates (which I'm still working on).
The entire code base (including build files) clocks in at a cool 200
lines with absolutely no dependency libraries.
Great work!
I write Clojure at $dayjob and consider it a great fit for full-stack web
(and Gemini by extension). Besides a static Gemini site, I've written one
CGI app in Rust (twinwiki) and one server/app in Python/Jetforce (
ansi.hrtk.in). Both could have been in Clojure if there was a nice library.
For my use RAM consumption is important, though, so I'd need to measure a
bit with GraalVM or possibly a tiny JVM instance. Practically Rust will
always be the better (best?) choice, but it's a bit heavy for prototyping.
Briefly reading the code I was left wondering if java.net.URI wouldn't
parse URIs out of the box. Probably it's just not ergonomic and/or has
weird corner cases...
Happy hacking!
-Hannu
-- GPG Key ID: 7BC158EDUse `gpg --search-keys lambdatronic' to find meProtect yourself from surveillance: https://emailselfdefense.fsf.org=======================================================================() ascii ribbon campaign - against html e-mail/\ www.asciiribbon.org - against proprietary attachments
Please avoid sending me MS-Office attachments.See http://www.gnu.org/philosophy/no-word-attachments.html