This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- DROP FUNCTION substitui_win1252_html(texto); | |
CREATE OR REPLACE FUNCTION substitui_win1252_html(texto text) | |
RETURNS text AS | |
$$ | |
BEGIN | |
texto := replace(replace(replace(replace(replace(texto, '', '’'), '', '“'), '', '”'), '','•'), '', '–')::text; | |
RETURN texto; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- DROP FUNCTION substitui_win1252(texto); | |
CREATE OR REPLACE FUNCTION substitui_win1252(texto text) | |
RETURNS text AS | |
$$ | |
BEGIN | |
texto := replace(replace(replace(replace(replace(texto, '', ''''), '', '"'), '', '"'), '','•'), '', '-')::text; | |
RETURN texto; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once("/pasta/do/phpmailer/class.phpmailer.php"); | |
$mail = new PHPMailer(); | |
$mail->IsSMTP(); // send via SMTP | |
$mail->Host = "mail.seudominio"; //seu servidor SMTP | |
$mail->SMTPAuth = true; // 'true' para autenticação | |
$mail->Username = "usuario@seudominio"; // usuário de SMTP | |
$mail->Password = "senhaxxx"; // senha de SMTP | |
$mail->From = "de@seudominio"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Desacentua uma string | |
* @param string $str String a ser desacentuada | |
* @return string String desacentuada | |
*/ | |
function desacentua($str) { | |
$a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Select * from dba_users; | |
Select * from dba_directories; | |
Select * from user_tables; | |
Select * from user_tab_columns; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT i, clock_timestamp() t1, random() r1, random() r2, random() r3, clock_timestamp() + (round(random()*1000)::text || ' days')::interval d1 | |
FROM generate_series(1,1000) i(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Baseado em http://mig5.net/content/mysql-postgresql-all-databases-backup-script | |
# Rafael Bernard Rodrigues Araujo - 14/06/2012 | |
today=$(date +%y%m%d) | |
# local dir where the backups go | |
myDir='/disk2/backup/pg' | |
# this is for PostgreSQL. If you don't need it, you |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function exception_error_handler($severity, $message, $filename, $lineno) { | |
if (error_reporting() == 0) { | |
return; | |
} | |
if (error_reporting() & $severity) { | |
throw new ErrorException($message, 0, $severity, $filename, $lineno); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- zerando historico | |
select * | |
from tpt_registration | |
where trim(custom9) is not null; | |
select * from all_tables where table_name like '%ACTION%' AND OWNER='TP8'; | |
select * | |
from tpt_offering_action | |
where id in ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE pg_database SET datistemplate=FALSE WHERE datname='template1'; | |
DROP DATABASE template1; | |
CREATE DATABASE template1 | |
WITH owner=postgres template=template0 encoding='UTF8' LC_COLLATE='C' LC_CTYPE='C'; | |
UPDATE pg_database SET datistemplate=TRUE WHERE datname='template1'; |
OlderNewer