Skip to content

Instantly share code, notes, and snippets.

View uilian's full-sized avatar
🏠
Working from home

Uilian Souza uilian

🏠
Working from home
View GitHub Profile
@uilian
uilian / ora-password-expiration.sql
Created August 25, 2014 14:35
Oracle - Dealing with locked accounts and password expiration
-- 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;
@uilian
uilian / table_size.sql
Created September 16, 2014 13:48
Table size
SELECT SEGMENT_NAME, (BYTES/1024)/1024 --MB
FROM DBA_SEGMENTS
WHERE segment_name = :table_name
ORDER BY 1 DESC;
@uilian
uilian / table-ref.sql
Created September 16, 2014 13:57
Identify table references
select
distinct *
from
(
select
upper(:table_name) tabela,
'is refereced by' behaviour,
b.table_name
from
all_constraints a,
@uilian
uilian / block-update.sql
Created October 14, 2014 12:50
SQL - Loop block update
--- template, adjust accordingly
declare
cnt integer;
begin
cnt := 0;
for req in (select rowid, x, y, z from tabela where x is null) loop
update tabela set y = x+z where rowid = req.rowid;
@uilian
uilian / create-dblink.sql
Last active August 29, 2015 14:08
DBLINK Oracle
@uilian
uilian / sample-groovy.groovy
Created November 17, 2014 11:44
Sample Groovy
class Animal implements Skills, Talk {
abstract String voice
Animal(){
initSkills()
}
}
trait Talk {
def talk(){println "Ele diz ' ${voice.concat(' ') * 3}'"}
}
@uilian
uilian / locked_objects.sql
Created December 14, 2014 20:25
Oracle locked objects
-- 1 - Identify lock
column oracle_username format a15
column os_user_name format a15
column object_name format a37
column object_type format a37
select a.session_id,a.oracle_username, a.os_user_name, b.owner "OBJECT OWNER", b.object_name,b.object_type,a.locked_mode from
(select object_id, SESSION_ID, ORACLE_USERNAME, OS_USER_NAME, LOCKED_MODE from v$locked_object) a,
(SELECT OBJECT_ID, OWNER, OBJECT_NAME,OBJECT_TYPE FROM DBA_OBJECTS) B
where a.object_id=b.object_id;
@uilian
uilian / set-java.bat
Created January 6, 2015 11:32
Configuring the JDK Version - Windows
rem echo off
cd "c:\program files\java"
rmdir jdk
mklink /d jdk jdk1.8.0_20
rem mklink /d jdk jdk1.7.0_51
rem mklink /d jdk jdk1.6.0_45
############################################################
# Dockerfile to build Pentaho EE BA Server container images
# Based on Ubuntu 14.04
############################################################
FROM ubuntu:14.04
MAINTAINER Matt Tucker, matthewtckr@gmail.com
## Install Base Software
RUN apt-get update -y
@Grab(group="org.twitter4j", module="twitter4j-core", version="4.0.2")
import twitter4j.*
import twitter4j.api.*
import twitter4j.conf.*
import org.pentaho.reporting.engine.classic.core.util.TypedTableModel;
colNames = ['Screen Name', 'Tweet Date', 'Text'] as String[]
colTypes = [String, Date, String] as Class[]
model = new TypedTableModel(colNames, colTypes);