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 / wp-install .sh
Created May 26, 2025 09:59
WordPress Deployment Script
#!/bin/bash
# WordPress Auto-Installer Script
# Author: WordPress Development Assistant
# Description: Automated WordPress installation with database setup and configuration
set -e # Exit on any error
# Color codes for output
RED='\033[0;31m'
@RatulHasan
RatulHasan / updateApplicationUrl.js
Last active October 15, 2024 17:09
Update shopify Application URL from .toml file to all desired files. just run `node bin/updateApplicationUrl.js`
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
// Get the directory name of the current module
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Paths to the files
const tomlFilePath = path.join(__dirname, '../shopify.app.toml');
@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