Code Trips & Tips

Code Trips & Tips

Adventures in developing distributed systems in Go, Java , Python and C++

  • About
  • January 4, 2021

    Implement the Envelope Wrapper Pattern in C++ using Google Protocol Buffers

    The Envelope Wrapper pattern This pattern, described in “Enterprise Integration Patterns” (Ch. 8, “The Envelope Wrapper”), is used typically in messaging systems, when a number of metadata fields (for routing, security, etc.) are kept in a header, while the data used by service endpoints is serialized in a payload. For the system to be generically…

  • December 29, 2020

    Support multiple JDKs in Debian Linux

    With the relatively recent change in the frequency of Java releases (every six months) it has become pretty much required to be able to have multiple JDKs on one’s development machine, and being able to run/test them at different times, for different projects, or even for the same project. Motivation While some wizardry with symlinks…

  • August 4, 2020

    Parse Args in Bash Scripts

    There is something to be said for the immediacy of using Bash scripts, especially when dealing with relatively simple system operations; however, parsing command line arguments has always been rather cumbersome and usually done along the lines of painful if [[ ${1} == ‘–build’ ]]; then …. On the other hand, Python is pretty convenient…

  • August 2, 2020

    Modern C++: Implementing a Merkle Tree

    Merkle Trees store a hash of the sub-tree in each of the Nodes, so that the whole tree’s contents can be validated against tampering.They are used, for example, in Bitcoin’s blockchain, and in Cassandra to validate replicas.In this article, we will show how to implement a generic Merkle Tree using features of Modern C++. Previous…

  • July 26, 2020

    Modern C++: Writing a thread-safe Queue

    The STL provides a high-performance queue class in std::queue<T>; however, the API is not very intuitive, or easy, to use and it is not safe to access from multiple threads.In this article, we will show how to wrap it in a more convenient, and thread-safe, API. The C++ Standard Template Library (STL) offers a template-class…

  • May 31, 2020

    Ubuntu: adjust mouse scroll wheel sensitivity

    Honestly, it should be easier – then again, it’s Gnome, nothing really is easy. Collecting a combination of various pages (this one finally yielded the right directions) it turns out one has to install imwheel and then adjust the ~/.imwheelrc file: The magic incantation is in the first couple of lines and the value (3…

  • May 1, 2020

    filecrypt — OpenSSL-based file encryption, release 0.7.2

    Almost four years after its initial inception and release, I have entirely rewritten the CLI invocation, streamlined the encryption secrets management, and created a self-contained executable. Once you have a private/public key pair, a file can be simply encrypted using: ./filecrypt.pyz -o my_file.enc /path/to/plain.txt and decrypted using: ./filecrypt.pyz  -o /path/to/plain.txt -d my_file.enc The –send option…

  • April 5, 2020

    How to emit battery data in a one-liner on MacOS

    In MacOS the command to emit data about battery status is: pmset -g batt If you want to record the battery percentage level in a file at regular intervals, here is how to record the data in a one-liner: while true; do \ echo “$(date “+%Y-%m-%d %H:%M:%S”) ” \ “$(pmset -g batt | grep “%”…

  • March 20, 2020

    Converting a C++ project to CMake & Conan

    This post describes how to fully automate the build/install of a C++ Project, with several dependencies, using CMake and Conan, a package manager. A couple of years back, I needed a simple HTTP client to run some integration tests against a Gossip Server I was developing; it turns out that, something we take for granted…

  • March 18, 2020

    Ubuntu: Disable mouse wake from suspend

    One of the most annoying “features” of Ubuntu is that it will wake from suspend on mouse move, even if waking up your system was the last thing you wanted; in fact, it will wake from suspend, a second after you put it to sleep, if your touch is less than feather-like in releasing the…

←Previous Page
1 2 3 4 … 17
Next Page→

Website Powered by WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
 

Loading Comments...
 

    • Follow Following
      • Code Trips & Tips
      • Already have a WordPress.com account? Log in now.
      • Code Trips & Tips
      • Edit Site
      • Follow Following
      • Sign up
      • Log in
      • Report this content
      • View site in Reader
      • Manage subscriptions
      • Collapse this bar