Skip to content

Instantly share code, notes, and snippets.

View fidelisrafael's full-sized avatar
🏠
Working from home

Rafael Fidelis fidelisrafael

🏠
Working from home
  • https://web.archive.org/web/20221024062310/http://www.fidelis.work/
  • Brasil
  • 03:06 (UTC -03:00)
View GitHub Profile
@fidelisrafael
fidelisrafael / clima_tempo.js
Last active September 6, 2016 15:50
Ordena(ASC) as capitais pela minima diaria
// http://www.climatempo.com.br/brasil
var tables = jQuery(".columns table.medium-6");
var getTableData = function(table) {
return jQuery.map(table.find('tbody > tr'), function(element, index) {
var _element = jQuery(element);
var scope = _element.find('td');
var city_name = scope.find('a.txt-blue').text(),
minimum = scope.find('span.txt-black').first().text(),
@fidelisrafael
fidelisrafael / ar_test.rb
Last active July 22, 2016 13:49
AR model definition
require 'active_record'
require 'pry'
class BaseClass
def self.model(&block)
@model ||= Class.new(ActiveRecord::Base, &block)
end
def initialize(options = {})
establish_database_connection
@fidelisrafael
fidelisrafael / bookshelf.md
Created July 7, 2016 15:14 — forked from zenorocha/bookshelf.md
My bookshelf
@fidelisrafael
fidelisrafael / dropkick.sh
Created June 30, 2016 21:43
Turn off spy cams in airbnb rentals
#!/bin/bash
#
# DROPKICK.SH
#
# Detect and Disconnect the DropCam and Withings devices some people are using to
# spy on guests in their home, especially in AirBnB rentals. Based on Glasshole.sh:
#
# http://julianoliver.com/output/log_2014-05-30_20-52
#
# This script was named by Adam Harvey (http://ahprojects.com), who also
@fidelisrafael
fidelisrafael / albums_programming.md
Last active June 30, 2016 20:04
My top 10 of all best albums for turning music in code!

Best albums for coding (IMHO)

#1 - SBTRKT - SBTRKT (2011)

Of course I will start this list with one debut album, this self-titled album by SBTRKT(pronounced as "Subtract") is a masterpiece!!!!
A wonderful reunion of great collaborators, most of the songs has Sampa contrib in vocal, when you hear the voice of this guy for the first time, you find yourself addicted to it!
Theres a track called Ready Set Loop, I always read as Read Eval Print Loop(REPL - that kind of interactive shell you have in your programming language, such as irb, node, python, php)

@fidelisrafael
fidelisrafael / br_documents.rb
Last active June 27, 2016 22:43
CPF & CNPJ validator and formatter
require './documents/base'
require './documents/cpf'
require './documents/cnpj'
module BRDocuments
VERSION = '0.0.1'
end
@fidelisrafael
fidelisrafael / nginx_parser_log.rb
Last active November 17, 2019 08:45
Nginx Logger Parser for Ruby
require 'pry'
require 'json'
require 'uri'
module Application
class NginxLogParser
DEFAULT_FORMAT_REGEXP = /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s?\-\s?-\s?\[(\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\]\s?\\?"?(GET|POST|PUT|HEAD|DELETE|OPTIONS)\s?(.*?)\s(HTTP\/\d\.\d)\\?"?\s?(\d{3})\s?(\d+)\s?\\?\"\-\\?\"\s?\\?\"(.*?)\"/i
REQUEST_FORMAT = [
@fidelisrafael
fidelisrafael / gist:f63827e5ddac047cde6536998110aace
Created May 9, 2016 21:08 — forked from mikestone14/gist:11198630
Getting a GoDaddy domain to point to a Heroku app.
@fidelisrafael
fidelisrafael / Rakefile
Created May 5, 2016 18:43 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@fidelisrafael
fidelisrafael / ruby_csr_example.rb
Last active April 29, 2016 21:04 — forked from mitfik/ruby_csr_example.rb
Ruby example of CSR with openssl
require 'openssl'
def gen_key(name)
key = OpenSSL::PKey::RSA.new 1048
file = File.new(name, "w")
file.write(key)
file.close
end
def get_key(name)