Golang: Design Patterns

Design Patterns in Golang https://github.com/tensor-programming/pattern-tutorial

Design Pattern: Active Record

Active Record An Active Record Object represents a row in a DB table. The object has fields mapping to a column in the table and methods to access table data. Active Record connects classes to relational database tables to establish an almost zero-configuration persistence layer for applications. The library provides a base class that, when…

Improving Security of Docker Container

Improving Security of Docker Container The article is a great primer on fixing obvious vulnerabilities in the Docker image. Summary Use an unprivileged user. Remove all executables with setuid on. It will disallow the hacker to run an executable as root. Reference https://scene-si.org/2019/12/12/docker-images-and-security/

A Quick Look at Statsd

The idea of application performance monitoring with minimal side-effects brought Statsd to life. It is a daemon service that listens to UDP packets. It expects text payload, aggregates the metrics, and send them over to a metrics server (a time series DB). The metrics data is flushed at regular intervals (default 10 seconds). After every…

K-Messed Array Sort: Python Solution

K-Messed Array Sort Given an array of integers arr where each element is at most k places away from its sorted position Solution from Queue import PriorityQueue def sort_k_messed_array(arr, k): kheap = PriorityQueue() result = [] for num in arr: kheap.put(num, 'num') if kheap.qsize() == (k + 1): item = kheap.get() result.append(item) while not kheap.empty():…

%d bloggers like this: