Skip to content

Instantly share code, notes, and snippets.

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

Michael Bastos bastosmichael

🏠
Working from home
View GitHub Profile
@bastosmichael
bastosmichael / gitlab6.5.sh
Last active August 29, 2015 13:55
Gitlab 6.5 Ubuntu Installer
#!/bin/bash
if [ $# -eq 0 ]
then
echo "gitlab.sh [options] postgres|mysql|restart
postgres - Automatically install gitlab with postgres on ubuntu
mysql - Automatically install gitlab with mysql on ubuntu (Not Finished)"
elif [ $1 == 'postgres' ]; then
#!/bin/bash
if [ $# -eq 0 ]
then
echo "https.sh [options] install"
elif [ $1 == 'install' ]; then
echo "Self signing SSL Certs..."
sudo mkdir /etc/nginx/ssl
@bastosmichael
bastosmichael / kandan.sh
Last active August 29, 2015 13:56
Kandan Ubuntu Installer
#!/bin/bash
if [ $# -eq 0 ]
then
echo "kandan.sh [options] postgres|restart
postgres - Automatically install gitlab with postgres on ubuntu
elif [ $1 == 'postgres' ]; then
echo "Updating Operating System..."
@bastosmichael
bastosmichael / something_csv.rb
Created March 10, 2014 21:42
Simple Ruby CSV Model
require 'csv'
class SomethingCSV
def initialize(io, relation)
@target = io
@relation = relation
@headers = [ "Name",
"SomeValue",
"AnotherValue"
]
end
@bastosmichael
bastosmichael / wordpress-redis.sh
Last active August 29, 2015 13:57
Basic Redis WordPress Installer
#!/bin/bash
if [ $# -eq 0 ]
then
echo "wordpress-redis.sh [options] install|mysql
install - Automatically installs wordpress without database
database - Automatically installs wordpress with mysql"
elif [ $1 == 'install' ]; then
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
require 'webmock/rspec'
require 'factory_girl'
require 'factory_girl_rails'
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')

How to patch Ubuntu for Heartbleed

  1. sudo apt-get update
  2. sudo apt-get install -y libssl1.0.0 openssl
  3. openssl version -a and confirm the "built on" date is >= 2014-04-07
  4. sudo lsof -n | grep ssl | grep DEL and restart all listed services.

Repeat #4 until no results are returned.

@bastosmichael
bastosmichael / devise_invitable.pt-BR.yml
Created April 9, 2014 15:26
Portuguese locale file for DeviseInvitable
pt-BR:
devise:
invitations:
send_instructions: 'Um e-mail convite foi enviado para %{email}.'
invitation_token_invalid: 'O token convite fornecido não é válido!'
updated: 'Sua senha foi definida com sucesso. Você agora está assinado dentro'
no_invitations_remaining: 'Nenhum convite restante'
invitation_removed: 'Seu convite foi removido.'
new:
header: 'Enviar convite'

Configure local wildcard DNS server

  1. Install Dnsmasq: sudo apt-get install dnsmasq
  2. Since Ubuntu's NetworkManager uses dnsmasq, and since that messes things up a little for us, open up /etc/NetworkManager/NetworkManager.conf and comment out (#) the line that reads dns=dnsmasq. Restart NetworkManager afterwards: sudo restart network-manager.
  3. Make sure Dnsmasq listens to local DNS queries by editing /etc/dnsmasq.conf, and adding the line listen-address=127.0.0.1.
  4. Create a new file in /etc/dnsmasq.d (eg. /etc/dnsmasq.d/dev), and add the line address=/dev/127.0.0.1 to have dnsmasq resolve requests for *.dev domains. Restart Dnsmasq: sudo /etc/init.d/dnsmasq restart.

source: http://brunodbo.be/blog/2013/04/setting-up-wildcard-apache-virtual-host-wildcard-dns