Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about programming (old posts, page 98)

Croupier version v0.4.0 is out

A new release of Croupier my Crystal library for tasks and dataflow programming is out!

What's Changed

  • Sup­port key/­val­ue in ad­di­tion to files as in­put/out­put
  • Im­ple­ment a per­sis­tent k/v store
  • Im­ple­ment fast_­mode
  • au­to mode with kv

Full Changel­og: v0.3.4...v0.4.0

New Project: Shortcodes

One thing leads to an­oth­er. I want­ed to learn a new lan­guage and chose Crys­tal. To prac­tice, I rewrote my stan­dard prac­tice pro­jec­t, Nico­let­ta, a stat­ic site gen­er­a­tor.

That brought to mind doit a task/­dataflow li­brary, which made me want to im­ple­ment some­thing sim­i­lar, so I wrote Croupi­er which went well, so I said "Why not write a more se­ri­ous SS­G, which is Nicol­i­no which I think would not be com­plete with­out a fea­ture from Niko­la which I stole from Hugo, called short­codes. So I had to write a short­code pars­er.

What are short­codes?

Sort of macros for markdown. You want to do a <figure> but markdown doesn't have it, so you do this:


{{% figure src="http://whatever" %}}

And you end up with a fig­ure tag in your doc­u­men­t.

That is done by pass­ing da­ta like that "s­r­c" ar­gu­ment and the con­text of the doc­u­ment you are writ­ing in­to a tem­plate, which ren­ders a piece of HTM­L, that's in­sert­ed where the short­code was and bob's your un­cle.

There are vari­ants, and de­tail­s, and sub­tleties, but that's the ba­sic idea.

The bad news was that I was not the au­thor of Niko­la's cur­rent short­code parser, that was some­one else, and I re­al­ly don't un­der­stant their code.

So I want­ed to write it from scratch.

I have been want­ing to learn ragel for a bit, let's say 10 years. It's a thing that takes a fi­nite state ma­chine de­scrip­tion in a DSL and turns it in­to a pars­er in the lan­guage you wan­t.

As long as you want one of the lan­guages it likes, which is not Crys­tal, so I used it to gen­er­ate it in C. And wrapped that in Crys­tal.

So, that's a very long way to say that I wrote a Short­code pars­er li­brary that can be used from Crys­tal and from C, and since it can be used from C, it can be used from pret­ty much any lan­guage.

It does­n't im­ple­ment the whole short­code "spec­i­fi­ca­tion" (which is not a re­al thing that ex­ist­s) but it im­ple­ments the ba­sic­s.

Now, I just need to use it in Nicol­i­no, and even­tu­al­ly make it bet­ter as need­ed.

BTW: Ragel rocks.

Exposing Code-Server on a VPN

I have all my com­put­ers in a Tailscale VPN which means I can see them all as if I were di­rect­ly con­nect­ed to them.

Re­cent­ly I got a new desk­top com­put­er which is, for my stan­dard­s, ridicu­lous­ly fast. So, it makes sense to de­vel­op things in it even when I am not in front of it.

Since VS Code is ba­si­cal­ly a web ap­p, the idea is to use code serv­er run­ning in it and ac­cess it via VP­N.

Did it work? OH YES.

Per­for­mance is prac­ti­cal­ly the same as run­ning VS code lo­cal­ly, sim­i­lar to us­ing GitHub codespaces.

Did it need any spe­cial con­fig?

Just one. To make Chrome stop com­plain­ing about "in­se­cure con­tex­t", it needs to be ac­cessed via HTTP­S, even when it's done over a com­plete­ly en­crypt­ed tun­nel.

Luck­i­ly, it's very, very easy.

So, just get caddy, and use this Caddyfile:

mindy.tailABCDEF.ts.net

reverse_proxy :8088

Yes. Two lines. The ABCDEF part will be dif­fer­ent for each tailscale net­work.

And that's it. Ac­cess it us­ing http­s://­mindy.­tail­ABCDE­F.t­s.net and ... that's al­l. I am shocked at how well it worked, and how easy it was.

Hacé version v0.1.2 is out

A new release of Hacé my make-like tool backed by Croupier is out!

Version v0.1.2

  • Make tasks not be de­fault by de­fault. This means that if you
    don't spec­i­fy a task when in­vok­ing hace, noth­ing will hap­pen.

    This is a break­ing change.

  • Added self to ex­posed vari­ables in tasks. This can be used
    to achieve what you would use $@ or oth­er au­to­mat­ic vari­ables
    in Make­files.

  • Added -f op­tion to spec­i­fy a Hace­file to use.

  • Added -n op­tion to do a dry run.

  • Added al­ways_run flag for tasks which caus­es them to al­ways
    run even if their de­pen­den­cies are un­changed.

  • Im­ple­ment­ed --ques­tion flag to ask if a task should be run.

  • Im­ple­ment­ed au­to com­mand, which con­tin­u­ous­ly re­builds as need­ed
    re­act­ing to filesys­tem changes.

Croupier version v0.3.4 is out

A new release of Croupier my Crystal library for tasks and dataflow programming is out!

What's new?

  • Fixed bug sav­ing .croupier, was miss­ing all in­puts
  • Added tests for TaskManager.save_run
  • Fixed bug in in­o­ti­fy watch­er path lookup
  • Fixed bug where au­to_run would on­ly run tasks once (found in Hacé)

Contents © 2000-2024 Roberto Alsina