In the home directory make a .my.cnf file
touch ~/.my.cnf
Ensure it has your login details.
[mysqldump]
user=yourdbusername
password=yourdbpassword
In the home directory make a .my.cnf file
touch ~/.my.cnf
Ensure it has your login details.
[mysqldump]
user=yourdbusername
password=yourdbpassword
<?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) { |
<?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]; | |
} |
#!/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"; |
// 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; | |
} |
powercfg -lastwake | |
This will show you what last woke up your PC, in my case it was Windows Updates trying to schedule a restart. | |
I dont care about that but could not seem to disable it even though I am logged in as an Administrator user?! | |
Solution download pstools from Microsoft Sysinternals | |
Run a cmd prompt and disable the scheduled tasks | |
There is probably a better way to just disable the Wake from Lan option on the task but blah! |
<?php | |
// Note: Has problem with color spaces if input image is not sRGB some color info will be dropped. Loss of saturation/vibrance may be noticable. | |
function create_square_image($original_file, $destination_file=NULL, $square_size = 96){ | |
// get width and height of original image | |
$imagedata = getimagesize($original_file); | |
$original_width = $imagedata[0]; | |
$original_height = $imagedata[1]; | |
if($original_width > $original_height){ | |
$new_height = $square_size; |
#!/bin/sh | |
cd /var/www/html | |
sudo su -s /bin/bash www-data |