Skip to content

Instantly share code, notes, and snippets.

View rudiedirkx's full-sized avatar

Rudie Dirkx rudiedirkx

View GitHub Profile
@rudiedirkx
rudiedirkx / read-error-log.php
Last active April 19, 2023 22:29
read-error-log.php
#!/usr/bin/env php
<?php
$args = array_slice($_SERVER['argv'], 1);
if (!count($args)) {
echo "Missing file argument\n";
exit(1);
}
$project = null;
@rudiedirkx
rudiedirkx / sendmail.mc.diff
Created May 5, 2022 21:44
sendmail.mc.diff
@@ -88,6 +88,12 @@
dnl # Stop connections that overflow our concurrent and time connection rates
FEATURE(`conncontrol', `nodelay', `terminate')dnl
FEATURE(`ratecontrol', `nodelay', `terminate')dnl
+
+MASQUERADE_AS(digitalinsightsplatform.nl)dnl
+FEATURE(masquerade_envelope)dnl
+FEATURE(masquerade_entire_domain)dnl
+MASQUERADE_DOMAIN(digitalinsightsplatform.nl)dnl
+
@rudiedirkx
rudiedirkx / filesearch.php
Last active July 10, 2021 18:19
Search for/in (certain) files
<?php
class Filesearch {
// Config
public $string = '';
public $extensions = array();
public $dir = '';
public $exclude = array();
public $in_files = true;
public $matcher = 'ci';
javascript: (function(f, a) {
f = new Blob(['"Date","Description","Amount"\n', [].map.call(queryAllShadow('[data-tag-name="ing-ow-expandable-item"]', queryAllShadow('[data-tag-name="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();
<analyses>
<analysis>
<test>
<testCode>A</testCode>
</test>
<package>
<packageCode>C</packageCode>
</package>
<package>
<packageCode>D</packageCode>
const queue = [];
chrome.browserAction.onClicked.addListener(function(tab) {
var url = 'http://www.example.com/?x=' + String(Math.random()).substr(2);
queue.push(url);
console.log('queue', queue);
chrome.tabs.update({url});
});
chrome.runtime.onMessage.addListener(function(msg, sender, sendResponse) {
/* From https://gist.github.com/MadRabbit/996893 */
function Bezier(p1, p2, p3, p4) {
var Cx = 3 * p1,
Bx = 3 * (p3 - p1) - Cx,
Ax = 1 - Cx - Bx;
var Cy = 3 * p2,
By = 3 * (p4 - p2) - Cy,
Ay = 1 - Cy - By;
var http = require('http');
var https = require('https');
var websocket = require('websocket');
var util = require('util');
function _log(msg) {
console.log.apply(console, arguments);
console.log('');
}
@rudiedirkx
rudiedirkx / line-lengths.php
Last active August 14, 2018 21:22
Line lengths for controllers and views recursively in a folder.
<?php
snap('init');
define('LL_TAB_SIZE', 4);
define('LL_TOO_LONG', 130);
define('LL_WAY_TOO_LONG', 220);
ini_set('html_errors', 0);
var PACKAGE = 'rdx/db';
ghGrapQL(`query { viewer { login, repositories(first: 100, privacy: PUBLIC, orderBy: {direction: DESC, field: PUSHED_AT}) { nodes { name } } } }`).then(rsp => {
return rsp.data.viewer.repositories.nodes.map(repo => `${rsp.data.viewer.login}/${repo.name}`)
}).then(repos => {
return repos.map(repo => {
return (rsps) => {
console.log(repo);
return fetch(`https://rawgit.com/${repo}/master/composer.json`).then(rsp => rsp.ok ? rsp.json() : null).then(rsp => rsps.concat([[repo, rsp]]));
}
});