Skip to content

Instantly share code, notes, and snippets.

View adrianomitre's full-sized avatar

Adriano Mitre adrianomitre

  • Sao Paulo, SP - Brazil
View GitHub Profile

Setup Ubuntu 14.04.3 LTS 64-bits para desenvolvimento Rails

Ubuntu 14.04.3 LTS

Particionamento:

  • Partição >= 25 GB para /
    • Somar tamanho da base de dados se pretender deixá-la nesta partição
  • Partição >= 100 GB para /home
  • Partição >= quanto tiver de RAM para swap
{
// When using non_blocking mode, delay update of gutter icons by the
// following amount (in milliseconds).
"debounce_delay": 42
}
{
"caret_extra_bottom": 3,
"caret_extra_top": 2,
"caret_extra_width": 2,
"color_scheme": "Packages/User/Twilight with GitGutter support.tmTheme",
"draw_white_space": "selection",
"font_face": "Menlo",
"font_size": 14,
"highlight_line": true,
"ignored_packages":
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Michael Sheets</string>
<key>name</key>
<string>Twilight with GitGutter support</string>
<key>settings</key>
<array>
@adrianomitre
adrianomitre / migration_tricks.rb
Last active February 3, 2016 20:21
Changing tables from within the Rails console
ActiveRecord::Migration.class_eval do
change_table :teams, :force => true do |t|
# copy and paste from migrations create_table block, e.g.,
t.string :slug, unique: true
end
# specific commands
add_column :people, :cpf, :integer, null: false
remove_column :people, :cpf
@adrianomitre
adrianomitre / circular_primes_v1.rb
Created February 24, 2016 17:59
Circular Primes v1
# O( N log N )
class Integer # in real apps should use refinements instead of monkey patching
def prime?
return false if self < 2
! 2.upto(self**0.5).any? { |n| self % n == 0 }
end
def rotations
n, ss = to_s.length, to_s * 2
@adrianomitre
adrianomitre / circular_primes.rb
Last active February 24, 2016 18:14
Circular Primes
# Ruby solution to http://www.beatmycode.com/challenge/5/show
class Integer # in real apps should use refinements instead of monkey patching
def prime?
return false if self < 2
! 2.upto(self**0.5).any? { |n| self % n == 0 }
end
def rotations
n, ss = to_s.length, to_s * 2
@adrianomitre
adrianomitre / Twilight with GitGutter support.tmTheme
Created March 30, 2016 21:58
SublimeText 3 Twilight theme with GitGutter support
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Michael Sheets</string>
<key>name</key>
<string>Twilight with GitGutter support</string>
<key>settings</key>
<array>
@adrianomitre
adrianomitre / ivona.py
Created July 20, 2016 18:51
IVONA CreateSpeech test based on AWS example
# AWS Version 4 signing example
# EC2 API (DescribeRegions)
# See: http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html
# This version makes a GET request and passes the signature
# in the Authorization header.
import sys, os, base64, datetime, hashlib, hmac
import requests # pip install requests
import urllib
@adrianomitre
adrianomitre / .gitconfig
Created August 15, 2016 17:12
My .gitconfig
[credential]
helper = cache --timeout=3600
[user]
name = Adriano Mitre
email = adriano.mitre@gmail.com
[core]
editor = subl --wait
[alias]
# one-line log