Behavioral Patterns Observer Pattern The observer pattern allows a type instance to “publish” events to other type instances (“observers”) who wish to be updated when a particular event occurs.
Implementation In long-running applications—such as webservers—instances can keep a collection of observers that will receive notification of triggered events.
Implementations vary, but interfaces can be used to make standard observers and notifiers:
type ( // Event defines an indication of a point-in-time occurrence.
Structural Patterns Decorator Pattern Decorator structural pattern allows extending the function of an existing object dynamically without altering its internals.
Decorators provide a flexible method to extend functionality of objects.
Implementation LogDecorate decorates a function with the signature func(int) int that manipulates integers and adds input/output logging capabilities.
type Object func(int) int func LogDecorate(fn Object) Object { return func(n int) int { log.Println("Starting the execution with the integer", n) result := fn(n) log.
When you’r using the s3 plugin to store the Kops state inside a bucket, Kops stores the CA key and certificate in its S3 bucket.
aws s3 cp s3://$BUCKET/$CLUSTER/pki/private/ca/$KEY.key ca.key aws s3 cp s3://$BUCKET/$CLUSTER/pki/issued/ca/$CERT.crt ca.crt We will use this certificate to create some RBAC access.
Introduction Recently I started a series of articles about Gang of Four Design Patterns and their adoption in Golang. They made a lot of noise in the community. I read a lot of contradictionary opionions whether should be used or not. I am publishing those articles as show case how the common design patterns can be adopted and implemented in Golang. I don’t encourage or promote their usage. Every developer has own style of programming, architecture desing and problem solving solutions.
What is DRBD (Distributed Replicated Block Device)? DRBD (Distributed Replicated Block Device) is a Linux-based software component to mirror or replicate individual storage devices (such as hard disks or partitions) from one node to the other(s) over a network connection. DRBD makes it possible to maintain consistency of data among multiple systems in a network. DRBD also ensures high availability (HA) for Linux applications. DRBD supports three distinct replication modes, allowing three degrees of replication synchronicity.
When you write programs in a functional style it is a requirement that you use pure functions. To begin understanding the concept of pure functions we first need to understand what referential transparency is. An expression satisfies referential transparency if its result can replace it and program behavior does not change in any way. This replacement does not depend on context so it must hold wherever substitution happens in the program.
Explained Logistic regression is a supervised classification algorithm and therefore is useful for estimating discrete values. It is typically used for predicting the probability of an event using the logistic function in order to get an output between 0 and 1.
When first learning this logistic regression, I was under the impression that it was a sort of a niche thing and therefore I didn’t give it my full attention.
Explained Decision trees are a form of supervised learning that can be used for both classification and regression purposes. In my experience, they are typically utilized for classification purposes. The model takes in an instance and then goes down the tree, testing significant features against a determined conditional statement. Depending on the result, it will go down to the left or right child branch and onward after that. Typically the most significant features in the process will fall closer to the root of the tree.
Linear Regression Perhaps the most popular machine learning algorithm out there and definitely the most under appreciated. Many data scientists have a tendency to forget that simpler is almost always preferred over complex when performance is comparable.
Anyways, linear regression is a supervised learning algorithm that predicts an outcome based on continuous features. Linear regression is versatile in the sense that it has the ability to be run on a single variable (simple linear regression) or on many features (multiple linear regression).
Old school way Kill all running containers docker kill $(docker ps -q) Delete all stopped containers (including data-only containers) docker rm $(docker ps -a -q) Delete all ‘untagged/dangling’ () images docker rmi $(docker images -q -f dangling=true) Delete ALL images docker rmi $(docker images -q) Docker command Since docker 1.25
docker system prune https://docs.docker.com/config/pruning/#prune-images