Cyber security

Creating a Linux password hash Like you find in /etc/shadow. mkpasswd --method=sha-512 --salt=Kf0TqvhN Search tools Use different search engines Banner grab httrack inspy metagoofil intitle:“index of” DNS poison/spoof Infosec websites - website hacking training - the IoT search engine - what’s that site running? Cracking a KeePass2 master password with John the Ripper john <(keepass2john easy. [Read More]


Complicated versus complex

Complexity projects Game of Life Social distancing Crowd simulation Building evacuation SIR (epidemiology) A complex system has Interdependence Connectedness Diversity Adaptation and learning Wolfram behaviours Stables Periodic Chaotic Complex (high info content) Misc Exploration versus exploitation Highest peak On dancing landscape you can never stop exploring Emergence Complexity is an emergent property Stasis encourages exploration and vice versa Slime mold breaking symmetry Bottom up and top down emergence Power law distribution Long tail Weekly emerging, strongly emerging (never figure out) Preferential attachment model Agent-based models Fires in crouded buildings Epidemics Netlogo Good science and agent based models must simplify (abstract) Feedback and externality Feedback is affecting the same action. [Read More]

The magnitude of it all

The units you should be aware of

In 2014 Randall Munroe estimated that Google stores 10 exabytes of data across all of its operations. See list of SI prefixes. If CPUs are topping out at gigahertz then single operations aren’t going to subceed the order of nanoseconds. 1 000 kilo | milli .001 1 000 000 mega | micro .000 001 1 000 000 000 giga | nano .000 000 001 1 000 000 000 000 tera | pico . [Read More]


SQL “Structured Query Language” SQL - relational NoSQL - non-relational Tables / schema Humongous data, collections, documents, duplication of data Structured Semi/no structure, flexible Relations Less dependence on relations, quick reads Atomic Eventually consistent Monolithic Distributed SQL MySql, Oracle, Sqlite, Postgres, MS-SQL, Amazon Aurora (part of RDS). NoSQL MongoDB, BigTable, Redis, RavenDb, Cassandra, Hbase, Neo4j, CouchDb, Amazon DynamoDB. [Read More]


Single responsibility principle A class should have only a single responsibility (i.e. changes to only one part of the software’s specification should be able to affect the specification of the class). A class should have only one reason to change. Separate GUI and the business logic. Low coupling, high cohesion. Open/closed principle Software entities should be open for extension, but closed for modification. However, realistically you don’t know which bits need to be extensible. [Read More]

STL containers Sequence Containers array vector deque forward_list list Container Adapters stack queue priority_queue Associative Containers set map multiset multimap Unordered Associative Containers unordered_set unordered_multiset unordered_map unordered_multimap Features multiset, set and map are typically implemented as binary search trees. Forward lists are sequence containers that allow constant time insert and erase operations anywhere within the sequence. map is generally slower than unordered_map containers to access individual elements by their key, but it allows the direct iteration on subsets based on their order. [Read More]


Layers and protocols

Please Do Not Take Salami Pizza Away Comparison of OSI and TCP/IP models. OSI TCP/IP Protocol Data Unit Protocols Example Hardware example Application Application Files/data Facebook Application layer gateway (packet inspection) Presentation ssh Encryption Session http, telnet Login Transport Transport Segments/datagrams TCP, UDP TCP Firewall (port number) Network Internet Packets IP, ICMP, ARP ping Router, layer 3 switch Datalink Network Frames/bits fibre, Ethernet, Wi-Fi ARP Bridge, switch (forward or not forward) Physical Wi-Fi Repeater, hub (multiport repeater) Additionally ICMP: ping, sends echo request. [Read More]


Argument dependent lookup

Why does this compile? A one-liner to print a vector to stdout. But why does this compile without the namespace std::? #include <iostream> #include <vector> #include <iterator> int main() { const std::vector<int> v{1, 2, 3, 4, 5}; copy(cbegin(v), cend(v), std::ostream_iterator<int>(std::cout, "\n")); } Run the code on Compiler Explorer, Jason Turner on YouTube and ADL on Wikipedia. Note: C++14 is the default for the latest GCC (9.2). Exercise Propose some other examples of ADL. [Read More]

Coding tests

Techniques to up your interview game

Listen - usually all of the information in the question is useful. Example - make examples larger, avoid special cases. Brute force - better to have brute force than nothing at all, don’t necessarily code it, maybe just state the runtime. Optimise. Walk through your algorithm. Code. Test - use small test cases, then edge cases. Analyse and optimise - check for loops, maths, walk through the code, not the algorithm. [Read More]