VSC Vanishing Go Imports

With the Go extension installed in VSC, by default if you have an unused import, when you save, it will disappear. If you're like me and you may habitually press ctrl+s, this is very frustrating. After a lot of messing around in VSC's settings. I learned that this "feature" has nothing to do with the settings pertaining to linting or formatting. It's actually to do with automatic import organisation, which you can configure as follows in VSC's settings.json. "[go]" : { "editor.codeActionsOnSave" : { "source.organizeImports" : false, }, } This solution comes from this StackOverflow answer. You can still organise imports with the shortcut shift+alt+o.

Fixing Gnome's Gnonsense

When some aspect of the Gnome desktop stops working at runtime, you can do alt+f2 and type "restart" to refresh the desktop without losing any of your open programs. I would say that my experience of using Ubuntu 20.04 is not as stable as Ubuntu 16.04 which felt rock-solid after doing one bit of config . But it's not really a fair comparison because I've changed hardware, desktop environment, and other programs during that time; and furthermore, my current install was Kubuntu 19.10 followed by a "dist-upgrade" that unexpectedly gave me regular Ubuntu 20.04 with all of its defaults, so it's a bit messy. Because of my messy install, I don't know how many of the problems I encounter a normal user would experience, so I won't detail them here. I don't need to do this restart trick very often, and this solution is quick and painless for the occasional buggyness. I'm not exactly bothered about accidentally gaining vanilla Ubuntu because alth

How to Host TTT

1. Download add-ons Recommended Client Add-Ons Recommended Maps Recommended Server Add-Ons 2. Allow players to connect to your machine. In your router's settings create a new port forwarding rule. Forward TCP and UDP traffic on port 27015 to your computer. Different routers have different user interfaces, so you may have to dig a little to find the options. The settings will likely be presented to you as a of external ports mapped to a range of internal ports. Unless you have to doing something special, you just want all those values to be 27015. 3. Get players to connect to your machine. In your Steam profile settings, you should allow your friends to see your online activity. (View Profile -> Privacy Settings -> Game Details) Other players should be able to see that you are in game in their friends list. And by right-clicking on you, they should be able to join your game once you have your server running. This doesn't always seem to work, so you can allo

TypeScript: Turn an Array of Values into a Type Union

I found the answer I was looking for here: I wasn't sure that it would be possible. In fact, it turns out that the solution is far more impressive than I expected. What follows cuts to the core part of the article that I need solved my particular problem. Problem I want to have an object type with specific keys and I want a static array of those keys, but I don't want to have the same list of keys written out twice in case I mistakenly make them differ in the future type K = "a" | "b" | "c"; type O = Record<K, V>; const keys: K[] = ["a","b","c"]; I want to be sure that 'keys' contains every member of type 'K' exactly once and vice-versa. I want to use 'keys' to build an object of type 'O', so I can't just rely on using 'Object.keys' on an

In HTML the default type of button is not button

The default type of <button> is "submit" which is why a <button> in a <form> submits the form when clicked. Simply doing <button type="button"> removes this behaviour without the need for JavaScript.

Hiding non-hidden files in your file manager

Create a file called .hidden and fill it with a newline separated list of files. Works in Nautilus and Dolphin. Perfect for ~/snap.

The TypeScript "extends" Keyword Doesn't Extend Types

I was looking through the built in TypeScript definition file "lib.es5.d.ts" and found the definition "Pick". //From T pick a set of properties K type Pick<T, K extends keyof T> = {     [P in K]: T[P]; }; In more words: Pick<T,K> is a new type of object whose keys are the set K , which has to be a subset of the keys in T . But when I tried to understand what it was from the code itself, I had some trouble, and the source of that trouble is simply the extends  keyword. We usually use ' A extends B ' to mean  A  has all the keys in  B  and maybe some more, which the English also suggests. But in reality  K must be a subset of T 's keys. What is going on? What is a Type? A type is a set of values based on some rule. e.g. Colour = { red orange yellow ... } If A is a subtype of B, values that match A are a subset of values that match B. The definition of the subtype therefore has to be a narrower version of the