Skip to content

Instantly share code, notes, and snippets.

View glauco's full-sized avatar

Glauco Oliveira glauco

View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

Keybase proof

I hereby claim:

To claim this, I am signing this object:

require 'set'
class Lottery
@max = 0
def generate_lottery_cards(amount, numbers_per_game)
games = []
randoms = Random.new
@glauco
glauco / gist:3136604
Created July 18, 2012 14:44
BaseTest
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
namespace MT.SmsNavigationFactory.Tests
{
public abstract class BaseTest
{
@glauco
glauco / gist:3020212
Created June 29, 2012 19:42
Corrigindo problemas de locale no Jekyll

Ao executar o Jekyll estava recebendo o seguinte erro:

/Users/glauco/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
Configuration from /Users/glauco/Github/glauco.github.com/_config.yml
Building site: . -> ./_site
/Users/glauco/.rvm/gems/ruby-1.9.3-p194/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:29:in `read_yaml': invalid byte sequence in US-ASCII (ArgumentError)
	from /Users/glauco/.rvm/gems/ruby-1.9.3-p194/gems/jekyll-0.11.2/lib/jekyll/layout.rb:31:in `initialize'
	from /Users/glauco/.rvm/gems/ruby-1.9.3-p194/gems/jekyll-0.11.2/lib/jekyll/site.rb:113:in `new'
	from /Users/glauco/.rvm/gems/ruby-1.9.3-p194/gems/jekyll-0.11.2/lib/jekyll/site.rb:113:in `block in read_layouts'
@glauco
glauco / gist:2038839
Created March 14, 2012 19:24
Código do estagiário
public string TirarAcentos(string texto) {
string textor = "";
for (int i = 0; i < texto.Length; i++) {
if (texto[i].ToString() == "ã") textor += "a";
else if (texto[i].ToString() == "á") textor += "a";
else if (texto[i].ToString() == "à") textor += "a";
else if (texto[i].ToString() == "â") textor += "a";
else if (texto[i].ToString() == "ä") textor += "a";
else if (texto[i].ToString() == "é") textor += "e";
@glauco
glauco / gist:1871342
Created February 20, 2012 20:51
Implementing a Singleton in Io
Highlander := Object clone
Highlander clone := Highlander
@glauco
glauco / select.sql
Last active September 29, 2015 20:43
SELECT t.test_id, t.run_count, t.success, t.failure, t.run_time
FROM tests t
JOIN test_runs tr
ON t.id = tr.test_id
JOIN run_metadata rm
ON rm.run_id = tr.run_id
AND rm.key = 'build_name'
AND rm.value = 'gate-tempest-dsvm-postgres-full'
GROUP BY t.test_id, t.run_count, t.success, t.failure, t.run_time
@glauco
glauco / gist:1200993
Created September 7, 2011 16:12
Random numbers
­#!/usr/bin/python
import random
for k in range(10):
r = random.randint(1,3)
print r,
@glauco
glauco / bootstrap-puppetdb.sh
Last active August 29, 2015 14:25
bootstrap-puppetdb.sh
#!/bin/bash
apt-get update
apt-get upgrade -y
apt-get install git -y
git clone https://git.openstack.org/openstack-infra/system-config /opt/system-config/production
/opt/system-config/production/install_puppet.sh
export REAL_HOSTNAME=puppetdb.openstack.org
bash /opt/system-config/production/install_modules.sh