Skip to content

Instantly share code, notes, and snippets.

@felclef
felclef / clf-p2browser.sh
Created Dec 13, 2012
Created for MacOS, so you might need change something here... This script helps a log when you try to read errors printed as HTML, e.g. PHP's XDebug output inside a image src's attribute. Just copy the content and p2browser to read it with at least a drop of dignity.
View clf-p2browser.sh
#!/bin/bash
function p2browser() {
pbpaste > /var/tmp/clf-output.html && open /var/tmp/clf-output.html && sleep 3 && rm /var/tmp/clf-output.html
}
@felclef
felclef / clf-better-ping.sh
Created Dec 12, 2012
Better ping cuz I hate when I need to select part of a URL to ping. And it gets worse when it comes to Chrome, which copies the http:// stuff :P Put this on you bash/zsh rc file or whatever you want...
View clf-better-ping.sh
#!/bin/bash
function ping() {
lph=`echo $1 | sed 's#https*://\([^/]*\)/.*#\1#'`
/sbin/ping $lph
}
@felclef
felclef / ez-install.sh
Created Dec 5, 2012
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 <
View ez-install.sh
#!/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
View 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/>
View 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 / felclef.zsh-theme
Created Jul 4, 2012
oh my zsh theme o' mine etc (based on don-not-remember-sorry-halp)
View felclef.zsh-theme
# 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 Jun 11, 2012
felclef's zsh theme (based on something I cant remember, sorry)
View felclef.zsh-theme
# 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 / within-group-prog-count.sql
Created May 16, 2012
Simulating an partition-by-ordered-count (lol) in MySQL
View within-group-prog-count.sql
-- 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 / ellano_links.html
Created Mar 21, 2012
Just talkin about links :P
View ellano_links.html
@felclef
felclef / ora_sh_t_solver.sql
Created Dec 2, 2011
workaround etc... plsql could really do what you guys think you cant with yer rb, py, php, etc
View ora_sh_t_solver.sql
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;