Skip to content

Instantly share code, notes, and snippets.

View mauriciomdea's full-sized avatar
👋
Looking for work

Mauricio Almeida mauriciomdea

👋
Looking for work
View GitHub Profile
@mauriciomdea
mauriciomdea / python-on-ubuntu.sh
Created April 4, 2016 15:51 — forked from neuroticnerd/python-on-ubuntu.sh
Python 2.7.9 on Ubuntu 14.04.2 (without overwriting original version)
#! /usr/bin/env bash
# http://smirnov-am.blogspot.com/2015/04/installation-of-python-279-in-ubuntu.html
# http://davebehnke.com/python-pyenv-ubuntu.html
# https://renoirboulanger.com/blog/2015/04/upgrade-python-2-7-9-ubuntu-14-04-lts-making-deb-package/
# install dependencies
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
@mauriciomdea
mauriciomdea / user_test.rb
Created June 24, 2014 19:32
Omniauth Unit Tests
require 'test_helper'
class UserTest < ActiveSupport::TestCase
setup do
@user_from_linkedin = User.from_omniauth(OmniAuth.config.mock_auth[:linkedin])
@user_from_google = User.from_omniauth(OmniAuth.config.mock_auth[:google])
end
test "should create new user from omniauth hash" do
#!/usr/bin/env ruby
require 'digest/md5'
require "addressable/uri"
# this is based on gravatar image API
# https://en.gravatar.com/site/implement/images/
# options :
# size : <integer> size of image
# default: <string> url of image if email not found or:
# * 404
#! /usr/bin/env python2
# Requires: PIL, colormath
#
# Improved algorithm now automatically crops the image and uses much
# better color matching
from PIL import Image, ImageChops
from colormath.color_objects import RGBColor
import argparse
import math
@mauriciomdea
mauriciomdea / rspec.log
Created January 7, 2014 17:12
Rspec results.
rspec
I, [2014-01-07T15:09:54.404914 #86163] INFO -- : Not reporting to Code Climate because ENV['CODECLIMATE_REPO_TOKEN'] is not set.
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
User
should respond to #password_confirmation
should respond to #company_name
should respond to #name
should respond to #password_reset_token
should respond to #email
upstream unicorn {
server unix:/tmp/unicorn.blog.sock fail_timeout=0;
}
server {
listen 80 default deferred;
# server_name example.com;
root /home/deployer/apps/blog/current/public;
location ^~ /assets/ {
@mauriciomdea
mauriciomdea / setup_iptables.sh
Created August 17, 2012 15:16
Basic Firewall configuration for new VPS
#!/bin/bash
# Accept already established connections (so it doesnt drop your current SSH session)
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Accept SSH connections from anywhere
iptables -A INPUT -p tcp -i eth0 --dport ssh -j ACCEPT
# (Optional) Accept HTTP connections from anywhere
iptables -A INPUT -p tcp -i eth0 --dport 80 -j ACCEPT
@mauriciomdea
mauriciomdea / colored_logger.rb
Created December 24, 2011 08:16 — forked from romanbsd/colored_logger.rb
Color logging for Mongoid
require 'logger'
class ColoredLogger < Logger
WHITE = "\e[37m"
CYAN = "\e[36m"
MAGENTA = "\e[35m"
BLUE = "\e[34m"
YELLOW = "\e[33m"
GREEN = "\e[32m"
RED = "\e[31m"
BLACK = "\e[30m"