Skip to content

Instantly share code, notes, and snippets.

View skmezanul's full-sized avatar

SK Mezanul Haque skmezanul

View GitHub Profile
@skmezanul
skmezanul / backup_digitalocean.md
Created May 11, 2024 21:14 — forked from amalmurali47/backup_digitalocean.md
Backup DigitalOcean droplet locally

DigitalOcean does not provide a way to download a snapshot of your droplet locally. You can use rsync to accomplish this instead.

On your local machine, assuming you have added your-server in your SSH config:

rsync -aAXHv --append-verify --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} your-server:/
  • -a : archive mode (all files, with permissions, etc.)
  • -A : preserve ACLs/permissions (not included with -a)

Adjusting child processes for PHP-FPM (Nginx)

Problem:

The following warning message appears in the logs:

[26-Jul-2012 09:49:59] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 8 idle, and 58 total children  
[26-Jul-2012 09:50:00] WARNING: [pool www] server reached pm.max_children setting (50), consider raising it  
It means that there are not enough PHP-FPM processes. 
@skmezanul
skmezanul / nginx.conf
Created September 26, 2023 16:41 — forked from QROkes/nginx.conf
NGINX Configuration for WordPress Multisite + Domain Mapping with HTTPS
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com subsite.com www.subsite.com another.com www.another.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
@skmezanul
skmezanul / install_realvnc_server.sh
Created March 9, 2023 19:24 — forked from vietanhdev/install_realvnc_server.sh
Install RealVNC Ubuntu - Raspberry Pi 4
#!/bin/bash
mkdir realvncserversetup && cd realvncserversetup
echo Add armhf arch
sudo dpkg --add-architecture armhf && sudo apt update
echo Download and install RealVNC server
wget -nv https://downloads.realvnc.com/download/file/vnc.files/VNC-Server-6.11.0-Linux-ARM.deb && sudo apt install ./VNC-Server-6.11.0-Linux-ARM.deb
echo Download and install dependencies
@skmezanul
skmezanul / windows_hardening.cmd
Created March 29, 2022 18:55 — forked from ricardojba/windows_hardening.cmd
A Windows hardening script
::##########################################################################################################################
::
:: This script can ruin your day, if you run it without fully understanding what it does, you don't know what you are doing,
::
:: OR BOTH!!!
::
:: YOU HAVE BEEN WARNED!!!!!!!!!!
::
:: This script is provided "AS IS" with no warranties, and confers no rights.
:: Feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section,
@skmezanul
skmezanul / raspbian-64bit-headless.md
Last active March 21, 2022 10:08 — forked from bartosjiri/raspbian-64bit-headless.md
Raspberry Pi Raspbian 64bit headless setup

Raspberry Pi Raspbian 64bit headless setup

A step-by-step guide for running a headless Raspbian 64bit kernel and OS on Raspberry Pi. The provided configuration has been tested on models 3B, 3B+ and 4B.

Instructions

  1. Download the Raspberry Pi Imager application.

  2. Use the application to download Raspbian Lite (under Raspbian (other)) and write the image on your SD card.

  3. Setup wireless connection configuration by creating wpa_supplicant.conf file in the boot folder:

@skmezanul
skmezanul / .htaccess
Created February 28, 2022 21:49 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@skmezanul
skmezanul / RemoveOptions.php
Created December 9, 2020 20:28 — forked from bh-ref/RemoveOptions.php
Remove/Delete Product Attribute Options in Magento 2
<?php
namespace Vendor\ModuleName\Options;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory;
class RemoveOptions
{
@skmezanul
skmezanul / youtube_id_regex.php
Created January 5, 2020 13:30 — forked from ghalusa/youtube_id_regex.php
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
#!/usr/bin/env python3
'''
calisuck: index, filter-out smartly and download ebooks from Calibre open directories
Installation:
You need python 3.5 installed
Download the file as a zip and unzip-it and get into the dir