Skip to content

Instantly share code, notes, and snippets.

View ameri110's full-sized avatar
๐Ÿ˜ƒ

Ahmad Ameri ameri110

๐Ÿ˜ƒ
View GitHub Profile
@ameri110
ameri110 / self-signed-SSL-cert.md
Last active July 20, 2024 08:02 — forked from klcantrell/self-signed-SSL-cert.md
How to create and trust a SSL certificate on Windows

How to create and trust a SSL certificate on Windows

Step 1

Generate a private root key

openssl genrsa -des3 -out myCA.key 2048

Step 2

Generate a root certificate

@ameri110
ameri110 / empty-wp-plugin.php
Created April 25, 2022 13:27 — forked from sareiodata/empty-wp-plugin.php
Empty WordPress plugin
<?php
/**
* Plugin Name: Name Of The Plugin
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
* Description: A brief description of the Plugin.
* Version: The Plugin's Version Number, e.g.: 1.0
* Author: Name Of The Plugin Author
* Author URI: http://URI_Of_The_Plugin_Author
* License: A "Slug" license name e.g. GPL2
*/
@ameri110
ameri110 / block_RFC1918_RFC6598.sh
Created April 14, 2021 13:04
block RFC1918/RFC6598 in iptables firewall
iptables -A OUTPUT -p tcp -s 0/0 -d 10.0.0.0/8 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 172.16.0.0/12 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 192.168.0.0/16 -j DROP
iptables -A OUTPUT -p tcp -s 0/0 -d 100.64.0.0/10 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 10.0.0.0/8 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 172.16.0.0/12 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 192.168.0.0/16 -j DROP
iptables -A OUTPUT -p udp -s 0/0 -d 100.64.0.0/10 -j DROP
iptables-save
@ameri110
ameri110 / wp_debug
Last active October 27, 2021 08:26
wordpress debug
/**
* ADD FOLLOWING TO wp-config.php FILE
*
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
@ameri110
ameri110 / db2tg.php
Last active December 31, 2023 12:54
backup database, compress and send to telegram
<?php
// backup database, compress and send to telegram
// you may setup cronjob:
// 0,30 * * * * /opt/cpanel/ea-php73/root/usr/bin/php -q /home/path/public_html/db2tg.php
$bot_token = '123456789:xxxxxxxxxxxxxxxxx';
$chatid = '123456789';
$db_host = 'localhost';
$db_username = 'my_user';
@ameri110
ameri110 / ssh.php
Created February 7, 2021 17:30
Run SSH commands from PHP
<?php
if (!function_exists("ssh2_connect")) die("-error: function ssh2_connect doesn't exist");
function ssh2_debug($message, $language, $always_display) {
printf("%s %s %s\n",$message,$language,$always_display);
}
function my_ssh_disconnect($reason, $message, $language) {
printf("Server disconnected with reason code [%d] and message: %s\n", $reason, $message);
}
@ameri110
ameri110 / form2ajax.html
Last active February 7, 2021 17:10
Convert HTML forms to AJAX
<!--
// if you have a form in your page and want to submit the form using ajax
// compatible with dynamically created forms.
// no need to add your action url and form data to the ajax script
// 0. add jQuery to your html file!
// 1. add "ajax" class to the form.
// 2. add the following script to your html file.
-->
<script>
@ameri110
ameri110 / squid_proxy_tutorial.md
Last active October 9, 2020 20:53 — forked from jackblk/squid_proxy_tutorial.md
Tutorial on how to setup a squid proxy with authentication.

Note

This tutorial is for Ubuntu & Squid3. Use AWS, Google cloud, Digital Ocean or any services with Ubuntu to follow this tutorial.

Install squid & update

sudo apt-get update
sudo apt-get install squid3
sudo apt-get install apache2-utils