Skip to content

Instantly share code, notes, and snippets.

View tony-dtn's full-sized avatar

Tony Nguyen tony-dtn

View GitHub Profile
@tony-dtn
tony-dtn / disk_used_alert2slack
Created February 24, 2021 04:13 — forked from AAber/disk_used_alert2slack
Script to monitor disk space and alert via slack when disk usage is > 80% Place the script in /etc/cron.hourly
#!/bin/bash
# Parse df selected output
df -h|egrep -v 'File|tmpfs|docker|udev'| \
while read LINE; do
USED_NUMBER=`echo $LINE |awk '{print $5}'|sed 's/\%//'|sed 's/ //g'`
USED_PERCENT=`echo $LINE |awk '{print $5}'|sed 's/ //g'`
MOUNT_POINT=`echo $LINE |awk '{print $6}'|sed 's/ //g'`
if [ $USED_NUMBER -gt 80 ]; then
# Create message without spaces
@tony-dtn
tony-dtn / robots.txt
Created October 24, 2019 03:53 — forked from hn-support/robots.txt
Magento 2 recommended additions for robots.txt
User-agent: *
# Directories
Disallow: /app/
Disallow: /bin/
Disallow: /dev/
Disallow: /lib/
Disallow: /phpserver/
Disallow: /pkginfo/
Disallow: /report/
@tony-dtn
tony-dtn / load_customer_via_email.php
Created January 8, 2014 04:35
Magento Customer
<?php
$customer_email = "customer@example.com";
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($customer_email); //load customer by email id
//use
echo $customer->getId();
echo $customer->getFirstName();
//print_r($customer->getData()); to find all the available elements.
?>
@tony-dtn
tony-dtn / 0_reuse_code.js
Created December 30, 2013 06:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console