Skip to content

Instantly share code, notes, and snippets.

View anmolnagpal's full-sized avatar
🤘
Peace

Anmol Nagpal anmolnagpal

🤘
Peace
View GitHub Profile
@anmolnagpal
anmolnagpal / contoltower-kms-policy.json
Created June 3, 2024 10:05
KMS policy for Control Tower Setup
{
"Version": "2012-10-17",
"Id": "key-consolepolicy-3",
"Statement": [
{
"Sid": "Enable IAM User Permissions",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<account_no>:root"
},
@anmolnagpal
anmolnagpal / nginx-tuning.md
Created February 12, 2021 21:53 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@anmolnagpal
anmolnagpal / k8s-svc-annotations.md
Created November 25, 2019 09:44
AWS ELB-related annotations for Kubernetes Services (as of v1.12.0)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval (in minutes)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix
  • service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags (comma-separated list of key=value)
  • service.beta.kubernetes.io/aws-load-balancer-backend-protocol (http|https|ssl|tcp)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled (true|false)
@anmolnagpal
anmolnagpal / git-clearHistory
Created August 24, 2019 11:18
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: web
spec:
rules:
- host: go-home.$NS.ing.k8z.eu
http:
paths:
- backend:

Keybase proof

I hereby claim:

  • I am anmolnagpal on github.
  • I am anmolnagpal (https://keybase.io/anmolnagpal) on keybase.
  • I have a public key ASDYZYwt-Y1ZjxqTZX4byFrb9X4gI5P_Ya31TelDt_YDOQo

To claim this, I am signing this object:

@anmolnagpal
anmolnagpal / kubernetes.md
Created May 4, 2019 21:09 — forked from xmlking/kubernetes.md
Kubernetes Cheat Sheet

Kubernetes

Install

Prerequisites

  1. Bash v5+ checkout Upgrading Bash on macOS
  2. bash-completion@2

Install Docker and Kubernetes(k8s)

#!/bin/sh
set -e
set -o pipefail
WORKING_DIRECTORY="$PWD"
[ "$GITHUB_PAGES_REPO" ] || {
echo "ERROR: Environment variable GITHUB_PAGES_REPO is required"
exit 1
}
@anmolnagpal
anmolnagpal / packer-ansible-aws-ami-template.json
Created April 3, 2019 12:49
packer template using Ansible playbook for AWS AMI
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"source_ami" : "ami-040404040",
"region" : "eu-central-1",
"profile" : "{{env `account`}}"
},
"builders": [
{
@anmolnagpal
anmolnagpal / php-pools.md
Created November 7, 2018 11:32
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log