SOLID Software Design Principles

Thu 28 April 2022

SOLID

[S]ingle-responsibility principle:

Every class should only have one responsibility.

[O]pen-closed principle:

Software entitities (e.g. classes, functions, components), should be open for extension, but closed for modification. Write code in a manner that you are able to add new functionality, without changing the existing code, this prevents …

Category: Standards

Read More

Git Stash

Fri 06 August 2021

If you just quickly want to create a temporary stash:

git stash
# .. do your thing
git stash pop

This create and applies a stash, if you want to manage multiple stashes however, the following process is recommended:

[A] Create stash

git stash push -m "stashname"

Or simply use git stash …

Category: Git

Read More

Git Submodules

Fri 06 August 2021

Add a submodule

You can add either a HTTPS or SSH URL (SSH is most convenient) E.g. for github an HTTS URL looks like: https://github.com/... and SSH URL looks like: git@github.com:.... The URL can be picked from the github UI (Code button dropdown box).

git …

Category: Git

Read More

Git LFS

Sun 27 June 2021

First you need a .gitattibutes files in your repository. This is where the LFS file patterns are stored.

:::sh touch .gitattributes

Now lets start tracking *.gz files as LFS.

git lfs track "*.gz"

This tells git-lfs to track all files matching the .bin pattern. The quotes around the *.bin are …

Category: Git

Read More

SW Development Estimation

Wed 28 April 2021

The ABCD Rules of thumb for SW dev. estimation

[A] Clarify scope & requirements

This includes making sure everyone really understand the requirements

Clarifying requirements can be difficult, and often those who kwow the exact requirements, don't always understand how to convey them to the development team (itereate untill this is …

Category: Standards

Read More

Docker cheatsheet

Tue 30 March 2021
# run docker container with mounted host directory
# (use a full absolute path for <host_dir>
docker run -v <host_dir>:<container_dir> -it <image_id|image_name> /bin/bash

# connect to a running docker container
docker ps
# >> container_id    image    container_name
# >> ...             ...      ...
docker exec -it <container_id|container_name> /bin …

Category: Snippets [Docker]

Read More

Bash cheatsheet

Tue 30 March 2021
# To witch shell type, e.g. zsh
chsh -s /bin/zsh
chsh -s /bin/bash
# To hide bash deprecation warning on mac add the following to .bash_profile
export BASH_SILENCE_DEPRECATION_WARNING=1

# filter output and just print the n'th line of it
bash someScript.sh | sed -n …

Category: Snippets [Bash]

Read More

Go cheatsheet

Tue 30 March 2021

Most example code taken from A Tour of Go, which is an excellent introduction to Go. If you're new to Go, do that tour. Seriously.

Go in a Nutshell

  • Imperative language
  • Statically typed
  • Syntax tokens similar to C (but less parentheses and no semicolons) and the structure to Oberon-2
  • Compiles …

Category: Snippets [Go]

Read More

Manage multiple JDK versions

Tue 30 March 2021

To find the available JDK packages available for your system you can use apt search, to install for example java-8 and java-11 JDK:

sudo apt install -y openjdk-8-jdk openjdk-11-jdk

NOTE: Since Debian 11, minimum available openjdk vesion included in the debian repositories, is version 11. The older JDK version can …

Category: Debian Linux

Read More

Breadth First Search (BFS) in Python

Tue 30 March 2021
import queue


class BreadthFirstSearch:
    def __init__(self, graph):
        """
        graph: Graph represntation in the form of an adjecency list.
            E.g:  `B <- A -> C`, graph = { 'A' : ['B','C'], }
        """
        self._graph = graph

    def head(self):
        # NOTE: In Python 3.7.0 the insertion-order preservation nature of
        # dict objects has been declared to …

Category: Snippets [Python]

Read More
Page 1 of 2

Next »