I recently started using Next.js instead of create-react-app (CRA) for building React apps. The main reason is for server-side rendering. I found it a bit tricky to modify the webpack configuration, so I'm sharing how I managed to match some behaviour from CRA. By default, recent versions of CRA let you import foo.module.css in your … Continue reading Next.js with and without CSS modules
How to upgrade Debian 8 Jessie to Debian 9 Stretch
This past weekend, I upgraded my laptop (eeyore) from jessie to stretch. As I've been running debian testing for the last 20 years, this is the first time I've actually had to do an upgrade. Unfortunately I hit a few snags. Problem #1: Upgrading without uninstalling packages When you run apt-get dist-upgrade, you find that … Continue reading How to upgrade Debian 8 Jessie to Debian 9 Stretch
Removing exactly one physical volume from an ext4 filesystem
While there appear to be many webpages explaining how to resize/shrink a volume, I haven't seen one that resizes/shrink the filesystem to exactly the right size, and then resizes/reduces the logical volume to match. The accepted approach appears to be to resize the filesystem to definitely smaller than the logical volume will be, then reducing the … Continue reading Removing exactly one physical volume from an ext4 filesystem
Dependency Injection Design Pattern in Java: Example
Dependency Injection Design Pattern Program to an 'interface', not an 'implementation'. This is the premise of dependency injection. It goes one step further to allow libraries that use the interface library to not 'depend' on the implementation library even though they depend on the interface library. That is, the implementation can be 'injected' at run … Continue reading Dependency Injection Design Pattern in Java: Example
Workaround transient I/O errors
So apparently some older linux kernels have issues during times of high I/O and cause drives to be stuck reporting I/O errors until a reboot. Apparently this is a more common issue on virtual machines. If this doesn't happen to the drive containing your OS, you're lucky because you can recover from this without rebooting. … Continue reading Workaround transient I/O errors
git status sorted by last modified timestamp
For those of us that keep a heap of local changes (both new and changed files), here's a command that will show you unstaged files, sorted by time: ls -lrtd $(git status --porcelain | grep '^.[?M]' | sed 's/^.. //') I find this particularly useful to commit what I worked on that day. If you … Continue reading git status sorted by last modified timestamp
umount mountpoint and all sub-mountpoints
A bash function to show the most reliable way I've found: unmount() { sudo umount -l $(cut -f5 -d ' ' /proc/self/mountinfo | egrep "^$1(/|$)" | sort -r | uniq | xargs) } What's wrong with /proc/mounts? If you have a "device" that's been deleted, it makes the output harder to parse. Why not just … Continue reading umount mountpoint and all sub-mountpoints
Moved to wordpress.com
Not that there are many on CSE who host their blog using wordpress, but for those that have, to migrate: export from CSE (e.g., https://cgi.cse.unsw.edu.au/~jayen/blog/wp-admin/export.php) import onto wordpress.com (e.g., https://jayenashar.wordpress.com/wp-admin/admin.php?import=wordpress) choose an appropriate theme (if you were using a custom theme on CSE that you can't use on wordpress.com) fix up your widgets move any … Continue reading Moved to wordpress.com
javascript every language (and country) in every other language
Thank you java for supplying this information:Full lookup:codetonames.jsSome duplicates removed:codetonames.js
retry function for bash
Example: