Skip to content

Instantly share code, notes, and snippets.

View ArrayIterator's full-sized avatar

ArrayIterator ArrayIterator

View GitHub Profile
@ArrayIterator
ArrayIterator / stateless-cookie-user-using-password_hash.php
Last active December 17, 2022 04:48
Php very simple stateless cookie with user id & sign using password_hash
@ArrayIterator
ArrayIterator / Simple.php
Created December 2, 2022 19:25
Simple Event Dispatcher
<?php
declare(strict_types=1);
namespace Events;
use Closure;
class Simple
{
/**
@ArrayIterator
ArrayIterator / nginx-tuning.md
Created November 5, 2022 13:06 — 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.

@ArrayIterator
ArrayIterator / Renderer.php
Created February 11, 2022 04:41
custom wordpress sitemap styling & sitemap generator
<?php
namespace ArrayIterator\WP\Components\Sitemap;
use DOMDocument;
use WP_Sitemaps_Renderer;
if (!class_exists(WP_Sitemaps_Renderer::class)) {
return;
}
@ArrayIterator
ArrayIterator / ubuntu (16|18).04 - network interface (ifup down)
Last active November 4, 2022 13:45
assign / implement ip6 OVH Ubuntu
# /etc/network/interfaces.d/50-cloud-init.cfg
# command : ifup -a
# 2001:4860:4860::8888 2001:4860:4860::8844 is a google dns
iface ens3 inet6 static
address ipv_6
netmask 64
gateway ipv_6_gateway
dns-nameservers 2001:4860:4860::8888 2001:4860:4860::8844
@ArrayIterator
ArrayIterator / example.com.host.conf
Last active December 18, 2021 16:10
php-fpm 8.0 + nginx server block.
server {
# http
listen 80;
# https
# pastikan sudah di deklarasi untuk
# ssl_certificate & ssl_certificate_key
# atau deklarasi server block ini
listen 443 ssl http2;
#!/usr/bin/env bash
C_USER='user'
CWD_DIR=/home/${C_USER}/host/aurys.fr
CONFIG_DIR=${CWD_DIR}/config
BACKUP_DIR=${CWD_DIR}/database
CONFIG_FILE=${CWD_DIR}/public/wp-config.php
COMMITDATE=`date '+%Y-%m-%d %H:%M:%S'`
C_NAME='${C_USER}'
C_EMAIL='${C_USER}@127.0.0.1'
@ArrayIterator
ArrayIterator / root.color.css
Last active January 5, 2023 05:13
CSS :root Based Color - flatuicolor https://www.flatuicolorpicker.com/
/*!
* Factory Color
* Based On: https://www.flatuicolorpicker.com/
*/
:root {
/* BLUE */
--shark-blue: #24252a;
--serpa-blue: #013243;
--ebony-clay-blue: #22313f;
--pickled-bluewood: #34495e;
@ArrayIterator
ArrayIterator / random_char_permutations.php
Last active December 28, 2022 18:34
Random Character Permutation
<?php
/**
* Create possible random array permutation by characters
*/
function random_array_permutations($array_or_string, int $length, int $max = 10, array $must_be_not_in = []) : array
{
if (!is_array($array_or_string)) {
$array_or_string = str_split((string) $array_or_string);
}
$count = count($array_or_string);
<?php
class Event
{
protected static $events = [];
public static function register(
$name,
$callable,
$priority = 10
) {