In the home directory make a .my.cnf file
touch ~/.my.cnf
Ensure it has your login details.
[mysqldump]
user=yourdbusername
password=yourdbpassword
// Given an Async Function (Not a promise) this class will ensure that the run method can only run 1 instance of that async operation at a time. | |
class AsyncSingleInstance { | |
// Soon we will have private fields? https://github.com/tc39/proposal-class-fields#private-fields | |
//#inProgress; | |
//#asyncFunction; | |
constructor(asyncFunction) { | |
this.inProgress = false; | |
this.asyncFunction = asyncFunction; | |
} |
#!/bin/bash | |
# This runs the php malware finder scripts and sends an email of the log out | |
# First Install this project & dependencies (yara): https://github.com/nbs-system/php-malware-finder | |
# Modify the script as needed and set up the crontab if you wish to automate it. | |
# | |
# Example Crontab: 0 1 * * * /root/php-malware-finder/run-php-malware-finder | |
LOGFILE="/var/log/malwaredetect/phpmalwarefinder-$(date +'%Y-%m-%d').log"; | |
EMAIL_MSG="Please see the log file attached."; | |
EMAIL_FROM="cron@someserver"; | |
EMAIL_TO="your@email"; |
<?php | |
// Read filenames from the input file, get their file sizes if possible and total it. | |
// Show the total in a human readable file size. | |
function human_filesize($bytes, $decimals = 2) { | |
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB'); | |
$factor = floor((strlen($bytes) - 1) / 3); | |
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor]; | |
} |
<?php | |
// Read filenames from the input file, get their file sizes if possible and total it. | |
// Show the total in a human readable file size. | |
function human_filesize($bytes, $decimals = 2) { | |
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB'); | |
$factor = floor((strlen($bytes) - 1) / 3); | |
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor]; | |
} |
<?php | |
// Splits a string on commas, trims whitespace and ignores empty items. | |
// Does not split an item with internal spaces like "some thing". | |
function splitter($input) { | |
return preg_split ('/\s*,\s*/', $input, -1, PREG_SPLIT_NO_EMPTY); | |
} | |
$labels = splitter("Oh bob, Sagget, , ,,,, ,, asdas d, a,1,2,3,4,5,"); | |
foreach($labels as $label) { |
In the home directory make a .my.cnf file
touch ~/.my.cnf
Ensure it has your login details.
[mysqldump]
user=yourdbusername
password=yourdbpassword
Prevent locking up forever if trying to connect when db is not available. | |
Set the c3p0.checkoutTime to something other than 0 so that it stops trying to connect at some point. | |
<property name="hibernate.c3p0.acquireRetryAttempts">2</property> | |
<property name="hibernate.c3p0.acquireRetryDelay">10</property> | |
<property name="hibernate.c3p0.checkoutTimeout">1000</property> | |
<property name="show_sql">false</property> |
Windows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk] | |
"TimeOutValue"=dword:00000019 | |
"IoTimeoutValue"=dword:00000014 |
WITH monster_drops | |
AS | |
( | |
SELECT id as monster_id, MVP1id AS item_id, MVP1per AS item_rate FROM mob_db | |
UNION | |
SELECT id as monster_id, MVP2id AS item_id, MVP2per AS item_rate FROM mob_db | |
UNION | |
SELECT id as monster_id, MVP3id AS item_id, MVP3per AS item_rate FROM mob_db | |
UNION | |
SELECT id as monster_id, Drop1id AS item_id, Drop1per AS item_rate FROM mob_db |