Skip to content

Instantly share code, notes, and snippets.

Uilian Souza uilian

Block or report user

Report or block uilian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Tablespace Usage 1
col "Tablespace" for a22
col "Used MB" for 99,999,999
col "Free MB" for 99,999,999
col "Total MB" for 99,999,999
select df.tablespace_name "Tablespace",
totalusedspace "Used MB",
(df.totalspace - tu.totalusedspace) "Free MB",
df.totalspace "Total MB",
round(100 * ( (df.totalspace - tu.totalusedspace)/ df.totalspace))
uilian / tbsp-ddl-extract.sql
Created Apr 8, 2014
Oracle - extract DDL for all tablespaces
View tbsp-ddl-extract.sql
select dbms_metadata.get_ddl('TABLESPACE','TD_DBCLARIDATA_AUTO') from dual;
set head off echo off
select 'select dbms_metadata.get_ddl(''TABLESPACE'','''
|| tablespace_name || ''') from dual;' from dba_tablespaces;
uilian / unzip.groovy
Last active Aug 29, 2015
Find and extract file in zip
View unzip.groovy
String targetFileName = 'someFileName'
String filter = 'someFilter'
def dir = new File(".")
dir.eachFileRecurse(FileType.FILES){ file ->
if ( {
def zipFile = new
uilian / long-queries-progress.sql
Last active Aug 29, 2015
Oracle - Long query progress
View long-queries-progress.sql
-- Mostra o andamento de operacoes longas no Oracle.
select target, sofar, totalwork, ROUND((sofar/totalwork)*100,5) pct_done
from v$session_longops
where (sid, serial#) in (select sid, serial#
from v$session
where logon_time > trunc(sysdate))
order by pct_done;
uilian / scripts-uteis.sql
Created May 20, 2014
Oracle Spatial - Scripts
View scripts-uteis.sql
-- calcular centroide
select SDO_GEOM.SDO_CENTROID(tb.geom, '0.000005')
from tabela tb;
-- converter para outra projecao
uilian / call-command-line.groovy
Created May 21, 2014
Groovy - executar linha de comando
View call-command-line.groovy
String commandLine= "java -version"
def sout = new StringBuffer(), serr = new StringBuffer()
def proc = commandLine.execute()
proc.consumeProcessOutput(sout, serr)
if (sout) "$sout"
if (serr) "$serr"
uilian /
Created May 23, 2014
Linux doesn't loves you
echo '
..XXX. .XXX..
..` V ,.' | tr '.\`, VYTX' ' ()__() '
uilian / unlock-sheet.vb
Created Jul 1, 2014
Unlocking protected excel sheets
View unlock-sheet.vb
Sub PasswordBreaker()
'Breaks worksheet password protection.
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
uilian / convert-load-geo-spatial-data-notes
Last active Aug 29, 2015
Notes on manipulating geo/gis data and load on a database
View convert-load-geo-spatial-data-notes
Carregar novas features no mapa.
Ferramentas: (plataforma OSGEO) QGIS, Udig, JOSM, Gimp/Inkscape, Open Street Maps.
1) Inkscape + Gimp: criar um raster (DFX, TIF) da feature desejada (um rio, por exemplo), deixá-la o mais simples possível, sem ruído. Vetorizar esta imagem, e salvar como SVG. Georeferenciar a imagem vetorizada, e converter para shapefile.
Para georeferenciar pode-se utilizar o ogr2ogr, como no exemplo abaixo:
ogr2ogr -progress -f "ESRI Shapefile" SAIDA.SHP -a_srs EPSG:3785 -dsco ATTRIBUTES_SKIP=YES -order 1 -gcp 285.32538 226.59571 -5429612.461 -26028.318 [-gcp X_IMG Y_IMG X_MAP Y_MAP] ENTRADA.SHP
uilian / ora-password-expiration.sql
Created Aug 25, 2014
Oracle - Dealing with locked accounts and password expiration
View ora-password-expiration.sql
-- Identify and change profile life_time
select profile from DBA_USERS where username = '<username>';
alter profile <profile_name> limit password_life_time UNLIMITED;
select resource_name,limit from dba_profiles where profile='<profile_name>';
-- Identify which accounts are about to expire (or expired), change password and unlock
select username,expiry_date,account_status from dba_users ORDER BY expiry_date DESC;
alter user <username> identified by <new_password> account unlock;
You can’t perform that action at this time.