Skip to content

Instantly share code, notes, and snippets.

View mt-shihab26's full-sized avatar
🏠
Working from home

Shihab Mahamud mt-shihab26

🏠
Working from home
View GitHub Profile
@mt-shihab26
mt-shihab26 / wordpress-nginx-cloudflare-ubuntu-24.04-setup.md
Created August 25, 2025 21:34
WordPress Setup on Ubuntu 24.04 LTS with Nginx and Cloudflare SSL

WordPress Setup on Ubuntu 24.04 LTS with Nginx and Cloudflare SSL

Prerequisites

  • DigitalOcean Ubuntu 24.04 LTS server with root or sudo access
  • Domain name pointed to your server's IP address
  • Cloudflare account with domain added

Step 1: Initial Server Setup

Update the system

@mt-shihab26
mt-shihab26 / builder-pattern.ts
Created April 6, 2025 09:59
Builder design pattern with #TypeScript
type TInitValue = string | number | null | undefined;
class Money {
private value: number | null;
constructor(initValue: TInitValue) {
if (!initValue) {
this.value = null;
return;
}
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
@mt-shihab26
mt-shihab26 / prettier.config.cjs
Last active October 8, 2023 19:09
Prettier config file
module.exports = {
printWidth: 80,
tabWidth: 4,
arrowParens: "avoid",
plugins: ["prettier-plugin-tailwindcss"],
};
@mt-shihab26
mt-shihab26 / nginx.conf
Created August 24, 2023 03:15
Nginx virtual host setup
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;

PHP & MySQL Docker Development Enviroment

Commends

$ docker-compose up -d --remove-orphans

# To Tear Down
$ docker-compose down --volumes

When ever any permission error just run

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
import os
import shutil
def convert_files(folder_path, old_ext, new_ext):
for dirpath, dirnames, filenames in os.walk(folder_path):
for filename in filenames:
if filename.endswith(old_ext):
old_file_path = os.path.join(dirpath, filename)
new_file_path = os.path.splitext(old_file_path)[0] + new_ext
shutil.move(old_file_path, new_file_path)
{
"Typescript React Functional Component with Props": {
"prefix": "fcp",
"body": [
"import type { FC } from \"react\";\n\ntype Props = {};\n\nconst $1: FC<Props> = () => {\n return <>$1</>;\n};\n\nexport default $1;\n"
]
},
"Simple Typescript React Functional Component": {
"prefix": "fcs",
"body": ["const $1 = () => {\n return <>$1</>;\n};\n\nexport default $1;\n"]
@mt-shihab26
mt-shihab26 / Merging Two Git Repositories Into One Repository Without Losing File History.md
Last active June 18, 2022 05:25
Merging Two Git Repositories Into One Repository Without Losing File History

The basic idea is that we follow these steps:

Create a new empty repository New. Make an initial commit because we need one before we do a merge. Add a remote to old repository OldA. Merge OldA/master to New/master. Make a subdirectory OldA. Move all files into subdirectory OldA. Commit all of the file moves. Repeat 3-6 for OldB.