[Thiago Cafe] Programming is fun!

List of public projects I worked on

Created by Thiago Guedes on 2024-04-30 05:59:56

One of the curious parts of not bieng super young, is that the list of public projects I worked on is quite long, for example a C++17 compatible quickfix lib, twitter client, media player, logo processor, todo tool, multi platform service wrapper, etc. They are all useless now.

This is a small list of recent projects that might be useful to others.


Texted - Free your text!

Overview

Texted is a database-less blogging platform where you can write your posts using markdown or HTML.

Why?

Many times, I had content in different formats or platforms and it was not simple to recover or render/read. From issues with MS Word documents depending on a closed source paid application to read, google docs and wordpress posts that were hard to export, I was tired of the mess. To make things worse, sometimes, a bad change in those documents (sometimes by mistake) made them irrecoverable.

How do I use it?

All the posts and templates you see in this website are hosted in gitlab, meaning that all is versioned and no small mistakes can make me lose what I wrote.

Suggested workflow

Or, what is my workflow?

  1. Templates and posts (what is generated by texted-tool bootstrap) are in a git repository (gitlab)
  2. All changes are pushed to git and in the host pulled
  3. After pulling, I restart the texted service

With that, I don't lose any content and I can even open the content in the gitlab repo and see the rendering before restarting


LuSH

LuSH is a lua for shell scripts - embedded in a single binary, easy to share, to run everywhere

The problem

I love Bash. I have tons of bash scripts, they're run only on my machine. If I copy to other hosts, they never work properly because either the bash version is older or some of the shell utils are not available or are not the same version, etc. Surely there are many methods to solve this, but the scripts complexity just increase. In prative, they never work everywhere. I want to simplify my life, not the other way around.

The solution

My own solution for that is to be able to deploy, just by copying, all I need to run my scripts. My first idea was to build a portable bash version, but I still need to have many other utils, such as awk, cut, wc, etc. So, why not using a more powerful language? For that, one widely used, easy and that just works is LUA. I love its simplicity and powerful tables. Initially, where I am, this will be a portable LUA interpreter (without any dependencies, all static) and many lua scripts with helpers to make it easy for the scripts to call local binaries.

Why nots

Why not Python?

Because I really don't like whitespace as block delimiter

Why not Ruby?

Because the runtime is big and not very portable.

Why not (whatever other language)?

Because I had to choose one. I got a super popular language as I don't want to be the eternal father of the project. I want something to solve my issues and not creating more. LUA has tons of scripts to do pretty much anything and most of them I just need to copy a lua file to a directory. Isn't it great?


sgrep (Simple Grep)

A simple grep util for those lazy to remember many command line options.

Have you ever wanted to have grep filtering but showing the first line (for instance, when you run ps | grep)? Me too. So I created sgrep!

(Note the header os the ps command, line 0)

# Displays lines containing "pub struct" string in all .rs files in the local directory
sgrep -p "pub struct" *.rs
# Displays lines containing "#ifdef" or "#ifndef" in all *.c* and *.h* files
sgrep -p "#ifdef" -p "#ifndef" -f .c -f .h
# Display the top 1 line and filter for bash, case insensitive
ps -ef | sgrep -t 1 -i -p bash

Spacer

Sometimes, when running commands with long long outputs, it's great to have some space between them.

Tell me your opinion!

Reach me on Twitter - @thiedri