miércoles, 14 de octubre de 2020

An emacs' Feature Development

So, in https://lists.gnu.org/archive/html/emacs-devel/2020-10/msg00691.html there's a proposal for an optimization in emacs, adding empty-directory-p so that elisp users don't have to (null (directory-files dir-name nil 'nodots t))).

And it makes sense to have a faster way. The person that proposed this improvement proposed a solution too. And it was a good one!

Then, Eli proposed something else. Some alternative implementation that:

  • Allows to solve the problem at hand, 
  • Reuses existing code by adding a 'limit' to directory-files
  • Easier to implement
  • Makes the implementation more stratified. You can still create empty-dir-p by calling directory-files
  • in case of passing that limit count to directory-files, we still get a list of files instead of a boolean. It's richer information, in case we need it.

After that, the conversation goes on by trying to figure out if the partial list of files will be useful at some point, or it's adding indeterminism and no value, and finding a balance on simplicity and usefulness. 

All in all, a very good end-to-end conversation about a feature, its implications and its implementations with its corner cases and usability. Every time I see these conversations happening I feel this joy... I love when they happen in my team.

PS: Needless to say, this is a "simple" feature compared to bigger and more complex discussions going on in emacs-devel (which are hard problems that have no perfect solutions). But it's a good case study and there's something to be learned there about approaches, discussions, and building together.

Thanks to everyone involved!

sábado, 5 de septiembre de 2020

Radicle: Secure peer-to-peer code collaboration without intermediaries

That's a pretty neat project I've stumbled upon. Radicle.

It tries to do a really distributed code management solution by building upon a few concepts I consider super interesting and rock solid. 

I'm gonna be throwing a few keywords that lighted up when reading about it (they might or might not appear as direct references in radicle's articles).: 

  • Git 
  • Merkle trees 
  • P2P 
  • gossip protocols 
  • IPFS 
  • Scuttlebut 
  • pijul 
  • nix 
  • Rust 


That's a lot of cool stuff! I wish I had a bit more time, but lately I'm so much into Red language that I devote 80% of my free time to it. Still learning the basics of its toolchain, but it seems very impressive to me so far.


And here is something totally unrelated, but I enjoyed it so much I have to post it somewhere. A reverse engineering video of Contra (NES videogame from the 80's), with explanation of the konami code.

lunes, 20 de julio de 2020

tangling files with org-mode

I've been inspecting this repo https://github.com/kinnala/nixpkgs, and it was the first time I looked at the org tangling. Quite simple to do so:

Mostly using ":mkdirp yes :tangle path", is like doing a "cat block >>path". And you use (org-babel-tangle) as the exporter

#+begin_src elisp :mkdirp yes :tangle ~/.emacs

jueves, 16 de julio de 2020

export all variables in bash

If you have a prefix, the coolest way is like the following:

export ${!KONG_*}

If you want everything:

eval $(printenv | awk -F= '{ print "export " $1 }')

miércoles, 8 de julio de 2020


This is so amazing I don't want to lose it:

A Smalltalk-80 VM written in LuaJIT, that boots the images from the eighties:

Approachable tutorial on JITs. The second part talks about metatracing.

I recently discovered this guy and he's awesome. Haven't particularly examined this repo, but please, also check out his other stuff.

lunes, 29 de junio de 2020

Checking Password Strength in 10 Lines

Talking about dependencies, there's this simple case:

To check password strength, we want different min lenghts for passwords depending if they have lower, upper, numbers, and simbols.

For this, there's passwdqc that allows you to do it in a very simple way,  but, do you really need a library?
Here's the minimalistic implementation I came up with, which I think is pretty decent, and again, has some nice property I can't quite describe.  The code is lua, but it can of course be translated to anything.

It has minimum lenghts for the passwords depending on the amount of different classes of characters it contains. If it only contains 1 type, we don't accept. for 2, minimum length 24,....
   local str = io.read('*l')
   local d = str:match("[0-9]") and 1 or 0
   local down = str:match("[a-z]") and 1 or 0
   local up = str:match("[A-Z]") and 1 or 0
   local s = str:match("[!@#$^&*()_=+-]") and 1 or 0
   local l = #str
   local defs = {math.huge, 24, 11, 9}

viernes, 26 de junio de 2020

Some Thoughts on Ergonomics and Compression

A recent personal take on ergonomics and compression:

Why is vim so addictive, and somehow it's difficult to explain to non vim fanatics? I think it's a reification of the process of walking through a text file and doing stuff to it. A concrete way to talk about processes onto text files. Some feel it is strictly superior to GUIs because you can get ahold of it. you can write it down, put it in a postcard, and you have a handle to it. You type it again and it works. there's no syntax or fuzziness or stuff that can go wrong (TM).

Next question: Can you ahold an algorithm in your head? in the same concrete way you hold 'yypVr-'?

I'm lately quite interested in Array Languages and I'm reading some snippets of Apl/J/K. And the feeling is the same. Everything else looks so wasteful and error prone like the point-and-click looks to vimmers.

Shuffling a vector – breaking ⍵ down into ⍺ pieces from which another vector is built by merging. E.g. if is 'abcdefghij' and is 3, the pieces are 'abcd', 'efg', and 'hij', and the result is 'aehbficgjd':


The ergonomics are pretty different from what we're used to, but there's definitely an emergent property there. It's not just "it's shorter to type".

martes, 26 de mayo de 2020

Perl & Ruby do APL

So recently I saw a couple of posts that mention APL approaches to problems. The cool thing is that I saw those in a Perl related forum and a Ruby one.

- https://www.youtube.com/watch?v=UBl6t7zNfwE
- https://zverok.github.io/blog/2020-05-16-ruby-as-apl.html

jueves, 7 de mayo de 2020

Temporally Quaquaversal Virtual Nanomachine

I've enjoyed this talk so much I'm gonna post it here: Great as always, Damian Conway doing his particular 'GEB' on physics and programming: https://www.youtube.com/watch?v=ORjyXcLDd9M

Also, Keep Ruby Weird 2018, the same as !!Con, very interesting talks.

miércoles, 6 de mayo de 2020

Recreational vimming

When I have to do some sort of development or file editing inside a container, I usually have vim there but not emacs. docker-tramp is very useful but sometimes I just want to edit there.
The .vimrc I have in my container has only one line (I can't function without it):
imap jk 
Let's say I'm editing a lua script. After I've saved and c-z and run the file several times, I realize what I want is to have is:
:nore ,rr :!lua %
Then I can test it much quicker. But I realize I'm always :w before,rr. Colon, up, and modify the line to:
:nore ,rr :w:!lua %
Accidentally I quit vim and realize I have to set that again, so I go to my vimrc and add this:
nore ,rr :w:!lua %
nore ,vimrc :e ~/.vimrc
nore ,so :source ~/.vimrc
With this I have a pretty nice way to iteratively finetune my config. After some lua editing, the only thing I need to do often (and not provided by the excellent vim default functionality) is to comment and uncomment code.
nore ,cc :s/^/--/
nore ,cu :s/^\( *\)--/\1/
This gives normal and visual comment/uncomment functionality, and enough interactivity to build your ad-hoc shortcuts as you go.
This is an example that just happened yesterday, and the nice thing is that it grows and flows from 0. I couldn't get to this amount of functionality from an emacs -Q in such a small time. It has such a different feeling to configuring emacs. It reminds me of my Perl days, it's fun and quick. And the language is very orthogonal, with very few abstractions. It's the APL of text editing.

This is my take on this reddit thread. 

domingo, 26 de abril de 2020

What's in a git merge conflict?

There's something that was bothering me lately about git conflicts:

How come git knows which side is which, and when there is a conflict or where there isn't?

I have the notion of the common ancestor to base the versions off of, but when people do heavy cherry-picking (which is mostly a single branch operation).... how come git reconciles the contents?

Well... as usual, things in git are..... simpler?


lunes, 13 de abril de 2020

John Conway's Game of Life

John Conway passed away recently, so let's look at his Game of Life from the APL/J/K perspective.


And a recent ode to J, that explains the first prototype that Arthur Withney and Ken Iverson wrote in an afternoon. I remember having great fun deciphering it 3 years ago on the flights back and from $WORK at that time, and people staring at me reading that printed code and WTFing.

viernes, 3 de abril de 2020

Indeterminate dimensionality

From: http://www.wall.org/~larry/natural.html
Scientists like to be able to locate things by giving a ``vector'', that is, a list of coordinates in a space of known dimensionality. This is one of the reasons they like orthogonality--it means the various components of the vector are independent of each other. Unfortunately, the real world is not usually set up to work that way. Most problems, including linguistics problems, are a matter of ``getting from here to there'', and the geography in-between has a heavy influence on which solutions are practical. Problems tend to be solved at several levels. A typical journey might involve your legs, your car, an escalator, a moving sidewalk, a jet, maybe some more moving sidewalks or a tram, another jet, a taxi, and an elevator. At each of these levels, there aren't many ``right angles'', and the whole thing is a bit fractal in nature. In terms of language, you say something that gets close to what you want to say, and then you start refining it around the edges, just as you would first plan your itinerary between major airports, and only later worry about how to get to and from the airport.

lunes, 30 de marzo de 2020

Simplicity is its own reward

This is 3 top level hackers discussing about a patch that Stefan proposed to an already solved problem (I guess originally by Daniel, or someone else, but Daniel is anyway the father of the pdump feature).

Amazingly classy and to the point. All 3. I'm learning so much reading this maillist. And still a lot to learn.

Bravo, and thanks.

Stefan Monnier: >> Any objection?
Eli Zaretskii: > What are the advantages?  The original problem is solved, and
> everybody agreed that having a dead buffer in the pdumped area is
> nothing we should bother about.

Daniel Colascione: With Stefan's patch, Emacs is simpler. Simplicity is its own reward.

Original thread: https://lists.gnu.org/archive/html/emacs-devel/2020-03/msg00922.html

domingo, 29 de marzo de 2020

personal journals

 I've been sorta writting a personal engineering journal for some time now, and it's quite valuable. The most productive people I know rule their lives via bullet lists, and journals.

Here are some recent links talking bout them. Also, if you look for org-mode articles, you'll find some interesting workflows.

  • https://fs.blog/2014/02/decision-journal/
  • https://blog.trello.com/decision-journal
  • https://neilkakkar.com/the-human-log.html
  • https://neilkakkar.com/How-to-see-Systems-in-everyday-life.html

Links on JITs

If you're interested in JITs, here I leave some recent links that talk about different approaches and techniques. I don't understand many of them, but they might be useful for future reference.

  • https://abe-winter.github.io/2020/03/28/jitu-brutus.html
  • https://developers.redhat.com/blog/2020/01/20/mir-a-lightweight-jit-compiler-project/
  • https://akrl.sdf.org/gccemacs.html
  • https://news.ycombinator.com/item?id=22711391

jueves, 19 de marzo de 2020

TRAMP with docker is awesome

There's this recent post in reddit where the author shows how to chain tramp connections. And it's great indeed!

What I'm using TRAMP more often for is to login to containers.

Using docker-tramp, I usually browse into a docker and start dired there. But then, I can open a shell (or eshell if there's no bash) there.

And, for example, if you run a postgres container, why not opening a `sql-postgres` buffer?.


docker run -e POSTGRES_PASSWORD=a -e POSTGRES_USER=rgrau -ti --rm postgres

and when dired-ing through tramp, m-x sql-postrgres using the appropriate params.  Tada!

Neat, ain't it?

Happy hacking, and stay safe.

pipes on steroids

I though I had blogged about that before, but I can't find it anywhere, so I'm just gonna put it here (again?).

Pipes are great. You know that, I know that, everyone knows that. Because/But they are restricted to linear, non conditional flow.

Sometimes, I'd like to have an out-of-band pipe that bypasses a command in the middle, and there's no clear way how to do it.

So here are a few links on how to use file descriptors for advanced use cases. You can use them for this, and for other smart stuff in shells.

  • https://catonmat.net/bash-one-liners-explained-part-three
  • https://wiki.bash-hackers.org/howto/redirection_tutorial
  • http://tldp.org/LDP/abs/html/ioredirintro.html
  • http://catern.com/posts/pipes.html
  • https://mosermichael.github.io/jq-illustrated/dir/content.html
  • https://news.ycombinator.com/item?id=21700014 ( https://www2.dmst.aueb.gr/dds/sw/dgsh/ )
  • http://dongyuxuan.me/posts/pipeline.html 
  • https://stackoverflow.com/questions/2990414/echo-that-outputs-to-stderr
  • http://www.tldp.org/LDP/abs/html/io-redirection.html
  • http://wiki.bash-hackers.org/howto/redirection_tutorial 
  • https://news.ycombinator.com/item?id=22704774

domingo, 15 de marzo de 2020

reverse engineering courses

Maybe one day I'll get back to reverse engineering. Just in case that happens, I'm just stashing useful links:


martes, 25 de febrero de 2020

not all containers are made equal

So if you want to give another spin to your container knowledge, you know there are a few projects that relate to containers and are not just docker.

- https://wiki.archlinux.org/index.php/systemd-nspawn
- https://voidlinux.org/news/2017/12/advent-containers.html
- https://www.infoq.com/articles/containers-hypervisors-2019/
- https://github.com/p8952/bocker
- https://dev.to/napicella/containers-from-scratch-in-18-lines-of-code-3pmn
- https://ericchiang.github.io/post/containers-from-scratch/
- https://news.ycombinator.com/item?id=15608435
- https://www.ardanlabs.com/blog/2020/02/docker-images-part1-reducing-image-size.html

And here is a cool 'build-your-own-docker' talk

jueves, 20 de febrero de 2020

Larry Tesler RIP, Bert Sutherland RIP

Very sad week for our field. Two great great great pioneers on the computer science, human-computer-interface, and thought advancing concepts left the analogic world.

There are a bunch of stories in these HN links:

  • https://news.ycombinator.com/item?id=22361282
  • https://news.ycombinator.com/item?id=22370667

jueves, 13 de febrero de 2020

Transitive closure in k, and more

I found this gist on finding reachable nodes in a graph super entertaining. Every time I read on APL/J/K I feel this intense deep puzzle solving that heats my brain a little bit, but feels awesome when you arrive at the end. And it all makes sense there.

About 10 years ago I was having those feelings with the Shwartzian transform and JAPHs around the net.  Perl is the gateway drug.

Btw, if you want some more, https://www.youtube.com/watch?v=v7Mt0GYHU9A or https://www.youtube.com/watch?v=hzPd3umu78g .

lunes, 10 de febrero de 2020

spicing up your prompt

I've been using this very silly overloading of the prompt for some time, and even though it's dead simple, it gets to cheer me up sometimes.

On every emacs startup, and every 24 hours, you get  a different message on your prompt when 'm-x'.

Happy hacking,

domingo, 26 de enero de 2020

disable screen blank/sleep on idle

I've finally switched to more barebones linux distros again. Now I'm on NixOS and Void.

Void is minimalist and lightweight, with a textual installation process, like vectorlinux had (using text dialogs and menus).

I just found out that the way to keep the screen from going blank after some mouse/keyboard idle time is  xset s off -dpms. That saves you from any ad-hoc command line fu when watching movies with that girl.

jueves, 23 de enero de 2020

Latest Awesome Emacs Developments

In the last month or so, a great wealth of new Emacs stuff has been developing in both core and community.

We know that in free software projects (communities, that is) some branches might take a long time to develop, but some others

tree-sitter: Integrating this project opensourced by github. This could mean a new way of syntax highlight that doesn't drag, smarter indentation, and completions. Eli mentioned it in the emacs mail list and people are looking into it.

Yet another jitter, by Andrea Corrallo.  Another approach to make emacs' elisp code run faster.  There have already been many attempts to this (Guilemacs, "El Compilador", and others). Will this be the one?  From the highest level perspective, I like "el compilador" the most, because it's kinda smalltalkish, but hey,... I don't have the knowledge to hack on any of those, so whatever the wizards pick, I'm good with it. Also, see mailing list.

SystemE : Replace Systemd with runit? nope, geekier.

Emacs Application Framework because you can also have proper gui controls.
Animations in elisp (text)

OM. higher level org parsing

doct declarative org-capture templates.


So there's a new article on the internet about META-II!  And not just that, but it also talks about Forth!  And not just that, but it also talks about raku!

That thing alone already deserves a detailed browsing of the whole blog.