Skip to content

Instantly share code, notes, and snippets.

View dlresende's full-sized avatar

Diego Lemos dlresende

View GitHub Profile
@dlresende
dlresende / manifest.yml
Created August 27, 2021 19:55
my-http-server BOSH manifest for CF Networking Onboarding
name: my-http-server
releases:
- name: "bpm"
version: "latest"
- name: "routing"
version: "latest"
- name: "nginx"
@dlresende
dlresende / main.go
Created December 18, 2020 11:52
goroutine example with logging
package main
import (
"fmt"
"io"
"os"
"os/signal"
"sync"
)

Ruby

$ bundle gem $my_app -t rspec -b

Installing the local gem:

$ gem build $my_app.gemspec
$ gem install $my_app-<version>.gem
$ $my_app
uaac target https://pcf.$env.cf-app.com/uaa --skip-ssl-validation && uaac token owner get opsman pivotalcf -s ''
---
name: redis-on-demand-broker
releases:
- name: &broker-release ((broker_release))
version: latest
- name: &service-adapter-release ((service_adapter_release))
version: latest
- name: routing
version: latest
@dlresende
dlresende / why_om_ui_is_not_accessible.md
Last active October 20, 2018 12:07
Debug VirtualBox not correctly forwarding traffic on a multi-user machine

Problem

Cannot access OM running inside VirtualBox

Facts

box

  • The box has 2 interfaces one for each IP range
    eth0      Link encap:Ethernet  HWaddr 08:00:27:00:fb:33
              inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
    

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

### Keybase proof
I hereby claim:
* I am dlresende on github.
* I am dlresende (https://keybase.io/dlresende) on keybase.
* I have a public key ASCxCa7Jty9zqQzI9lGZcFWDaRCPUhCRa5jyi_imbXHyZQo
To claim this, I am signing this object:

Fizz Buzz Kata

Build a program that takes a number N as input and for each number from 1 to N:

  • If the number is divisible by 3, should print "Fizz";
  • If the number is divisible by 5, should print "Buzz";
  • If the number is divisible by both 3 and 5, should print "Fizz Buzz";
  • Otherwise, should print the number.

Example:

@dlresende
dlresende / tictactoe.rb
Created December 12, 2016 22:47
LSCC 2016-12-12
class Game
def initialize
@fields = "___" +
"___" +
"___" ;
end
def take(x, y, piece = "X")
line = x * 3
@dlresende
dlresende / gist:dc57f506e1ab1de7e7df
Last active September 3, 2018 16:49
Tic Tac Toe Kata

Tic Tac Toe Kata

The rules of the tic tac toe game are the following:

  • a game is over when all fields are taken
  • a game is over when all fields in a column are taken by a player
  • a game is over when all fields in a row are taken by a player
  • a game is over when all fields in a diagonal are taken by a player
  • a player can take a field if not already taken
  • players take turns taking fields until the game is over
  • there are two player in the game (X and O)