Skip to content

Instantly share code, notes, and snippets.

@felclef
felclef / ora_dblinks.sql
Created November 11, 2011 17:29
Oracle DBLink creator... (just works with Oracle Oracle, not Oracle MySQL, ok?) #trollface
@felclef
felclef / ora_tablespace_space_ace.sql
Created November 22, 2011 13:35
Como obter o informações de tablespaces e seus tamanhos... SQL-zado de forma legível, não aquela m. de (+) etc
select
ts.tablespace_name as "Tablespace",
round(sum(df.bytes) / (1024*1024), 2) as "Total (MB)",
round(sum(df.bytes) / (1024*1024) - sum(fs.bytes) / (1024*1024), 2) as "Usado (MB)",
round(sum(fs.bytes) / (1024*1024), 2) as "Livre (MB)",
round(sum(fs.bytes) / sum(df.bytes) * 100, 4) as "Livre (%)",
100 - round(sum(fs.bytes) / sum(df.bytes) * 100, 4) as "Usado (%)"
from
dba_tablespaces ts
inner join dba_data_files df
@felclef
felclef / ora_sh_t_solver.sql
Created December 2, 2011 16:54
workaround etc... plsql could really do what you guys think you cant with yer rb, py, php, etc
declare
entity_count integer := 0;
type t_ct_cur is ref cursor;
ct_cur t_ct_cur;
type t_codmat is table of varchar2(255);
blk_codmat t_codmat;
@felclef
felclef / ellano_links.html
Created March 21, 2012 19:42
Just talkin about links :P
@felclef
felclef / within-group-prog-count.sql
Created May 16, 2012 20:08
Simulating an partition-by-ordered-count (lol) in MySQL
-- olc: select id_quadro, user_hash from ( select iq.id_quadro, user_hash, if( @prev <> iq.id_quadro, @rownum := 1, @rownum := @rownum+1 ) as g_rank, @prev := iq.id_quadro from r7_inscricoes_quadros iq order by id_quadro, data_cadastro ) sq where g_rank <= 4
-- the sample uses some database wich I have not luvd... yet...
select
id_quadro,
user_hash
from
(
select
@felclef
felclef / felclef.zsh-theme
Created June 11, 2012 23:52
felclef's zsh theme (based on something I cant remember, sorry)
# hints got at http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
function collapse_pwd {
echo $(pwd | sed -e "s,^$HOME,~,")
}
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '±' && return
hg root >/dev/null 2>/dev/null && echo '☿' && return
# echo '○'
@felclef
felclef / felclef.zsh-theme
Created July 4, 2012 19:33
oh my zsh theme o' mine etc (based on don-not-remember-sorry-halp)
# hints got at http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
function collapse_pwd {
echo $(pwd | sed -e "s,^$HOME,~,")
}
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '±' && return
hg root >/dev/null 2>/dev/null && echo '‚òø' && return
# echo '‚óã'
@felclef
felclef / httpd.conf
Created July 5, 2012 19:11
httpd.conf
#
# Mac OS X / Mac OS X Server
# The <IfDefine> blocks segregate server-specific directives
# and also directives that only apply when Web Sharing or
# server Web Service (as opposed to other services that need Apache) is on.
# The launchd plist sets appropriate Define parameters.
# Generally, desktop has no vhosts and server does; server has added modules,
# custom virtual hosts are only activated when Web Service is on, and
# default document root and personal web sites at ~username are only
# activated when Web Sharing is on.
@felclef
felclef / httpd-vhosts.conf
Created July 5, 2012 19:12
httpd-vhosts.conf
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
@felclef
felclef / ez-install.sh
Created December 5, 2012 20:29
install deb package from url # this script was once shamelessly copy-pasted from a gTalk conversation by the awful filipekiss faget, who uploaded here -> https://gist.github.com/4219057 <- before I could ever think of do the same. So I made this tribute <
#!/bin/bash
# once know as clf-ez-install.sh
# install deb package from url
# this script was once shamelessly copy-pasted from a gTalk conversation by the awful filipekiss faget,
# who uploaded here -> https://gist.github.com/4219057 <-
# before I could ever think of do the same. So I made this tribute <3
pkg=$( echo $1 | sed -r 's/^.+\/([^\/]+\.deb)/\1/g' )
wget $1 && dpkg -i $pkg