Notes
Atom FeedLinters
A list of linters that I use for my projects:
Language | Linter |
---|---|
Python | black |
Python | flake8 |
Go | GoVet |
Go | Staticcheck |
Go | Errcheck |
Go | Golangci-lint |
Javascript | eslint |
Bash | Shellcheck |
Makefile | Checkmake |
Dockerfile | Hadolint |
Nginx | Gixy |
Vimscript | vint |
LaTeX | chktex |
Installing Mysqlclient in Python Slim Docker Image
Installing the mysqlclient python
package in a python:3.11-slim
docker container fails because the slim version leaves out the libraries needed
to compile mysqlclient
. Rather than using the full python:3.11
base image
that is much larger, you can install the mysqlclient
dependencies manually:
FROM python:3.11-bullseye
# Install mysqlclient debian package dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libmariadb-dev-compat gcc `: MySQL client` \
&& rm -rf /var/lib/apt/lists/*
# Install mysqlclient python package
RUN pip install --no-cache-dir mysqlclient
Processor Trends
42 Years of Processor Data
PermalinkResizing a Ubuntu Disk in a UTM VM
UTM is an awesome virtualization system based on QEMU built for M1 (ARM) Macs. v4.0.8 of UTM, the first v4 stable release, came out today with support for resizing QEMU disk images but while the UTM docs show how to resize the UTM machine, there’s several more steps to get the virtualized file system to recognize the additional disk space.
For an Ubuntu guest OS running a default GPT and LVM partition:
- On a shut down VM, in the UTM UI’s configuration, select the disk you wish to expand, resize the disk, and save the VM configuration.
- Launch the VM and get a terminal
- Run
sudo fdisk -l
and confirm that there is aGPT PMBR Size Mismatch will be corrected by w(rite)
warning - Run
sudo parted -l
and gparted should ask to automatically fix the size mismatch. Fix the size mismatch. - Run
sudo lvm
to get an lvm console - Run
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
to expand the lvm logical volume - Exit the lvm console
- Run
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
to expand the ext4 file system to the logical volume - Run
df -h
to confirm that the/dev/mapper/ubuntu--vg-ubuntu--lv
has been expanded.
References:
- Superuser: GPT PMBR Size Mismatch will be corrected by w(rite)
- AskUbuntu: Ubuntu Server 18.04 LVM out of space with improper default partitioning
Bash File Test Operators
Usage Example:
if [[ -e "$file" ]]; then
echo "pass"
else
echo "does not pass"
fi
Operator | Meaning |
---|---|
-e |
File exists |
-s |
File exists and is not empty |
-d |
File exists and is a directory |
-f |
File exists and is a regular file |
-v |
Variable is set and been assigned a value |
-z |
String is zero |
-n |
String is non-zero |