Skip to content

Instantly share code, notes, and snippets.

View rummykhan's full-sized avatar
🎯
Focusing

Rehan Manzoor rummykhan

🎯
Focusing
View GitHub Profile
@rummykhan
rummykhan / cfn-ec2.yaml
Created January 25, 2023 03:43
CFN stack to create EC2 Instances
AWSTemplateFormatVersion: "2010-09-09"
Parameters:
EnvironmentTypeParameter:
Description: Environment Type
Type: String
Default: dev
InstanceTypeParameter:
Description: Instance type parameter
@rummykhan
rummykhan / Laravel-Apache.conf
Created May 21, 2021 15:13
Apache configuration for laravel apps
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName test.rehanmanzoor.com
@rummykhan
rummykhan / Octane-Apache.conf
Last active February 3, 2024 20:52
Apache Configuration for Octane
#### Enable Apache Proxy related modules
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_ajp
sudo a2enmod rewrite
sudo a2enmod deflate
sudo a2enmod headers
sudo a2enmod proxy_balancer
sudo a2enmod proxy_connect
@rummykhan
rummykhan / nginx.conf
Created May 16, 2021 00:41
Octane Nginx conf
server {
listen 80;
server_name app.rehanmanzoor.me;
charset utf-8;
client_max_body_size 1M;
location / {
proxy_pass http://127.0.0.1:8001;
proxy_http_version 1.1;
@rummykhan
rummykhan / nginx.conf
Created April 24, 2021 21:11
Nginx + Supervisor conf for Octane
server {
listen 80;
server_name app.rehanmanzoor.me;
charset utf-8;
client_max_body_size 1M;
location / {
proxy_pass http://127.0.0.1:8001;
proxy_http_version 1.1;
@rummykhan
rummykhan / gist:3a5b0c2346c5ef8af7914162b988ac35
Created April 23, 2021 21:32
Nginx vs Swoole vs Roadrunner
# Nginx
~/Documents/Workspace/Youtube-Lab/channel master*
❯ wrk -c100 -t4 http://channel.loc
Running 10s test @ http://channel.loc
4 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 504.47ms 81.54ms 794.45ms 88.92%
Req/Sec 48.45 16.21 80.00 63.16%
1949 requests in 10.09s, 32.67MB read
Requests/sec: 193.21
@rummykhan
rummykhan / .bashrc
Created April 23, 2021 19:53
Add open SSL binary to path to install swoole
export PATH="/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
@rummykhan
rummykhan / ImageAwareTrait.php
Last active April 8, 2021 20:35
Generic Image Aware Trait
<?php
namespace App\Models\ImageAware;
use Illuminate\Http\UploadedFile;
trait ImageAwareTrait
{
/**
* Save image and get image name
@rummykhan
rummykhan / ImageAwareInterface.php
Last active April 8, 2021 20:35
Generic Image Aware Interface
<?php
namespace App\Models\ImageAware;
interface ImageAwareInterface
{
public function saveImage($file, $attribute = 'image', $disk = 'local');
public function getImageUrl($attribute = 'image', $default = null);
}
<?php
$a = [1, 2, 3, 4, 6, 7];
sort($a);
if ($a[0] != 1) {
return 0;
}