Skip to content

Instantly share code, notes, and snippets.

View agarzon's full-sized avatar
🕶️
Hunting bugs....

AG agarzon

🕶️
Hunting bugs....
  • Zend Certified Engineer
  • Canada, Montreal
View GitHub Profile
@agarzon
agarzon / texture-selector.go
Created November 12, 2018 18:53
Zibo texture selector for x-plane
// This command line program helps to install 4k or 2k textures in the Zibo's B738
// Author: Alexander Garzon
// Multi-platform. It should work with WIN, OS and Linux. Just be sure the file has execution permisstions.
// Tested with Zibo 3.31
package main
import (
"fmt"
"io"
@agarzon
agarzon / whmcs-export.sql
Created November 2, 2018 21:40
WHMCS export hosting services
SELECT tblhosting.domain, tblservers.name, tblhosting.domainstatus, tblproducts.name , CONCAT(tblclients.firstname, ' ', tblclients.lastname) AS Client, tblclients.status AS Clientstatus
FROM tblhosting
LEFT JOIN tblproducts ON tblhosting.packageid = tblproducts.id
LEFT JOIN tblservers ON tblhosting.server = tblservers.id
LEFT JOIN tblclients ON tblhosting.userid = tblclients.id
WHERE tblhosting.domainstatus IN ('Active', 'Suspended')
ORDER BY tblservers.id ASC
INTO OUTFILE '/tmp/whmcs.csv';
@agarzon
agarzon / ip-update.php
Last active July 6, 2018 09:35
ENOM IP Updater (PHP)
<?php
/* Run this script every 5 minutes (or 1 hour, is up to you) using a cron task */
/* Edit this data*/
$domain = "mydomain.com";
$pass = "xxxxxx";
$host = ""; // Optional, for additional hosts names like: ftp., mail. or any sub-domains.
/* DO NOT EDIT FROM HERE */
file_get_contents("http://dynamic.name-services.com/interface.asp?command=SetDNSHost&Zone=@.$domain&DomainPassword=$pass");
@agarzon
agarzon / googleize.sh
Created October 24, 2014 21:44
Automatically set up the Plesk DNS to work with Google Apps in a domain
#!/bin/bash
if [ -z "$1" ]
then
echo "Please provide a domain name as argument"
exit 1
fi
DOMAIN=$1
IP=`dig +short A $DOMAIN`
@agarzon
agarzon / phplint.sh
Last active October 4, 2017 21:21
Recursive PHP linting
find . -name "*.php" -print0 | xargs -0 -n1 -P $(nproc) php -l | grep -v '^No'
@agarzon
agarzon / shred.sh
Created October 4, 2017 15:38
Securely erasing all files in folders recursively
#!/bin/bash
#If you want more "passes" change vzun0 for vzun1 or any other number (process will be slower!)
find /mnt/backup -type f -print0 | xargs -0 shred -vzun0
@agarzon
agarzon / calendar.php
Last active September 4, 2017 20:39
Calendar generator function
<?php
function build_calendar($month, $year) {
$daysOfWeek = array('S','M','T','W','T','F','S');
$firstDayOfMonth = mktime(0,0,0,$month,1,$year);
$numberDays = date('t',$firstDayOfMonth);
$dateComponents = getdate($firstDayOfMonth);
$monthName = $dateComponents['month'];
$dayOfWeek = $dateComponents['wday'];
$calendar = "<table class='calendar'>";
$calendar .= "<caption>$monthName $year</caption>";
@agarzon
agarzon / wp-delete-unused-files.php
Last active June 14, 2017 20:40
Explore Upload folder to remove unused files and save disk space. Wordpress shell script
<?php
/**
* Wordpress shell script
* Explore Upload folder to remove unused files and save disk space
*
* @category Wordpress
* @package Wordpress.shell
*
* @author Alexander Garzon <agarzon@php.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
@agarzon
agarzon / domain2dns.php
Last active May 8, 2017 10:04
Get DNS information from domain name with PHP
<?php
// Get nameserver from a domain name.
function getNameservers($hostname) {
$result = dns_get_record($hostname, DNS_NS);
foreach($result as $record) {
$return[] = $record['target'];
}
return $return;
}
@agarzon
agarzon / myip.sh
Created July 18, 2014 18:43
The fastest way to find your own public IP
dig +short myip.opendns.com @resolver1.opendns.com