Leaving commented code

What are the alternatives to leaving commented old code in a codebase as a reference? Many times I’ve been saved by something that had been commented, but does the overhead of littering the code outweigh the occasional convenience? Add an extended comment to remind your future self what was removed Document in a third party tool Get used to using git log -p GitLab blame Some other change visusalisation tool? [Read More]


Non-const global variables have external linkage by default Const global variables have internal linkage by default Functions have external linkage by default What’s the “static initialization order ‘fiasco’ (problem)”? C++ scoped static initialization is not thread-safe, on purpose! (pre-C++11) constinit static vs std::call_once vs double checked locking DCLP Double-Checked Locking Pattern const and static variables don’t have external linkage. [Read More]


  • GeoJSON is an open standard format designed for representing simple geographical features, along with their non-spatial attributes. It is based on the JSON format.”
  • Sequalize
  • GIS – geographical information standard
  • GML – geography markup language is the XML grammar defined by the Open Geospatial Consortium (OGC) to express geographical features.”
  • PostGIS is an open source software program that adds support for geographic objects to the PostgreSQL object-relational database.”

Run Apache

In Docker

docker run --detach --rm --publish 80:80 deanturpin/aws-apache FROMubuntu# Install dependenciesRUN apt updateRUN apt -y install apache2 vim# Install apache and write hello world messageRUN echo 'Kem chho!' > /var/www/html/index.html# Configure apacheRUN echo '. /etc/apache2/envvars' > /root/run_apache.shRUN echo 'mkdir -p /var/run/apache2' >> /root/run_apache.shRUN echo 'mkdir -p /var/lock/apache2' >> /root/run_apache.shRUN echo '/usr/sbin/apache2 -D FOREGROUND' >> /root/run_apache.shRUN chmod 755 /root/run_apache.shEXPOSE80CMD /root/run_apache. [Read More]

Favourite C++ features

And wish list

C++17 Boost filesystem execution policy: parallel algorithm support for range-based for loops - potential for easily parallelsing existing code structured bindings clamp std::optional [[maybe_unused]] C++20 spaceship operator range based for loops with initialiser bit header coroutines ranges and views - a nod to strongly typed, const languages like Haskell https://en.cppreference.com/w/cpp/utility/source_location https://en.cppreference.com/w/cpp/numeric/constants Wish list See the compiler support matrix. std::format modules - wait for clang12, gcc11 Modules Look interesting but not available until clang-12. [Read More]

Linux CLI tricks

Send a string to an IP/port telnet 80 (echo hello; sleep 1) | telnet 80 echo hello > /dev/tcp/ echo hello | nc localhost 80 See also https://tldp.org/LDP/abs/html/x17974.html https://highon.coffee/blog/reverse-shell-cheat-sheet/ https://catonmat.net/bash-one-liners-explained-part-three http://docs.eggplantsoftware.com/epp/9.0.0/ePP/advovercoming_tcpip_connection_li.htm Print a random line from a file sed "$(( $RANDOM % $(cat readme.txt | wc -l) ))q;d" readme.txt shuf readme.txt | head -1 Epoch seconds From bash 5. $ echo $EPOCHREALTIME 1614870873.574544 $ echo $EPOCHSECONDS 1614870876 uptime The three load average values are 1, 5 and 15 minutes. [Read More]