Dockerfile: how to set env variable from file contents

Environment Variables If you want to set a number of environment variables into your docker image (to be used within the containers) you can simply use env_file configuration option in your docker-compose.yml file. With that option, all the entries in the .env file will be set as the environment variables in image and hence into … Read more

How do you capture a group with regex?

Here’s a code example that demonstrates capturing multiple groups. You can see that group ‘0’ is the whole match, and subsequent groups are the parts within parentheses. Note that this will only capture the first match in the source string. Here’s a version that captures multiple groups in multiple matches. #include <stdio.h> #include <string.h> #include … Read more

what is posix compliance for filesystem?

In the area of “requires POSIX filesystem semantics” what is typically meant is: allows hierarchical file names and resolution (., .., …) supports at least close-to-open semantics umask/unix permissions, 3 filetimes 8bit byte support supports atomic renames on same filesystem fsync()/dirfsync() durability gurantee/limitation supports multi-user protection (resizing file returns 0 bytes not previous content) rename … Read more

how do I parse an iso 8601 date (with optional milliseconds) to a struct tm in C++?

New answer for old question. Rationale: updated tools. Using this free, open source library, one can parse into a std::chrono::time_point<system_clock, milliseconds>, which has the advantage over a tm of being able to hold millisecond precision. And if you really need to, you can continue on to the C API via system_clock::to_time_t (losing the milliseconds along … Read more

tech