This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
copy(Array(32).fill(0).map(() => '#' + ('00000' + Math.floor(Math.random()*Math.pow(256, 3)).toString(16)).slice(-6)).join("\n")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATE="`date +"%d_%H%M"`" | |
echo "DATE=$DATE" | |
DB_FILEPATH="/home/forge/backups/dip_db_$DATE.sql" | |
echo "DB_FILEPATH=$DB_FILEPATH" | |
STORAGE_FILEPATH="/home/forge/backups/dip_storage_$DATE.tgz" | |
echo "STORAGE_FILEPATH=$STORAGE_FILEPATH" | |
echo | |
echo "database:" | |
mysqldump --defaults-file=/home/forge/.mysql.prod.cnf --skip-comments prod > "$DB_FILEPATH" || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$json1 = <<<JSON | |
... | |
JSON; | |
var_dump(strlen($json1)); | |
$data1 = json_decode($json1, true); | |
// print_r($data1); | |
$data2 = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
totalVotes(18.7); | |
totalVotes(14.3); | |
totalVotes(45.5); | |
function totalVotes(float $target, float $margin = 0.08) : void { | |
echo "$target %...\n"; | |
$fVotes = 100 / $target; | |
echo "~ $fVotes votes...\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(8); | |
$ps2 = ''; | |
if ($pid2 = findPsPid($ps2)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- sendmail.mc 2023-06-05 18:02:04.731427285 +0200 | |
+++ sendmail.mc 2023-06-05 18:04:03.723468728 +0200 | |
@@ -88,4 +88,10 @@ | |
FEATURE(`conncontrol', `nodelay', `terminate')dnl | |
FEATURE(`ratecontrol', `nodelay', `terminate')dnl | |
+ | |
+MASQUERADE_AS(example.com)dnl | |
+FEATURE(masquerade_envelope)dnl | |
+FEATURE(masquerade_entire_domain)dnl | |
+MASQUERADE_DOMAIN(example.com)dnl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$home = rtrim(getenv('HOME'), '\\/'); | |
$moreDirs = array_slice($_SERVER['argv'], 1); | |
$output = `df -h`; | |
if (!preg_match('#(\d+)% +/\s#', "$output ", $match)) { | |
echo trim($output) . "\n"; | |
exit(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Using https://packagist.org/packages/mollie/mollie-api-php | |
$info = [ | |
'amount' => [ | |
'currency' => $this->config['currency'] ?: 'EUR', | |
'value' => number_format($this->payment->amount, 2, '.', ''), | |
], | |
'description' => $this->payment->order_description, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* `url` can be a data URI like data: or a blob URI like blob: or an existing, public resource like http: | |
* `filename` is the (default) name the file will be downloaded as | |
*/ | |
function download( url, filename ) { | |
var link = document.createElement('a'); | |
link.setAttribute('href',url); | |
link.setAttribute('download',filename); | |
var event = document.createEvent('MouseEvents'); | |
event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); |
NewerOlder