lunes, 9 de septiembre de 2019

set -e in bash subshell

Did you ever realize that even when you use `set -e` in a bash script, anything that happens inside a  $(subshell like that) won't be executed under the `set -e` umbrella?


Here are the 2 solutions we found. None feels very solid... but hey, it's bash, what did you expect?

- https://lists.gnu.org/archive/html/bug-bash/2008-01/msg00121.html . Apparently traps work in this dynamic scope and they get access to the nesting level of the bash shell the code is called from. Kind of not unwinding the stack?

- https://unix.stackexchange.com/questions/65532/why-does-set-e-not-work-inside-subshells-with-parenthesis-followed-by-an-or .  running the subshell as a background task and immediately waiting for it, like a 1process forkjoin.  Nuts.

lunes, 2 de septiembre de 2019

Migrating from vim (proficent) to emacs

In HN's thread about 26.3 being released (Congrats!), there's this guy  explaining that being already quite confortable with vim, it's too much of a commitment to move to emacs.

I remember the frustration when coming to emacs from an advanced vimmer POV: no "yyp"? no ":%s/foo/bar"? imap? But here's what I answered him:

As this is not an overnight conversion and you are quite proficent with vim already, my advice is to:
- Get used to type "emacs file.txt" instead of "vim file.txt" in your console.
- Have a function in emacs that opens the current file in vim for those moments where you just want your trusted environment. Writing it by yourself is a good focused learning experience.
This way you'll decide (and balance) how much you want to learn every day, and little by little you'll find yourself using that function less and less.

And I think this goes very well with my other "bootstrap your emacs lisp learning".

It's the same approach to most of my development (and life) efforts.  It's a function of how bad do you need it, how fast do you want it, the compound interest of starting early, and how much it slows you down (or blocks you for doing other things).

miércoles, 21 de agosto de 2019

Taming zoom with ratpoison

If you use a manual tiling window manager (ratpoison), chances are zoom is misbehaving when you want to minimize it.

The minimized window steals the focus and you can't do anything while the window is minimized.

If the window is maximized you have to manually corner it somewhere (at least wasting 25% of your screen).

But! I found a way to use zoom while letting you work while you don't see the screen.

It's a tiny shellscript that pinpoints the Zoom full window, and then relegates it to a 1 pixel window on the top of the screen.  Very simple, but it works wonders for me.

miércoles, 7 de agosto de 2019

the simplest bookmark manager ever

So this is not even a bookmark manager with proper tags or anything.

It's just a stupid combination of shell tricks that compose into a quick memo browser.

I guess I'll keep reinventing program launchers and fuzzy finders till I die (first ratfinder version being from 2006)


jueves, 4 de julio de 2019

postgres indexes

I'm progressively more convinced PostgreSQL is my next "emacs", as in "a tool I'm addicted to and I'm determined to find out everything about it".

I'm starting with some of the internals, and some deep descriptions about its various types of indexes.  Those pages provided me a bunch of hours of reading and knowledge on postgres internals.

http://www.louisemeta.com/blog/indexes-gin/
https://habr.com/en/company/postgrespro/blog/441962/
http://www.interdb.jp/pg/

Also, this week I read somewhere that postgres was first written in Lisp! I guess it shows when you run EXPLAIN on a query. I just confirmed it for a fact. :)

miércoles, 3 de julio de 2019

who's next?

Queues is a pretty fascinating topic.

- https://www.braze.com/perspectives/article/building-braze-job-queues-resiliency
- https://www.youtube.com/watch?v=1bNOO3xxMc0
- http://www.treewhimsy.com/TECPB/Articles/SevenInsights.pdf
- https://www.johndcook.com/blog/2008/10/21/what-happens-when-you-add-a-new-teller/
- https://clojuresync.com/zach-tellman/?__s=syke5mi2pqufm5d27m7f

lunes, 1 de julio de 2019

What's dat?

I still don't know exactly, but it looks very interesting, in a similar spirit as Scuttlebutt:

- https://www.kickscondor.com/on-dat/
- https://github.com/datprotocol/how-dat-works
- https://dat.foundation/
- https://datprotocol.github.io/how-dat-works/