Skip to content

Instantly share code, notes, and snippets.

@icarocamelo
icarocamelo / Factorial Class
Created September 24, 2011 00:50
Factorial: OO x OO (FP inspired)
public class Factorial {
public static long declarativeFactorial(int n){
assert n > 0 : "Argument must be greaten than 0";
if (n == 1)
return 1;
else
return n * declarativeFactorial(n-1);
}
@icarocamelo
icarocamelo / gist:1442462
Created December 7, 2011 11:22
UnitTest with Mocks
[SetUp]
public static void Setup()
{
MockRepository = new MockRepository();
Repositorio = MockRepository.DynamicMock<ILanceRepositorio>();
Servico = new LanceServico(Repositorio);
}
[TestCase]
public static void Teste_Retornar_Todos()
@icarocamelo
icarocamelo / gist:2659726
Created May 11, 2012 13:42
SQL Lambda Expression
1) Using SQL-like Expression
var iNames = from i in employees
select i.name;
2) Using Lambda Expression
var iNames = employees.Select<Employee, string>(r => r.name);
@icarocamelo
icarocamelo / Agile Facilities Techniques
Last active July 4, 2017 08:00
Agile Facilities Techniques
Activities
Basic Activities
Simple activities which are good for less-experienced groups.
Ping pong
Navigator-driver
Missing Tool Activities
#!/usr/bin/python
from mininet.net import Mininet
from mininet.node import Controller, RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel, info
def emptyNet():
net = Mininet( controller=RemoteController )
net.addController( 'c0' )
h1 = net.addHost( 'h1' )
@icarocamelo
icarocamelo / sudo ovs-vsctl show
Created August 20, 2015 13:18
sudo ovs-vsctl show
mininet@mininet-vm:~$ sudo ovs-vsctl show
987c42d0-eab0-43d9-a32b-4246973706c2
Manager "ssl:10.0.1.6:6640"
Bridge "br1"
Port "br1"
Interface "br1"
type: internal
Bridge "s1"
Controller "ssl:10.0.1.6:6653"
fail_mode: secure
<nodes xmlns="urn:opendaylight:inventory">
<node>
<id>openflow:1</id>
<table xmlns="urn:opendaylight:flow:inventory">
<id>0</id>
</table>
<switch-features xmlns="urn:opendaylight:flow:inventory">
<max_tables>254</max_tables>
<max_buffers>256</max_buffers>
<capabilities>flow-feature-capability-table-stats</capabilities>
#!/usr/bin/python
from mininet.net import Mininet
from mininet.node import Controller, RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel, info
def emptyNet():
net = Mininet(controller=None)
net.addController( 'c0', controller=RemoteController, ip='10.0.1.6', port=6653 )
h1 = net.addHost( 'h1' )
mininet@mininet-vm:~$ sudo ovs-vsctl list controller
_uuid : 39a115f0-4632-4102-8168-8686d00d3e5c
connection_mode : []
controller_burst_limit: []
controller_rate_limit: []
enable_async_messages: []
external_ids : {}
inactivity_probe : []
is_connected : false
local_gateway : []
@icarocamelo
icarocamelo / ovs-vswitchd.log
Last active August 29, 2015 14:27
/var/log/openvswitch/ovs-vswitchd.log
2015-08-20T14:14:35Z|00473|bridge|INFO|bridge s1: added interface s1 on port 65534
2015-08-20T14:14:35Z|00474|bridge|INFO|bridge s1: using datapath ID 0000c22decc72b46
2015-08-20T14:14:35Z|00475|connmgr|INFO|s1: added service controller "punix:/var/run/openvswitch/s1.mgmt"
2015-08-20T14:14:35Z|00476|bridge|INFO|bridge s1: using datapath ID 0000000000000001
2015-08-20T14:14:35Z|00477|bridge|INFO|bridge s1: added interface s1-eth1 on port 1
2015-08-20T14:14:35Z|00478|bridge|INFO|bridge s1: added interface s1-eth2 on port 2
2015-08-20T14:14:35Z|00479|connmgr|INFO|s1: added primary controller "tcp:10.0.1.6:6653"
2015-08-20T14:14:35Z|00480|rconn|INFO|s1<->tcp:10.0.1.6:6653: connecting...
2015-08-20T14:14:35Z|00481|rconn|INFO|s1<->tcp:10.0.1.6:6653: connected
2015-08-20T14:14:35Z|00482|connmgr|INFO|s1<->tcp:10.0.1.6:6653: sending OFPBRC_BAD_TYPE error reply to OFPT_HELLO message