Recent Changes

Updates since 2020-04-28 03:06 UTC up to 2020-07-27 03:06 UTC

1 | 3 | 7 | 30 | 90 days
List all changes Include rollbacks Include minor changes
List later changes RSS RSS with pages RSS with pages and diff

2020-07-26

  • 08:05 UTC (new) (history) 2020-07-26 Running Node.js scripts from the command line . . . . mbork A few days ago I accidentally ran Node.js from the command line with a wrong argument. I had a script – call it myscript.js – in a directory called myscript. I typed node mys in the directory one level higher, pressed tab and ended up with node myscript/, then pressed enter and got an error (obviously). So, I then cd​‘d into the right directory and (without much thinking) pressed up twice and enter. To my surprise, the script ran. What is going on?

2020-07-19

2020-07-13

  • 20:42 UTC (new) (history) 2020-07-13 Miller - a csv Swiss Army knife . . . . mbork I often need to work with csv files. Until recently, my go-to tools to do most things with them were Emacs with csv-mode (when I need to interactively edit simpler csvs, LibreOffice (when I need interactivity and more complex things, like multi-line cells, which are not supported by csv-mode), and xsv (when I need to automate some transformations, like selecting a subset of columns, changing the order of columns and other things). Some time ago, I learned about another csv-related tool: Miller.

2020-07-06

  • 17:51 UTC (new) (history) 2020-07-06 Auto renaming image files . . . . mbork Like probably everyone else, I have lots of pictures from digital camera(s). Cataloging them is basically a nightmare, and I lost any hope for doing that manually a long time ago. But why not make the computer do as much work as possible?

2020-06-27

  • 11:51 UTC (new) (history) 2020-06-27 Selective display . . . . mbork A few days ago I was working with some large JSON files. The top level of the file contained a large array, and each of its elements was a large object consisting of numbers, strings and other objects. I needed to work with a few elements at the top level of those objects, and did not want the lower-level objects to get in the way. In other words, I needed to hide them somehow.

2020-06-22

  • 21:03 UTC (new) (history) 2020-06-22 lodash iteratee shorthand . . . . mbork As is widely known, JavaScript is a language with good semantics, not-so-good syntax and a terrible standard library. There are a few modules that aim to help with the last part, and lodash is one of them that I happen to use. It is a very nice thing, but is not necessarily easy to learn for newcomers. One of its nice features is so-called “iteratee shorthand”, mentioned many times in the docs. What is that? Well, Lodash has (among many others) the _.iteratee function. It accepts one argument and returns a function. If the argument is a function, _.iteratee just returns the same function – nothing interesting (and if given null, it returns the identity function). The first interesting thing happens when the argument is a string or an integer.

2020-06-15

  • 20:51 UTC (new) (history) 2020-06-15 Emacs, Org-mode, Beeminder and pomodoros . . . . mbork As some of my readers probably know, I am a happy user of Beeminder, and I even wrote my own Emacs- and Org-based Beeminder client. For some time, I’ve been thinking about somehow incorporating the famous pomodoro technique into my productivity quiver. The problem was, I did know how exactly to do it. Until today.

2020-06-08

  • 20:11 UTC (new) (history) 2020-06-08 Emacs as a (very simple) CAT . . . . mbork From time to time, I need to translate something (usually from English to Polish). Being an Emacs user, I obviously do the typing in Emacs. However, translating – as opposed to writing – has its own set of challenges. One of them is that I need to have two texts on the screen, and track my positions in both. While the “current position” in the active window is clearly marked with the point, this is not that helpful in the “other window” – while the point is visible there, it is usually not very prominent (even if you customize the cursor-in-non-selected-windows variable, which see). You probably expect where this is going to. Yes, I’m going to write such a tool myself.

2020-06-01

  • 06:20 UTC (new) (history) 2020-06-01 Node modules working as command-line scripts . . . . mbork Recently, I wanted to run one Node.JS CLI script from another. Of course, being in a hurry and KISS and whatnot, I decided to just use child_process.execFileSync with node as the first argument, but this is of course grossly inefficient. What if I could write a module usable both from the command line and other code? Well, it turns out that not only is this doable, but actually easy and robust.

2020-05-24

  • 08:17 UTC (new) (history) 2020-05-24 Two parameters and at least one required in yargs . . . . mbork I happen to write shell scripts in Node.JS quite often. They usually consume some kind of command-line agruments, and my library of choice to parse them is yargs. Recently, I had a situation where there were two parameters and it was required that one of them is given. A bit surprisingly, yargs does not seem to have an option requiredAlternative or something that says “of the following two parameters, at least one must be given” (it has a conflicts method and option, either of which can be used to say “of these two parameters, at most one may be given”, though). Happily, there is a simple way to enforce such a requiement due to the quite general “check” method.

2020-05-18

  • 20:19 UTC (new) (history) 2020-05-18 entr, a wrapper around inotify . . . . mbork Shortly after my post from last year describing how I use inotifywait to start programs on file change, one of the readers emailed me about an utility called entr. It is an extremely simple-to-use tool which just gets the filelist to watch on stdin and a command to execute when any of the files changes as CLI arguments – and that’s pretty much it. (That does not imply it is simplistic – according to its website, it performs some non-trivial stuff under the hood.) Thanks!

2020-05-11

  • 20:37 UTC (new) (history) 2020-05-11 Diffing and font-lock . . . . mbork I often work with diffs in Emacs. I usually do that within Magit, which highlights diffs in the usual way (highlighting deleted lines with reddish background, inserted lines with greenish background, and the deleted/inserted characters within these lines with slightly more prominent versions of the same colors). However, I sometimes use plain Emacs diff (e.g. to compare two fles not kept in Git), and I noticed an annoying thing: diff’s font-lock is applied on top of the usual font-lock, depending on the files’ syntax. While in general this seems resonable, in the case of LaTeX files in AUCTeX (where the font lock colors are especially diverse) this makes the diff completely unreadable. I was pretty sure that disabling the syntax font-lock would reduce the visual noise of the diffs.

2020-05-03

  • 07:08 UTC (new) (history) 2020-05-03 Help in read-string . . . . Marcin Borkowski Last week I wrote about making Emacs ask for parameters for lp when printing from pdf-tools. The only thing missing was some kind of help for lp, which is far from intuitive. I figured that it would be best if I could somehow make read-string display some help string when some key was pressed, even in the midst of editing in the minibuffer. (Preferably, the key would be C-h, which is Emacs’ default for “help”.) And guess what? This is Emacs. Not only is such a feature possible, it is actually built-in!

More...

Filters