Skip to content

Instantly share code, notes, and snippets.

@bmaupin
bmaupin / reasons-not-to-use-windows.md
Last active May 3, 2023 12:36
Reasons not to use Windows
  • In Windows, files that are in use cannot be modified
    • As a result, Windows updates have to happen when the computer is not in use, such as during shutdown or boot (often both)
      • Compare to Linux/macOS, which can install updates while the computer is being used 😎
  • Windows command line has a length limit of 8191 characters
  • Windows uses backslashes (\) as file system path separators
    • All other modern operating systems (macOS, Linux, Android, iOS, etc) use a normal (i.e. forward) slash (/) and use backslashes for escaping
  • Windows can't run Docker containers natively
    • They need to run inside a Linux VM (they can be run inside WSL, which is itself a Linux VM)
  • Windows' NTFS filesystem performs poorly compared to Linux's ext4 filesystem
@bmaupin
bmaupin / javascript-xml-parsers.md
Last active January 12, 2024 20:04
JavaScript XML parsers
Parser Size Maintained Node.js Browser Streaming Types Modifying XML Notes
jsdom 3.11 MB yes yes N/A DefinitelyTyped yes Probably the best choice since its API is closest to the browser API for manipulating XML
cheerio 558 kB yes yes yes included yes jQuery-like API for parsing and manipulating HTML and XML
xmldoc 41.4 kB yes yes yes DefinitelyTyped Partial, not recommended (nfarina/xmldoc#51)
@xmldom/xmldom 182 kB yes yes yes included yes ⚠️ Based on DOM but no querySelector/querySelectorAll
sax 55 kB yes yes yes? yes DefinitelyTyped Not recommended ⚠️ API is callback-based and very cludgy, but it has streamin
@bmaupin
bmaupin / programming-languages.md
Last active June 20, 2022 18:11
Thoughts on programming languages

ⓘ This list is more-or-less limited to languages I have personal experience with

C#

  • Recommended?: 👎
  • Pros
    • Like a more modern Java without a lot of Java's problems
  • Cons
    • Although it is now open-source with .NET Core, a lot of existing code and libraries aren't compatible
    • A fully open-source .NET/C# seems to conflict with Microsoft's priorities: Can we trust Microsoft with Open Source?
  • See also: Is .NET an open platform yet?
@bmaupin
bmaupin / ui-component-libraries.md
Last active January 16, 2023 14:39
UI component libraries
@bmaupin
bmaupin / 2022-russian-invasion-of-ukraine-maps.md
Last active October 18, 2022 12:56
2022 Russian invasion of Ukraine maps

Latest Latest Russian invasion of Ukraine map

2022-09-05 2022-09-05 Russian invasion of Ukraine map

2022-04-08 2022-04-08 Russian invasion of Ukraine map

2022-03-16

@bmaupin
bmaupin / javascript-date-time-gotchas.md
Last active November 24, 2021 15:29
JavaScript date/time gotchas

TL;DR

  • The general consensus seems to be use UTC everywhere and convert to the local time zone when displaying dates/times to the user
    • UTC isn't perfect; aside from leap seconds, the biggest issue seems to be when local time zone rules change, making dates stored in UTC inaccurate
  • When passing timestamps over the wire (e.g. to/from an API), convert them to strings using an unambiguous standard format that includes the time zone such as ISO 8601
    • In TypeScript/JavaScript this can be accomplished using Date.toISOString(). Use new Date(dateString) to convert back into a Date object
  • In the cases where the time zone is set to UTC but a local timestamp is needed (e.g. to represent "today midnight"), a library may be needed: https://momentjs.com/docs/#/-project-status/recommendations/

[new Date(year, monthIndex, day)](https://developer.mozilla.org/docs

@bmaupin
bmaupin / modern-native-compiled-languages.md
Last active July 14, 2022 15:40
Modern high-level languages that compile to native binaries

Goal

A simple way to write native applications (particularly CLI applications but optionally GUI applications) in a modern language (e.g. not C++/Qt) that's fun to use (e.g. not Go). This is primarily for small utilities where speed isn't a big concern. Binary size is a mild concern. Most of the rest is just icing on the cake (cross-compile support, etc).

Summary

Language High-level Garbage-collected Cross-compiling REPL Backed by large organization Cross-platform GUI library Comments
👉 TypeScript with pkg yes yes yes yes yes yes This isn't really "native" but may be the best option for something quick and dirty without having to resort to less-fun languages (like Go). See test-javascript-executables for ways to get the binary as small as possible.
Kotlin with GraalVM yes yes ⚠ [no](https://github.com/oracle/graal/
@bmaupin
bmaupin / kobo-support.md
Last active October 4, 2021 19:08
Kobo support
@bmaupin
bmaupin / wii-remote-powering-off.md
Last active January 29, 2024 16:09
Wii remote intermittently powering off

Symptoms

Wii remote will randomly power off when in use.

Cause

This is most often caused by a bad connection between the batteries and the contacts, which is frequently due to corrosion from current or past battery leakage. This is fairly common with standard non-rechargeable alkaline batteries.

Prevention

@bmaupin
bmaupin / ankidroid-clean-ui.md
Last active May 28, 2021 14:36
AnkiDroid clean UI config

General configuration

Here are some general tips to make AnkiDroid have a cleaner UI that's a little bit less distracting:

  1. Go to Settings > Reviewing

  2. Uncheck Show button time

    (This shows the next interval for the card above each answer button)

  3. Uncheck Show Top Bar