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
Verifying that +bastosmichael is my blockchain ID. https://onename.com/bastosmichael
module Search
class Indexer
include Sidekiq::Worker
sidekiq_options queue: :low, retry: false, backtrace: true
LOGGER = Sidekiq.logger.level == Logger::DEBUG ? Sidekiq.logger : nil
SEARCH_POOL = ConnectionPool.new(size: SEARCH_UPDATE_POOL, timeout: 5) do
Elasticsearch::Client.new host: ELASTICSEARCH_URL, logger: LOGGER
end
@bastosmichael
bastosmichael / gitlab7.0.sh
Last active August 29, 2015 14:03
Gitlab 7.0 Ubuntu 14.04 Postgres Install
#!/bin/bash
if [ $# -eq 0 ]
then
echo "gitlab.sh [options] install
elif [ $1 == 'install' ]; then
echo "Updating Operating System..."
sudo apt-get update -y
@bastosmichael
bastosmichael / .travis.yml.PR_PUSH_EXAMPLE
Last active August 29, 2015 14:03
Push from working branch into master once PR closes using TravisCI and travis gem
after_success:
- if [ $TRAVIS_PULL_REQUEST == "false" ]; then
- git config --global user.email "${GIT_EMAIL}"
- git config --global user.name "${GIT_NAME}"
- git pull origin master
- git remote add travis "https://${GH_TOKEN}@github.com/username/some-branch.git"
- git push travis "${TRAVIS_BRANCH}":master
- fi
env:
global:
@bastosmichael
bastosmichael / fstab
Last active August 29, 2015 14:03
/etc/fstab
/dev/sdb1 /home/michael/Media1 ext4 defaults 0 1
//192.168.1.104/TV /media/TV cifs guest 0 0
//192.168.1.104/TV-Christina /media/TV-Christina cifs guest 0 0
//192.168.1.104/TV-Kids /media/TV-Kids cifs guest 0 0
//192.168.1.104/TV-Michael /media/TV-Michael cifs guest 0 0
//192.168.1.104/Movies /media/Movies cifs guest 0 0
//192.168.1.104/Music /media/Music cifs guest 0 0
//192.168.1.104/Photos /media/Photos cifs guest 0 0
//192.168.1.104/Training /media/Training cifs guest 0 0
@bastosmichael
bastosmichael / gist:a701f8ada44b19315a45
Last active August 29, 2015 14:01
mass object assignment without an array or enumerable
class Xs # represent a string of 'x's
include Comparable
attr :length
def initialize(n)
@length = n
end
def succ
Xs.new(@length + 1)
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {

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

@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'

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.