Skip to content

Instantly share code, notes, and snippets.

View wahidsadik's full-sized avatar

Wahid Sadik wahidsadik

View GitHub Profile
@wahidsadik
wahidsadik / understanding-http-caching.md
Last active December 18, 2017 04:49
Capturing my understanding of how caching works in HTTP.

Introduction

Different HTTP headers are used to make caching work.

Headers sent by parties involved can be ignored by the receiving party, and hence there is no guarantee things will work as expected. Because of this, multiple headers / directives are usually sent by parties to make sure one of them will work.

Mozilla is the most reliable source of description on the headers.

Types of headers

@wahidsadik
wahidsadik / linux-firewall.md
Last active December 18, 2017 02:48
This gist captures my understanding of Linux firewall at 30000 feet level.

Introduction

This article provided me many of the basic ideas. It primarily talks about TCP traffic and Stateful firewalls (all explained in due time).

Direction of firewall

Firewall rules can apply both of these directions:

@wahidsadik
wahidsadik / docker-nuggets.md
Last active December 1, 2017 07:08
Few useful patterns that I've recognized with docker

Few useful patterns that I've recognized with docker.

Tips

Use docker-compose.yaml to replace long complicated docker commands.

Always use a docker-compose file to run your service, even if the file describes just one service. This will make the life of the user much easier.

Use docker containers to drive local development.

@wahidsadik
wahidsadik / gradle-plugins-i-use.md
Last active May 28, 2017 09:48
Some of gradle plugins I use in most projects

This gist annotates some of the common gradle plugins I use for my Java projects. See sorting-algorithms-in-java for one such exacmple. Excerpt from that file:

plugins {
    id 'java'
    
    id 'eclipse'
    
    id 'findbugs'
 id 'pmd'
@wahidsadik
wahidsadik / ubuntu-16.04-hardening.yml
Last active September 1, 2018 20:57
Playbook for hardening a new Ubuntu 16.04 and 18.04 box
# This assumes that you are using this role: https://github.com/wahidsadik/ansible-role-harden-ubuntu
# Run like this when SSH works with password only: $ ansible-playbook -i <IP>, test-hardening-role-1604.yml --user=<connection-user> --ask-pass
# Run like this when SSH works with key: $ ansible-playbook -i <IP>, test-hardening-role-1604.yml --user=<connection-user> --become --ask-become-pass
---
- hosts: all
gather_facts: no # Added this for Ubuntu 16.04
# Added this block for Ubuntu 16.04
pre_tasks:
@wahidsadik
wahidsadik / ubuntu-14.04-hardening.yml
Last active September 1, 2018 20:55
Playbook for hardening a new Ubuntu 14.04 box
# This assumes that you are using this role: https://github.com/wahidsadik/ansible-role-harden-ubuntu
# Run like this when SSH works with password only: $ ansible-playbook -i <IP>, test-hardening-role-1404.yml --user=<connection-user> --ask-pass
# Run like this when SSH works with key: $ ansible-playbook -i <IP>, test-hardening-role-1404.yml --user=<connection-user> --become --ask-become-pass
---
- hosts: all
vars:
## Uncomment one of these variables to not run the relevant section
# add_deployment_user: False
@wahidsadik
wahidsadik / ansible-with-ubuntu-16.04-LTS.md
Created November 10, 2016 10:44
How to use Ansible with Ubuntu 16.04 LTS

Ubuntu 16.04 doesn't have python 2.x installed, which is needed by Ansible. For those situations, use the following playbook. Few important parts in it:

  • gather_facts: Must be turned off initially. Later on, we enable it via the setup task in pre_tasks.
  • pre_tasks: Before other tasks/roles kick in, we install python 2.x and aptitude (for some reason, Ubuntu 16.04 LTS asks for it). Optionally, you can use setup task to gain back whatever you lost by not running gather_facts before.

Start of playbook

- hosts: all
  remote_user: root

gather_facts: no