Skip to content

Instantly share code, notes, and snippets.

@lunitrixx
lunitrixx / docker-swarm-architecture.md
Created February 26, 2024 12:25 — forked from scyto/docker-swarm-architecture.md
My Docker Swarm Architecture
@lunitrixx
lunitrixx / agressive-url-encode.md
Created February 10, 2024 23:00 — forked from Paradoxis/agressive-url-encode.md
Agressive URL encode

Agressive URL encode

Python based CLI tool to agressively url-encode strings, rather than just encoding non-url characters this tool will encode every character in the URL.

Usage:

Firstly make a function in your .bash_profile to call the script

function url-encode()
{
 python ~//url_encode.py $@
@lunitrixx
lunitrixx / header_filter_by_lua_example.md
Created February 10, 2024 11:03 — forked from ejlp12/header_filter_by_lua_example.md
nginx, openresty, transform/modify response body, header_filter_by_lua
@lunitrixx
lunitrixx / nginx-tuning.md
Created February 7, 2024 17:46 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@lunitrixx
lunitrixx / functions.php
Created September 23, 2023 06:22 — forked from cliffordp/functions.php
Automatically login a single WordPress user upon arrival to a specific page.
<?php
/**
* Automatically login a single WordPress user upon arrival to a specific page.
*
* Redirect to home page once logged in and prevent viewing of the login page.
* Compatible with WordPress 3.9.1+
* Updated 2014-07-18 to resolve WP_DEBUG notice: "get_userdatabylogin is deprecated since version 3.3! Use get_user_by('login') instead."
* Updated 2019-07-09 to reformat code, pass 2nd parameter to `do_action()`, and hook into priority 1.
*
@lunitrixx
lunitrixx / wordpress-display-query-variables.php
Created September 9, 2023 10:51 — forked from deepak-rajpal/wordpress-display-query-variables.php
WordPress display all wp_query and query variables (post information etc)
<?php
global $wp_query;
echo "<pre>";
var_dump($wp_query->query_vars);
var_dump($wp_query);
echo "</pre>";
?>
@lunitrixx
lunitrixx / link_post_translation.php
Created September 5, 2023 12:15 — forked from djoo/link_post_translation.php
WPML Custom end point link 2 existing translation
<?php
/**
* Link the FR translation and the EN translation
* Called by API https://domain.com/wp-json/link_translation/post/
*/
function custom_rest_link_translation($data) {
//Source https://wpml.org/wpml-hook/wpml_set_element_language_details/
@lunitrixx
lunitrixx / install.sh
Created August 16, 2023 10:58 — forked from ikr4-m/install.sh
Hyper-V Enhanced Session for Debian
#!/bin/sh
# This script based on linux-vm-tools for Ubuntu 22.02.
# Thanks to https://github.com/Hinara/linux-vm-tools/ to script
# This script is for Ubuntu 22.04 Jammy Jellyfish to download and install XRDP+XORGXRDP via
# source.
#
# Major thanks to: http://c-nergy.be/blog/?p=11336 for the tips.
#
@lunitrixx
lunitrixx / cdn-jquery.php
Created April 6, 2023 10:52 — forked from Shelob9/cdn-jquery.php
Replace WordPress' jQuery with CDN jQuery of the right version
add_action( 'init', function(){
if ( ! is_admin()) {
if( is_ssl() ){
$protocol = 'https';
}else {
$protocol = 'http';
}
/** @var WP_Scripts $wp_scripts */
global $wp_scripts;