Be careful with Node file globbing vs bash globbing
There’s a common gotcha when using commandline tools that have their own file globbing, such as Prettier in Nodejs. This command is supposed to run prettier against all the .ts files in all folders…
notestoself.dev/posts/be-car…
Productivity with random numbers
One little productivity trick I use is to select tasks or work with a random number. The simplest form is numbering a list of things you could do, then selecting one randomly.
notestoself.dev/posts/produc…
Loop try catch
A simple cause of failure in software systems is a single problematic item in a set causing the entire set to fail. Trivially, it looks like this: for (const item of items) { processItem(item) } When something goes wrong in processItem()…
notestoself.dev/posts/loop-t…
1
2
Ask your interview candidates to ask you an algorithm question in return
Here’s a potential idea to improve the technical interviews that you run: if you use algorithm questions in interviews, ask candidates to ask you an algorithm question as well.
notestoself.dev/posts/interv…
1
2
Easy social media images and markup with Hugo
Twitter Cards and Facebook’s OpenGraph provide semi-standardised markup for describing web content to social media and other aggregators.
notestoself.dev/posts/easy-s…
Github Action job to post pytest coverage as PR comment
Here’s a Github Action job that runs pytest coverage and then posts a summary of the coverage report as a PR comment with Markdown formatting.
notestoself.dev/posts/github…
Capturing multiline output and exit status in a Github Action with bash
You can capture output from a Github Action by echoing a variable name to the file specified by the
notestoself.dev/posts/github…
Python script to automate static Hugo site post images
It’s good to have a general post image on content sites, as it gives more of an identity to each page, and works well for social media sharing images.
notestoself.dev/posts/python…
Easier interface segregation in TypeScript (even better than Go!)
Preamble: Introduction to interface segregation (Skip this if you’re aware of what the Interface Segration Principle is.) The Interface Segration Principle is the I in the SOLID mnemonic.
notestoself.dev/posts/easier…
Python iterator chunk generator function
Here’s a versatile Python function that splits any iterator into chunks of size n as a generator. It can take simple iterators such as lists, but also take a generator and chunk it without unwinding the whole…
notestoself.dev/posts/python…
eslint changed TypeScript files only
It’s best if a linter is applied from the beginning of a project, and with default linting rules, as that way the project benefits from the linting with the minimum possible effort.
notestoself.dev/posts/eslint…
1
1
Keeping the ElasticSearch service running on an Ubuntu server
A local ElasticSearch instance powers the Chinese example sentence search feature on Chinese Boost. This works fine, but the ElasticSearch instance has a habit of crashing about once a day.
notestoself.dev/posts/keep-e…
Simulating an S3 static website on localhost with Yulin
If you’re using S3 to host a static website and want to test and develop it locally, you can use the @kensio/yulin package.
notestoself.dev/posts/yulin-…
Simulating AWS IAM authorization of S3 calls locally with Yulin
If you want to check locally that your IAM policies allow and deny what you think they do, you can use the simulated IAM service in Yulin.
notestoself.dev/posts/yulin-…
A bad mix of bash and sh with [[
If you accidentally run a bash script with sh, you’re probably going to have a bad time. One little gotcha is the use of [[ (double square brackets) in bash. E.g.: if [[ -z "${PROJECT_ID}" ]]; then echo
notestoself.dev/posts/a-bad-…
Combining TypeScript assertion signatures and function overloads
TypeScript has a useful feature called assertion signatures that allows you to write functions that can be used to narrow the type of a value.
notestoself.dev/posts/combin…
5
Problem maximisation
A common metaphor about the potential dangers of AI is called “paperclip maximisation”. The idea is that an AI tasked with producing paperclips could figure out that it can produce more paperclips by e.g.
notestoself.dev/posts/proble…
1
7
Beware of SQL averages over dates with empty days
It’s pretty common to use SQL to extract sales summaries from tables that represent sales orders as rows. These kinds of queries often use the AVG() aggregate function to summarise the sales volume.
notestoself.dev/posts/beware…
3
Catching stale dist files in an npm tarball before publishing
Most TypeScript packages publish only their build output from the dist/ directory. That looks like this in the package.json file: {
notestoself.dev/posts/npm-pa…
2
Bash script to run CDK synth only if there are changed TS files
The cdk synth command can be pretty slow, even when running for a single small stack. We also often want to run the CDK synth command regularly as part of local development setups, so it’s…
notestoself.dev/posts/cdk-sy…
17
