Skip to content

Instantly share code, notes, and snippets.

View huzaifaarain's full-sized avatar
🏠
Working from home

Muhammad Huzaifa huzaifaarain

🏠
Working from home
View GitHub Profile
@huzaifaarain
huzaifaarain / nginx_fastcgi_errors.md
Created December 6, 2023 20:55 — forked from CMCDragonkai/nginx_fastcgi_errors.md
NGINX: Common FastCGI Errors involving PHP-FPM

Common FastCGI Errors involving PHP-FPM

  1. 504 Gateway Timeout

    upstream timed out (110: Connection timed out) while reading response header from upstream
    

Means NGINX timed out reading the HTTP response header from upstream. This

@huzaifaarain
huzaifaarain / docker-php-ext-install.md
Created August 26, 2022 07:51 — forked from giansalex/docker-php-ext-install.md
docker-php-ext-install Reference
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 
@huzaifaarain
huzaifaarain / .php-cs-fixer.php
Created February 28, 2022 19:30 — forked from laravel-shift/.php-cs-fixer.php
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',
@huzaifaarain
huzaifaarain / .php-cs-fixer.php
Created February 28, 2022 19:29 — forked from pktharindu/.php-cs-fixer.php
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null],
@huzaifaarain
huzaifaarain / Response.php
Created November 30, 2021 08:28 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@huzaifaarain
huzaifaarain / 2019-https-localhost.md
Created May 12, 2021 19:26 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@huzaifaarain
huzaifaarain / fork-example.php
Created April 21, 2021 21:03 — forked from nicksantamaria/fork-example.php
Example: Parallel processing in PHP using pcntl_fork()
<?php
/**
* @file
* Basic demonstration of how to do parallel threads in PHP.
*/
// This array of "tasks" could be anything. For demonstration purposes
// these are just strings, but they could be a callback, class or
// include file (hell, even code-as-a-string to pass to eval()).
@huzaifaarain
huzaifaarain / meta-tags.md
Created May 31, 2019 17:36 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@huzaifaarain
huzaifaarain / scrape.py
Created December 24, 2018 05:02
Web Scraping for Email Addresses and Phone numbers using Python
# Small Python Script to scrape websites for
# email addresses and phone numbers(not a very great RE)
# Author: Dhruv Baldawa (@dhruvbaldawa on twitter)
# Github: http://www.github.com/dhruvbaldawa
import urllib,re
f = urllib.urlopen("http://www.example.com")
s = f.read()
re.findall(r"\+\d{2}\s?0?\d{10}",s)
re.findall(r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}",s)