Pack:
tar -zcvf archive.tar.gz directory/
c - create an archive from files in directory (recursive by default)
z - compress above archive with gzip
f - store the output as a file
v - list all the files
Unpack:
tar -zxvf archive.tar.gz
2015/04/24
2015/04/11
How to send mail from PHP using swiftmailer library ?
Download swiftmailer library from here
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
require_once "swiftmailer/swiftmailer/lib/swift_required.php"; | |
private function send_mail($total_google_num){ | |
$subject = 'Subject'; | |
$from = array('example_1@gmail.com' =>'Your Name'); | |
$to = array('example_2@gmail.com' => 'Recipient1 Name'); | |
$text = "text message"; | |
$html = "html message"; | |
$transport = \Swift_SmtpTransport::newInstance("smtp.gmail.com") | |
->setPort(465) | |
->setEncryption('ssl') | |
->setUsername(your_gmail_username) | |
->setPassword(your_gmail_password); | |
$swift = \Swift_Mailer::newInstance($transport); | |
$message = (new \Swift_Message($subject)) | |
->setFrom($from) | |
->setBody($html, 'text/html') | |
->setTo($to) | |
->addPart($text, 'text/plain'); | |
$failures = null; | |
if ($recipients = $swift->send($message, $failures)) | |
{ | |
echo 'Message successfully sent!'; | |
} else { | |
echo "There was an error:\n"; | |
print_r($failures); | |
} | |
} |
2015/04/10
How to select records that has unix_timestamp and differs in minutes in MySql ?
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
SELECT * | |
FROM proxy | |
WHERE status = 'active' | |
AND TIMESTAMPDIFF(MINUTE, FROM_UNIXTIME(blocking_date), CURRENT_TIMESTAMP) > 60 * 4)) | |
ORDER BY total_ping_counter |
Subscribe to:
Posts (Atom)