Tra.pt Tools Logo Tra.pt Tool Blog

First Few Tra.pt Tools

Looky what I did. Playing with stuff the other day and wanted to give Vercel a try. I'm pretty versed in Netlify's system and way of doing things. But my Vercel knowledge was pretty limited. I tried it years ago and felt like it was more of a Glitch type product...but I was wrong (or they evolved).

I wanted a place to put some functions and simple tools. And it looks like this will work out pretty well. First think I wanted to give a go was a bot...🤖.

Daily Stoic Bot 🗿

I enjoy a good stoic quote to keep my ADHD brain from going berserker. Just a quick reminder that I need to only deal with what is in my sphere of control and not worry too much about tomorrow. I've collected a ton of quotes (370+) over a period of time, and I dumped them into an AirTable sheet for use.

I like using AirTable because it has a great API. I thought about loading up a PocketBase instance as well to work with that, but I'd rather have the up-time capability outside of my hands. I've used PocketBase where I needed some authentication and it's pretty nice, but AirTable is easier.

SO! What do we have. Every morning around 9am CST (◀ I hope), Moai (🗿) will throw out a quote that may not be rooted in the Stoic Philosophy, but definitely is applicable. Check it out!

https://botsin.space/@stoic/

MathML ➕➗➖❌

I originally needed a way to convert LaTeX math syntax into actual good looking equations. I use Hugo on my main site and there wasn't any clean way of doing it. So I found Temml, and after a quick PR to get it working, I have a function in Vercel that will take dirty LaTeX format and give you back the MathML markup that every browser understands.

So I send it this:

G_{\mu\nu}=8\pi G\left(T_{\mu\nu}+{\large \rho}_\Lambda {\large g}_{\mu\nu} \right)

It gives me this:

<math
  xmlns="http://www.w3.org/1998/Math/MathML"
  class="mathml"
  display="block">
  <mrow>
    <msub>
      <mi>G</mi><mrow><mi>μ</mi><mi>ν</mi></mrow>
    </msub>
    <mo>=</mo><mn>8</mn><mi>π</mi><mi>G</mi>
    <mrow><mo fence="true" form="prefix">(</mo>
      <msub>
        <mi>T</mi><mrow><mi>μ</mi><mi>ν</mi></mrow>
      </msub>
      <mo>+</mo>
      <msub>
        <mstyle mathsize="1.2000em"><mi>ρ</mi></mstyle>
        <mrow><mi mathvariant="normal">Λ</mi></mrow>
      </msub>
      <msub>
        <mstyle mathsize="1.2000em"><mi>g</mi></mstyle>
        <mrow><mi>μ</mi><mi>ν</mi></mrow>
      </msub>
      <mo fence="true" form="postfix">)</mo>
    </mrow>
  </mrow>
</math>

Which looks like this: Gμν =8πG ( Tμν + ρ Λ g μν )

Check out the usage here: Tra.pt's Tex-2-MathML Function


Recent posts