Skip to content

Instantly share code, notes, and snippets.

View alfakini's full-sized avatar

Alan R. Fachini alfakini

View GitHub Profile
#!/bin/bash
curl -s "https://octodex.github.com/" | grep "<img.*data-src" | grep -o "/images.*\.png" | while read line; do
line="https://octodex.github.com$line"
wget $line
done
@alfakini
alfakini / test.rb
Created June 13, 2015 13:57
Test Syntax
class AccountLogoUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
max_file_size = 5.megabytes
version :original do
process
end
private
@alfakini
alfakini / git-global-config
Created December 2, 2011 15:20
Git global config
[user]
name = xxxx
email = xxxx
[github]
user = xxxx
token = xxxx
[web]
browser = google-chrome
[core]
excludesfile = /Users/alfakini/.gitignore
@alfakini
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: http://www.polignu.org/artigo/um-padr%C3%A3o-para-mock-de-depend%C3%AAncias-internas-em-testes-de-unidade
public class RotaFinderFactory {
private static RotaFinderFactory rotaFinderFactory = null;
private RotaFinderFactory() { }
// Singleton
public static RotaFinderFactory getFactory() {
if(rotaFinderFactory == null) {
rotaFinderFactory = new RotaFinderFactory();
}
return rotaFinderFactory;
@alfakini
alfakini / pr.md
Created January 3, 2014 04:15 — forked from piscisaureus/pr.md

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 = git@github.com:joyent/node.git

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
alfakini / spotify2hc
Last active May 11, 2016 01:16
Post the current music playing on Spotify to HipChat.
ROOM_ID="" # Can also be the name of the room
AUTH_TOKEN="" # Go here to get it https://chute.hipchat.com/account/api
function getURL {
url=`osascript -e 'tell application "Spotify" to spotify url of current track'`
remove='spotify:track:'
url=${url#$remove}
url="http://open.spotify.com/track/$url"
echo $url
@alfakini
alfakini / Embedding GoLang into a Ruby application.md
Last active January 29, 2018 20:41 — forked from schweigert/Embedding GoLang into a Ruby application.md
Embedding GoLang into a Ruby application - Blogpost to Magrathealabs

#!inbox

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.

Note

@alfakini
alfakini / cidades.md
Created May 17, 2018 02:38
cidades.md

× Done - In progress

# Cidade Crawler Parser
1 São Paulo
2 Rio de Janeiro -
3 Brasília
4 Salvador
@alfakini
alfakini / events_two.py
Created October 16, 2018 00:34
Filesystem events monitoring with Python [events.py 2]
def on_created(self, event):
file_size = -1
while file_size != os.path.getsize(event.src_path):
file_size = os.path.getsize(event.src_path)
time.sleep(1)
self.process(event)
@alfakini
alfakini / digits.sh
Last active April 27, 2019 11:54
Install Digits
$ wget ...cuda-repo-ubuntu1404_7.5-18_amd64.deb
$ sudo dpkg -i /tmp/cuda-repo-ubuntu1404_7.5-18_amd64.deb
$ rm -f /tmp/cuda-repo-ubuntu1404_7.5-18_amd64.deb
$ wget ...nvidia-machine-learning-repo_4.0-2_amd64.deb
$ sudo dpkg -i /tmp/nvidia-machine-learning-repo_4.0-2_amd64.deb
$ rm -f /tmp/nvidia-machine-learning-repo_4.0-2_amd64.deb
$ sudo apt-get install digits