This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "ubuntu/xenial64" | |
config.vm.provider "virtualbox" do |vb| | |
vb.customize ['modifyvm', :id, '--nictype1', 'Am79C973'] | |
vb.customize ['modifyvm', :id, '--nicpromisc1', 'allow-all'] | |
end | |
config.vm.provision :shell, path: "bootstrap.sh" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace('iperf', function () { | |
desc('Iperf server receiving 64 byte'); | |
task('s64', { async: true }, function () { | |
var cmds = ['iperf -s -u -l 64 -i 1']; | |
jake.exec(cmds, { interactive: true }, function () { | |
complete(); | |
}); | |
}); | |
desc('Iperf server receiving 128 byte'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Run `snort -A console` command using a pipe. | |
Warning! Alerts are delayed until snort's stdout buffer is flushed. | |
""" | |
from __future__ import print_function | |
from subprocess import Popen, PIPE, STDOUT | |
snort_process = Popen(['snort', '-A', 'console', '-c', 'snort.conf'], | |
stdout=PIPE, stderr=STDOUT, bufsize=1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from mininet.topo import Topo | |
from mininet.cli import CLI | |
from mininet.net import Mininet | |
from mininet.util import dumpNodeConnections | |
from mininet.log import setLogLevel | |
from mininet.node import RemoteController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
require './short_string_packer' | |
def random_string | |
[*'a'..'z'].sample(rand(1..12)).join | |
end | |
test_cases = %w(a z asdf abcdefghijkl aaaaaazzzzzz) | |
describe 'Test whether packing methods are valid' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check the output file | |
if ARGV[1].nil? | |
print 'Insert the name of your output file (yml file) ' | |
outname = $stdin.gets.chomp | |
else | |
outname = ARGV[1] | |
end | |
# Build the array of Hashes | |
require 'yaml' | |
survey = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ARGV[1].nil? | |
print 'Insert the name of your output file (tsv file) ' | |
outname = $stdin.gets.chomp | |
else | |
outname = ARGV[1] | |
end | |
# Deserialize | |
require 'yaml' | |
survey = YAML.load(File.read(ARGV[0])) | |
# Create the TSV file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fizzbuzz(num, &strategy) | |
arr = [] | |
1.upto(num) do |i| | |
if i % 5 == 0 and i % 3 == 0 | |
arr.push("FizzBuzz") | |
if strategy | |
yield 'FizzBuzz' | |
end | |
elsif i % 3 == 0 | |
arr.push("Fizz") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var config = require('./config'); | |
module.exports = { | |
startPkt: function() { | |
dpid = config.dpid; | |
urlApi = 'http://127.0.0.1:8080/packetgen/start/' + dpid; | |
request(urlApi, function(error, response, body) { | |
if (!error && response.statusCode == 200) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ryu.base import app_manager | |
from ryu.controller import ofp_event | |
from ryu.controller.handler import CONFIG_DISPATCHER | |
from ryu.controller.handler import set_ev_cls | |
class DeleteAll(app_manager.RyuApp): | |
def __init__(self, *args, **kwargs): | |
super(DeleteAll, self).__init__(*args, **kwargs) |