sábado, 22 de enero de 2022

Postgres AoC

Here's a link I don't want to lose, a thread about amazing people doing Advent of Code in Postgres. If you ask 'why', you're probably not the good audience for that anyway.

https://news.ycombinator.com/item?id=29467671

sábado, 15 de enero de 2022

Classless CSS

So, this is really a thing: Like, IDGAF about CSS, but want my site to look slightly more modern than danluu's page.

https://news.ycombinator.com/item?id=29929438

 

Nice, nice, nice

domingo, 31 de octubre de 2021

What Terraform is NOT

Both https://cuddly-octo-palm-tree.com/posts/2021-10-10-tyska-terraform/ and https://news.ycombinator.com/item?id=29020460 touch on this topic I was a bit surprised when I started looking at terraform.

Your "code" won't be agnostic to the cloud you use. So I think it shares very little with the properties of "code" I usually assume.

Still, it's a good tool that gives a language and a syntax to talk about a set of infrastructure things. But given I've heard stories about the dependency graph not being really reliable (and for sure I've already seen deploys gone wrong in the middle of the process), I ask myself if it's really worth it (for smallish infrastructures).

A nice thing I felt when using it is the fast feedback loop when trying stuff. being able to test something new from a fresh aws account using plan,apply,destroy in 5 minutes.  That's super cool indeed

martes, 19 de octubre de 2021

Terraform and aws batch: empty env variable disappearing

So I had my dose of head scratching today when noticed that if you set an environment variable to the empty string for an aws batch job, aws ignores it, and next time you terraform plan, terraform will think it is out of sync, so it'll tell you it has to add that value again


miércoles, 13 de octubre de 2021

awk is cool (again)

Awk is lately appearing in HN more often.  I quite like awk, but having gone through Perl, bash, awk, I see people praise awk for being a POSIX compliant enhanced scripting language.  And while being true, I don't think this matters much to the commenters. They see it as an improved bash. And I think we're repeating the history.

Shortcomings that people see in bash, or awk, are solved in Perl. But people dismiss Perl for some reason, and they (we) are going to rediscover it in different forms. Perl is so optimized for scripting that it's really hard to beat. And it has a awk-like mode, so you can easily do the "/pattern/ {action}" thing.

 

Still, here are some threads on awk, with mentions to Perl.  I specially liked K (from K&R) awk.help file. That guy knows how to write!


https://news.ycombinator.com/item?id=28707463

https://earthly.dev/blog/awk-examples/

https://www.cs.princeton.edu/courses/archive/spring19/cos333/awk.help

 https://ferd.ca/awk-in-20-minutes.html

https://www.gnu.org/software/gawk/manual/gawk.pdf

http://www.cs.unibo.it/~sacerdot/doc/awk/nawkA4.pdf

https://ia803404.us.archive.org/0/items/pdfy-MgN0H1joIoDVoIC7/The_AWK_Programming_Language.pdf

miércoles, 29 de septiembre de 2021

Shell Tricks: ripgrep -U and $(!!)

Because learning the tools is an ongoing task, just two simple helpers for your daily terminal usage:

Finding matches in two consecutive lines. I used to do that in Perl, using multiline matches, but it involves remembering the Perl one-liner incantations....

 Well, I found that rg -U enables multiline matches, so you can do stuff like:

rg -U 'doseq.*\n.*deftest' test

To find tests wrapped in doseq.

Another cool shell trick I discovered by myself was $(!!).  

I have this helper function that greps my $HISTFILE, to find old usages of commands. I use it like ctrl-r, sort of:

rg --no-filename "$@" ~/.zhistory

I use it sometimes with fzf, and many times, when I select the commad, I realize I want to run it.  Well, there are more optimal ways to do it (fzf can run the command), but I liked discovering $(!!), that reruns your last command (the rg ..|fzf), and will run its output.


martes, 28 de septiembre de 2021

The “Two-And-Done” Rule

This one is something that depending on the moment you think about this you might agree or disagree, and it's like those optical illusions that when you think "right" the images rotates to the right, and when you think "left", it does to the left.

The principle of "two and done" is a guiding tenet to keep yourself sane, on your toes, and put things on perspective to not give an unwarranted amount of importance to things that do not have them. 

Even if "someone is wrong on the internet", knowing when to stop arguing can feel like "not driven enough" on my side, but it can feel also like a liberating proactive empathic way to problem solving.

So the Two-And-Done rule was born, wherein I will state my case the first time, and if whoever is arguing to the contrary does not agree after hearing my position, I’ll let it go. But the next time the opportunity comes up, I will argue my point again. Maybe allowing for a gap of time for people to consider my original point, or maybe allowing me time to refine and rephrase my ideas to be more convincing.

If I fail to get my way after the second time though, I am done. I will even say as much to whomever I am debating if they are the final decision-maker. I will say something like, “OK, let’s go your way then. I still don’t completely agree with everything proposed here, but I think I’ve made my case, and we need to move on.”

Yielding in an argument like this has some weird, powerful effects. One is, it kind of releases you from responsibility if things should go wrong. And if a truly bad decision has been made, it is actually pretty likely that things will start going wrong. (Important Note: If you fail to convince people after two tries, you really do have to get behind the decision, and not try to sabotage or undermine it)

 

The pretty important part is that you have to get behind the decision.