Skip to content

Instantly share code, notes, and snippets.


Alan R. Fachini alfakini

View GitHub Profile
alfakini /
Created May 17, 2018 02:38

× Done - In progress

# Cidade Crawler Parser
1 São Paulo
2 Rio de Janeiro -
3 Brasília
4 Salvador
alfakini / Embedding GoLang into a Ruby
Last active January 29, 2018 20:41 — forked from schweigert/Embedding GoLang into a Ruby
Embedding GoLang into a Ruby application - Blogpost to Magrathealabs
View Embedding GoLang into a Ruby


Go Title

I am passionate about Ruby, but its execution time compared to other languages is extremely high, especially when we want to use more complex algorithms. In general, data structures in interpreted languages become incredibly slow compared to compiled languages. Some algorithms such as ´n-body´ and ´fannkuch-redux´ can be up to 30 times slower in Ruby than Go. This is one of the reasons I was interested in embedding Go code in a Ruby environment.

For those who do not know how shared libraries operate, they work in a similar way as DLLs in Windows. However, they have a native code with a direct interface to the C compiler.


sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev
sudo apt-get install -y --no-install-recommends libboost-all-dev
sudo apt-get install -y libatlas-base-dev
sudo apt-get install -y python-dev
sudo apt-get install -y python-pip git
sudo apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
curl -s "" | grep "<img.*data-src" | grep -o "/images.*\.png" | while read line; do
wget $line
alfakini /
Created January 3, 2014 04:15 — forked from piscisaureus/

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

alfakini / gist:6106012
Last active December 20, 2015 09:09 — forked from anonymous/gist:6105990
Como fazer mocking de dependências internas? Refletindo sobre o tópico levantado aqui:
View gist:6106012
public class RotaFinderFactory {
private static RotaFinderFactory rotaFinderFactory = null;
private RotaFinderFactory() { }
// Singleton
public static RotaFinderFactory getFactory() {
if(rotaFinderFactory == null) {
rotaFinderFactory = new RotaFinderFactory();
return rotaFinderFactory;