1. 3

    Working more my little shell commands library inspired by the blog post sd: my script directory by ianthehenry. So far it’s enabled me to write re-usable scripts instead of a lot of the throw away code I was writing in the past.

    The big thing I need to figure out is how to best generate completions for zsh for commands implemented with my library. I’ve only done very basic implementation of zsh completion functions and so I need to figure out how to write something to provide the completions on-demand.

    1. 1

      Been inspired by the blog post sd: my script directory and want to implement something similar for my own use, particularly at work.

      Considering writing the dispatch program in a compiled language instead of a shell script, for performance reasons. This is particularly as I’m considering adding a --completion parameter that will be called by the zsh completion functions to get dynamic information based on the script command directory contents and I want this to be as near instant as possible.

      Trying to figure out which language to use that would be the easiest for me, as I don’t typically use language implementations with native compilation.

      1. 16

        This is more of a console based program than a CLI, but VisiData is an essential part of my workflow when dealing with structural data like CSVs. So much more convenient than using a spreadsheet like Excel and very effecient.

        1. 4

          I’ve never seen VisiData before - it’s amazing! Thank you!

          1. 3

            Paul’s doing a Strange Loop workshop and I’m so sad I have to miss it due to conflicting obligations.

          1. 2

            I’d be interested in learning how the compiler is bootstrapped. This says it is self-hosted, and so I’m curious to see how it is accomplished. I see there is a bootstrap directory with some C files with content that appears machine generated.

            1. 2

              The compiler has a C backend. Those C files are most likely output from the compiler compiling itself to the C backend to bootstrap on machines without a cowgol compiler.

              1. 1

                Ah, that makes sense! I missed the C backend part when I was skimming the docs. Very cool.

            1. 1

              The universal hooks thing is sometime I’ve been thinking about myself lately. I appreciate the power that advice in Emacs Lisp and would love that same power in my shell.

              I haven’t started implementing anything yet, because each time I come up with a design, the shortcomings are very quickly obvious.

              1. 2

                Kind of reminds me of Ken Thompson’s classic ACM Turing Award Lecture, Reflections on Trusting Trust. He talked about getting a Trojan Horse into the system via the C compiler.

                1. 2

                  It’s been a while since I last read that; it is indeed a classic.

                  Reminded me of a story a family member shared, they worked in a secure office, the sort of place with faraday cages and true air gapped networks. A breach had been detected in one of the offices and “everything with a microchip needs to now go in the shredder” they were informed as someone turned up with a big machine with teeth on wheels.

                  An entire room of equipment was destroyed that day to be replaced the same day due to it having lost all trust all because one machine on that network being potentially compromised.

                1. 3

                  I’ve really been enjoying Dave’s content on this channel. Even though I’ve not always been a fan of Microsoft as a company or Windows as a product, I’ve enjoyed learning about his experiences working on MS DOS and Windows during his time at Microsoft.

                  His series on Windows Task Manager (starting here) – which he was the original author of – was interesting. He even got permission from Microsoft to show some of the code. Very cool to see how he designed it to run under various constraints.

                  1. 2

                    I’m working on small tools in Rust to help me with my personal finance data entry. I’m really making progress in understanding Rust.

                    1. 1

                      I was able to make enough progress this weekend on my little CSV to Ledger importer in Rust that I am now using it to get caught up with my data entry for my Ledger to prepare for filing my taxes.

                      I’m really liking Rust more and more. And I even correctly used lifetime annotations and understood why I was using it as well!

                      I still have to better grok how to handle errors and the like, but I like Rust and the ecosystem in it, especially some of the really high quality crates like eyre, csv, regex, serde, and structopt.

                      Not bad for a weekend of work for someone still relatively new to Rust: https://github.com/travisbhartwell/financial-tools/compare/f1cb58e93729a4f7eb4c81fbc068ca29974adca8..c8caf40d05b6d30cb82c861d568d0a531f896661

                    1. 3

                      I recently lost (due to not having backups nor putting the scripts into source control) some Python scripts that I used to help with data entry and maintaining data for my files I use with Ledger CLI. I’ve learned my lesson, have set up a git repo and am rewriting what I lost in Rust. I know there exist other tools to do what I want, but this is more of an exercise for learning Rust than necessarily merely replacing the lost functionality.

                      Also, I need to upgrade my work Mac Book Pro to Big Sur, so I’m working on getting everything backed up and cleaned up and doing the upgrade there.

                      1. 4

                        Though this is a TUI-app and not a CLI app that many of the others in this thread are, I have to mention Visidata. It is so handy for viewing and manipulating csv files.

                        1. 2

                          In the Game State section, the author has this sentence:

                          Normally I avoid dataclasses on account of their being mutable, but here that’s what we need.

                          I wonder if frozen=True in the dataclass definition is not sufficient for their needs here. Both the data class documentation [1] and the similar documentation [2] for the popular attrs library’s parameter of the same name indicate that true immutability is not possible in Python.

                          If you want true immutability in your code, Python is not a language to guarantee that.


                          [1] https://docs.python.org/3/library/dataclasses.html#frozen-instances

                          [2] https://www.attrs.org/en/stable/examples.html#immutability

                          1. 1

                            It’s less that I want “true” immutability and more that I prefer the sorts of code patterns that you’d associate with immutability. In practice I use NamedTuples instead of dataclasses, but as you point out they’re not truly immutable. Usually they’re close enough though.

                          1. 2

                            VisiData is easily one of my top favorite tools I’ve discovered in the past couple of years. It’s my go-to whenever I deal with CSV or relatedly formatted data. Huge ups to Saul and co for an awesome project.

                            1. 1

                              At work, I’m starting work on a documentation project for a client, documenting how to use the particular software stack we’ve been working on for a while for them.

                              Also at work, I need to do some reworking of the build process of Riak Exploer to make our internal automated snapshot builds a bit more useful.

                              On the personal side, I’ve been wanting to start a new project. Though I’m sure there are already tools to do some of what I want, this is more of an exercise that just happens to be motivated by a real-world problem. I have an old back up drive that most consists of copies of data from home directories of old machines, going back well over a decade. I’m wanting to collate and move all of the useful bits to a newer drive (before this old drive dies). So I want to write a tool to index my drive. By file name. Find duplicates by content hashes, etc.

                              I’m thinking I want to do something with Python 3, I’ve not written a Python 3 project. I’m thinking Python 3 + MyPy + Hypothesis + Attrs + Click. I have an empty directory for the code. But I haven’t even gotten as far as writing a requirements.txt. Want to do that.

                              Are there any good examples of Python 3 first or only projects out there (applications, not libraries) that I can look at? I haven’t written much high quality Python code for a while now, so I’m out of the loop.

                              1. 2

                                xonsh is a shell writen in python3: http://xon.sh/

                              1. 5

                                I started work on an Emacs dmenu replacement for dwm a few weeks ago and I hope to release something this week. It’s now morphed into something that doesn’t use Emacs (it uses zsh instead). Funny how these things go.

                                As for the “why did I get into this” category, I’m going to write a new backend for Gnus to manage my paper database. I realized that they’re just “articles” and I want to mark them as read as well as make notes on them. I use Gnus and it seems like a decent fit for my needs (either that or it’s my hammer of late).

                                1. 3

                                  I actually wrote a dmenu replacement myself, originally about 7 years ago. I wanted a GTK window for it instead of the minimalist dmenu design. It was also an excuse to write an application in Haskell: gtkmenu

                                  I’d like to add fuzzy searching to it and clean up the code a bit, but it’s something that I use every day without fuss.

                                  1. 1

                                    Cool! I’ll check that out. Thanks for the pointer.

                                1. 8

                                  Or just use magit in Emacs, which automatically shows you a diff in one buffer and you edit your commit message in another.

                                  1. 4

                                    Yeah, magit is my favorite tool in a long time - the support for viewing staged diff chunks and operating on them individually - including discarding them if they’re just e.g. debug prints - is pretty great.

                                    It’s also being improved regularly, for example I like the new command for starting a new branch and cleaning up the current branch (probably master) after you’ve already committed some things - magit-branch-spinoff, that’s not in the online docs yet: github.com/magit/magit/blob/master/Documentation/magit.org – search for spinoff

                                    1. 1

                                      Thanks for sharing about magit-branch-spinoff. That looks useful! I haven’t been tracking what the new features in magit are, perhaps I should!

                                  1. 9

                                    … what am I doing? This is a question that never seems to bother me too much. The general rule is to just wake up and decide in the moment what to do. I don’t even know what I’ll be doing 30 minutes from now.

                                    Last week, we were on a week long road trip in / around Chiang Mai.

                                    This week, we’re on a beach for much of the week with 2 Russian expat families. The Russian fathers and I will be working from here, but that’s fine. :)

                                    As for actually getting something done … I’ve been working a lot on Mindy, a byte code compiler and VM for Dylan. We’ve now gotten pull requests from 4 people, some of them who hadn’t contributed to anything for Dylan before. I’ve also started bringing back support in melange, our C header parser and FFI bindings generator, for Mindy’s flavor of FFI.

                                    Mindy is a lot of fun to work with. The entire thing compiles in seconds, there’s no complicated bootstrap and the codebase is pretty clear. There’s a lot of easy things to do and clean up or fix or improve. It takes a very different approach to things than Open Dylan did. Open Dylan is an ahead of time compiler that tries to do a lot of validation and optimization. Mindy is not. It just tries to get you to experimenting as quickly as possible. (It’ll be fun to improve the error handling there over time and improve how it implements the type system.) Everything about Mindy is easier and that lets things move a lot faster.

                                    Also, my Github streak has now passed 1024 days.

                                    1. 2

                                      btw, you have a typo on your link to Mindy

                                      1. 1

                                        Woops. Was typing out all links manually … sorry about that.

                                    1. 2

                                      Work and Work-related:

                                      • Continue performance testing, bug fixing, and tuning the Riak-Mesos Framework
                                      • Tweak org-mode LaTeX export to PDF to have nicer work status reports

                                      Personal:

                                      1. 3

                                        Tweak org-mode LaTeX export to PDF to have nicer work status reports

                                        Yeah, this is on my list, too. I may try to squeeze the Tufte LaTeX package into the chain as well. If I have nothing interesting to say, I might as well say it beautifully.

                                        1. 2

                                          Yeah, I haven’t touched LaTeX since university a dozen years ago, so I’m not looking forward to this.

                                      1. 1

                                        Chris Armstrong discusses a different technique in his 2015 Strange Loop talk, Side Effects are a Public API. Though the majority of the talk is about implementing these techniques in Python, he does also show an example in Haskell.

                                        1. 3

                                          I just started a new part-time contract position last week after several years not working due to chronic illness.

                                          I’m not sure how much I can share about work, so this might be vague:

                                          Work

                                          • Performance testing on a Mesos cluster
                                          • Helping update project code to improve performance

                                          Work Admin

                                          • Generate an invoice for last months work
                                          • Get PDF export of org-mode documents working and looking nice.

                                          I’ve been using Howard Abrams techniques that he documented in this screencast to document what I’ve been doing and to make sure I get everything done on the various servers in the cluster I’m working on.

                                          Because I’m working, I’m not sure I really have the spoons to work on anything personal, as much as I would like.

                                          1. 5

                                            I love this exploration of empathy in software development that spans everything from features to code and tools.

                                            Software is ultimately about humans. Providing something tangible for them. The act of writing software isn’t so much about communicating with the computer, but with others (and, yourself as other – one day you’ll have to understand the code you wrote).

                                            This reminds me a bit of the work of Seung Chan Lim at Realizing Empathy. He’s done a couple of talks about the subject that might be interesting: