janv. 2025
jeu. 16 janv.
TIL that htmx is mostly a js library to make requests to an API from html attributes.
ven. 3 janv.
TIL that on mac hitting Alt+Space produces non breakable spaces that are recognized as a character, part of a command. Hence the tr : commande introuvable or grep : commande introuvable that happen sometimes.
déc. 2024
lun. 30 déc.
TIL that with docker-xampp, you can have an easy local development setup for php. localhost:41062/www gives you your site, localhost:41062/phpmyadmin the db web ui...
lun. 30 déc.
TIL react-leaflet map object offers a map.getZoom and map.getBounds methods to precisely know the current view. Also, Bounds offer a .contains method to tell if a point is within the bounds !
mer. 18 déc.
TIL with mysql (at least) its possible to order elements before aggregating them in a e.g. GROUP_CONCAT aggregate. For example : GROUP_CONCAT((SELECT date order by date) SEPARATOR ', ')
mer. 18 déc.
TIL that -n flag in echo command prevents the ending newline
jeu. 12 déc.
TIL how to join on geography with a tolerance : select * from a join b on st_intersects(st_buffer(a.geog, <tolerance_meters>), b.geog)
jeu. 12 déc.
TIL to create a spatial index in PostGIS with CREATE INDEX <index_name> on <table_name> USING GIST (<geography_or_geometry_column_name>). Sooooo efficient
mar. 10 déc.
TIL that typesense filter_by operators : and := are quite different. : filters using full-text search while := performs exact search.
nov. 2024
ven. 22 nov.
TIL that you can run TS files with tsx it automatically transpiles ts to js and runs it with node.
jeu. 21 nov.
TIL about jaccard similarity, a metric for deduplication, that compute the ratio of overlap of two binary vectors. It is computed as the ratio of the intersection over union of terms. It can be combined with tf-idf by using the tf-idf weight for each term.
mar. 19 nov.
TIL to set response headers with fastify, ridiculously simple. E.g. to set cache headers for browsers to use their internal cache for one hour, the callback of a simple endpoint would be: (req, res) => { res.header("Cache-control", "public, max-age=3600"); return doSomething(req)} // or res.send(doSomething(req))
lun. 18 nov.
TIL that to get the summary of a git diff you can add --stat to get the number of edits per file.
oct. 2024
mar. 29 oct.
TIL how to extract data with jq, e.g. for extracting the names of the collections from a typesense cluster : curl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" "http://localhost:8108/collections" | jq '.[] | {name}'
mar. 29 oct.
TIL that typesense now requires infix parameter to be explicitely set for each query_by field and cannot be broadcasted/inferred by server.
lun. 28 oct.
TIL that it is possible to avoid the gutter layout shift by using the CSS scrollbar-gutter: stable; attribute. Gutter (but not the scrollbar) is then always displayed. Not optimal but sometimes help with intempestive layout shifts...
lun. 28 oct.
TIL that @fastify/multipart sets a default limit on the file parts size (total, individual, etc.). One need to override them when registering multipart : e.g. app.register(multipart, {limits: {fileSize: 10_000_000}}) for 10MiB.
jeu. 24 oct.
TIL about FormData and @fastify/multipart to handle file uploads on the front and back ends. Uploading a file requires to append each part (variable, files, etc.) with formData.append("name", data.name) or formData.append("gpx", data.gpx[0]) for a file (data.<name> for file input is always an array). Sending requires no special headers with fetch("/endpoint", {method: "POST", body: formData}). Consuming the fields and files on the back makes use for request.parts() where each file part has a file attribute set.
mar. 22 oct.
TIL that in REST Client Extension in VSCode, it is possible to get the cURL request of a request : Right-click > Copy cURL.
lun. 21 oct.
TIL that the CSS :last-child selector only applies if the html entity is actually the last child of its parent, whether the class is present or not. e.g. <div><div class='lastchild'/><div /></div> will not work, <div><div class='lastchild'/></div> will.
mer. 16 oct.
TIL that the event mouseenter is triggered in the reverse order compared to other elements, from parent to children. In other words, there is only a capture phase and no bubbling phase
mar. 15 oct.
TIL that creating a download link is not entirely solved yet. The download attribute makes part of the job, but there are still issues for setting filenames, apache configuration to add headers such as the Content-Disposition: attachement header. Many unreliable tricks to avoid 1. opening the file in a new window. 2. downloading a file without extension and an "Unknown" filename. 3. look unsecure (especially when not same origin).
ven. 11 oct.
TIL that it is possible to style a console log in the browser by including %c in console.log argument and the next arg should contain css. Example console.log("%cmy background is red", "background-color: red")
lun. 7 oct.
TIL that in apache it is possible to customize cache expiration of a per file type basis with the mod_expires module. Chosing the expiration type is controlled by mime-type : ExpiresByType image/jpeg "access plus 1 year"
lun. 7 oct.
TIL that apache is great for static file serving, and enabling it is as simple as adding the an alias Alias /static/ /local/path/ and the directory specification and options <Directory /local/path/>[...]</Directory>
mer. 2 oct.
TIL about leaflet-textpath which enables to draw text along a polyline or a geojson.
mer. 2 oct.
TIL that react-leaflet doesn't re-render a component when one of its attribute value is changing.
sept. 2024
jeu. 19 sept.
TIL that rclone enables to sync the content of a folder onto a cloud storage (such as s3 on OVH for example). One can rclone sync local/folder rcloneProfile:bucket to sync the entire folder and descending file tree.
jeu. 19 sept.
TIL that + and %20 both encode a space character in urls and url-encoded content. Usually the latter is considered safer.
mar. 17 sept.
TIL that the UNIX date takes a format such as +%Y-%m-%d and can be offset with the option --date e.g. --date yesterday.
sam. 14 sept.
TIL that there are two types of auto-fill: form filling and login manager. The former can be disabled with the attribute autocomplete="off" and is usually followed by browsers, the latter is not always complying to the instruction given by the attribute...
mer. 11 sept.
TIL that in docker's journald logging driver, you can set the tag to {{.Name}} to use the container name for the syslog identifier in logs, enabling to filter logs only for one container in journalctl with journalctl -t <container-name>
mer. 11 sept.
TIL that you can specify crontab's day of week with abbreviated day names such as mon, tue...
mer. 11 sept.
TIL (again) that using a pretty logger in fastify is as simple as specifying a transport object in the logger option when creating the fastify app.
lun. 9 sept.
TIL that in urls the anchor (#anchor or #/path/to/the/hash/route) has to be put after the search params, which seems wierd when using hash-routing.
lun. 9 sept.
TIL that using journald as a logging driver makes it possible to have logs both from docker compose logs (or docker logs) and from journalctl.
lun. 9 sept.
TIL that it's possible to open multiple sockets to one port, as long as the participating processes open their socket with the SO_REUSEPORT option. This allows to add load-balancing or clustering features transparently.
ven. 6 sept.
TIL that in Typesense, when filtering a numerical value between two values, one must use range filters a: [10..100] instead of a AND condition with inequalities a>=10 && a<=100. The former is much quicker and the latter may result in stupidly long response times.
ven. 6 sept.
TIL that docker logs are stored on the host in the containers folder (usually under /var/lib/docker). This folder last for as long as the container is alive (even stopped), but as soon as it is recreated ou removed (e.g. with docker compose down <name>) logs are lost.
ven. 6 sept.
TIL that syslog is a protocol and a system for log management, that is standard but rarely built-in in linux systems, whereas journald is a less UNIX-y log management system but commonly built-in, for example in ubuntu.

Started writing TILs, also in the middle of an Infra-as-code project