Skip to content

Instantly share code, notes, and snippets.

View uhlhosting's full-sized avatar
🏠
Working from home

Viorel-Cosmin Miron uhlhosting

🏠
Working from home
View GitHub Profile
@1hakr
1hakr / example.com
Last active November 29, 2024 20:48
Supercharge your NGIX config
proxy_cache_path /tmp/cacheapi levels=1:2 keys_zone=microcacheapi:100m max_size=1g inactive=1d use_temp_path=off;
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.com;
location /api/ {
# Rate Limiting
limit_req zone=reqlimit burst=20; # Max burst of request
@HSPDev
HSPDev / AllowSSHFromIP.php
Created July 2, 2018 22:56
Complementary code and IAM policy for "You don't need that Bastion host"
<?php
// For laravel 5 based systems
// /path/to/project/app/Console/Commands/AllowSSHFromIP.php
namespace App\Console\Commands;
use Aws\Ec2\Ec2Client;
use Carbon\Carbon;
use Illuminate\Console\Command;
@aslafy-z
aslafy-z / wp-config.sh
Last active November 17, 2020 00:06
Generate wp-config.php from env variables
#!/bin/sh
set -e
if [ -z "$1" ]; then
echo "Usage: ./wp-config.sh <wp-config.php-path>"
exit 1
fi
WP_CONFIG_FILE=$1
@romainnorberg
romainnorberg / regex-vs-array.php
Created May 11, 2018 07:58
Php performances test
<?php
$excludeBotsRegex = '/(googlebot|Googlebot-Mobile|Googlebot-Image|Google favicon|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogo
@Friendbg
Friendbg / modsecurity-wordpress
Created March 30, 2018 06:21
ModSecurity Filters for wordpress
#Block WP logins with no referring URL
<Locationmatch "/wp-login.php">
SecRule REQUEST_METHOD "POST" "deny,status:401,id:5000130,chain,msg:'wp-login request blocked, no referer'"
SecRule &HTTP_REFERER "@eq 0"
</Locationmatch>
#Wordpress Brute Force detection
SecAction phase:1,nolog,pass,initcol:ip=%{REMOTE_ADDR},id:5000134
<Locationmatch "/wp-login.php">
# Setup brute force detection.
@drscotthawley
drscotthawley / WebAudioFreqGain.html
Last active February 19, 2023 13:31
WebAudio OSC Output for use with Wekinator
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html> <head>
<title>WebAudio OSC Output Example - 2 Variables</title>
<!-- By Scott Hawley @drscotthawley. Modified from https://github.com/automata/osc-web/blob/master/web-side/app.html
No additional license restrictions are introduced with these modifications; the automata/osc-web site gives no license info.
Thus as far as this author is concerned: "unlimited license": feel free to use & modify in any way you wish! -->
</head>
<body>
<h2>WebAudio OSC Output Example - 2 Variables</h2>
@rynaldos-zz
rynaldos-zz / wc-eu-vat-countries.php
Last active February 15, 2021 14:08
filter the countries where the VAT number field will show up for
add_filter( 'woocommerce_eu_vat_number_country_codes', 'woo_custom_eu_vat_number_country_codes' );
function woo_custom_eu_vat_number_country_codes( $vat_countries ) {
// only show field for users in BE
return array( 'BE' );
}
@moiseevigor
moiseevigor / Dockerfile.tf15-py3-cv3
Last active November 18, 2018 17:16
Tensorflow 1.5 + OpenCV 3.4.1 + Python 3
FROM gcr.io/tensorflow/tensorflow:1.5.0-gpu-py3
LABEL maintainer="Igor Moiseev <[email protected]>"
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
wget \
unzip \
@josanua
josanua / wp-code-utils.php
Last active October 25, 2024 03:58
wp code utils
<?php
************ Debug, Debuging ************
//Activate log files in wp-config.php
define( 'WP_DEBUG', true ); // Enabling WP_DEBUG will cause all PHP errors, notices and warnings to be displayed.
define( 'WP_DEBUG_LOG', true ); // Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_DISPLAY', true ); // Controls whether debug messages are shown inside the HTML of pages or not.
// use this
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
@joachimesque
joachimesque / config.php
Created January 4, 2018 15:19
CSP headers with a script-src nonce directive for Kirby
<?php
/*
---------------------------------------
CSP
---------------------------------------
*/
$csp_nonce = base64_encode(random_bytes(20));
$csp_header = "Content-Security-Policy: default-src 'self'; script-src 'self' 'nonce-" . $csp_nonce . "';";
// set `csp-nonce` so it's accessable