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
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
uilian / unzip.groovy
Last active Aug 29, 2015
Find and extract file in zip
View unzip.groovy
import groovy.io.FileType
String targetFileName = 'someFileName'
String filter = 'someFilter'
def dir = new File(".")
dir.eachFileRecurse(FileType.FILES){ file ->
if (file.name.endsWith(filter)) {
def zipFile = new java.util.zip.ZipFile(file)
@uilian
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
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
EXECUTE SDO_CS.TRANSFORM_LAYER('TABLE_ORIGINAL','GEOM_COL','TABLE_DESTINATION',3857);
@uilian
uilian / oracle-spatial-google-projection.sql
Created May 20, 2014
Oracle Spatial add Google SRID conversion capability
View oracle-spatial-google-projection.sql
------------------------------------------------
-- OPTIONAL STEPS
-- Adding Ellipsoid
INSERT INTO MDSYS.SDO_ELLIPSOIDS (
ELLIPSOID_ID,
ELLIPSOID_NAME,
SEMI_MAJOR_AXIS,
UOM_ID,
INV_FLATTENING,
SEMI_MINOR_AXIS,
@uilian
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)
proc.waitForProcessOutput()
if (sout) log.info "$sout"
if (serr) log.info "$serr"
@uilian
uilian / unexpected-rude.sh
Created May 23, 2014
Linux doesn't loves you
View unexpected-rude.sh
echo '
..XXX. .XXX..
.XXXXY.TXXXX.
XXXXXYXTXXXXX
.VXXVYXTVXXX.
`.TYXTXYXTV .
` ,YVTXYYV .,
`...XXXXX`..,
.`...XXX...,.
..` V ,.' | tr '.\`, VYTX' ' ()__() '
@uilian
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
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.
Técnicas:
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
You can’t perform that action at this time.