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 / pt-table-sync.pl
Created November 18, 2011 21:24
pt-table-sync improved
#!/usr/bin/env perl
# This program is part of Percona Toolkit: http://www.percona.com/software/
# See "COPYRIGHT, LICENSE, AND WARRANTY" at the end of this file for legal
# notices and disclaimers.
use strict;
use warnings FATAL => 'all';
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
@agarzon
agarzon / random_color.php
Last active September 11, 2023 17:04
PHP Random Color Generator Hex
<?php $color = dechex(rand(0x000000, 0xFFFFFF)); ?>
<body style="background-color: <?php echo $color; ?>;">
<h1><?php echo $color ?></h1>
</body>
@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 / 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 / whois.php
Created June 5, 2012 14:57
WHOIS with PHP including .ve domains
<?php
function whois($domain) {
// fix the domain name:
$domain = strtolower(trim($domain));
$domain = preg_replace('/^http:\/\//i', '', $domain);
$domain = preg_replace('/^https:\/\//i', '', $domain);
$domain = preg_replace('/^www\./i', '', $domain);
$domain = explode('/', $domain);
$domain = trim($domain[0]);
@agarzon
agarzon / index.html
Last active April 5, 2022 23:44
My Html5 template with Jquery and Bootstrap from CDN
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Project Title</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
@agarzon
agarzon / .htaccess
Created June 28, 2012 12:52
Sitio en mantenimiento con htaccess
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !/mantenimiento.html$
RewriteCond %{REMOTE_HOST} !^999\.999\.999\.999
RewriteRule $ /mantenimiento.html [R=302,L]
@agarzon
agarzon / chmod.html
Last active October 6, 2015 21:38
CHMOD ONLINE EMULATOR
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CHMOD ONLINE EMULATOR</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="CHMOD ONLINE EMULATOR">
<!-- Twitter Bootstrap -->
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
@agarzon
agarzon / secondsToTime.php
Created July 11, 2012 14:24
Calculate remaining days, hours, minutes and seconds from seconds
<?php
function secondsToTime($seconds) {
// Extract days
$days = floor($seconds / 86400);
// Extract hours
$divisorHours = $seconds % 86400;
$hours = floor($divisorHours / 3600);
// Extract minutes
@agarzon
agarzon / dnsSync.sh
Last active October 7, 2015 03:58 — forked from adam12/update-slave.sh
Bash script to sync nameservers slave master automatically. Plesk 11 tested
#!/bin/bash
#Require root SSH access by authentication file
TEMPFILE=`mktemp -p /tmp`
HOSTNAME=`hostname`
MASTERS=`hostname -i`
REMOTE_URI="root@xxx.xxx.xxx.xxx"
SLAVE_PATH="/var/named/chroot/etc/"
for domain in `egrep '^zone' /etc/named.conf | egrep -iv "arpa|\"\." | egrep -iv "domain.com" | awk -F\" '{print $2}'`
do printf "zone \"${domain}\" {\n\t type slave;\n\t file \"/var/named/slaves/${domain}.db\";\n\t masters { ${MASTERS}; };\n};\n\n"