Skip to content

Instantly share code, notes, and snippets.

View allanbatista's full-sized avatar

Allan Batista allanbatista

View GitHub Profile
@allanbatista
allanbatista / sidekiq.conf
Created February 21, 2016 19:27
Sidekiq Startup
# /etc/init/sidekiq.conf - Sidekiq config
# This example config should work with Ubuntu 12.04+. It
# allows you to manage multiple Sidekiq instances with
# Upstart, Ubuntu's native service management tool.
#
# See workers.conf for how to manage all Sidekiq instances at once.
#
# Save this config as /etc/init/sidekiq.conf then manage sidekiq with:
# sudo start sidekiq index=0
@allanbatista
allanbatista / install_safe_sign.sh
Created November 22, 2015 20:32
Instalação do Safe Sign no ubuntu
#!/bin/bash
sudo apt-get install pcscd libccid libpcsclite1 libwxgtk2.8-0 libwxbase2.8-0 libfontconfig1 fontconfig-config libtiff5 libjbig0
wget http://www.validcertificadora.com.br/upload/downloads/linux64bits/safesignidentityclient_3.0.77-Ubuntu_amd64.deb
sudo dpkg -i safesignidentityclient_3.0.77-Ubuntu_amd64.deb
@allanbatista
allanbatista / convert_float.rb
Created November 9, 2015 16:18
Convert numeric integer or float delimited by comma in float delimited by point
# Convert numeric integer or float delimited by comma in float delimited by point
def convert_float(string_val)
flt = string_val.gsub(',','.')
if flt.count('.') > 1
Float(flt[0..flt.rindex('.')-1].gsub('.','') + flt[flt.rindex('.')..flt.length])
else
Float(flt)
end
end
@allanbatista
allanbatista / master_pg_hba.conf
Created October 18, 2015 19:24 — forked from greinacker/master_pg_hba.conf
PostgreSQL 9.2.x replication
hostssl replication replicator 5.6.7.8 md5
@allanbatista
allanbatista / gist:adad3035d98caa0c6099
Last active September 8, 2015 19:26 — forked from marcelojunior/gist:3708804
Inflections PT-BR Rails
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
@allanbatista
allanbatista / host.conf
Created July 15, 2015 17:56
Apache com path para directory com aplicação rails e passenger
<VirtualHost *:80>
ServerName ciclo.digital
ServerAlias www.ciclo.digital
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/ciclo.digital/public
<Directory /var/www/ciclo.digital/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
@allanbatista
allanbatista / install.sh
Created February 24, 2015 13:49
Instalar ffmpeg ubuntu 14.04
sudo add-apt-repository ppa:mc3man/trusty-media -y && sudo apt-get update && sudo apt-get install ffmpeg gstreamer0.10-ffmpeg -y
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@allanbatista
allanbatista / validate-email.js
Created July 1, 2014 14:08
Regex Validate Email
function validateEmail(email){
reg = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/
return reg.test(email);
}
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.2'
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'net-ssh', '2.7.0'
gem 'sqlite3'
end