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 / letsencrypt-hostname.sh
Created June 3, 2016 19:01 — forked from xgin/letsencrypt-hostname.sh
Secure plesk clean installation with hostname certificate by Let's Encrypt
#!/bin/bash -e
### Copyright 1999-2015. Parallels IP Holdings GmbH. All Rights Reserved.
### Secure plesk clean installation with hostname certificate by Let's Encrypt
export PYTHONWARNINGS="ignore:Non-standard path"
LE_HOME=${LE_HOME:-"/usr/local/psa/var/modules/letsencrypt"}
HOSTNAME=$(hostname)
# Use staging server for testing
# --server https://acme-staging.api.letsencrypt.org/directory
@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 / cli_color.class.php
Last active December 18, 2015 05:19 — forked from bluefuton/cli_color.class.php
PHP Class for CLI Colors
<?php
// Based upon http://goo.gl/406o
class CliColor
{
private $colors = array();
private $bgcolors = array();
public function __construct()
{
// Set up shell colors
@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"