1. 6

    Between this and the recent home-manager post, I think I’ve found a new blog worth subscribing.

    1. 14

      That’s very kind, but you’re in for disappointment! I hardly ever write anything.

      1. 16

        all the better, less cost to subscribe

    1. 8

      Ok, now bring back phones with an integrated hardware keyboard like the HTC desire Z.

      1. 4

        My experience is that a fold-out bluetooth keyboard is much more comfortable and better.

        1. 6

          I guess it depends on your use case. If you have a proper table you’re right. If you want to have a purely hand held device for places like a crowded subway an integrated keyboard would be superior, I guess.

          1. 2

            I do tend to use various phones for multiple tasks as well. That being said, bluetooth fold-out keyboards were never a viable option for me (starting with some early folding ones for Palm handhelds etc up to the current Logitech Key-To-Go that isn’t foldabe but portable). My biggest problem with all of them was, that I use mobile devices mainly via commuting and it is just not really usable on your lap without the phone falling out or it being really shaky. A builtin keyboard might not be as comfortable as a separate bluetooth one, but it is fixed on your phone.

            A notable exclusion of the “external keyboards don’t work when commuting” is the ipad Pro with a Smart Keyboard - the magnets are holding it in place as good as a fixed one. (Can’t say anything about the magic keyboard but I assume similar) edit: i actually wrote about my experience using the iPad here - not really using it “fullblown” with a VM and stuff ondevice like you do but rather as a remote shell: https://www.shift-2.com/journal/my-current-setup-learning-and-developing-rust

            1. 1

              Is it possible to use the one you linked on one’s laps? Or would I need a proper desk for that?

          1. 2

            Doesn’t the dog/cat example violate the strict aliasing rule?

            1. 4

              I’m not sure — is the rule taking effect at the time of pointer creation, or use?

              In either case, if compilers accept that code, by Hyrum’s Law, it doesn’t matter what the standard thinks about it.

              1. 2

                An object can only have its stored value accessed via an lvalue of a compatible type. (C99 s. 6.5 p 7)

                It is perfectly fine to merely copy the value of a pointer into an lvalue of an incompatible type as long as it is never dereferenced – although I cannot think of a reason why you would.

                1. 3

                  There’s no requirement in C that sizeof(X*) and sizeof(Y*) are the same, so this might not be possible. char* and void* must be large enough to hold pointers to anything, but C on a sufficiently weird architecture pointers may be different sizes depending on the size of the values. On machines that have word-addressable memory, most types are just addresses but char* and void* are both an address plus a mask or offset.

                  This doesn’t matter for any mainstream architectures.

                  1. 2

                    I won’t call it good practice, but you can do this to store a pointer-to-X in a pointer-to-Y as long as you know that the latter is never dereferenced as such. I.e. you always convert it back to pointer-to-X before dereferencing it. You could for example (ab)use an unused structure member to hold a different kind of pointer than its declared type.

                2. 2

                  That rule is commonly misunderstood. It’s permissible to convert a pointer to one type to a pointer to another type, it’s not permissible to dereference a pointer if it points to an “object” (that’s the terminology of the standard) of the wrong type (with some exceptions/allowances).

                  If I remember rightly converting a pointer from one type to another results in an implementation-defined value anyway, i.e. it doesn’t even necessarily point into the same object. Of course, with your typical compiler, it does.

                1. 12

                  I’d be really hesitant to link a Slack thread in a commit message. Even permissions aside, Slack limits the history access on some plans so this link may soon become invalid.

                  1. 4

                    I prefer analysis and notes go in a bug tracker for a variety of reasons (e.g., you can amend it later if URLs change or to make it clear the analysis was somehow incorrect) – but, yes, whether in bug notes or in the commit message itself, it definitely feels better to paraphrase, summarise, or even just copy and paste the salient details rather than just link to a discussion in some other potentially ephemeral mechanism or something volatile like a gist.

                    1. 1

                      Agreed, IMHO details and discussion should all be in the bug tracker - not in Slack or in commit messages. The commit message should have a short ”what does this change do” explanation and a reference to the bug tracker where more details can be found if needed. I don’t agree with the need to put an entire essay in the commit message that seems to be popular on the Internet.

                      1. 16

                        My 12-year-old codebase is on it’s fourth bug tracker. None of the links in commit messages still work, but the repository kept history when it got converted to git, so 12-year-old commit messages still carry useful context.

                        1. 2

                          As other comments mention, commit history has a longer lifetime than bug trackers. Of course, you can port your tickets when you change trackers, but will you?

                          1. 2

                            Yes, of course. Not migrating your hard earned knowledge would be an incredible destruction of time and money, especially in a commercial setting.

                            1. 2

                              Commits are for non commercial settings as well, and sometimes migration can’t be done e.g. when you rehome but don’t move a GitHub repository (if for example original access controls were vested in single humans who then apparently vanished).

                              Keeping content in an issue tracker is nice, but it’s always worth duplicating knowledge into the git commit.

                              Catastrophic data loss can always happen, even in commercial settings.

                        2. 1

                          I mostly agree here. But I do think that links can belong in a commit message, like when referencing a design document. Since design docs are usually a snapshot of a design of a feature, that usually has context on motivations for some of the decisions that are too long to type out in a commit message, as well as discussions.

                        3. 1

                          Interesting point. It’s a trade-off between providing context easily and future proofing. I was assuming a paid plan, which has no historical limits. I don’t think free slack is a good fit for this, because of the memory hole.

                          1. 2

                            I’m fine with linking to a fully fledged bugtracker we know we’ll keep using (yeah…) but something like Slack feels far to flimsy to me. It’s not clear where the context begins and where it ends as the discussion often evolves and drifts away to other related topics. A chat platform just isn’t a fit here in my opinion.

                        1. 2

                          My only real complaint with Hugo is the difficulty in making your own themes. I did not find their documentation for theme-makers to be very helpful at all.

                          I understand the concepts of partials and that they piece the page together into different “puzzles” by using variants of a partial, but I don’t understand how to change which page gets which assembled “puzzle”.

                          1. 5

                            The first comment on the lwn post has a reference to a themeless setup for Hugo. The themeless theme sets up a barebones Hugo site. It might be helpful in learning theming because there is very little in the templates and css files to it is easier to work with them than more established themes.

                            1. 2

                              I actually found creating my own theme pretty straightforward, especially after trying to do it in Pelican. In a simple case you need only two templates (“list” and “single”), as opposed to a dozen in Pelican. Because of this it’s also easier to create a non-blog in Hugo, as many templates required by Pelican stop making any sense when you don’t create a typical blog.

                              1. 2

                                I think I just need to start fresh as I think I went about it wrong after looking at what @eb commented. I did some very dirty solutions to get things working early on and I think that is contributing to the current issues.

                                1. 1

                                  That’s not true at all, in Pelican you only need index and page templates, everything else can be empty. Explicit is better than implicit so if empty files bother you then you can hide them on your system file browser or something.

                                2. 2

                                  My current site is built using Gatsby, which, while cool, is a nightmare to keep updated. I’d heard of Hugo, and figured porting my site would be fairly easy since it’s a single-digit number of blog posts and a super basic stylesheet.

                                  After fighting with Hugo and their docs for at least three hours, I gave up and just wrote my own site generator. I’m sure Hugo is great for complex scenarios, as most static site generators probably are, but I wanted a home page, list of posts, a post page, and nice syntax highlighting. I couldn’t manage to get that with Hugo as easily as I thought it could be.

                                  On the plus side, my site generator is the only one I’m aware of that uses the same syntax highlighting engine as VS Code, so all my code snippets are now super colorful!

                                  1. 1

                                    I’m using Hugo for several projects and have a similar experience. I still cannot confidently say I know how to solve the simplest tasks like list posts with some conditions or create an archive page. This is mostly my fault, but Hugo’s documentation does not help.

                                    1. 1

                                      Would you mind sharing a link to your generator if it is open source?

                                      1. 2

                                        I still need to get inlining of small assets working, but maybe I can use this as motivation to finish it soon! I’ll reply again once I’ve published it.

                                    2. 2

                                      Check out Pelican. It’s using Jinja2 for better templating and it’s a really nice templating engine also used by Django.

                                      1. 3

                                        Django doesn’t actually use Jinja2 (at least not by default, you can configure it to do so) but it’s own templating engine. They are however very similar since Jinja2 is actually modelled after the Django templating engine.

                                    1. 26

                                      inheritance is something that makes your code hard to understand. Unlike function, which you can read just line by line, code with inheritance can play “go see another file” golf with you for a long time.

                                      This isn’t an argument against inheritance, it’s an argument against modularity: Any time you move code out of inline you have the exact same “problem” (to the extent it is a problem) and you can only solve it the same way, with improved tooling of one form or another. ctags, for example, or etags in Emacs.

                                      1. 31

                                        Inheritance has this problem to a much larger degree because of class hierarchies. Tracing a method call on a class at the bottom of the tree, requires checking every parent class to see if its overridden anywhere. Plain function calls don’t have that problem. Theres only a single definition.

                                        1. 7

                                          Plain function calls don’t have that problem. Theres only a single definition.

                                          Unless we start using higher order functions when the function is passed around as a value. Such abstraction creates the exact same problem, only now it’s called “where does this value originate from”.

                                          1. 5

                                            Yes, which is why higher order functions are another tool best used sparingly. The best code is the most boring code. The most debuggable code is the code that has the fewest extension points to track down.

                                            This is, of course, something to balance against debugging complicated algorithms once and reusing them, but it feels like the pendulum has swung too far in the direction of unwise extensibility.

                                            1. 4

                                              For extra fun, use higher-order functions with class hierarchies!

                                            2. 4

                                              The best is python code where the parent class can refer to attributes only created in child classes. There are equivalents, but less confusing, in languages like Java.

                                              1. 1

                                                Isn’t the example in the linked article doing exactly that?

                                                1. 2

                                                  Okaaaay… what’s self.connect doing? Ah, it raises NotImplementedError. Makes sense, back to SAEngine:

                                                  Not exactly. :)

                                                  1. 1

                                                    Check out Lib/_pyio.py (the Python io implementation) in CPython for lots of this.

                                                2. 1

                                                  The overrides is mostly for modularity and reduce code duplication. Without classes, you might either end up with functions with tons of duplicated code, or tons of functions having a call path to simulate the “class hierarchies”. And yes, it’s going to make the code harder to read in some cases, but it also makes the code much shorter to read.

                                                  1. 6

                                                    Without classes, you might either end up with functions with tons of duplicated code

                                                    Why? There is literally no difference in code re-using between loading code through inheritance vs function calls, apart from possibly needing to pass a state to a function, that could otherwise be held in class instances (aka objects). this is certainly less than class definition boilerplates.

                                                    or tons of functions having a call path to simulate the “class hierarchies”

                                                    The call chain is there in both cases. It’s just that in the class-based approach it is hidden and quickly becomes a nightmare to follow. Each time you call a method statically or access a class atribute, you are basically pointing to a point in your code that could be hooked to different points in the hierarchy. This is a problem. People don’t think it is a big deal when they write a simple class and know it well, because the complexity is sneaky. Add another class and all of the sudden you brought in a whole other hierarchy into the picture. Each time you read “this” or “instance.something”, you’re up for am hunt. And each other hierarchy you bring into the picture increases complexity geometrically. Before you know, the project is unmanageable, the ones writing it went on to some green field project, doing a similar mess again for some poor soul to struggle with after them.

                                                    And yes, it’s going to make the code harder to read in some cases, but it also makes the code much shorter to read

                                                    It doesn’t really. People fall for this because you can instantiate a class and get a bunch of hidden references that are all available to you at will without you need to explicitly pass them to each method, but you only get this through defining a class, which is way more verbose than just passing the references you need.

                                                    All that said, what classes do offer in most languages is a scope that allows for fine grain control of data lifecycle. If we remove inheritance, then class members are akin to use global variables in non-OOP languages. But you can create as many scopes as you want. I which languages like python would do this as, for the same reason as OP, I suffer from working with OOP codebases.

                                                    1. 4

                                                      You make it sound like inheritance is the only way to reduce code duplication. In my experience that is simply not true, you can always use composition instead. E.g. Haskell doesn’t support inheritance or subtyping and you still get very compact programs without code duplication.

                                                      1. 5

                                                        Without classes, you might either end up with functions with tons of duplicated code, or tons of functions having a call path to simulate the “class hierarchies”

                                                        This is only true in my experience if you’re trying a functional approach with an OO mindset. There are other ways to solve problems, and many of them are far more elegant in languages designed with functional programming as the primary goal.

                                                    2. 5

                                                      When you move a bit of code out of your file it’s not going to call back function from the first file. You going to even make sure this is the case, that there is no circular dependency, because it makes (in cases when a language allows to make you one) code harder to read. In case of inheritance, those games with calling everything around is just normal state of things.

                                                      Of course, example in the article is small and limited, because pulling a monster from somewhere is not going to make it more approachable, but surely you’ve seen this stuff in the wild.

                                                      1. 4

                                                        You might do that, in the same way that you might carefully document your invariants in a class that allows inheritance, mark methods private/final as needed, etc. But you also might not do that. It sounds a bit as if you’re comparing well-written code without inheritance to poorly written code with it.

                                                        Not that there isn’t lots of terrible inheritance based code. And I’d even say inheritance, on balance, makes code harder to reason about. However, I think that the overwhelming issue is your ability to find good abstractions or ways of dividing up functionality–the choice of inheritance vs. composition is secondary.

                                                        1. 2

                                                          It’s just that without inheritance it’s easier to make good abstractions. Inheritance affords you to do wrong thing easily, without any friction - just read a good article about that few weeks ago.

                                                      2. 4

                                                        Interesting article from Carmack about inlining everything:

                                                        http://number-none.com/blow/blog/programming/2014/09/26/carmack-on-inlined-code.html

                                                        1. 4

                                                          This isn’t an argument against inheritance, it’s an argument against modularity: Any time you move code out of inline you have the exact same “problem” (to the extent it is a problem) and you can only solve it the same way, with improved tooling of one form or another. ctags, for example, or etags in Emacs.

                                                          Not really, including code via accessing a class or object member forces you to manually go figure out which implementation is used, or where the implementation in a web of nested namespaces. In the case of function, each symbol is non-ambiguous. This is a big deal. If you have types A and B, with A having an attribute of the type B, each of these types containing a 3 level hierarchy, and you call A.b.some_b_method(). That could be defined in 9 different places, and if it is, you need to figure out which that symbol resolves to. This is a real problem.

                                                          1. 2

                                                            This isn’t an argument against inheritance, it’s an argument against modularity:

                                                            Yeah, all code should be in a single file anyway. No more chasing of method definitions across multiple files. You just open the file and it’s all there…

                                                            1. 2

                                                              Any form of modularity should be there to raise the level of abstraction. ie. Become a building block, that is solid (pun intended) firm and utterly reliable, that you can use to understand the higher layers.

                                                              You can peer inside the building block if you need to, but all you need to understand about it, to understand the next level up, is what it does, not how it does it.

                                                              Inheritance is there to allow you to know that “all these things IS A that”. ie. I can think of them and treat all of them exactly as I would treat the parent class. (ie. The L in SOLID)

                                                              I can utterly rely on the fact that the class invariant for the superclass holds for all subclasses. ie. The subclasses may guarantee other things, but amongst the things they guarantee, is that the super class’s class invariant holds.

                                                              I usually write a class invariant check for every class I write.

                                                              I then invoke it at the end of the constructor, and the beginning of the destructor, and at the start and end of every public method.

                                                              As I become more convinced of the correctness of what I’m doing, I may remove some for efficiency reasons. As I become more paranoid, I will add some.

                                                              In subclasses, the class invariant check always invokes the parent classes invariant check!

                                                            1. 23

                                                              I think we should either get the tag distributions or package management as a general category before considering adding more specialized tags.

                                                              1. 5

                                                                I prefer going towards a generalization instead (there’s similar technologies like Guix, PowerShell DSC, OSTree, Silverblue, etc.) - the problem is what that generalization is because Nix covers a lot of ground; package management, desired-state, etc.

                                                                1. 6

                                                                  the problem is what that generalization is because Nix covers a lot of ground; package management, desired-state, etc.

                                                                  Nix does, but a specific post not likely. My bet would be on using a tag appropriate to the post, not the technology it’s about as a whole.

                                                                2. 1

                                                                  I think that package management, or maybe something generally enough to also categorize stuff like Flatpack and Docker would be good, distro is too linux specific, and linux already is a tag.

                                                                1. 4

                                                                  Does this still let you require that you must touch the Yubikey to use it? That’s the only safe way to use SSH agent forwarding

                                                                  1. 2

                                                                    I just tried it and yes, it does.

                                                                  1. 6

                                                                    I switched away from Fish (after using it for several years) because I couldn’t get used to it’s non-POSIX syntax…

                                                                    1. 13

                                                                      That’s the reason I picked it; for day to day usage, it’s a lot less warty, and if I need a bunch of POSIXy stuff, I can just exec bash.

                                                                      1. 1

                                                                        You are correct in that exec bash is a useful way to run POSIXy stuff. Unfortunately (to my knowledge), shell functions, aliases, etc. must be translated into fish. I depend on being able to source POSIX shell scripts in order to bring my functions and aliases to remote servers and containers.

                                                                        1. 2

                                                                          From my experience, 90% of shell functions and aliases can (and should) be rewritten as standalone scripts. Unless you indeed modify the current shell’s environment or even the argument handling (like noglob in zsh), there is no reason to hoard functions.

                                                                          1. 1

                                                                            Funny; I did just that mere hours before you posted your comment. Took three commits to my dotfile repo (1, 2, 3).

                                                                            There is one other benefit to using shell functions and aliases: it’s easy to view them all at once by running functions && alias; the result can be written to a file, giving you a single file with all your custom commands.

                                                                          2. 1

                                                                            That’s a different use case, yeah. For me, I have two computers I ever interact with, so.

                                                                            1. 1

                                                                              Yeah, that’s unfortunately why I have to use bash at work even though I use fish everywhere else. Sad; fish is way nicer for shell scripting.

                                                                          3. 5

                                                                            I switched away from Fish, despite much preferring its obviously better syntax and other UI improvements, because I still had to work with old bash and posix shell scripts day-to-day anyway.

                                                                            1. 4

                                                                              For the folks in this thread who found Fish was not compatible with their POSIX scripts: do you have a lot of functions that modify your shell’s state/environment, then? For me that’s limited to a few scripts related to virtualenv, changing directories, and setting the prompt. The other 95% does just fine as standalone scripts with #!/bin/sh as the hashbang.

                                                                              To avoid misunderstanding, I’m not really asking “why do/don’t you use X”. It is me wanting to see all the things folks do with their shell that could not be done as a script, so please Share All The Things That Come Under That Heading And That You Feel LIke Sharing :D

                                                                              1. 3

                                                                                The biggest offenders are the version-switchers for various languages–virtualenv, chruby/rvm/rbenv, nvm, etc. For some of these things, there are fish equivalents, but it remains a point of friction.

                                                                                The other annoyance with fish is that any time I have any problem with a shared script at work that works for everybody else, everyone assumes fish is the problem (which is rarely-to-never the case).

                                                                                But it’s still a great shell and I continue to use it.

                                                                              2. 4

                                                                                I’m just writing scripts for zsh or a non-shell language when I want to do more than one thing.

                                                                                fish has made 99% of my interactions at a shell prompt ‘just work’ with practically zero config, learning curve, or slowness.

                                                                              1. 10

                                                                                It makes me uncomfortable many people don’t even consider Git as a standalone software. For many it’s just an implementation detail of their Gitlab or other frontend of the month. I’m not sure what to think about it.

                                                                                1. 2

                                                                                  That’s kind of what made me try to dig into Git.

                                                                                  I also discovered annexes in Git, which are pretty neat (here), but which I deemed out of scope for this article.

                                                                                  1. 2

                                                                                    Thought it might be worth linking to the source :^)

                                                                                    1. 2

                                                                                      git-annex is quite cool, and an interesting alternative to Git LFS that is easier to maintain yourself (doesn’t require a custom server, and supports multiple servers rather than requiring a canonical one). That being said it makes sense you left it out of this article — it’s not actually “barebones” git, it’s a separate package that’s maintained separately (almost entirely by its original author, Joey Hess).

                                                                                      1. 1

                                                                                        annexes look pretty cool, I wouldn’t mind seeing an article with your workflow with that.

                                                                                        1. 1

                                                                                          Never seriously tried them, but I might do, and write something on that topic.

                                                                                          I’m already gonna write an article on man, and writing documentation pages.

                                                                                    1. 3

                                                                                      Why not allow it to be controlled by a response header (with a safe default when the header is missing)? I’ve always thought highly of the browser shared cache. In an ideal world, the shared cache turns the browser into a dynamically evolving foundation. I’d be sad to see it go away.

                                                                                      1. 4

                                                                                        Whose response? The CDN or the first-party?

                                                                                        It depends on the first-party to judge whether it’d be safe to retrieve from cache or not. The first-party website would need a mechanism in page to make that statement. (Either as an attribute for each element (yuck) or a site-/document-wide policy in a header).

                                                                                        That might work. I’m not sure.

                                                                                        But can you give an example where you’d certainly know that it’s OK to opt-in to timing side channels?

                                                                                        1. 3

                                                                                          I think the best example of where it’d be okay is in commonly used libraries hosted on popular CDNs. “The user has been on another website which uses jQuery” isn’t such a bad information leak. (Though even then, an attacker could probably figure out exactly which versions of which popular libraries you have cached, and from which CDNs, and use that to build a fairly good picture of the set of popular websites you’re likely visiting.)

                                                                                          1. 7

                                                                                            The challenge with this is: Who decides what resources should get that treatment? The first-party website has an incentive to allow its advertising partners to track the user. The CDN operator has even more incentive. Some websites, and some CDNs, might be trustworthy enough not to use the flag gratuitously… but if we allow them to self-designate as such, we’re right back where we started.

                                                                                            1. 2

                                                                                              It might work like the media permissions: a website may request a shared cache for some resources and the user may allow them (for this and every following website/request). That being said, it would be too annoying to actually work.

                                                                                              1. 1

                                                                                                Yeah, I think that’s at least a feasible approach, if not for this particular optimization, maybe for other privacy/performance trade-offs.

                                                                                              2. 2

                                                                                                I don’t know how it would work in practice, and to be clear, I don’t think it’s a good idea. That’s just the only example of a situation where it could in principle make sense, regardless of whether it would work in practice.

                                                                                                1. 1

                                                                                                  Yes, I certainly think it’s a scenario worth thinking through. Thank you for that.

                                                                                          2. 3

                                                                                            Partitioning is done for privacy. It won’t help if the bad guys can set a I'm-not-a-bad-guy header. If you’re hoping they wouldn’t be so brazenly and openly violating privacy, see what Google did with the P3P header.

                                                                                          1. 4

                                                                                            While we’re here, let’s revive issue 9

                                                                                            Pros:

                                                                                            • ddgable.
                                                                                            • Funny because..
                                                                                            • “Issue 9 from Google Labs” (like plan 9)
                                                                                            • It literally is issue 9
                                                                                            • Good abbreviation for compiler and filename extension: i9
                                                                                            • Guy who already made a go programming language gets the name back
                                                                                            1. 4

                                                                                              I love how assholy the final comment was that closed the issue. Basically “We dominated you this 11 months with our large marketing budget and nobody knows about you and your stupid language, so we aren’t renaming.” And by love, I mean not love.

                                                                                              1. 1

                                                                                                Yeah, it wasn’t nice. :-(

                                                                                                1. 1

                                                                                                  Fun fact: “Google Go” isn’t a programming language. (It’s the trimmed down version of the Google app for markets with low bandwidth/tiny phones)

                                                                                                  https://play.google.com/store/apps/details?id=com.google.android.apps.searchlite&hl=en

                                                                                                2. 3

                                                                                                  That has so much better prosody than “go” too. Only downside is I can’t think how you get a cute animal mascot out of it.

                                                                                                  1. 2

                                                                                                    I find that amusing that now we have this problem as issue 81. Or issue 9 squared if you will.

                                                                                                  1. 3
                                                                                                    1. 5

                                                                                                      That’s how this started – but it launched very slowly without -Q, but then it launched with a lot of unnecessary UI, so I had to add Emacs Lisp to disable some UI modes, and then I discovered some platform inconsistencies… and so on.

                                                                                                      But the primary reason to create this script is actually to massage calc-mode into being slightly more user-friendly for non-Emacs users.

                                                                                                      1. 3

                                                                                                        full-calc is what the script is calling, after some setup.

                                                                                                        1. 2

                                                                                                          I don’t think full-calc has a postfix mode. Postfix can be useful for incremental calculations.

                                                                                                        1. 3

                                                                                                          I have a very similar one, possibly with a tad better error handling (not that it matters much here):

                                                                                                          #!/bin/bash
                                                                                                          
                                                                                                          finish() {
                                                                                                              rm -rf "$TMP"
                                                                                                              exit
                                                                                                          }; trap finish EXIT INT TERM
                                                                                                          TMP="$(mktemp -d -t firefox.XXXXXX --tmpdir=/tmp)"
                                                                                                          
                                                                                                          env HOME="$TMP" firefox -no-remote "$@"
                                                                                                          

                                                                                                          My observations:

                                                                                                          1. OP’s script won’t clean up after itself if this Firefox gets killed or otherwise exits in less than ideal manner.
                                                                                                          2. It could use quotes around $@ for the argument list for proper whitespace handling.
                                                                                                          3. Without -no-remote it might re-use an existing Firefox process, effectively doing nothing. It’s likely Firefox keeps its lockfile in $HOME though so I might be overly cautious here.
                                                                                                          1. 1

                                                                                                            this solution from the author of magit.

                                                                                                            I do not believe that Jonas Bernouilli and Artur Malabarba (endlessparentheses author) are the same person.

                                                                                                            1. 4

                                                                                                              I love the fact that both names link to the same Github user (tarsius) in your comment.

                                                                                                              1. 2

                                                                                                                Copy-paste error on my part, the second is supposed to be https://github.com/Malabarba/

                                                                                                              2. 2

                                                                                                                Thanks @atw I have corrected the blog post.

                                                                                                              1. 1

                                                                                                                Is there any guide people really like that goes through a full migration from GMail to notmuch? I personally got really lost in the tagging bit and never really figured out how to get notmuch to stop showing me messages from my spam folder.

                                                                                                                1. 2

                                                                                                                  I don’t recall any full guide but if it helps, I use the following rules related to spam and trash:

                                                                                                                  # Mark as deleted if a new or old but not yet archived email got
                                                                                                                  # deleted on some other device.
                                                                                                                  notmuch tag +deleted -- tag:inbox and folder:/Trash/
                                                                                                                  # Mark as spam if the newly downloaded email got marked so
                                                                                                                  # server-side.
                                                                                                                  notmuch tag +spam -- tag:new and folder:/Spam/
                                                                                                                  notmuch tag +spam -- tag:new and folder:/Junk/
                                                                                                                  

                                                                                                                  EDIT: I included the comments from my config too.

                                                                                                                  1. 1

                                                                                                                    Also out of curiosity, you use the emacs mail client right?

                                                                                                                    1. 2

                                                                                                                      Yes, I do, notmuch.el to be specific. (the post author here BTW)

                                                                                                                      1. 1

                                                                                                                        Yea, I realized that too late after sending my reply.

                                                                                                                  2. 2

                                                                                                                    I wouldn’t call it a “guide” – but my email setup (including configuring mbsync, msmtp, and notmuch) is here: https://github.com/stig/.emacs.d/blob/master/README.org#email - I’ve just now moved some documentation around to make it a little easier to follow. This is an Org mode document with literate programming elements; you may want to look at the raw source rather than GitHub’s rendered version as it may provide additional clues.

                                                                                                                    As vifon points out the trick to hide spam is to tag the messages that are filed into spam serverside with the spam tag, and add this tag to your “excluded by default” tags. (Try notmuch config set search.exclude_tags 'deleted;spam;draft'.)