Skip to content

Instantly share code, notes, and snippets.

View PotHix's full-sized avatar
🎯
Focusing

PotHix PotHix

🎯
Focusing
View GitHub Profile
#!/bin/sh
printf "\n\n\n\n\n\n\n" | openssl req -new -x509 -keyout /tmp/pemfile.pem -out /tmp/pemfile.pem -days 365 -nodes 2>/dev/null
cat <<EOF > /tmp/python-https-server.py
import ssl
import BaseHTTPServer, SimpleHTTPServer
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler

Keybase proof

I hereby claim:

  • I am pothix on github.
  • I am pothix (https://keybase.io/pothix) on keybase.
  • I have a public key ASDS2rmVcEksSd9MvZipGYftVdtOrxH6g0EiNrMxNRmFIQo

To claim this, I am signing this object:

Pothix

Escolhas do desenvolvedor

  • O desenvolvedor decide uma série de coisas durante sua vida profissional. Você decide desde qual editor até o servidor que você vai usar.
  • Por que Ruby? Além de uma escolha pessoal, que é o principal motivo, a syntax é bem enxuta, tem bastante coisa pronta, fácil prototipagem e talvez você já tenha boa experiência isso
  • Mas você precisa saber o que usar: as vezes você precisa fazer um sistema embarcado, Ruby não é a resposta.
  • Use sempre linguagem correta para o problema correto
  • O Leela, projeto de integração de métricas da Locaweb, possui em seu repositório: Haskell, C, Python, Ruby, Clojure + Cassandra…
  • Cada uma dessas linguagens resolve problemas diferentes. Nenhuma das linguagens vai ser a bala de prata.
  • Seja fluente em pelo menos uma linguagem.
@PotHix
PotHix / wordpress2middleman.rb
Last active August 29, 2015 14:21
A simple script to convert the export file from wordpress to middleman blog style
require "nokogiri"
require "upmark"
require "time"
BLACKLIST = ["pothix", "ilmo francisco m. melo"]
def tags_for element
element.xpath("category").map do |cat|
cat.text.downcase if cat["domain"] == "post_tag"
end.compact
@PotHix
PotHix / main
Last active December 28, 2015 08:59
Go and a lot of http requests
const NumberOfGoroutines = 15
func main() {
var wg sync.WaitGroup
channel := make(chan string, NumberOfGoroutines)
redisch := make(chan *namesp.Metric, 3)
for i := 0; i < NumberOfGoroutines; i++ {
wg.Add(1)
@PotHix
PotHix / robot.js
Created December 6, 2012 01:44
PotHix
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.fire();
@PotHix
PotHix / about.md
Created August 22, 2011 04:39 — forked from CrociDB/about.md
Programming Achievements: How to Level Up as a Developer
@PotHix
PotHix / gist:640517
Created October 22, 2010 13:19
remarkable -> shoulda sed helpers :P
grep "should_have_many" spec/* -Ril | xargs sed -i "s/should_have_many\(.*\)/it { should have_many\1 }/g"
grep "should_have_one" spec/* -Ril | xargs sed -i "s/should_have_one\(.*\)/it { should have_one\1 }/g"
grep "should_belong_to" spec/* -Ril | xargs sed -i "s/should_belong_to\(.*\)/it { should belong_to\1 }/g"
grep "should_validate_presence_of.*" spec/* -Ril | xargs sed -i "s/should_validate_presence_of\(.*\)/it { should validate_presence_of\1 }/g"
grep "should_validate_uniqueness_of.*" spec/* -Ril | xargs sed -i "s/should_validate_uniqueness_of\(.*\)/it { should validate_uniqueness_of\1 }/g"
grep "should_validate_numericality_of.*" spec/* -Ril | xargs sed -i "s/should_validate_numericality_of\(.*\)/it { should validate_numericality_of\1 }/g"
grep "should_validate_acceptance_of.*" spec/* -Ril | xargs sed -i "s/should_validate_acceptance_of\(.*\)/it { should validate_acceptance_of\1 }/g"
grep "should have_many :.*through.*" spec/* -Ril | xargs sed -i 's/should have_many :\([a-z_=>]*\),.*:through => :\(.*\)
class Achievement
WEIGHT = 100
class << self
attr_accessor :all
end
self.all = []
attr_accessor :badge
- Fugitive
- Rails Vim
- endwise
- ragtag
- surround
- matchit
- snipmate
- repeat.vim