Skip to content

Instantly share code, notes, and snippets.

View haani-niyaz's full-sized avatar

Haani Niyaz haani-niyaz

  • Melbourne, Australia
View GitHub Profile
haani-niyaz /
Last active February 10, 2022 07:02
Go application development guiding principles

Go Dev Guiding Principles

An opinionated list of practices when developing in Go.

(1) Names

Names should be self revealing.

haani-niyaz /
Created June 29, 2020 01:37 — forked from wojteklu/
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.

General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

haani-niyaz /
Last active May 11, 2023 21:32
Go notes

Go Journal

Developer Environment

Private Repo Setup

git config --global \
  url."https://${user}:${personal_access_token}".insteadOf \
haani-niyaz /
Last active November 3, 2019 05:31 — forked from Zearin/
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.

Q: How can I make a chain of function decorators in Python?

If you are not into long explanations, see [Paolo Bergantino’s answer][2].

haani-niyaz /
Created January 3, 2019 22:36 — forked from so0k/
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
haani-niyaz /
Last active March 22, 2023 12:37
HAProxy config for nexus docker repo with no connector

HAPROXY Docker Nexus (No HTTP Connector)


  1. The docker-login repo is setup with minimal (read-only) access which allows all users to login. This creates the necessary credentials store required for all subsequent docker operations. The team docker repositories will be setup with RBAC to only allow access to members of that respective team to perform docker push/pull operations.

  2. The proxy will inspect the context path for the docker pull/push operations and proceed only if authorization is successful.

haani-niyaz /
Last active May 24, 2020 09:07 — forked from vfarcic/
kubernetes training
cd k8s-specs
git pull
export AWS_ACCESS_KEY_ID=[...]
aws --version
haani-niyaz / haproxy_resolvers.cfg
Created May 9, 2018 00:53
How to use DNS name backends in haproxy
View haproxy_resolvers.cfg
log local2
pidfile /var/run/
user haproxy
group haproxy
maxconn 1000
log global
mode http
View 8.2.3. HTTP log format
8.2.3. HTTP log format
The HTTP format is the most complete and the best suited for HTTP proxies. It
is enabled by when "option httplog" is specified in the frontend. It provides
the same level of information as the TCP format with additional features which
are specific to the HTTP protocol. Just like the TCP format, the log is usually
emitted at the end of the session, unless "option logasap" is specified, which
generally only makes sense for download sites. A session which matches the
"monitor" rules will never logged. It is also possible not to log sessions for
haani-niyaz /
Last active March 26, 2018 00:39
Random kubernetes code snippets

How to use hostPath pv with a volumeClaimTemplate in StatefulSets

hostPath PV

kind: PersistentVolume
apiVersion: v1