Skip to content

Instantly share code, notes, and snippets.

View pedro108's full-sized avatar

Pedro Henrique Pereira de Jesus pedro108

  • London, United Kingdom
View GitHub Profile
@pedro108
pedro108 / deploy.rb
Last active December 11, 2015 03:39 — forked from bkutil/deploy.rb
Script para rodar restart de processos Resque via Capistrano
after "deploy:create_symlink", "resque:restart_workers"
after "resque:restart_workers", "resque:restart_scheduler"
##
# Rake helper task.
# http://pastie.org/255489
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
@pedro108
pedro108 / solr_cap.rb
Last active December 22, 2015 09:18 — forked from doitian/solr_cap.rb
namespace :deploy do
task :setup_solr, roles: :app do
run "mkdir -p #{shared_path}/solr/data"
put File.read('config/sunspot.yml'), "#{shared_path}/config/sunspot.yml"
end
end
namespace :solr do
def solr_config
/* Foca no código!
.---.
/o o\
__(= " =)__
//\'-=-'/\\
) (_
/ `"=-._
/ \ ``"=.
@pedro108
pedro108 / blowfish.rb
Last active May 27, 2020 02:04 — forked from nono/blowfish.rb
Ruby class to use the Blowfish encryption / decryption algorithm in a Rails environment. Based on https://gist.github.com/nono/2995118
#!/usr/bin/env ruby
require 'openssl'
class Blowfish
def self.key
Rails.application.secrets.secret_key_base
end
def self.encrypt(decrypted_string, salt=nil)
@pedro108
pedro108 / nginx.conf
Created June 26, 2015 13:57 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@pedro108
pedro108 / font-mimetypes
Last active November 9, 2018 18:19 — forked from localpcguy/font-mimetypes
Mime Types for Fonts and Media
.eot - application/vnd.ms-fontobject
.woff - application/font-woff
.ttf - application/x-font-truetype
.svg - image/svg+xml
.otf - application/x-font-opentype
IIS (Web.Config)
<remove fileExtension=".eot" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<remove fileExtension=".ttf" />
@pedro108
pedro108 / dockerignore-test.sh
Created November 1, 2022 19:23 — forked from sgdan/dockerignore-test.sh
Test the ".dockerignore" file to ensure the build context doesn't contain unwanted files
#!/bin/sh
# Based on BMitch's answer from:
# https://stackoverflow.com/questions/38946683/how-to-test-dockerignore-file
# Note: will create and delete temporary file "Dockerfile.build-context"
# 1. Copy to project folder where image is being built
# 2. Run script
# 3. You should see list of files in build context