This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Raffle script. Uses Quicksilver (http://docs.blacktree.com/quicksilver/what_is_quicksilver) and Applescript | |
# CSV file of attendees was downloaded from EventWax (http://www.eventwax.com/). It needs 2 returns to continue the raffle | |
# - one to bring focus back to the terminal. | |
require 'rubygems' | |
require 'appscript' | |
require 'yaml' | |
require 'fastercsv' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts __FILE__ | |
puts File.dirname(__FILE__) | |
puts File.expand_path(__FILE__) | |
puts File.expand_path(File.dirname(__FILE__)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Search and Replace in all files within a directory recursively on Linux | |
# http://www.jonasblog.com/2006/05/search-and-replace-in-all-files-within-a-directory-recursively.html | |
find ./ -type f -exec sed -i ’s/string1/string2/’ {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extracting HTML/XML tag text data using sed | |
# http://alleightllc.wordpress.com/2007/12/13/extracting-htmlxml-tag-text-data-using-sed/ | |
sed -n -e 's/.*<id>\(.*\)<\/id>.*/\1/p' file.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Só Sed | |
# http://thobias.org/doc/sosed.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sharing a git repo on the network | |
# http://paulbarry.com/articles/2010/02/06/sharing-a-git-repo-on-the-network | |
git daemon --base-path=/path/to/dir/with/repo --export-all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using url_for and expire_page in console and runner | |
# http://pjkh.com/articles/2007/12/12/using-url_for-and-expire_page-in-console-and-runner | |
app.url_for(:controller => 'foo', :action => 'bar') | |
app.url_for(:controller => 'foo', :action => 'bar') | |
# => 'http://www.example.com/foo/bar' | |
app.url_for(:controller => 'foo', :action => 'bar', :only_path => true) | |
# => '/foo/bar' | |
app.host! 'www.mydomain.com' | |
# => 'www.mydomain.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# One-liner to install nginx with passenger and ssl | |
# http://pragmatig.com/2010/05/22/one-liner-to-install-nginx-with-passenger-and-ssl/ | |
wget -O /tmp/nginx-0.7.64.tar.gz http://sysoev.ru/nginx/nginx-0.7.64.tar.gz && cd /tmp && tar xzvf nginx-0.7.64.tar.gz && sudo passenger-install-nginx-module --nginx-source-dir /tmp/nginx-0.7.64 --extra-configure-flags="--with-http_ssl_module" --auto --prefix=/opt/nginx-0.7.64 && sudo ln -s /opt/nginx-0.7.64 /opt/nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# imprime somente as linhas que se encaixam na expressão regular | |
# (emula o "grep") | |
sed '/regexp/!d' | |
# procura e imprime por AAA e BBB e CCC (em qualquer ordem) | |
sed '/AAA/!d; /BBB/!d; /CCC/!d' | |
# imprime somente as linhas com menos que 65 caracteres | |
sed '/^.\{65\}/d' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SED dicas | |
# http://aurelio.net/sed/sed-dicas.txt | |
# 20000524 <verde (a) aurelio net> | |
# aceita várias substituições, separadas por ponto-e-vírgula ou ENTER | |
sed 's/uqe/que/; s/qeu/que/; s/euq/que/' | |
# ou | |
sed 's/uqe/que/ |