Skip to content

Instantly share code, notes, and snippets.

View RatulHasan's full-sized avatar
🎯
Focusing

Ratul Hasan RatulHasan

🎯
Focusing
View GitHub Profile
@RatulHasan
RatulHasan / create_nginx_config.sh
Last active January 6, 2024 21:21
Just enter folder name and index.php file path to dynamically create `.test` domain in nginx server
# sudo find / -name "create_nginx_config.sh"
# alias newdomain="/path/to/create_nginx_config.sh"
# source ~/.zshrc
#!/bin/bash
read -p "Enter domain folder name (without .test): " domain_name
read -p "Enter index.php path: " path_name
if [ -z "$domain_name" ]; then
@RatulHasan
RatulHasan / localstack.sh
Last active November 21, 2023 18:37
Running AWS Services In A Laptop Using LocalStack
#####################################################
# Running AWS Services In A Laptop Using LocalStack #
# https://youtu.be/8hi9P1ffaQk #
#####################################################
# Referenced videos:
# - Terraform vs. Pulumi vs. Crossplane - Infrastructure as Code (IaC) Tools Comparison: https://youtu.be/RaoKcJGchKM
# - Should We Replace Docker Desktop With Rancher Desktop?: https://youtu.be/bYVfCp9dRTE
#########
@RatulHasan
RatulHasan / zsh.json
Created March 18, 2023 19:59
My oh-my-zsh profile
{
"Ansi 1 Color" : {
"Red Component" : 0.7074432373046875,
"Color Space" : "sRGB",
"Blue Component" : 0.16300037503242493,
"Alpha Component" : 1,
"Green Component" : 0.23660069704055786
},
"Tags" : [
@RatulHasan
RatulHasan / setup.md
Last active July 16, 2023 17:03
Setup Dev environment on new Mac

Setup Dev environment on new Mac

Install Stats

  • https://github.com/exelban/stats

Install brew.

  • /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@RatulHasan
RatulHasan / dijkstra.php
Created March 11, 2023 13:13
Dijkstra's Algorithm in PHP
<?php
function dijkstra($graph, $start, $end) {
// Set the distance from the start node to all other nodes to infinity
$distances = array_fill(0, count($graph), INF);
// Set the distance from the start node to itself to 0
$distances[$start] = 0;
// Set all nodes as unvisited
$visited = array_fill(0, count($graph), false);
// Set the previous node for each node to null
$previous = array_fill(0, count($graph), null);
@RatulHasan
RatulHasan / container.php
Last active March 10, 2023 12:31
PSR-11
<?php
use Psr\Container\ContainerInterface;
class AppContainer implements ContainerInterface {
private array $instances = [];
public function get( string $id ) {
if ( $this->has( $id ) ) {
@RatulHasan
RatulHasan / wp-fresh.sh
Created December 15, 2022 05:49
Automate WP fresh installation
#!/bin/bash -e
clear
# for MAMP user using php version 7.1.1 this is required
# export PATH="/Applications/MAMP/bin/php/php7.1.1/bin:$PATH"
# Remove/Uninstall process
if [[ $1 == "remove" ]]; then
@RatulHasan
RatulHasan / wordpress_docker.md
Last active September 17, 2021 04:24
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@RatulHasan
RatulHasan / URL.php
Created October 18, 2018 07:37
try to copy url
<script>
function copyw(e) {
e.preventDefault();
var dummy = document.createElement('input'),
text = window.location.href;
document.body.appendChild(dummy);
dummy.value = text;
dummy.select();
@RatulHasan
RatulHasan / 00.howto_install_phantomjs.md
Created April 24, 2018 15:27 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev