Tools

Restclient is dead… Now we have verb!

emacs rest tools

Recently I found an interesting mode in emacs to manage and run http requests!

enjoy! heheh

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Restclient is dead… Now we have verb!

Emacs code navigation? TAAAGS!

emacs tools

Do you know when you open a code file and you want to navigate it but you have to fire up a whole enviroment just to do it? In clojure, would be cider, in python it would be elpy and so on…

Well, get ready feel free! All you need is a command line and vanilla emacs!!

The command is etags. What this command does is look for all the definitions you made in the files you pass as an argument with the language and it will create a TAGS file in the current directory.

find . -type f -name "*.clj" | xargs etags --language=lisp

Once that is done, use you xref-find-definitions and xref-pop-marker-stack command (alias in vanilla as M-. and M-,, respectively) and it will ask you where is the TAGS table.

You can reset the table with tags-reset-tags-table. If it feel very UNIX like, you would be right. It is! Enjoy!

Oh, not sure what languages are supported? Fear not!

etags --help

  1. emacs tags
  2. elpy
  3. cider

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Emacs code navigation? TAAAGS!

Integration test in a good way

code tools rest

This is another tale of redemption… I really enjoy minimalistic solutions and yet, I was not using for integration tests…

So, as everything that needs a start, what was the problem? For some time, I have been thinking about integration tests. What I am calling integration here means a way to test an API that goes through other APIs.

The non minimal

I tried a few approaches. One was to create a “fake” data structure that would represent the return of one API but that proved to be very difficult to insert in my coding routine.

Another approach was to use a http request client. The one I used the most was restclient mode in emacs. Which is pretty good. Here is an example of a GET request from the README:

#
# XML is supported - highlight, pretty-print
#
GET http://www.redmine.org/issues.xml?limit=10

With the mode, you have some shortcuts and can have a bunch of requests in a single file. It is pretty cool actually. The problem? it is not very good in the automation front… I did not find an easy way to run all these requests.

Well, what is the solution? Thinking minimal. Like, really minimal. I mean curl minimal.

Now, what is the problem with curl? It is tedious to make it work if you are not used to it. You have a lot of the control of how the request should be made…

Save this. We will come back to it.

The minimal

Why is it a solution, then? Because you made your request with a command line, it is very easy to automate with a script, such as a shell script.

For instance, you can create an “integration” test script like so:

# testing with 10
curl -X GET http://www.redmine.org/issues.xml?limit=10

# a test with json post
curl -X POST http://www.afakeurl.org/afakemethod --json @path-to-json-file

echo

Pretty simple if you ask me. Now, after a commit or when you feel like it, it is one command away.

Remember the problem? Well, I wonder if it really is. More control over it means that you are fully aware of what is going on. Meaning, you have a better understanding of the process. You have to study more? Sure, however I would argue it is the extra mile that could make you a better coder.

I am leaving giving my thanks to ’erica and umgeher for this small realization. Cheers!

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Integration test in a good way

Zoom vs OpenBSD

openbsd tools

I do not mind saying it again, OpenBSD is pretty cool, however it does has its quirks. Recently, I had a fairly important meeting in Zoom in which I would make an presentation and I did not make it because I could not enter the room. All it appeared to me was and enternal “Joining” and the endless MS circle spinning.

So, let’s fix it shall we?

Apparently, in order to make Zoom work, one must have wasm enabled in your system. By the way, this is what I would call a bloated piece of software… it only is a videoconference software… geez…

Anyway, I digress. So, OpenBSD disables wasm by default for security reasons. So, what one can do is: enables wasm, go to your conference and at the end disables it.

And I give you sadzoom! You will notice that I use chromium to enter the conference. I do that because with chromium because outside of the box it allows screen share. Why sadzoom? Because you are probably sad to use zoom as I am…

One last thing, remember to use let’s-meet to enable cam and mic =]

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Zoom vs OpenBSD

Bookmark unix-style!

shell-script tools

Hypothetical user, do you use any bookmark system? What? Only on firefox? Why am I calling it “system”?

Well, you don’t need to use bookmark only for webpages and restricted to the browser. A little bit of rofi and shell script, and there you go: bmark!

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Bookmark unix-style!

pomodoro is now its own thing!

code shell-script life tools

I started using my pomodoro script again, and made few improvements. Also, I separated in its own repository.

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: pomodoro is now its own thing!

Meetings in openbsd

openbsd tools

Ok… I have been using a little bit more OpenBSD, and I was having some issues to use it during calls. After some research and experimentation, I have thought a way to make it happen! So it was born lets-meet!

It is simply a toggle to enable/disable microphone and camera. Enjoy!

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Meetings in openbsd