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
haani-niyaz / clean_code.md
Created June 29, 2020 01:37 — forked from wojteklu/clean_code.md
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
haani-niyaz / python_decorator_guide.md
Last active November 3, 2019 05:31 — forked from Zearin/python_decorator_guide.md
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
haani-niyaz / kubectl.md
Created January 3, 2019 22:36 — forked from so0k/kubectl.md
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
haani-niyaz / 14-aws.sh
Last active May 24, 2020 09:07 — forked from vfarcic/14-aws.sh
kubernetes training
cd k8s-specs
git pull
export AWS_ACCESS_KEY_ID=[...]
export AWS_SECRET_ACCESS_KEY=[...]
aws --version
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
haani-niyaz / curl.md
Created August 10, 2017 01:21 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@haani-niyaz
haani-niyaz / Apache Tomcat 8 Start stop script init.d script
Created June 18, 2017 06:57 — forked from miglen/Apache Tomcat 8 Start stop script init.d script
Apache Tomcat init script (or startup/controll script). Works fine for version 7/8. Read the comments for release history. Feel free to modify, copy and give suggestions. (c) GNU General Public License
#!/bin/bash
#
# description: Apache Tomcat init script
# processname: tomcat
# chkconfig: 234 20 80
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under
@haani-niyaz
haani-niyaz / rpm-digital-signature.sh
Created May 30, 2017 07:08 — forked from fernandoaleman/rpm-digital-signature.sh
How to sign your custom RPM package with GPG key
# How to sign your custom RPM package with GPG key
# Step: 1
# Generate gpg key pair (public key and private key)
#
# You will be prompted with a series of questions about encryption.
# Simply select the default values presented. You will also be asked
# to create a Real Name, Email Address and Comment (comment optional).
#
# If you get the following response:
@haani-niyaz
haani-niyaz / serverspec_rspec_cheatsheet.html
Created May 26, 2016 23:52 — forked from mearns/serverspec_rspec_cheatsheet.html
A cheat sheet for server spec and rspec
<!DOCTYPE html >
<html>
<!-- This was hacked together by hand after python-markdown output the bulk of it.
Maybe someday I'll put together a better script to aut-generate this from markdown source. -->
<head>
<!-- github-markdown, plus github pygments -->
<style type='text/css'>
/* <![CDATA[ */
@font-face {
font-family: octicons-link;
@haani-niyaz
haani-niyaz / 0_reuse_code.js
Created February 24, 2014 09:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console