Skip to content

Instantly share code, notes, and snippets.

View formigarafa's full-sized avatar

Rafael Santos formigarafa

View GitHub Profile
@formigarafa
formigarafa / teste.md
Created February 4, 2011 15:12
teste de markdown

=teste dessa budega

eu só quero testar se o markdown funciona como eu gostaria, e se eu consig retornar ele processado a partir do gist.

@formigarafa
formigarafa / postgres_queries_and_commands.sql
Last active October 21, 2020 09:00 — forked from biinari/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- 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 / example.rb
Created June 25, 2020 02:46
Ruby 2.6.6 weird behaviour for protected method
class Item
def initialize(value: )
@value = value
end
def subitems
@subitems ||= [
Item.new(value: 1),
Item.new(value: 2),
]
@formigarafa
formigarafa / Dockerfile
Created March 1, 2017 22:17 — forked from bellbind/Dockerfile
[docker] ruby-1.8.7 with rails-2.3.18 image
# 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 / eta-snippet.rb
Created October 4, 2017 08:47
console process feedback with ETA in ruby
module EtaReport
def total
@total ||= whatever.count
end
def started_at
@started_at ||= Time.now
end
def progress_feedback(processed)
@formigarafa
formigarafa / Google-DNS-over-HTTPS.md
Last active March 15, 2017 08:15
Basic to get google dns over https working.
@formigarafa
formigarafa / XGH - PT-BR.md
Created January 15, 2017 23:51 — forked from banaslee/XGH - en.txt
eXtreme Go-Horse Process

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 June 4, 2016 03:05
disable trackstick on ubuntu
@formigarafa
formigarafa / nginx_prax_proxy.conf
Last active April 29, 2016 14:03
prax configuration with ssl via nginx. Note: remember to stop prax service (but not the daemon)
upstream prax_unsecure_backend {
server localhost:20559;
}
server {
listen 80;
server_name *.dev;
server_name *.xip.io;
server_name *.rafael.nz;
@formigarafa
formigarafa / gist:4424525
Created January 1, 2013 01:20
Basic script to create a rails app encapsuled in a gemset. this script creates a gemset with the same name as the app, installs rails gem for this gemset, creates the app, add a .rvmrc and add .rvmrc into .gitignore file.
RUBY_VERSION=1.9.3
APP_NAME=that_great_app
rvm $RUBY_VERSION@$APP_NAME --create && gem install rails --no-ri --no-rdoc && rails new $APP_NAME -d mysql && echo "rvm $RUBY_VERSION@$APP_NAME" > $APP_NAME/.rvmrc && echo ".rvmrc" >> $APP_NAME/.gitignore