domingo, 29 de noviembre de 2020

A pipe inspector with tee

I've kept writing my scripting-field-guide, adding some more common pitfalls and cool tricks I've used in the last years. 

Something I started using not long time ago is the "tee >()" incantation. It's super cool to be able to branch off the output of a command to another command, and make some sort of tree. 

For now, there's this snippet I created to be able to inspect the contents of a pipe:

The default to the current timestamp isn't going to really work, as the string is evaluated only once, but I hope I'll get something more decent soon.

Another cool usage is when selecting something from a grep/fzf/dmenu and you want to do something with it like open that file, but also copy it to your clipboard.

The clearest example is my daily-zoom-selector, where I'm not just opening the room, but also copying it.

domingo, 15 de noviembre de 2020

Programming with Constraints

I've been following https://www.hillelwayne.com/ for some time and there's always something valuable to take to your daily life from each one of his posts.

Highest level is queuing theory and TLA+ stuff. But the couple of articles that touched home the most are his J lang article and the decision table patterns (and its intro from long time ago). 

He uses productivity tools that reasonate a lot with my way of tooling. AutoHotKey, editors, minilanguages and, Constraint Propagation Systems.

On CPS, he talks about MiniZinc and OR-Tools. For me, Oz/Mozart rang a bell (from CPM book), and cl:screamer. I don't know if Z3 overlaps with it, but worth mentioning too.

Now onto my usage/takeaway of this: I used screamer to create a magic-square some time ago, and last week I was thinking if I could use screamer, Prolog, or PiLog to solve the coin change problem.

Well, as just today, I read about this MiniZinc tool and when this watching the MiniZinc videos, it was clear that yes, it should be possible, and it might be worth to try the coin change there. Here's what I came with (using screamer):



I haven't figured out how to do the performance analysis of this, but I suspect it will be less efficient than the usual manual way, because the only 'fitness' function is v=, but it's a complete hit-or-miss. once the current factors add up to an already bigger num than out target, this algorithm will keep trying "what if I add one coin of 1cent?", "and what about 2?".  

IIRC, in CPM, there are some explanations of smarter CPS, but I'm not sure if they apply here, as there is only a single 'cut', which is the final objective function.

viernes, 13 de noviembre de 2020

Flow State

I've been subscribing more and more to newsletters lately. It's kinda RSS on your mail.

I discovered (in https://subreply.com, which is an "interesting" social network I tried once) this Music Newsletter called FlowState. And boy, it's SO GOOD. Relaxing non-vocal flowy music every day.  There's jazz, there's (psy-)?ambient, new-age, tribal, house,... I'm surprised every day by a couple of playlists I can snap into spotify and start working.

Of course, reading mail in emacs makes that you can just automate the shit out of it. It placed my radios repo in a clear 2nd place on my daily music listening.

Here's an example of a great thing that appeared yesterday in Flow State. Anthony Braxton: Six Monk's Compositions (1987)


Enjoy.

martes, 10 de noviembre de 2020

On Writing

I've lately been a bit interested in writing style. The triggers were a couple of things:

1) People in my $ENV abusing extremely indirect-passive I-am-not-that-involved I-dont-give-many-fucks-but-I-talk-academically-to-seem-that-at-least-I-am-thoghtful.  Yes, the problem probably lies in me, but I digress.

2) I discovered this writing plain English. This page is short, to the point, and I found it amazing that you can apply 99% of it to programming, and behaving, and many planes of your daily life. It caused a big impact. It's like a Fowler's article masked as an English writing guide.

3) https://news.ycombinator.com/item?id=41298774

Then "The Internet" started throwing links and videos at me about writing effectively, like this Steven Pinker one, or this other one aimed at academics writing articles, but with interesting insights from the University of Chicago. Also, did you know that George Orwell has a very cited text on English style? I didn't. But it's cool.

So, I haven't read 'The Elements of Style' or plan to (for now), but I can recommend all 4 links here. You can ingest them in a single day, with your non-tech-geek SO, and have thoughtful discussions. Long term, if something sticks, great.  Else, you write a blogpost about those links so you can reference and reread them later on. :)

Addendum: https://www.julian.com/guide/write/intro looks like good advice also