Today I ran into an interesting question, why am I being asked to configure
tzdata while installing npm. Turns out that the aptitude cli has a why
command that very handily nails down why you have something installed on a
debian based system.
Install aptitude #
apt install aptitude
Why tzdata #
Now we can query why we need tzdata and see the full chain with the root
package being npm.
root@47685221fb82:/# aptitude why tzdata
i npm Depends node-gyp
i A node-gyp Depends gyp (>= 0.1+20200513gitcaa6002)
i A gyp Depends python3:any
i A python3 Provides python3:any
i A python3 Depends python3.12 (>= 3.12.3-0~)
i A python3.12 Depends tzdata
Today I ran into this interactive prompt on ubuntu while installing node and npm, and I do not want to manually configure this interactively every time I run an install, moreso in docker I do not have the interactive terminal to do so.
Configuring tzdata
------------------
Please select the geographic area in which you live. Subsequent configuration questions will narrow this down by presenting a list of cities, representing the time zones in which they are located.
1. Africa 2. America 3. Antarctica 4. Arctic 5. Asia 6. Atlantic 7. Australia 8. Europe 9. Indian 10. Pacific 11. Etc 12. Legacy
Geographic area:
Why tzdata #
Checking aptitude why tzdata it shows that the chain goes back through npm.
root@47685221fb82:/# aptitude why tzdata
i npm Depends node-gyp
i A node-gyp Depends gyp (>= 0.1+20200513gitcaa6002)
i A gyp Depends python3:any
i A python3 Provides python3:any
i A python3 Depends python3.12 (>= 3.12.3-0~)
i A python3.12 Depends tzdata
The solution, configure tzdata #
export TZ="America/Chicago"
export DEBIAN_FRONTEND=noninteractive
apt update
apt install tzdata -y
ln -fs /usr/share/zoneinfo/$TZ /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
DEBIAN_FRONTEND=noninteractive
This is required, because apt installing tzdata will trigger the
interactive prompt. You will manually configure it in the next two steps.
dst session one
https://www.youtube.com/watch?v=03KsS09YS4E&t=610s
Today I learned about the basic calculator, bc. At the very end of this video prime uses it to add numbers in vim.
REPL #
You can start a calculator repl at the command line, by running bc.
Vim #
Since bc supports standard unix pipes you can easily pipe data from vim into bc
and back out using !!bc. All you need is a string of math on the line you
want to calculate, go to normal mode and run !!bc to get the answer.
Traditionally I will open my system calculator or ipython to do something like this.
To keep the equation and the result in the same line you can send the equation to stderr and the result to stdout using tee.
:.!tee >(cat >&2) | bc