A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

How to maintain software

You have a massive legacy spaghetti mess of code, and you need to add a new feature.

Write tests first.

Put all your new code in a new module, and only insert single lines into the legacy code to call the new code. This allows you to properly encapsulate the new code, wrap it in try/catch blocks, etc. and not break the legacy system.

Pass whole objects into the new code, this is a necessary consequence of encapsulation.


How big is libgen? Answer: 131TiB (= 144Tb)

# First method: 131TiB

$ wget https://phillm.net/libgen-stats.php -O libgen-stats.json


$ cat libgen-stats.json | jq '.[]|.size_bytes' | perl -lne'$x+=$_;END{print$x}'

144116297318150


$ bc -l

144116297318150 / 1024 / 1024 / 1024 / 1024

131.07300884998949186410 Tebibytes


$ bc -l

144116297318150 / 1000 / 1000 / 1000 / 1000

144.11629731815000000000 Terabytes



New software cheat sheet

 

## Languages

- Perl: best for fast prototyping
- Ruby: best for having fun
- Node: best for public projects
- Python: best for experiments

## Frameworks

### Perl

- DBIx::Class 💯
- Mojolicious 💯

### Node

- Express (popular)
- React?
- Koa?
- NestJS?
-....? for testing: Qunit?
-....? for web framework

### Python

- Django? (this one)
- Flask?

### Ruby

- Rails?
- Active Record?

## Libraries

### Perl

- just everything

### Node

- minimist reads command line arguments
- cheerio parses HTML
- daysjs manages dates/times
  - customParseFormat plugin parses dates
- knex does CRUD on databases
- fs perfoms operations on the file system
- import process from 'node:process'; // process.exit(1);