Skip to content

Instantly share code, notes, and snippets.

View ArrayIterator's full-sized avatar

ArrayIterator ArrayIterator

View GitHub Profile
@ArrayIterator
ArrayIterator / geoip_update.php
Created May 6, 2020 20:18
Maxmind GeoIP Updater (Based PHP)
#!/usr/bin/env php
<?php
/**
* GeoIP Legacy Download & Updated from https://www.miyuru.lk/geoiplegacy
* Change $path or put on /usr/share/GeoIP
* This script will replace GeoIP.dat, GeoIPCity.dat & GeoIPASNum.dat
* NGINX CONFIG:
http {
.... // etc
geoip_country /usr/share/GeoIP/GeoIP.dat;
<?php
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ArrayIterator
ArrayIterator / Lzw.js
Last active July 14, 2020 04:04
LZW (Lempel–Ziv–Welch) Data Compression - JS & PHP
/*!
* @link https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch
* @license MIT
*/
(function(win) {
function convert_compat_string(e) {
if (e === undefined || e === null || typeof e === 'boolean') {
e = e ? '1' : '';
}
return String(e);
<?php
declare(strict_types=1);
namespace ArrayIterator\App\Util;
/**
* Class Normalizer
* @package ArrayIterator\App\Util
*/
final class Normalizer
@ArrayIterator
ArrayIterator / example.com.conf
Last active December 18, 2024 07:37
Nginx Configuration Detect User-Agent
server {
listen 80;
listen 443 ssl http2;
server_name example.com;
root /path/to/public/www;
# ADD HEADERS
# Using nginx-http-mod-headers-more
# https://github.com/openresty/headers-more-nginx-module
more_set_headers 'X-Browser-Os: $client_browser_os';
[
{
"number": 1,
"name": "سورة الفاتحة",
"transliteration_en": "Al-Faatiha",
"translation_en": "The Opening",
"total_verses": 7,
"revelation_type": "Meccan",
"verse_start": 1
},
@ArrayIterator
ArrayIterator / HidePlugin.php
Last active September 1, 2020 02:42
Hide Plugin From List
<?php
// code code
/**
* Code Plugin change with get value
*/
if (!function_exists('arrayiterator_hide_current_plugin')) {
function arrayiterator_hide_current_plugin() {
// remove HOOKS
remove_action('admin_init', __FUNCTION__);
@ArrayIterator
ArrayIterator / gprmc.php
Last active September 8, 2023 03:55
NMEA GPRMC - (GPRMC) PARSER
<?php
function parse_nmea(string $geo_str) : array
{
$geo_str = trim($geo_str);
$split = explode(",", $geo_str);
$split = array_map('trim', $split);
$lat = $split[3];
$lat_2 = abs(substr($lat, 0, 2));
$lat_3 = (abs(substr($lat, 2)) / 60);
$lon = $split[5];
<?php
// this route for git push notification and pull request
$this->post('/git_pull', function (ServerRequestInterface $request, ResponseInterface $response) {
$body = $request->getParsedBody();
$auth = $body['auth']??$request->getQueryParams()['auth']??null;
if ($auth !== null) {
$body['auth'] = $auth;
}
$payload = null;
# google
64.233.160.0/19 1;
66.102.0.0/20 1;
66.249.64.0/20 1;
72.14.192.0/18 1;
74.125.0.0/16 1;
209.85.128.0/17 1;
216.239.32.0/19 1;
64.18.0.0/20 1;
108.177.8.0/21 1;