Skip to content

Instantly share code, notes, and snippets.

View ankurk91's full-sized avatar
⛈️
Moving to Cloud

Ankur K ankurk91

⛈️
Moving to Cloud
View GitHub Profile
@devopsdescent
devopsdescent / Cloudwatch.md
Last active December 27, 2024 14:49
Level Up Your Monitoring: Install & Configure CloudWatch Agent for Custom Metrics

CloudWatch Agent Setup on AWS EC2 ⚒️

This guide walks you through installing and configuring the CloudWatch Agent on an EC2 instance.

Step 1: Check your EC2 instance's architecture

  • SSH to your EC2 instance
  • Run the following command to determine your EC2 instance's architecture:
@ilyasozkurt
ilyasozkurt / FindRiskyNumericFields.php
Last active January 1, 2023 08:10
FindRiskyNumericFields.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class FindRiskyFieldsOnDatabases extends Command
{
/**
@vncsna
vncsna / bash_strict_mode.md
Created June 6, 2021 01:59 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@sindresorhus
sindresorhus / esm-package.md
Last active April 6, 2025 11:31
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@maelvls
maelvls / README.md
Last active March 24, 2025 21:11
Ubuntu, libsecret, git-credential-helper

Dealing with secrets

GNOME comes with libsecret. You can use libsecret to store your git credentials:

sudo apt install libsecret-1-0 libsecret-1-dev libglib2.0-dev
sudo make --directory=/usr/share/doc/git/contrib/credential/libsecret
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
@ejlp12
ejlp12 / 1_ecs_note.md
Last active March 17, 2025 07:24
ECS Best Practices Notes
@Jiab77
Jiab77 / real-time-php-fpm-status.md
Last active January 13, 2025 13:36
This gist will explain you how to enable an undocumented feature of PHP-FPM which will give a real-time performance stats.

Real-time PHP-FPM Status

This gist will explain you how to enable an undocumented feature of PHP-FPM which will give a real-time performance stats.

Everybody knows the famous phpinfo() and the page it generates, right? Then the real-time PHP-FPM status page design is very similar.

image

Some informations from the top are not displayed to avoid security issues.

Enable PHP-FPM Status

@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active March 29, 2025 12:18
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@pepeloper
pepeloper / ProfileJsonResponse.php
Created December 15, 2017 08:56
Middleware to use Laravel debugbar on JSON responses.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\JsonResponse;
class ProfileJsonResponse
{
/**
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 6, 2025 12:54
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example