Skip to content

Instantly share code, notes, and snippets.

View teone's full-sized avatar

Matteo teone

  • Intel
  • San Francisco
View GitHub Profile
@teone
teone / go.mod
Created November 18, 2023 00:45
log-example
module github.com/teone/log-example
go 1.20
replace (
github.com/coreos/bbolt v1.3.4 => go.etcd.io/bbolt v1.3.4
go.etcd.io/bbolt v1.3.4 => github.com/coreos/bbolt v1.3.4
)
require github.com/opencord/voltha-lib-go/v7 v7.4.6
@teone
teone / missing-port-finder.py
Created May 22, 2020 21:10
Find missing ports in ONOS when running at scale with BBSim
import argparse
import re
def read_ports(file):
file1 = open(file, 'r')
lines = file1.readlines()
p = re.compile('.*(BBSM.*-1)')
ports = []
@teone
teone / images-diff.sh
Last active May 4, 2020 18:46
check the commits between two images in the opencord repo
images=( "$@" )
commits=()
if [ ${#images[@]} != 2 ]
then
printf "You need to provide two images only, eg:\n"
printf "\tbash $0 voltha/voltha-rw-core:2.3.6 voltha/voltha-rw-core:2.4.0\n"
exit 1
fi
@teone
teone / jenkins-collect.py
Last active April 23, 2020 02:15
Collect results from builds on the voltha-scale-measurement job
"""
Script to get data from voltha-scale-measurements Jenkins builds
Example usage:
python jenkins-collect.py
(and follow the prompts)
"""
import csv
from urllib import urlopen
from datetime import date
@teone
teone / xos-migrations.md
Last active February 6, 2019 23:04
XOS-Migrations

XOS Migrations

NOTE this feature is not implemented yet

This document describes how to use the XOS toolchain to generate basic migrations for service models. The autogenerated migrations can later be extended with custom logic to support more complex scenarios.

NOTE from now on we assume you have obtained the code as described in this guide and the

@teone
teone / Makefile
Last active October 5, 2016 23:23
OrangeBox tweaks
include ../common/Makedefs
CONFIG_DIR:=$(shell pwd)
DOCKER_COMPOSE_YML=./onboarding-docker-compose/docker-compose.yml
BOOTSTRAP_YML=./docker-compose-bootstrap.yml
DOCKER_PROJECT=mcord
BOOTSTRAP_PROJECT=mcordbs
XOS_BOOTSTRAP_PORT=81
XOS_UI_PORT=80
ADMIN_USERNAME=padmin@vicci.org
@teone
teone / REAME.md
Created July 25, 2016 16:09
JS Binary Tree

Binary Tree Implementation

This is a draft implementation of a Binary Tree in Javascript.

No libraaries are used to define the Tree, but mocha and chai are used to test the code, so you should execute npm install before running tests.

The BinaryTree implementation is defined in binary-tree.js, example usages are in index.js (too see them use npm start), test are defined in spec.js and you can execute them with npm test;

TODO

@teone
teone / sample.js
Created July 16, 2016 00:35
returning...
if(this.model.site){
var options_list = this.config.fields.site.options;
var selectVal = _.find(options_list,['id',this.model.site]);
if(selectVal && this.model.name){
return (this.model.name.toLowerCase().indexOf(selectVal.label.toLowerCase()) === 0) ;
}
else{
return false;
}
}
@teone
teone / test.js
Last active April 17, 2020 19:44
Mocking promises in Angular Karma/Jasmine tests
(function () {
'use strict';
describe('The service', () => {
let service, scope;
const resolveValue = 'The value you want to resolve.';
const mock = {
promise: () => {
return {
@teone
teone / karma.conf.js
Created May 13, 2016 16:37
Test Suites with Karma
// Karma configuration
// this is to load a different suite of test while developing
var testFiles = '*'; // by default load all js files
if(process.argv[4]){
// if a param is specified, read only that file
testFiles = process.argv[4];
}
var wiredep = require('wiredep');