Skip to content

Instantly share code, notes, and snippets.

View VirtuBox's full-sized avatar
🚀
Back to work

VirtuBox VirtuBox

🚀
Back to work
View GitHub Profile
@VirtuBox
VirtuBox / microsoft-dns-block.txt
Created July 22, 2019 14:43
Blocking Microsoft DNS hosts file
0.0.0.0 feedback.microsoft-hohm.com
0.0.0.0 search.msn.com
0.0.0.0 a.ads1.msn.com
0.0.0.0 a.ads2.msn.com
0.0.0.0 a.rad.msn.com
0.0.0.0 ac3.msn.com
0.0.0.0 ads.msn.com
0.0.0.0 ads1.msn.com
0.0.0.0 b.ads1.msn.com
0.0.0.0 b.rad.msn.com
@VirtuBox
VirtuBox / nginx.conf
Last active April 19, 2024 07:46
Secure nginx.conf
##
# Common security rules
##
# Security settings for better privacy
# Deny hidden files
location ~ /\.(?!well-known\/) {
deny all;
}
# Return 403 forbidden for readme.(txt|html) or license.(txt|html) or example.(txt|html) or other common git repository files
@VirtuBox
VirtuBox / nginx.conf
Created April 19, 2024 07:35
optimized nginx.conf
user www-data;
# # The special value auto allows binding worker processes automatically to available CPUs:
worker_processes auto;
worker_cpu_affinity auto;
# # Changes the limit on the maximum number of open files (RLIMIT_NOFILE) for worker processes
worker_rlimit_nofile 100000;
pid /run/nginx.pid;
# # PCRE JIT can speed up processing of regular expressions significantly.
pcre_jit on;
@VirtuBox
VirtuBox / pihole.list
Created September 25, 2019 00:22
Pi-hole blocking lists
##StevenBlack's list
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
##MalwareDomains
https://mirror1.malwaredomains.com/files/justdomains
##Cameleon
http://sysctl.org/cameleon/hosts
##Zeustracker
@VirtuBox
VirtuBox / nginx-geoip-module.md
Last active January 24, 2024 08:44
How to configure GeoIP module for Nginx

Create a folder to store the databases :

mkdir -p /usr/share/GeoIP

Download Country IP database

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz
@VirtuBox
VirtuBox / wsl-vpnkit.sh
Last active November 17, 2023 13:13
Script to install wsl-vpnkit with a systemd service for Debian/Ubuntu
#!/usr/bin/env bash
# -------------------------------------------------------------------------
# wsl-vpnkit install script
# -------------------------------------------------------------------------
# Check if user is root
[ "$(id -u)" != "0" ] && {
echo "Error: You must be root or use sudo to run this script"
exit 1
}
@VirtuBox
VirtuBox / nextcloud.conf
Created July 15, 2020 13:52
wordops nextcloud
# WordOps nextcloud configuration
# install path : /var/www/yourdomain.tld/conf/nginx/nextcloud.conf
# replace "fastcgi_pass php73;" with another upstream if you are using php72 or php74
# ----------------------------------------------------------------------------
add_header X-Robots-Tag none;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Referrer-Policy no-referrer;
location = /robots.txt {
allow all;
@VirtuBox
VirtuBox / protect.conf
Created June 23, 2017 20:54
Nginx Configuration to block SQL Injection and similar attacks
location ~* "(eval\()" { deny all; }
location ~* "(127\.0\.0\.1)" { deny all; }
location ~* "([a-z0-9]{2000})" { deny all; }
location ~* "(javascript\:)(.*)(\;)" { deny all; }
location ~* "(base64_encode)(.*)(\()" { deny all; }
location ~* "(GLOBALS|REQUEST)(=|\[|%)" { deny all; }
location ~* "(<|%3C).*script.*(>|%3)" { deny all; }
location ~ "(\\|\.\.\.|\.\./|~|`|<|>|\|)" { deny all; }
location ~* "(boot\.ini|etc/passwd|self/environ)" { deny all; }
location ~* "(thumbs?(_editor|open)?|tim(thumb)?)\.php" { deny all; }
@VirtuBox
VirtuBox / Readme.md
Last active July 9, 2023 11:38
VPS Benchmark Script using sysbench

Simple bash script to perform benchmark using sysbench

Benchmarks :

  • CPU
  • RAM
  • Disk
bash &lt;(wget -qO - https://gist.githubusercontent.com/VirtuBox/ebdb8d30690eda6834d5b62798dc4a02/raw/e7834c5a70cba397aa161a47a6a26016d8b08825/sysbench.sh)
@VirtuBox
VirtuBox / backup.php
Last active May 19, 2023 19:18
A simple php script to backup a database and getting db parameters from wp-config.php if available
<?php
/** Define ABSPATH as this file's directory */
if (! defined('ABSPATH')) {
define('ABSPATH', __DIR__ . '/');
}
/* If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php
* doesn't, load wp-config.php. The secondary check for wp-settings.php has the added benefit
* of avoiding cases where the current directory is a nested installation, e.g. / is WordPress(a)