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 / uitabs.html
Created August 26, 2013 16:05
Making linkeable Jquery UI tabs even when active tab is defined by default
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Tabs - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.7.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
@agarzon
agarzon / MkvToAvi.sh
Created August 9, 2013 18:49
ffmpeg mkv to avi
ffmpeg -i "File.mkv" -f avi -c:v mpeg4 -b:v 4000k -c:a libmp3lame -b:a 320k "File.avi"
@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 / .bashrc
Created June 6, 2013 15:58
Coloured Git Status in Your Bash Prompt
# User specific aliases and functions
function _git_prompt() {
local git_status="`git status -unormal 2>&1`"
if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then
if [[ "$git_status" =~ nothing\ to\ commit ]]; then
local ansi=32
elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then
local ansi=34
else
@agarzon
agarzon / dnsbl.sh
Last active January 28, 2025 15:41
DNS Black List - Linux shell script (improved from: http://www.daemonforums.org/showthread.php?t=302)
#!/bin/sh
# Check if an IP address is listed on one of the following blacklists
# The format is chosen to make it easy to add or delete
# The shell will strip multiple whitespace
BLISTS="
b.barracudacentral.org
bb.barracudacentral.org
bl.deadbeef.com
bl.mailspike.net
@agarzon
agarzon / random_name.php
Last active October 13, 2015 06:08
Random Name Generator
<?php
/**
* Generador de palabras o nombres aleatorios
*
* @param integer $min longitud mínima de la palabra
* @param integer $max longitud máxima de la palabra
* @return string palabra generada
*/
function nombreAleatorio($min = 3, $max = 10) {
@agarzon
agarzon / flush.php
Last active May 5, 2016 10:01
PHP Flush Output
<?php
@ini_set('zlib.output_compression', 0);
@ini_set('output_buffering', 0);
@ob_end_clean();
ob_implicit_flush(true);
for($i=0; $i<10; $i++){
echo $i;
@agarzon
agarzon / index.php
Last active January 23, 2017 23:00
Basic upload file with PHP
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Upload file</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container jumbotron">
<h1>Upload file</h1>
@agarzon
agarzon / emailXtractor.php
Created July 16, 2012 14:46
Extract all email address from any text content removing duplicated, and exporting as TEXT, SQL or CSV
<?php
/**
*
* Extract all email address from any text content removing duplicated
* Return string formated as: TEXT, SQL or CSV
* @author Alexander Garzon
*
*/
class emailXtractor {
@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="[email protected]"
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"