Skip to content

Instantly share code, notes, and snippets.

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

Itamar Hassin ihassin

🏠
Working from home
View GitHub Profile
@ihassin
ihassin / user.yml
Last active June 23, 2018 09:56
Ansible user.yml playbook used in blog post
---
- hosts: webservers
user: vagrant
sudo: True
vars_files:
- vars.yml
vars:
deploy: deploy
home_dir: /home/deploy
@ihassin
ihassin / Vagrantfile
Last active February 24, 2020 20:30
Vagrantfile used in the blog entry
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define :web do |web_config|
web_config.vm.box = "precise64"
web_config.vm.box_url = "http://files.vagrantup.com/precise64.box"
web_config.vm.network :private_network, ip: "33.33.33.33"
web_config.vm.network :forwarded_port, guest: 80, host: 8080
@ihassin
ihassin / Reconnect
Created June 3, 2012 14:51
Reconnect to a lost database connection using an exception block trick (ruby, rails, mysql, activerecord)
def my_task
while(true) do
begin
database_access_here
rescue Exception => ex
begin
ActiveRecord::Base.connection.reconnect!
rescue
sleep 10
retry # will retry the reconnect