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/zsh | |
gs -dSAFER -dBATCH \ | |
-dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \ | |
-sColorConversionStrategy=CMYK \ | |
-dProcessColorModel=/DeviceCMYK \ | |
-sOutputFile=$2 \ | |
$1 |
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
$ rake compile | |
rake/gempackagetask is deprecated. Use rubygems/package_task instead | |
mkdir -p tmp/x86_64-darwin11.4.0/nmatrix/1.9.3 | |
cd tmp/x86_64-darwin11.4.0/nmatrix/1.9.3 | |
/Users/carlosagarie/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -I. ../../../../ext/nmatrix/extconf.rb | |
checking for clapack_dgetrf() in -llapack... no | |
checking for clapack.h... no | |
checking for cblas_dgemm() in -lcblas... yes | |
checking for ATL_dgemmNN() in -latlas... yes | |
checking for cblas.h... no |
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
ruby -rwebrick -e 'WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd).start' |
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
def fix_encoding(fn) | |
q = File.read(fn) | |
File.open(fn, 'w') { |f| f << q.encode("UTF-8", "ISO-8859-1") } | |
end |
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
def matthews(tp, tn, fp, fn) | |
den = tp * tn - fp * fn | |
num = (tp + fp) * (tp + fn) * (tn + fp) * (tn + fn) | |
den / Math.sqrt(num) | |
end |
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
abaixo | |
aca | |
acaso | |
acerca | |
acima | |
acola | |
acula | |
ademais | |
adentro | |
adiante |
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
a | |
about | |
above | |
across | |
after | |
afterwards | |
again | |
against | |
all | |
almost |
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
# From: http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-mac-osx | |
hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/iso.iso | |
# Run diskutil list and determine the device node assigned to your flash media (e.g. /dev/disk2). | |
diskutil list | |
# Replace N with the disk number from the last command. | |
diskutil unmountDisk /dev/diskN |
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
# Small experiment in which I try to implement the composite pattern without | |
# resorting to two classes. | |
class Composite | |
attr_accessor :action, :subcomposites | |
# Cool thing: if we don't provide a block, it'll be passed nil. So there's no | |
# need to make it a "default parameter" (you can't do it, actually). | |
def initialize(&action) | |
@action = action |
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
# The F1 score is a measure of how accurate an algorithm is. | |
# | |
# Precision is the probability that a (randomly selected) retrieved document is relevant: | |
# precision = true positives / (true positives + false positives) | |
# | |
# Recall is the probability that a (randomly selected) relevant document is retrieved in a search: | |
# recall = true positives / (true positives + false negatives) | |
def f1_score(precision, recall) | |
(2 * (precision * recall)) / (precision + recall) |