Skip to content

Instantly share code, notes, and snippets.

View alexishida's full-sized avatar
👨‍💻
Coding

Alex Ishida alexishida

👨‍💻
Coding
View GitHub Profile
@alexishida
alexishida / devise.pt-BR.yml
Last active May 31, 2023 16:05
pt-BR translations for Devise
pt-BR:
devise:
confirmations:
confirmed: "Sua conta foi confirmada com sucesso. Você está logado."
send_instructions: "Dentro de minutos, você receberá um e-mail com instruções para a confirmação da sua conta."
send_paranoid_instructions: "Se o seu endereço de e-mail estiver cadastrado, você receberá uma mensagem com instruções para confirmação da sua conta."
failure:
already_authenticated: "Você já está logado."
inactive: "Sua conta ainda não foi ativada."
invalid: "%{authentication_keys} ou senha inválida."
@alexishida
alexishida / Dockerfile
Last active November 14, 2019 15:21
Dockerfile Rails Ruby entrypoint start.sh
FROM ruby:latest
RUN apt-get update
RUN apt-get install -y libaio1 wget unzip curl sudo build-essential cron --no-install-recommends apt-utils
RUN apt-get install -y locales locales-all --no-install-recommends apt-utils
ENV LC_ALL pt_BR.UTF-8
ENV LANG pt_BR.UTF-8
@alexishida
alexishida / schedule.rb
Last active October 30, 2019 15:26
whenever
env :GEM_PATH, ENV['GEM_PATH']
ENV.each { |k, v| env(k, v) }
cd /app
rm -fr /app/tmp/*
gem install bundler
bundle update
bundle update --bundler
RAILS_ENV=production
bundle exec whenever --update-crontab --set environment=production
@alexishida
alexishida / png-jpg-optimizer.txt
Created September 27, 2019 16:41
PNG JPG Optimizer pngquant mozjpeg
# PNG Optimizer
https://github.com/kornelski/pngquant
pngquant --quality=65-70 --nofs original.png -o modified.png
@alexishida
alexishida / configs-nginx-log-goaccess.txt
Created September 6, 2019 16:59
GoAccess NCSA Combined Log Format with Virtual Host NGINX
# NCSA Combined Log Format with Virtual Host
# nginx.conf
# https://goaccess.io/man#interactive-keys
log_format vcombined '$host:$server_port '
'$remote_addr $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
@alexishida
alexishida / sources.list
Created August 23, 2019 13:55
Proxmox VE No-Subscription Repository
# https://pve.proxmox.com/wiki/Package_Repositories
# /etc/apt/sources.list
deb http://ftp.debian.org/debian buster main contrib
deb http://ftp.debian.org/debian buster-updates main contrib
# PVE pve-no-subscription repository provided by proxmox.com,
# NOT recommended for production use
@alexishida
alexishida / certificados_services.rb
Created August 12, 2019 14:13
Obter certificados ruby
class CertificadosServices
def pegar_certificado (cer)
cert = OpenSSL::X509::Certificate.new(cer)
certificado = Certificado.new
certificado.nome = cert.subject.to_s.split("CN=")[1].split(":")[0]
certificado.cpf_cnpj = pegar_cpf_cnpj_certificado(cert)
certificado.tipo_certificado = pegar_tipo_certificado(cert)
certificado.serial = cert.serial
certificado.validade = cert.not_after
certificado.revogado = false
@alexishida
alexishida / recaptcha-v3-jsp.txt
Last active August 12, 2019 14:21
Recaptcha v3 Java jsp
---------------------------------- Classe Java -------------------------------------------------------
/*
Classe de uso para o Recaptcha
Autor: Alex Ishida
Data: 08/08/2019
*/
package com.alexishida.recaptcha;
@alexishida
alexishida / catalina.sh
Created August 8, 2019 12:19
charset encoding regiao pt-br tomcat catalina
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=windows-1252"
JAVA_OPTS="$JAVA_OPTS -Duser.timezone=America/Porto_Velho"
JAVA_OPTS="$JAVA_OPTS -Duser.language=pt -Duser.region=BR"
@alexishida
alexishida / server-config-proxy-ip.txt
Created July 30, 2019 16:02
IP proxy client tomcat
In your Apache HTTPD config, where you're configuring proxying the request, make sure you add: ProxyVia On This will make HTTPD set the "x-forwarded-for" HTTP request header's value to the IP address of the client. This value is passed to Tomcat when HTTPD proxies the request.
Then, where you're configuring the AccessLogValve (usually in your conf/server.xml file), change the default logging pattern to log the "x-forwarded-for" header value, like this:
<Host ...>
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
prefix="localhost_access_log."
suffix=".txt"
pattern="%{x-forwarded-for}i %l %u %t %r %s %b"