Skip to content

Instantly share code, notes, and snippets.

View galvao's full-sized avatar
😎
Rocking to the rythm of the sure shot beat

Er Galvão Abbott galvao

😎
Rocking to the rythm of the sure shot beat
View GitHub Profile
@galvao
galvao / RandStrGen.php
Created June 2, 2011 19:08
Random string generation
<?php
/**
* Generates a random string based on ASCII coding.
* @author Er Galvão Abbott <galvao@galvao.eti.br>
* @see http://www.asciitable.com/
*/
$result = '';
$bgn = 33;
@galvao
galvao / draw.php
Created June 2, 2011 20:49
Random draw
<?php
/**
* Random draw, "interactively" reducing the original array so each participant is drawn only once.
* @author Er Galvão Abbott <galvao@galvao.eti.br>
*/
$rounds = 3;
$eagerParticipants = array('Ad Rock', 'Mike D', 'MCA', 'Chuck D', 'Flavor Flav', 'Jammaster Jay', 'Terminator X');
$luckyBastards = array();
@galvao
galvao / Decrypt.php
Created December 26, 2011 16:57
Usando mcrypt com Zend Framework via helpers
<?php
class Helper_Decrypt extends Zend_Controller_Action_Helper_Abstract
{
private $applicationConfig, $cryptoConfig, $result;
public function direct($cryptedData, $base64Decode = TRUE)
{
$this->applicationConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
$this->cryptoConfig = $this->applicationConfig->my->crypto;
@galvao
galvao / gist:4120644
Created November 20, 2012 20:00
PHPMyAdmin é para os fracos =P
mysqldump --complete-insert --extended-insert --host=localhost --user=myUser --password=myPass --result-file=dump.sql --routines myDB
@galvao
galvao / gist:4126626
Created November 21, 2012 18:15
Disk usage, sorted by largest directories first, with no subdirs
du -Sh .|sort -hr|more
@galvao
galvao / find_and_remove_git
Created January 8, 2013 05:17
Find all git hidden folders and remove them
find /path/to/dir -name '.git*' -exec rm -rf {} \;
@galvao
galvao / music123_play.sh
Created February 5, 2013 18:35
Playing music like a boss with music123
music123 -l -r -z ~/Music/*
@galvao
galvao / gist:6007766
Created July 16, 2013 11:04
Select the largest value length of a column in an entity
SELECT MAX(LENGTH(TRIM(column))) FROM entity;
@galvao
galvao / column_info.sql
Last active December 25, 2015 16:09
Querying all column information from all entities in a MySQL Database
SELECT
table_name,
column_name,
data_type,
character_maximum_length,
numeric_precision,
numeric_scale,
column_type,
column_key,
extra,
@galvao
galvao / fk_query.sql
Created October 16, 2013 07:05
Querying for Foreign Key Constraints in a MySQL Database
SELECT
*
FROM
information_schema.referential_constraints
WHERE
table_name='<table_name>'
AND constraint_schema='<database_name>';