domingo, 29 de noviembre de 2020

A pipe inspector with tee

I've kept writing my scripting-field-guid, 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:

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.

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

viernes, 30 de octubre de 2020

The Web 2.1

I've never done any kind of smart frontend. My Rails experience was more inside lib/ and app/{models,controllers} than in app/views or assets/ . 


Over the years I tried a few frameworks to see if any of those 'clicked', but I didn't give time to any of them to sink in.

I the re-frame tutorials, but I didn't have any project of any size to try it.

I tried mithrill.js when I wrote my ultimate F5 crusher.

Long time ago I also gave a shot at intercooler.js, and seemed a very orthogonal, low-risk library to sprinkle pre-baked js into elements.  And found in HN that its author moved to develop htmx.

Fast forward to this week. The article "If not SPAs, what?" in HN brought up htmx again, and it was paired with alpine.js, tailwindcss, and others.   And it seems there's a kinda underground trend following the approach of totally detattched js/css on top of old classic Rails/Laravel/Django/YouNameIt. 

Maybe this time I'll swing along with the pendulum.

jueves, 29 de octubre de 2020

Systems, Fun, Code, Dread, Drag, Chaos, GOTO 10

Here's a weird post (the links are good though).

While usual ups and downs in life and work, I try to keep my information intake as regular as I can. When I keep reading and learning from the sources I know do bring me balance, I'm giving the opportunity to get back to my regular ok-state.

 Mood is a reinforcing feedback loop (self-optimizing machine), and if you don't cut it, it can tilt the system and change the equilibrium to a completely different point. And picking the right inputs help me slowing or reverting the feedback loop.

  Few weeks ago, by a friend's recommendation I watched this talk by Jens Mönig , and today this one from _why. And talk about learning, and the fun, and the big ideas that make our profession something like explorers, tinkerers. They both question some of the pains we take for granted as inherent complexity of programming, when they are mostly incidental.

  And it's "funny" I'm taking _why's inspiration, because at some point, he disappeared from the scene. Not sure about the reasons, but probably burnout? And we go to a grey-ish article about Surviving disillusionment.

  The Soul of A New Machine, we see a case of engineering, business, pressure, people enjoying their craft at the same time that they are suffering the extreme contraints of time, tech, decisions made from upwards. But they thrive. And thriving is also a reinforcing feedback loop.

  An internet person that helped me get up in a bump I had a few months ago is Jeremy Howard and his fastai courses and code. I saw him and I could easily take him as a model for how to code, approach problems, teach people, communicate, research (APL!), and even use vim! :) And it's very sad that he got bit by today's off-the-charts Code of Conduct policies and wrong-handling-gone-out-of-hand. I feel extremely sorry for him.

  Another thing that happened recently to me is reading CHAOS by James Gleick. And again, patterns from randomness. Learning about chaos in order and order in chaos. They are part of what we are.

  We like seeing patterns, seeing patterns when others just see noise. It's listening to jazz. And it takes time to teach your ear or eye on seeing those patterns.*

  You see a series of numbers, and there's interference. or the series does not stabilize anywhere. First thing you try to do is find a pattern. Do the numbers grow always? Do they alternate between positive and negative? Maybe they are converging?

  When things do not line up yet, you try to add a dimension there. Do they move faster every time (no matter if up or down)? Can I imagine the derivative of it being constant? or, is it the derivative of something that might have a pattern?

  Can, that derivative be seen as a series, and try to apply the first analysis again? is it always growing? more extreme?.....  (That feels like the enhanced optimization algorithm in "Why Functional Programming Matters").

  So, ups and downs come in patterns, and sometimes their ups and downs come from very concrete explainable things, and sometimes they form out of a small disruption, or they start a turbulence of crazy chaotic ups-downs.

  If not understanding it, can we foresee the chaos coming from a pattern of ups and downs? do we see a pattern, a f'(x), f''(x)? Are we approaching a singularity?

  Fuck if I know.


  * If we apply the learning lessons from _why and Jens, even if there has to be a basic intuition, it shouldn't be hard to see those patterns. But it is.

miércoles, 28 de octubre de 2020

Some Tcl

Wanna spend an afternoon learning a scripting language that you didn't know about?

 

Tcl has appeared in HN recently a couple of times, and every time I read about it I remember that great article by antirez showing some very cool features of Tcl. So The link that appeared in HN today was a book by Hal Abelson and Philip Greenspun. 

 

In the intro, It's funny how they compare Tcl and Lisp.

 

Anyway, the links: 

  • http://antirez.com/articoli/tclmisunderstood.html
  • https://philip.greenspun.com/tcl/index.adp