The main repository is located at https://gitlab.otonokizaka.moe/Umi/til
Collection of small writeups from my daily learning.
This document is best edited with emacs org-mode.
Docker has a new build backend called buildkit, which is an improvement over the original docker build backend.
You can activate it by exporting the DOCKER_BUILDKIT
environment variable like so:
export DOCKER_BUILDKIT=1
This works great with docker build
, however it doesn’t work with docker-compose build
.
You can fix that by exporting one more environment variable like so:
export COMPOSE_DOCKER_CLI_BUILD=1
There are commands for inserting a heading below the current line in org-mode, so you don’t have to type out the *
yourself.
The most useful one is probably org-insert-heading-respect-content
, which inserts a new heading at the end of the current subtree.
To trigger a Jenkins job with cURL, you will need to get an API token for your user.
Go to https://JENKINS_URL/user/JENKINS_USER/configure, then create a new API token under the API Token
section.
Then, to trigger a job, run:
curl -X POST https://JENKINS_API_TOKEN@JENKINS_USER:JENKINS_URL/job/JOB_NAME/build
Due to a bug in Kubernetes, HPA resources managed by ArgoCD might be stuck at syncing forever.
The fix is to reorder the metrics (placing memory before cpu). For example:
@@ -48,13 +48,13 @@ autoscaling:
metrics:
- type: Resource
resource:
- name: cpu
+ name: memory
target:
type: Utilization
averageUtilization: 60
- type: Resource
resource:
- name: memory
+ name: cpu
target:
type: Utilization
averageUtilization: 60
When the underlying system upgrades libffi
, and you are using a Python version installed with pyenv
, you might run into this error:
>>> import ctypes
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/umi/.pyenv/versions/3.8.1/lib/python3.8/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
The reason is that libffi.so.6
no longer exists and is repalced by a newer version of libffi
The fix is simply recompile your Python:
pyenv install -f 3.8.1 # or whatever version
It is often helpful to access global build info in your sbt files.
One might attempt to do something like this:
val version_ = (version in ThisBuild).value
someTask := // do something with version_
However, the above doesn’t work, to proper way is to do this:
someTask := {
val version_ = (version in ThisBuild).value
// do something with version_
}
If you’re using Maven repositories you will also have to select the right repository depending on your artifacts: SNAPSHOT versions go to the /snapshot repository while other versions go to the /releases repository.
Doing this selection can be done by using the value of the isSnapshot
SettingKey:
publishTo := {
val nexus = "https://my.artifact.repo.net/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
The shortcut to fix code indentation in vim is =
.
You can use visual mode to select a block of code and use =
to fix indentation for that selection.
You can also use =G
to fix indentation for every line below the cursor.
CTRL+w =