Skip to content

Instantly share code, notes, and snippets.

View darkcolonist's full-sized avatar
🐣
I rise from the fire, stronger and brighter.

Christian darkcolonist

🐣
I rise from the fire, stronger and brighter.
View GitHub Profile
@darkcolonist
darkcolonist / mysql-last100-export.ps1
Created March 27, 2026 04:01
powershell export last 100 records per table from mysql db
# ---------------------------------------------------------------------------
# Script: export_tables.ps1
# Description: Exports last 100 records to CSV with 100-char cell truncation
# Generated for: db_nmsapps_core (Manila Time/GMT+0800)
# ---------------------------------------------------------------------------
# Database Configuration
$Server = "localhost"
$Port = "3366"
$Database = "db_name"
@darkcolonist
darkcolonist / paste-in-console.js
Created March 26, 2026 07:41
discord web: take all threads
async function collectAll() {
let scroller = document.querySelector('#channels');
let seen = new Set();
// Scroll to top
scroller.scrollTop = 0;
await new Promise(r => setTimeout(r, 1000));
// Scroll down until end
let lastScrollTop = -1;
@darkcolonist
darkcolonist / pingloop.bat
Last active August 28, 2024 06:01
get your current IP as well as total time
@echo off
setlocal enabledelayedexpansion
:: Define the API to get the current public IP address
set "api_url=https://api.ipify.org"
:: Define the sleep duration in seconds
set "sleep_duration=1"
:: Get the current public IP address
@darkcolonist
darkcolonist / LumenViteCustom.php
Last active August 8, 2023 02:50
Vite Helper for PHP
<?php
namespace App\Helpers;
class Vite
{
/**
* ensure below matches base: '/dist/' in vite.config.js otherwise HMR will not work
* found in https://github.com/vitejs/vite/issues/7839#issuecomment-1350538408
*/
const SUB_DIRECTORY = "dist";
@darkcolonist
darkcolonist / remoteip.conf
Created March 3, 2023 08:31
override $_SERVER["REMOTE_ADDR"] with $_SERVER["X-Forwarded-For"] apache configuration
RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
RemoteIPHeader X-Forwarded-For
@darkcolonist
darkcolonist / haproxy.cfg
Created February 8, 2023 03:44
2023-02-08 how to pass client IP from HA-Proxy version 1.6.3 2015/12/25 to 10.4.13-MariaDB
# mysql 3307
frontend mysql3307-in
bind *:3307 name port3307
mode tcp
default_backend mysql3307-in_mes
timeout client 1h
backend mysql3307-in_mes
mode tcp
option forwardfor
@darkcolonist
darkcolonist / crontab for mysql read replica process watcher
Last active January 20, 2022 06:23
mysql read replica process watcher
* * * * * /bin/sh /path/to/script/rreplica-watcher.sh 2>/dev/null >/dev/null
0 2 * * * /bin/sh /path/to/script/rreplica-collate.sh 2>/dev/null >/dev/null
requests.post('https://jsonplaceholder.typicode.com/posts',
headers={"content-type":"application/json"},
json={
"keyyy-nervate" :"valll-retroactive" ,
"keyyy-polypody" :"valll-ladakin" ,
"keyyy-unremonstrant" :"valll-unmetropolitan" ,
"keyyy-exoticism" :"valll-monarchy" ,
}
)
@darkcolonist
darkcolonist / example_requester.pyr
Last active August 11, 2020 13:58
http requester & requester guide & usage for sublime text that works with PHP POST
### HTTP REQUESTER ###
POST http://localhost/test/index.php
Content-type: application/x-www-form-urlencoded
POST_BODY:
k1=v1&k2=v2
POST http://localhost/test/index.php
Content-type: application/json
Host: google.com
Cookie: SOMECOOKIE
@darkcolonist
darkcolonist / .htaccess
Created July 29, 2020 06:24
redirect to https behind haproxy, behind loadbalancer, behind cloudflare
RewriteEngine On
RewriteCond %{HTTPS} off
# RewriteCond %{HTTP:X-Forwarded-Proto} !https # commenting this out because: cloudflare -> haproxyLoadbalancer -> php70server
RewriteCond %{HTTP:CF-Visitor} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]