Skip to content

Instantly share code, notes, and snippets.

@khageshsaini
khageshsaini / gpg-ssh-setup.md
Created December 20, 2021 12:39 — forked from mcattarinussi/gpg-ssh-setup.md
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

@khageshsaini
khageshsaini / http2_apache2_ubuntu16.04.md
Created November 1, 2019 17:13 — forked from GAS85/http2_apache2_ubuntu16.04.md
How to Enable HTTP/2 in Apache 2.4 on Ubuntu 16.04

from https://techwombat.com/enable-http2-apache-ubuntu-16-04/

Requirements

  • A self-managed VPS or dedicated server with Ubuntu 16.04 running Apache 2.4.xx.
  • A registered domain name with working HTTPS (TLS/SSL). HTTP/2 only works alongside HTTPS because most browsers, including Firefox and Chrome, don’t support HTTP/2 in cleartext (non-TLS) mode.

Step 1: Upgrade Apache from PPA

Let’s assume you installed Apache from the standard stable Ubuntu repository using apt. When you check your version of apache2 by typing:

@khageshsaini
khageshsaini / keybase_id.md
Last active June 9, 2019 19:47
Keybase Identity

Keybase proof

I hereby claim:

  • I am khageshsaini on github.
  • I am khageshsaini (https://keybase.io/khageshsaini) on keybase.
  • I have a public key ASAIoKe4T7RCN56RPhaEchHNaKxwpu7Qxj01RkkxKeGz2wo

To claim this, I am signing this object:

@khageshsaini
khageshsaini / example.sh
Created June 5, 2019 13:22 — forked from DeRain/example.sh
Generate .env file from AWS Parameters Store
#Add ENV strings into AWS Parameter Store (as one parameter). All strings will be separated by the newline
#We are getting ENV string separated by the newline and pub them in the dotenv
aws ssm get-parameter --name Param-with-env --region eu-west-1 --query Parameter.Value | sed -e 's/^"//' -e 's/"$//' | awk '{gsub(/\\n/,"\n")}1' >> .env
@khageshsaini
khageshsaini / Laravel-Container.md
Created May 17, 2019 18:04
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@khageshsaini
khageshsaini / Envoy.blade.php
Created August 17, 2018 08:00 — forked from gvsrepins/Envoy.blade.php
A Laravel envoy script for deployment
@servers(['production' => 'productionserver', 'local'=> '[email protected] -p 2222'])
{{-- Configuration section --}}
@setup
/*
|--------------------------------------------------------------------------
| Git Config
|--------------------------------------------------------------------------
|
Ensure this in /etc/ssh/sshd_config
# Disable tunneling
PermitTunnel yes
# Disable forwarding tcp connections.
# no real advantage without denied shell access
AllowTcpForwarding yes
@khageshsaini
khageshsaini / ttfb.sh
Created June 21, 2018 06:25 — forked from sandeepraju/ttfb.sh
curl command to check the time to first byte
#!/bin/bash
# file: ttfb.sh
# curl command to check the time to first byte
# ** usage **
# 1. ./ttfb.sh "https://google.com"
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com"
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \
@khageshsaini
khageshsaini / detect_deadlocks_mysql
Created May 4, 2018 05:14
Detecting Deadlocks Mysql
1) SET @threshold = 30;
2) SELECT p.user,
LEFT(p.HOST, LOCATE(':', p.HOST) - 1) host, p.id,
TIMESTAMPDIFF(SECOND, t.TRX_STARTED, NOW()) duration,
COUNT(DISTINCT ot.REQUESTING_TRX_ID) waiting
FROM INFORMATION_SCHEMA.INNODB_TRX t
JOIN INFORMATION_SCHEMA.PROCESSLIST p
ON ( p.ID = t.TRX_MYSQL_THREAD_ID )
LEFT JOIN INFORMATION_SCHEMA.INNODB_LOCK_WAITS ot
ON ( ot.BLOCKING_TRX_ID = t.TRX_id )
@khageshsaini
khageshsaini / 00. tutorial.md
Created February 5, 2017 10:27 — forked from maxivak/00. tutorial.md
Importing/Indexing database (MySQL or SQL Server) in Solr using Data Import Handler