Skip to content

SyntaxError: Cannot use import statement outside a module (NodeJS / TypeScript)

I’ve been using TypeScript for about 5 years, and until now, I had been stuck to compiling to the ES5 target, because any time I would try something more recent, I would get an error saying: “SyntaxError: Cannot use import statement outside a module”.
This didn’t seem like a big deal, because TS is convenient in that it keeps your always newer code compatible with old JS standards, but still I finally decided to dig a little.

The first interesting thing I found was this. Basically, it says “In your package.json file, simply add “type”:“module””. That lead nowhere, however, while typing it, I noticed the only other alternative to “module” was “commonjs”.

Digging a bit more, I found that tsconfig has a similar parameter, called “module”. So I tired setting it to commonjs and… it worked. Looking back at it, this value was in the community base tsconfig for Node 14, meh. Should have just tried that in the first place. Anyway, here’s my current tsconfig:

  "compileOnSave": true,
  "compilerOptions": {
    "target": "es2020",
    "module": "commonjs",
    "allowSyntheticDefaultImports": true,
    "noImplicitAny" : true,
    "strictPropertyInitialization": true,
    "strictNullChecks": true,
    "esModuleInterop": true,
    "lib": [
    "skipLibCheck": false,
    "alwaysStrict": true,
    "removeComments": true,
    "typeRoots": [
    "moduleResolution": "node",
    "baseUrl": ".",
    "paths": {
      "*": [
  "exclude": [

Posted in JavaScript / TypeScript / Node.js, web development.

How to enable SSH (+/- root) password login

In recent Linux server distribs provided by dedicated server or VPN hosts, root login is often disabled, as well as password login. It doesn’t really improve security as long as you don’t use crappy passwords, and it’s one hell of an inconvenience. Restoring those is however easy (it’s also easy to find, but I prefer to keep my own copy here ^^):

sudo nano /etc/ssh/sshd_config

In it, set:
PasswordAuthentication yes
PermitRootLogin yes

Then restart the SSH daemon. For this 2 possible commands:
– I’ve always used sudo /etc/init.d/ssh restart
– I’ve also seen sudo service ssh restart

Also, don’t forget sudo passwd root to set the root password 😉

Posted in Linux.

Optimizing the Windows paging file

A long time ago, when RAM began to be cheap enough to stuff more than enough in any of my PCs, I started to systematically completely disable the Windows paging file, with the objective to make sure I never end up swapping. I found this all the more important when switching to SSD, where swapping sure wouldn’t be such a bad performance drag but would wear out the SSD.

However, in Windows 10 (not sure about Windows 7, as I recall at least the issue wasn’t so visible), I noticed that programs would start crashing / refusing to run due to “low memory” way before I reached my maximum capacity. Roughly, with 32 GiB of RAM (which is a large-ish amount, but not as “huge” by today’s standards as when I started using that amount 5 yeas ago), I started getting “low memory” warnings around barely 22-24 GiB of RAM used. What the hell was wrong with Windows so that it seemed to pretend the remaining 8-10 didn’t exist?

There are tons of random advice about swap file / page file management on the Internet, and most provide little justification on their choices. Globally, advice range from “set it to at least 1.5 (or 2) times the size of your RAM” to “you should absolutely disable it“. Which recurrently leads to quite a bit of confusion. The “no page file” arguments have always appeared clearer and more compelling to me (just remove it, see things still work fine, and enjoy no disk writes)… until those mysterious errors.

Eventually, I found the answer: when using RAM, Windows will commit some amount of RAM, larger than what will actually be used. And if there isn’t enough RAM left (including free space on the page file), counting by committed space rather than actually used space, it will fail with this “not enough RAM” error.

From this, my takeaway was that I should add a page file that’s roughly the size of the difference between my real RAM (32 GiB) and the RAM real usage at which I started getting that error (~22-24), so I set it to 8 GiB. With a varying size, since I don’t care about fragmenting that file, since it will +/- never be actually written too, it will just get allocated.
As for your own strategy, I’d say:
– If you don’t care about disk writes (and don’t mind a potential slowness when you start actually using the page file), set it to some high value.
– If you have an HDD and not an SSD, use a fixed-size pagefile
– If you want to minimize disk writes as much as possible, first set no page file, then use your computer normally and see when you start getting that not enough RAM error. Set your page file size to roughly the difference between your total RAM and the RAM actually used at that moment. A bit less if you really want to minimize disk writes as much as possible, a bit more if you want to be sure to be able to use all your RAM, even if it may mean you can have a few disk writes. In the former case, you can probably use a variable-size pagefile even on an HDD. In the latter, hard to decide. Why are you still using an HDD for your OS anyway? ^^

Posted in Windows.

Disabling Vivaldi auto-update, and a generic list of possible auto-start locations

How to disable Vivaldi’s auto-update check

I’ve been using Vivaldi since its beta, as a backup browser for poorly designed websites that require Google Chrome’s engine, because it combines both Blink and an UI that I find much better than Chrome’s. Another thing I like is the customization options, notably the control over auto-updates. Sadly, that last point evolved a few times. And again no later than a few days ago.

Yesterday, I upgraded to Vivaldi 4. No particularly visible change for me, except that my speed dial background picture got nuked and replaced with a super bright new one (ouch, my eyes, why inflict this to people who use the dark theme? :s), and I noticed the added e-mail client and stuff but I couldn’t care less.
Something I cared about, however, was that when I restarted my computer today, my firewall caught an unexpected piece of junk: update_notifer.exe, which I knew well from the previous versions but always kept at bay, automatically started. Without me even starting Vivaldi. What. The. Hell.
I guess at Vivaldi, just like at Google, “no” doesn’t mean “no”. It’s as if they can’t figure what kind of nightmare it would be if every single piece of software would do that crap. Imagine that, every time you start your computer, and/or every 24h, 300 auto-update tasks running on your computer. How lovely. How speedy. How environment-friendly.

Anyway, to disable this, the official thing to do is to go to Vivaldi’s settings, search for “update” (it used to have its own submenu, now I have no idea how to find it another way that typing its name…), click on “Show Update Settings” and uncheck “Notify About Updates”. By the way, nice way to bury the setting. I mean, there’s only ONE setting, why show/hide it via another button, instead of just always showing the setting instead, if not to make it harder to reach?

So, this should prevent getting a notification asking you to update. But the wording made me suspicious: after all, it’s a checkbox for “notifying” about updates, not “checking” for updates. If I was a sneaky bastard like most browser vendors, I’d still run the check but just not make a popup about it. I poked around a bit, and eventually checked the Windows Task Scheduler. What a nice thing, it’s one of those “new” auto-startup places that evade good old WinPatrol’s surveillance. And frankly, I don’t remember to check it often enough. And there it was, right in the root folder, a big fat “VivaldiUpdateCheck-[bunch of random characters]” task. Still active, despite my above-mentioned unchecked auto-update box. Isn’t this nice? The only question left, is how soon Vivaldi will say “fuck you” to my choices again. Time will sure tell.

So to wrap this up:
– in Vivaldi’s settings, search for “update” and uncheck “Notify About Updates”
– open Windows’s Task Scheduler and disable (or delete, I guess that works too – unless Vivaldi then auto-restores it) the VivaldiUpdateCheck task

Where to check for programs that automatically run at startup

That little issue prompted me to do a more global checkup, more specifically I launched WinPatrol and looked at what it listed. Found a few things that I wanted to remove, WinPatrol failed to remove them (apparently its feature to remove entries just doesn’t work – maybe a Windows 10 thing), so I went there manually and made a list.
Here are some common locations to make a program run at startup (PS: thanks Microsoft for making such a mess, would it kill you to make it more user-friendly and pick just a unique location?):

In regedit (type “regedit ” in the start menu):
(NB: all these have a sibling “RunOnce”, for running only once, which I guess should generally be empty)

The Startup folder of the Start Menu. Note a little trick: there are 2 of those, one for the current user, and one for everyone:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
C:\Users\[username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup, aka %appdata%\Microsoft\Windows\Start Menu\Programs\Startup

The Task Scheduler (type “task scheduler” in the start menu), which contains both task that can run at any time and at startup (also I believe a task that was scheduled to run while the computer was off will in most cases run as soon as it’s powered on)

The Services (type “services” in the start menu), which can be started automatically or “manually”, or disabled. The latter will completely prevent it from running. “Manually” will allow it to get triggered by “something” else, and on numerous occasions I’ve found “manual” start services would still end up starting despite me not realizing I ever launched them. So I tend to be heavy-handed on the “disabled” option, and switch back to manual if I notice I broke something. Note that there are many system services (and quite a few other legit services, notably drivers), so don’t just go and disable everything, that would most likely make a big mess.

To wrap up this part, here’s a partial list of what I busted today hiding there:
– Adobe ARM in some regedit Run key
– Adobe Update in Services
– a CorsairGamingAudioConfig service (but I don’t have any Corsair audio hardware…)
– Vivaldi in the Task Scheduler (as said above)
– Intel Telemetry in Task Scheduler (pretty sure I deleted it already earlier, I guess that crap adds itself back every single time you run Intel XTU)
– a couple of Xbox Live tasks (XblGameSaveTask & XblGameSaveTaskLogon – no kidding)

Posted in Windows.

Comparison of 2 vitamin B supplements

Just a personal note comparing a vitamin B mix I used to take but can’t find anymore (thanks EU for punishing GB for the Brexit…), to a new one that features quite smaller doses (but still high enough), for a significantly lower price.

“Solgar Formula Vitamin B-Complex”

Thiamin (vitmin B1 as thiamine mononitrate) – 100 mg
Riboflavin (vitamin B2) – 100 mg
Niacin (vitamin B3 as niacinamide) – 100 mg
(B5) Pantothenic acid (as calcium pantothenate) – 100 mg
Vitamin B6 (pyricoxine hydrochloride) – 100 mg
Choline (as bitartrate) – 20 mg
Inositol – 100 mg
(B8) Biotin – 100 µg
Folic acid (as prep) – 400 µg
Vitamin B12 – 100 µg
PABA – 0

“Vitamin B Komplex Intenso”

Thiamin (vitmin B1 as thiamine mononitrate) – 25 mg
Riboflavin (vitamin B2) – 25 mg
Niacin (vitamin B3 as niacinamide) – 50 mg
(B5) Pantothenic acid (as calcium pantothenate) – 125 mg
Vitamin B6 (pyricoxine hydrochloride) – 25 mg
Choline (as bitartrate) – 50 mg
Inositol – 50 mg
(B8) Biotin – 50 µg
Folic acid (as prep) – 200 µg
Vitamin B12 – 125 µg
PABA – 25 mg

Posted in Totally pointless.

Livedrive: a backup disaster story

About 8 years ago, I posted about large and cheap storage/backup solutions. About that time, I subscribed to my favorite pick in this list. And it seemed pretty great. Lots of space for manual storage and “unlimited” space for automatic backups (NB: “unlimited” for automatic backups means it’s actually quite limited, by the storage size on your backed-up computers + the limited amount of folders you choose to back up). All good, so far.

It all began with a payment processing issue…

Fast forwarding to 8 years later. I’m a bit late for my renewal, as usual. Well, not late-late, but late “just a few days before the deadline”. Because I use single-use debit cards (“e-cards”), and the core concept of those is “you create it, you use it immediately”.
And for the first time in 8 years, it’s rejected. Not “not enough funds” rejected, not “bank declined for some reason” rejected, just “we failed to process your payment try again” rejected. I tried lots of things: other e-cards, even physical cards, completing my billing address, which had been partial from the beginning, without it being an issue ever, etc. Nothing worked.
Contacted support and waited.

… but support was unresponsive

It was Friday, more or less in the middle of the day… You guessed it, they didn’t reply before the weekend. Yikes.
But as we’ll see later on, it turned out to be a blessing in disguise.

So I waited, during the weekend.
But as we’ll see later on, that was a bit stupid.

Monday morning now. Last day paid for in my current subscription state. Getting a bit nervous there…
Midday. Getting a bad feeling about this. If you have a customer writing to you because they want to pay you, you wouldn’t leave them hanging, would you? I start thinking about holidays for some reason, so I look a bit online, and…
Spring Bank Holiday
Bloody Hell. Hurray for a UK company 😡

Made in Britain (from The IT Crowd)

So I started recovering my backup…

Sounds like a good time to start panicking. I assume they have a grace period, but I decide I’ll try to download as much of my backup as I can. A quick calculation shows I won’t have time to download everything before the end of the day (told you waiting had been a bit stupid). Great, now I have to pick. Good thing I mostly have large files: downloading the first few will give me a lot of time to think about the next ones. I start downloading.

And this is where things go incredibly south. Let’s say nothing about SFTP being so unusably slow that I had to use FTP (“Welcome to 2001… wait, aren’t we in 2021?”), and let a picture be worth a thousand words. Or a few thousand files:


… only to find it was largely unrecoverable

Did you see it? No? Look at the bottom. Still no? Bottom-left. That’s right: for 3944 total files, 262 failed! That’s over 6.6% (almost 6.66%, the number of the Beast 👀). And I retried a bunch of them: it didn’t change a thing. A lost file was a lost file. For. Fuck. Sake.

I also gave a try to downloading from the web interface. Admire how a 10 GB file turns into a 0-byte file, without the slightest error message. “Everything normal, SNAFU”. Splendid:

Systems normal - all fucked up

Fun fact: file size didn’t seem to matter in how likely it was for a file to be lost. If random clusters would get lost, and as a result would doom the large file they were a part of, I would expect to lose almost all my huge files, and not nearly as many small files. But no, I lost many “small” files (a few MB), and not that many “huge” files (more than 5 GB). I seriously wonder how the hell you lose random files rather than random clusters… My best guess is 1) no data replication at all and 2) each file is placed on a single, random hard drive (independently from the time of upload, as files I had uploaded together didn’t necessarily had the same conservation status).

So I left

From that moment on, obviously I was fully decided not to renew my subscription. So I kept downloading even faster. I actually managed to get back most of my data, as my account wasn’t cut off at midnight, but kind of late in the following afternoon. Had I let it run for the night (silly me… :/), I would probably have gotten back everything. That is, everything that hadn’t been lost.

So, as I said earlier, that payment failure was a blessing in disguise, since it made me realize I was paying for a backup that pretty much had no value. 168€/year for 5TB for storage (+ automated backups, this I haven’t replaced yet).

Let’s talk a bit about what happened afterwards. After the account was suspended, I regularly received e-mail reminders, more precisely: within 1-2 hours after suspension, then at day 5, 10, 20 and 1 month. That last e-mail mentioned that it was a final reminder and that the account would be erased after 30 days. I logged into my account just 4 weeks after receiving that e-mail, and it was indeed still there (suspended, with just a payment form to reactivate it).
All in all, they give the impression of an honest company that does its best to make sure data don’t get wiped by accident (although 2 months isn’t that long, I guess they can’t keep the data forever either, it does have a cost). Only their best is far, far below reasonable expectations, as far as data integrity goes.

A new dawn

Moving on, I’m currently giving a spin to Backblaze, which I had been very hesitant about for a while, notably because of their unusual transfer protocol: they use their own. Cyberduck can handle it, but that’s pretty much it as far as open source clients go, I believe.
Still $0.005/GB/month, so for the price of Livedrive, in pure storage, I get 2.8TB. With lots of redundancy this time. Note that they bill for lots of little things: if you know AWS S3, Azure or other “cloud” providers, it’s a bit the same concept, every single action / API call is billable. In Backblaze’s case, there’s a free daily allowance that should help you avoid most of these little extra costs, if you spread your activity regularly rather than do tons of things one day, then nothing for ages. And there’s another billable thing, which this time is a big one: downloads. $0.01/GB (1GB free per day). That can pile up pretty quickly, and if I take the example of my emergency escape from Livedrive, downloading 2TB is therefore $20. Which is both “not nothing”, but also “not that much”. Better than losing 5%+ of my files, anyway.
Another nice thing with Backblaze, is that it will give me an incentive to minimize my storage, aka to stop freaking hoarding ^^. While Livedrive’s pricing was on the contrary an incentive to hover around 5TB…

Posted in backups.

aToad #29: FileSeek

Freeware to search in huge text files

Big text files are a recurrent issue for me. Not that I deal with them often, but when I do, they are indeed huge, and the tools I usually use, such as Visual Studio Code or Notepad++, just can’t deal with them.

I eventually found a blog post listing a bunch of software supposedly able to cope with large text files. Some have apparently vanished, some can open the files but can’t really search in them. The one that I found best for my needs was FileSeek, which can’t open the files but can search in them (and display a bit of contents around the found text – the whole line actually -, which was pretty much what I wanted).

FileSeek free version, searching in multiple SQL backup files

On the minus side, it’s neither open source nor free. On the plus side, it does have a free version, with very few limitations compared to the paid one (I don’t even notice them). Also it’s able to search in multiple files at once, a feature I didn’t need at first but which turned out to be quite convenient.

Posted in A Tool A Day.

aToad #28: ReqBin

Online API testing tool

The last tool I wrote about was a desktop API testing tool, ARC, well here’s an online one this time, if you don’t want to bother with running software locally. ReqBin allows you to send pretty much any HTTP request you want, from their website, with their IP (you get to choose between, at the moment, 2 server locations: US or Germany).

Compared to ARC, I find it more convenient if I need to just run one quick request. Notably, the UI is more comfortable IMO. But if I want to run (and save) a bunch, I stick with ARC.
A big thing to be aware of is that requests go through their servers (as I already wrote above). It’s convenient to hide your IP, but it also means that whatever you send (API keys…), you send to them first. It’s up to you to see if you want to use production keys there…

Another issue is that, like Postman, they add a bunch of extra headers compared to your original request. Including your user agent (yup, they hide your IP, but not your browser). For instance, here are the headers in a request I made to httpbin (which is another nice service, that will mirror whatever request you send them) with ARC:
"headers": {
"Content-Length": "0",
"Host": "",
"X-Amzn-Trace-Id": "xxxx"

And here are the headers from the same request made using ReqBin:
"headers": {
"Accept": "application/json",
"Accept-Encoding": "deflate, gzip",
"Content-Length": "0",
"Content-Type": "application/json",
"Host": "",
"User-Agent": "xxxx",
"X-Amzn-Trace-Id": "xxxx"

As you can see, 4 extra junk headers… “Content-Length” and “Host” appear unavoidable, “X-Amzn-Trace-Id” seems to be added by httpbin.

So well, keeping those little caveats in mind, this service can be useful on occasions.

Posted in A Tool A Day.

SumatraPDF dark mode

SumatraPDF is a lightweight PDF reader (here). To give you an idea, its installer is less than 10 MB (around 5 MB for version 3.1.2, which I still use due to a bug in 3.2, and 9 MB for version 3.2), where Adobe Acrobat Reader’s installer is over 150 MB.

I wanted to read some books in it, but the (usual) white background is a bit hard on the eyes. SumatraPDF doesn’t provide a dark mode as-is, however it provides a way to customize a lot of things in its UI… including background and font colors. Long story short, you can make your own dark mode. Quite easily, if you have some very basic knowledge of HTML colors codes: go to Sumatra’s menu, then Settings -> Advanced Options. This will open a text file, SumatraPDF-settings.txt, containing a bunch of settings (possibly all?), and even your recent file history, if you chose to keep it.

In this file, go to the FixedPageUI section (which should be quite close to the top of the list). Then edit TextColor and BackgroundColor at will. I chose #cccccc for text and #333333 for background. Note that 3-letter short color codes (like #ccc) won’t work here (yes, I tried, I’m that lazy ^^). In Sumatra 3.2, you also have GradientColors, which is the color of the windows background outside of the page, but in Sumatra 3.1.2 that setting is absent (and I tried adding it and it didn’t work).

The settings should apply as soon as you save the file. If not, I guess you can always restart Sumatra.

Note that this does have an annoying side effect: if the PDF you read contains pictures with a transparent background, they’ll probably look very weird. I don’t think there’s a fix for this, so I just skip the pictures, or if I really must, I put the text and background color back to respectively black and white.

Update (2021-05-03): “pale” mode

As I mentioned above, this dark mode is often problematic when viewing pictures. I also had, on occasion, text that would remain black, over my black background, making it impossible to read.
So I eventually gave a shot to another configuration, using this time some kind of dark-ish grey for text and some not-as-dark grey for background. This results in a pale but globally eye-relaxing (IMO) theme, although I noticed its lack of contrast forces me to zoom a bit bigger to be able to read comfortably. The big plus is I haven’t encountered any text or picture that was rendered totally unreadable by this setup. My values are:
TextColor = #333333
BackgroundColor = #bbbbbb

Posted in Uncategorized.

vsftpd quick installation cheat sheet

I recently had to set up an FTP server. I know right, who still uses FTP nowadays? Well apparently, some big people still do, and switching them to SFTP wasn’t an option. Luckily, I had an old self-made documentation from 2013 on how to set up all my server things, which at the time did include an FTP server, vsftpd. A quick search showed me that it still was the go-to software for this, so hurray, and here is what it said:

apt-get install vsftpd
Config file: /etc/vsftpd.conf
In this config file, uncomment the lines local_umask=022 and write_enable=YES.
At the end, add:

Command to restart: service vsftpd restart
guide: (RIP :/)

I suppose some things had changed, as this left me with a couple of errors/warnings.

First, I got an error message saying “vsftpd: refusing to run with writable root inside chroot()”. My quick fix was to add this to the above-mentioned config file:
But for more details, you may want to read this

Second, I got a message in FileZilla saying “Server sent passive reply with unroutable address. Using server address instead”. As the message suggests, it’s not breaking for FileZilla, which still managed to connect. However, it’s a problem for some clients. My final fix was to add this to the config:
#pasv_address=[server IP]

Turns out passive mode wasn’t enabled by default in my case, pasv_enable solves that.
Then I had a firewall issue, as I used to believe FTP uses just port 21, but I learned on this occasion that passive mode will automatically use a random port between pasv_min_port and pasv_max_port. Since the server where I’m setting this up is behind a paranoid firewall and I have to open ports one by one, I set them both to the same value. Not sure what the implications are compared to multiple random ports.
The last line I just kept commented out for safe-keeping, as I found it as a possible solution but it turned out it didn’t help, and I found there that it seems best to keep it unset.

And that’s about it, all working now. Although it could probably use some security tweaks. My priority here was “just make that damned thing work”.

Update 2021-03-31

It was brought to my attention that FTP needs one port per concurrent transfer, so having pasv_min_port = pasv_max_port means the server will only accept one concurrent transfer. Good enough for my use case, but you may want to keep a wider range for yours.

Update 2021-09-03

Coming back to this machine half a year later, I got that “Server sent passive reply with unroutable address. Using server address instead” message from Hell again. Despite no change in the config.
So I dug up some more, and eventually found this. Long story short, my pasv_address was IPv4, so I had to set listen_ipv6=NO and listen=YES (the default is the other way around, for some strange reason).
Problem solved (again). Until it reappears again?

Posted in FTP, servers.