Skip to content

Instantly share code, notes, and snippets.

View rudiedirkx's full-sized avatar

Rudie Dirkx rudiedirkx

View GitHub Profile
#!/usr/bin/env php
<?php
$args = array_slice($_SERVER['argv'], 1);
$backup = !in_array('--no-backup', $args);
if (!file_exists('.env')) {
echo "Must be in root dir.\n";
exit(1);
}
<?php
require __DIR__ . '/icares-env.php'; // GRAPHQL_ENDPOINT, GRAPHQL_TOKEN
if (isset($_GET['type'], $_POST['q'])) {
echo '<pre>';
print_r($_POST['q']);
$answers = [];
foreach ($_POST['q'] as $id => $value) {
<?php
// $ps = `ps -axf -o pid,command | grep -C3 '\/chrome\/'`;
// $ps = `ps -axf -o pid,command | grep 'chrome' | grep -C1 -v '\\_'`;
$ps1 = '';
if ($pid1 = findPsPid($ps1)) {
sleep(20);
$ps2 = '';
if ($pid2 = findPsPid($ps2)) {
@rudiedirkx
rudiedirkx / detect-history-state.js
Last active July 25, 2025 16:54
Detect pushState and replaceState
var _wr = function(type) {
var orig = history[type];
return function() {
var rv = orig.apply(this, arguments);
var e = new Event(type);
e.arguments = arguments;
window.dispatchEvent(e);
return rv;
};
};
<?php
use GuzzleHttp\Client; // guzzlehttp/guzzle
use rdx\jsdom\Node; // rdx/js-dom
require 'vendor/autoload.php';
$guzzle = new Client();
if (file_exists($file = 'cache/padelgids.html')) {
checkfile="${1:-composer.lock}"
#echo "$checkfile"
basebranch="${2:-prod}"
#echo "$basebranch"
branches=`git branch --format='%(refname:short)'`
for branch in $branches; do
#echo "$branch"
cmd="git dif --stat $basebranch...$branch -- $checkfile"
<?php
function incrotate(int $startLength, string $in) : string {
$len = $startLength;
$out = '';
while (strlen($out) < strlen($in)) {
$part = substr($in, strlen($out), $len);
$out .= strrev($part);
$len++;
}
<?php
$output = trim(file_get_contents('php://stdin'));
$lines = explode("\n", $output);
$counts = [];
$lastFile = null;
foreach ($lines as $line) {
if (preg_match('#^ Line \s+ (.+)#', $line, $match)) {
$lastFile = trim($match[1]);
<?php
$_debug = false;
$_uptime = 12;
if (!date_default_timezone_set($timezone = trim(file_get_contents('/etc/timezone')))) {
echo "Couldn't set timezone '$timezone'\n";
exit(1);
}
javascript: (function(f, a) {
f = new Blob(['"Date","Description","Amount"\n', [].map.call(queryAllShadow('ing-ow-expandable-item', queryAllShadow('ing-feat-transaction-period').reverse()[0]), row => ([
row.closest('.date-item').querySelector('time').getAttribute('datetime'),
row.querySelector('h5').textContent.trim(),
row.querySelector('h5 + strong').textContent.trim().replace(',', '.').replace('−', '-'),
]).map(col => '"' + col.replace(/"/g, '""') + '"').join(',')).join('\n')], {type: 'text/plain'});
a = document.createElement('a');
a.download = 'trans.csv';
a.href = URL.createObjectURL(f);
a.click();