Skip to content

Instantly share code, notes, and snippets.

View n3dst4's full-sized avatar

Neil de Carteret n3dst4

View GitHub Profile
n3dst4 /
Last active May 16, 2022 13:57
Enabling IE Mode in Microsoft edge to allow Silverlight apps to run

MS Edge has a fallback called "Internet Explorer Mode" which will allow Silverlight to run.

To enable Internet Explorer Mode in Edge:

  1. Ensure you have Silverlight installed. You can download it here:
  2. Open Edge. Click the ... button top right, then Settings in the menu.
n3dst4 /
Last active November 10, 2021 10:21
Gruvbox theme for VS Code

You'll need to open the command palette (ctrl-shift-p) and edit your settings file. Add this to the themes:

    "background": "#282828",
    "black": "#1D2021",
    "blue": "#458588",
    "brightBlack": "#928374",
    "brightBlue": "#83A598",
 "brightCyan": "#8EC97C",
n3dst4 /
Last active April 10, 2022 03:47
HATEOAS pros/cons



  • Makes discovery easy (good for new integrators)
  • Encourages consistency
  • Client software does not need to maintain a list of URLs
    • but they do need to maintain a list of link relations
    • but link relations are cleaner?
  • Improves API reuse over long horizons with multiple clients
n3dst4 / debounce-middleware.ts
Created May 26, 2021 09:50
redux debounce middleware
import { Dispatch } from "react";
import { AnyAction, Store } from "redux";
import { State } from "./types";
* Create a middleware that will debounce actions of a given kind.
* Debouncing means that if a certain action happens more than once in a given
* period, only the last one will actually take effect.
n3dst4 /
Last active February 6, 2021 11:57
Bulk webp conversion

Howto: bulk convert to .webp

Install webp

sudo apt update
sudo apt install webp

To convert a load of .pngs:

n3dst4 / destructuring.ts
Last active November 20, 2019 10:46
Destructuring tricks in JS or TS
// we'll be playing with this happy little object in these examples
const foo = {
bar: 1,
baz: 2,
corge: 3,
// 1. basic destructuring
const { bar } = foo;
n3dst4 /
Last active December 30, 2023 16:53
Using Postfix as an MTA so that local mail on a linux box gets delivered to somewhere useful

Simple Postfix MTA Setup for headless hobbyists

So, you're a hobbyist or maybe even a user in a small-scale business capacity and you have some kind of headless Linux (or other *nix) box, maybe it's a VPS or a Raspberry Pi, and you want it to be able to email you with alerts (setting up monitoring is a separate subject!)


I went round in circles with this for a while, because it seemed like such a

n3dst4 /
Created May 5, 2019 15:29
Ubuntu Linux EFI Grub Windows dual boot chaos

Ubuntu Linux EFI Grub Windows dual boot chaos

Situation: I had Ubuntu 18.10 successfully dual-booting with Windows 10. Tried to do_release_upgrade to 19.04 but it couldn't complete, probably because I had a million *-desktop packages installed and they'd trodden all over each other.

So I decided to install a fresh 19.04, using all defaults for everything. Install went smoothly but on reboot, there was no GRUB menu, just straight into Ubuntu.

After MUCH experimenting, it seems that the problem was that the default install was creating an "efi" partition which was effing it up somehow. The fix was to re-run the install, but instead of accepting the option to delete the previous Ubuntu and install over it, choose to "do something else", and manually the pick the partition to nuke and recreate. Do not create an efi partition.

It will piss and moan about not having an efi partition, but ignore it. It's fine, it will boot fine. Once you're up and running, pop a terminal and do:

n3dst4 / wsl_locales_profanity.markdown
Last active June 15, 2018 10:14
How to fix batshit WSL errors abut locales, $LANG, $LC_* etc

If you start getting shitty fucking error messages like

manpath: can't set the locale; make sure $LC_* and $LANG are correct

whenever you start up a WSL shell, your system locales are all fucked to insane buggery and you need to unfuck them pronto.

You can do this by running the official locale-unfucking command:

n3dst4 /
Created June 4, 2018 10:38
How to disable same-origin policy (aka CORS checking) in Chrome

You need to run Chrome with two command line flags:

--disable-web-security --user-data-dir

These are kind of documented here:

--disable-web-security is the one that turns off the same-origin policy (the name is scarier than the action). Although the docs don't say this, this flag is ignored unless you also specify --user-data-dir. That's because --disable-web-security can be super risky so you shouldn't be surfing in that mode all the time, so Chrome requires you to use an alternative user profile, specified with --user-data-dir. However, you can get away with just giving --user-data-dir and not specifying a dir, and it will use the default one (so you get all your bookmarks, cookies, extension, etc. but --disable-web-security will still feel that honour has been satisfied and tuirn off same-origin policy.