Batch resising for web
Smaller environment (Photo credit: wikipedia)
I recently tried to measure the environmental impact of this website. I used
an online tool. The result shows the easiest way
to improve my score was to reduce image sizes. This could easily be done with
ImageMagick.
I wrote a small bach script to resize my files:
#!/bin/bash
# resize images for web use
target_size=200 # in kb
output_dir="web"
mkdir -p $output_dir
resize_image() {
echo "image $1..."
output_file=$output_dir/$1
cp "$1" "$output_file"
current_size=$(( $(stat -c%s "$output_file") / 1024 ))
factor=95
while (( current_size > target_size ))
do
echo "current size: $current_size"
current_size=$(( $(stat -c%s "$output_file") / 1024 ))
magick "$1" -resize $factor% "$output_file"
factor=$(( factor - 5 ))
done
}
for image in *jpg
do
resize_image "$image"
done
It tries several resize factor (while loop, factor being redefined line 20)
until the output size is lower than a predefined threshold.
Then, I needed to replace path in all my articles.
Kmeans with Polars
rusty python logo
The goal of this article is to use the rust
polars directly to
perform a common machine learning task I usually do using python.
The task
Let's choose a simple task: use of K-means.
To do so, we should:
- retrieve a dataset
- make some preprocessing
- perform kmeans …
Read More
HTTP to HTTPS
Public key (Photo credit: Michael Drummond)
The goal was to migrate from HTTP to HTTPS
HTTPS overview
The HTTPS protocol rely on TLS
(previously SSL) to ensure data integrity (data cannot be modified unnoticed),
confidentiality (requested URL and content are only known by end points) and
authentication (end points are …
Read More
Travis setup
One job in continuous integration pipeline (Photo credit: Wikipedia)
The goal is to setup a CI pipeline based on Travis
with external dependencies integrated to a Github repository
Travis basics
To enable Travis integration in Github, one must edit ./.travis.yml file.
I won't go into detail. The setup is …
Read More
LaTeX makefile updated
My default LaTeX makefile evolved. Here is an update:
The makefile looks like:
LATEX=pdflatex
BIBTEX=bibtex
BIB=
RERUN='(There is undefined reference|Rerun to get (cross-references|the bars) right)'
%.pdf:%.tex
${LATEX} $<
@if [ -e $*.bbl ]; then ${BIBTEX} $* && ${LATEX} $< && ${LATEX} $< ; fi
@if egrep -q $(RERUN) $*.log ; then ${LATEX} $< ; fi
%.aux …
Read More
Functional Block diagram
How to make a block diagram
with \(\text{\LaTeX}\)?
This article is mainly inspired by tex example.
Here is an example
with tikz
resulting in the following figure:
The code:
\documentclass{article}
\usepackage[landscape,margin=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
\tikzstyle{block}=[draw,fill=red …
Read More
Sail ship maneuvers

Sail ship not tacking (Proto credit: Wikipedia)
Maneuvering a sailship is not straight forward, especially when against the wind.
This article is focused on sail position when turning for
full-rigged sailships.
The main sources are naval action videos.
Preambule
The sailship has 2 or 3 masts.
The fore-mast (the one …
Read More
loop devices
Loop devices are used to acces any file as if it were a block
device such as a disk. On
GNU/linux, the canonical command to interact with loop devices is
losetup . To list the next
usable loop device :
losetup -f
disk image loop mount …
Read More
Conference posters
Few weeks ago, I wrote about mindmap in
. Now I want to precise few ideas and to have all key ideas
visible in one sight. I think the best layout is similar to a conference
poster:
- key ideas are easily seen few meters away …
Read More
quick and easy calendar
A quick post to share something I was looking for for several month: a
quick way to see a calendar.
A simple tool using the command line
interface is
the `cal <https://en.wikipedia.org/wiki/Cal_%28Unix%29>`__ command
that display a calendar in …
Read More