Posts

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 supertype.
So one subtype of Colour could be Traff…

Turn a Web Page into a Desktop Application

I can't believe how simple the whole thing turned out to be. It's literally this simple, if you have Chromium/Chrome installed.

Linux:
Make sure you didn't install Chromium with snap.Go to the URL you want the app to open toEllipsis Button (...) -> "More tools" -> "Create shortcut"Don't un-tick the checkbox for "Open as window"Click "Create"Copy the newly created .desktop file to~/.local/share/applications Windows:
Basically the sameBut you'll have to look up how to put the shortcut in the all programs listI used to have on my desktop a shortcut to the all programs folder, which I used to drag and drop shortcuts into Formerly meirl:

"Oh, what a dream that would be!"
"It's a shame so many great programs are stuck nested in a browser window."
"The Chromium button on my launcher is cramped with stuff that doesn't belong there."
"I love Alt+Tab."
"App icons make it much eas…

Solution to Unity Desktop Fullscreen Graphical Glitch

You may find that your out of the box installation of Unity Desktop has the following glitch:


Connect a second screenFullscreen a window on one of those screensDo something on the other screen e.g. focusing or maximising a window The exact actions that cause an issue aren't very consistent.

Solution:

Install CompizConfigUtility → WorkaroundsSet "Force full screen redraws (buffer swap) on repaint" to true.

Custom Date Display in Unity Desktop (and probably some others)

I found that the date and time displayed by Unity Desktop can be customised.In dconf-editor (or in the terminal) com.indicator.datetime contains many options about date formatting.Set time-format to custom. This allows custom-time-format to be used for formatting.Set custom-time-format to a format string.When I discovered this was possible, it was difficult to find out the exact properties the format string could have. Not all of the placeholders are intuitive: `%w %d/%b/%Y %R`. It's easier to work it out with context from snippets online but I wanted a complete list of the options I had available.It turns out the C function called strftime is used, which means the syntax can easily be looked up on the internet or in the manpages.This reminded me of PHP's date format function, but it's different and not just the lack of percent signs.

En Dash with ComposeKey (Shift+AltGr)

AltGr is short for "alternative grammar". It doesn't do much on Windows, outside of adding acute accents to vowels and turning '4' into '€'.

On Linux it does a much wider variety of things and more things still with 'AltGr+Shift', just give it a try. It's not just for foreign characters but also fractions and arrows.

There is also a program called ComposeKey, which Ubuntu and probably many other distros, comes with automatically. If you type 'Shift+AltGr' the next few characters you type will be composed into  a character that sort of resembles that combination e.g. Shift+AltGr, s, s => ß and Shift+AltGr, =, > => ⇒.

You can alter the config for combinations here:/usr/share/X11/locale/en_US.UTF-8/Compose (or similar).

Although 3 hyphens does make an 'em dash', 2 hyphens doesn't make an 'en dash'. What I didn't realise until I looked in the config file was that you need 2 hyphens followed by a full-stop to …