Skip to content

Instantly share code, notes, and snippets.

Avatar

Rafael Santos formigarafa

View GitHub Profile
@formigarafa
formigarafa / example.rb
Created Jun 25, 2020
Ruby 2.6.6 weird behaviour for protected method
View example.rb
class Item
def initialize(value: )
@value = value
end
def subitems
@subitems ||= [
Item.new(value: 1),
Item.new(value: 2),
]
@formigarafa
formigarafa / postgres_queries_and_commands.sql
Last active Oct 21, 2020 — forked from biinari/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
View postgres_queries_and_commands.sql
-- show running queries (>= 9.2)
SELECT pid,
age(clock_timestamp(), query_start) AS age,
usename, state, query, waiting,
age(clock_timestamp(), xact_start) AS xact_age
FROM pg_stat_activity
WHERE state != 'idle'
AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY age DESC;
@formigarafa
formigarafa / eta-snippet.rb
Created Oct 4, 2017
console process feedback with ETA in ruby
View eta-snippet.rb
module EtaReport
def total
@total ||= whatever.count
end
def started_at
@started_at ||= Time.now
end
def progress_feedback(processed)
@formigarafa
formigarafa / Dockerfile
Created Mar 1, 2017 — forked from bellbind/Dockerfile
[docker] ruby-1.8.7 with rails-2.3.18 image
View Dockerfile
# docker build -t ruby-1.8.7 .
# docker run -it --rm ruby-1.8.7
FROM ubuntu:16.04
WORKDIR /root
RUN apt update
RUN apt upgrade -y
RUN apt install -y ruby-build autoconf subversion bison
RUN apt install -y mecab mecab-ipadic-utf8 wget
@formigarafa
formigarafa / XGH - PT-BR.md
Created Jan 15, 2017 — forked from banaslee/XGH - en.txt
eXtreme Go-Horse Process
View XGH - PT-BR.md

Fonte: http://gohorseprocess.wordpress.com

1- Pensou, não é XGH.

XGH não pensa, faz a primeira coisa que vem à mente. Não existe segunda opção, a única opção é a mais rápida.

2- Existem 3 formas de se resolver um problema, a correta, a errada e a XGH, que é igual à errada, só que mais rápida.

@formigarafa
formigarafa / tl_dr.md
Last active Jun 4, 2016
disable trackstick on ubuntu
View tl_dr.md
@formigarafa
formigarafa / nginx_prax_proxy.conf
Last active Apr 29, 2016
prax configuration with ssl via nginx. Note: remember to stop prax service (but not the daemon)
View nginx_prax_proxy.conf
upstream prax_unsecure_backend {
server localhost:20559;
}
server {
listen 80;
server_name *.dev;
server_name *.xip.io;
server_name *.rafael.nz;
@formigarafa
formigarafa / Google-DNS-over-HTTPS.md
Last active Mar 15, 2017
Basic to get google dns over https working.
View Google-DNS-over-HTTPS.md
@formigarafa
formigarafa / weekly_edm_report.md
Last active Nov 26, 2015
weekly edms for week of 2015-11-23
View weekly_edm_report.md
runs sent fail total
simulated 768 1577 2345
for real 838 1584 2422
total 1606 3161 4767
@formigarafa
formigarafa / file1.md
Created Nov 3, 2014
Gist title here, maybe a description
View file1.md

#whatever

you want here