Skip to content

Instantly share code, notes, and snippets.

View paulopatto's full-sized avatar
🎯
Focusing

Paulo Patto paulopatto

🎯
Focusing
View GitHub Profile
@paulopatto
paulopatto / Algorithms.md
Last active April 2, 2018 04:31 — forked from entaroadun/gist:1653794
Recommendation and Ratings Public Data Sets For Machine Learning
  • euclidean distance
  • pearson correlation coefficient
  • wighted mean
  • tanimoto coeficient
  • conditional probability
  • gini impurity
  • entropy
  • gaussian function
  • variance
  • dot products
@paulopatto
paulopatto / whoami.yml
Last active October 9, 2017 22:22
Exemplos de tarefas com Ansible
# ansible-playbook -i 'localhost,' --connection=local -K ./whoami.yml
- name: Show return value of command
hosts: all
gather_facts: true
become: false
tasks:
- name: "capture output of id command"
command: id -un
register: login
- debug: msg= "Logged in as user {{ login.stdout }}"
# http://bit.ly/2xf8pEv
def meditate(cushion, meditation = 'kinhin', *room_itens, time: , posture: 'kekkafuza', **periods, &block)
puts "====================================="
puts "We are praticing #{meditation}, for #{time} minutes, in the #{posture} posture (ouch, my knees!)."
puts "Room item: #{room_itens}"
puts "Periods: #{periods}"
puts "====================================="
block.call
end
'use strict';
console.log('Loading function');
exports.handler = (event, context, callback) => { callback(null, event); };
@paulopatto
paulopatto / rubocop_pre_commit_hook
Last active April 19, 2017 07:49 — forked from mpeteuil/rubocop_pre_commit_hook
Ruby style guide git pre-commit hook using Rubocop as the style guide checker. Only runs on staged ruby files that have been added and/or modified.
#!/usr/bin/env ruby
# http://ruby-doc.org/stdlib-2.0.0/libdoc/English/rdoc/English.html
require 'English'
require 'rubocop'
ADDED_OR_MODIFIED = /^\s*(A|AM|M)\s*/
GIT_COMMAND = "git status --porcelain".freeze
modified_files = `#{GIT_COMMAND}`.split(/\n/)
@paulopatto
paulopatto / morse.c
Last active December 14, 2017 16:24
Morse: Qual o resultado de morse() em cada um dos casos?
/// ANSI C
int morse() {
int o = 10;
return --o-o--;
}
SELECT country.continent, floor(avg(city.population))
FROM country country
INNER JOIN city city ON city.countrycode = country.code
GROUP BY country.continent
@paulopatto
paulopatto / webmotors_api.rb
Created July 25, 2016 22:16
Try access webmotors api with Ruby
require 'savon' # savon 2.11
WEB_MOTORS_WSDL = 'http://www.webmotors.com.br/integracaoRevendedor/wsEstoqueRevendedorWebMotors.asmx'
client = Savon.client do
wsdl WEB_MOTORS_WSDL
end
client.operations
# => [:autenticar]
@paulopatto
paulopatto / .gitignore
Last active May 12, 2016 12:24
Introduction To Concurrent Programming: A Beginner's Guide
*.class