Skip to content

Instantly share code, notes, and snippets.

View formigarafa's full-sized avatar

Rafael Santos formigarafa

View GitHub Profile
@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 / 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 / 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 / jquery.ba-tinypubsub.js
Created October 31, 2012 12:02 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
@formigarafa
formigarafa / math_and_programmers.md
Created July 1, 2011 13:54 — forked from danielvlopes/gist:1057764
math and programmers

Every programming language has some kind of way of doing numbers and math. Do not worry, programmers lie frequently about being math geniuses when they really aren’t. If they were math geniuses, they would be doing math, not writing ads and social network games to steal people’s money.

@formigarafa
formigarafa / test_unit_rules.md
Created June 28, 2011 17:14 — forked from rponte/gist:1051135
A test is not a unit test if

A test is not a unit test if:

  • it talks to the database
  • it communicates across the network
  • it touches the file system
  • it can’t run at the same time as any of your other unit tests
  • you have to do special things to your environment (such as editing config files) to run it Tests that do these things aren’t bad. Often they are worth writing, and they can be written in a unit test harness. However, it is important to keep them separate from true unit tests so that we can run the unit tests quickly whenever we make changes.

--

function rake {
if [ -e Gemfile ]; then
bundle exec rake $@
else
`which rake` $@
fi
}
require 'logger'
class String
LOGGER = Logger.new($stderr)
def -@; LOGGER.info self; end
end
# Extracted earlier, hardcoded for speed
ENTITIES = %w(I-ORG O I-MISC I-PER I-LOC B-LOC B-MISC MO B-ORG)
@formigarafa
formigarafa / Jabber-SH
Created April 3, 2011 01:27 — forked from pcreux/Jabber-SH
Código base usado para fazer o jabber-shell
#!/usr/bin/env ruby
# Jabber-SH — SH console via XMPP/Jabber (GTalk)
#
# Jabber-SH allows you to administrate a remote computer via a command line
# through a Jabber client. It’s like SSH via GoogleTalk! :)
# This is just a hack but it might be usefull sometime to run basic commands
# on a machine that is not accessible via ssh.
#
# Philippe Creux. pcreux/AT/gmail/DOT/com