Pinned

Influential technology by year

  • 2021 – Tracy profiler
  • 2020 – Blender, Media servers, GPUs, ZeroMQ
  • 2019 – Cloud computing, R (and the whole notebooks thing), GitLab, Hugo
  • 2018 – Docker (containers)
  • 2017 – Cryptocurrency, blockchain
  • 2016 – C++1z (the precursor to C++17)
  • 2015 – git / GitHub

Hashing

Hash tables

A hash table (hash map) is a data structure that implements an associative array abstract data type, a structure that can map keys to values. A hash table uses a hash function to compute an index into an array of buckets or slots, from which the desired value can be found.

Hashing derives a fixed size result from an input. See Hash table.

Properties of a hashing algorithm

  • Stable: the same input generates the same output every time
  • Uniform: the hash values should be uniformly distributed through the available space
  • Efficient: the cost of generating a hash must be balanced with application need
  • Secure: the cost of finding data that produces a given hash is prohibitive

String hashing

  • Sum ASCII values – not uniform, not secure
  • Fold bytes of every four characters into an integer – not secure
  • CRC32 – not secure
  • MD5 – not efficient, not secure
  • SHA2 – stable, uniform, not efficient, secure

Handling collisions

  • Chaining
  • Open addressing
  • Load/fill factor – the ratio of filled hash table array slots
  • DFS/BFS – depth-first search versus breadth-first
  • Brute force
  • Greedy algo – stall at local maxima
  • Dynamic programming
  • Longest common subsequence
  • Simulated annealing
  • Random solutions
  • Polynomial
  • PTAS – approximation scheme
  • More Hash Function Tests
  • Linear probing
  • Robinhood hashing
  • Cuckoo hashing
  • Preimage (attack)
  • URL shortener

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]

static

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. Variables with static storage duration are zero initialised. [Read More]

Geospacial

  • 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 FROM ubuntu # Install dependencies RUN apt update RUN apt -y install apache2 vim # Install apache and write hello world message RUN echo 'Kem chho!' > /var/www/html/index.html # Configure apache RUN echo '. /etc/apache2/envvars' > /root/run_apache.sh RUN echo 'mkdir -p /var/run/apache2' >> /root/run_apache.sh RUN echo 'mkdir -p /var/lock/apache2' >> /root/run_apache.sh RUN echo '/usr/sbin/apache2 -D FOREGROUND' >> /root/run_apache.sh RUN chmod 755 /root/run_apache.sh EXPOSE 80 CMD /root/run_apache. [Read More]

Linux CLI trivia

uptime The three load average values are 1, 5 and 15 minutes. $ uptime 15:29:28 up 20:23, 0 users, load average: 5.08, 1.49, 0.51 stress Stress your system in different ways. $ stress --cpu 8 Number of processors $ make -j $(nproc) Synonyms for localhost localhost 127.0.0.1 127.0.0.2 127.0.0.3 127.1 0.0.0.0 0 # yep Move a file out of the way mv {,_}.bash_history Verbose time $ /usr/bin/time -v time Usage: time [-apvV] [-f format] [-o file] [--append] [--verbose] [--portability] [--format=format] [--output=file] [--version] [--quiet] [--help] command [arg. [Read More]