text:
// Package server provides a server that can wrap a node and serve an http api
// for interacting with the node.
package server

import (
	"context"
	"net"
	"net/http"
	"strings"

	"github.com/HyperspaceApp/Hyperspace/modules"
	"github.com/HyperspaceApp/Hyperspace/node"
	"github.com/HyperspaceApp/Hyperspace/node/api"
	"github.com/HyperspaceApp/Hyperspace/types"

	"github.com/HyperspaceApp/errors"
)

// A Server is a collection of hsd modules that can be communicated with over
// an http api.
type Server struct {
	api               *api.API
	apiServer         *http.Server
	done              chan struct{}
	listener          net.Listener
	node              *node.Node
	requiredUserAgent string
	serveErr          error
	Dir               string
}

// serve listens for and handles API calls. It is a blocking function.
func (srv *Server) serve() error {
	// The server will run until an error is encountered or the listener is
	// closed, via either the Close method or by signal handling.  Closing the
	// listener will result in the benign error handled below.
	err := srv.apiServer.Serve(srv.listener)
	if err != nil && !strings.HasSuffix(err.Error(), "use of closed network connection") {
		return err
	}
	return nil
}

// Close closes the Server's listener, causing the HTTP server to shut down.
func (srv *Server) Close() error {
	// Stop accepting API requests.
	err := srv.apiServer.Shutdown(context.Background())
	// Wait for serve() to return and capture its error.
	<-srv.done
	if srv.serveErr != http.ErrServerClosed {
		err = errors.Compose(err, srv.serveErr)
	}
	// Shutdown modules.
	err = errors.Compose(err, srv.node.Close())
	return errors.AddContext(err, "error while closing server")
}

// APIAddress returns the underlying node's api address
func (srv *Server) APIAddress() string {
	return srv.listener.Addr().String()
}

// GatewayAddress returns the underlying node's gateway address
func (srv *Server) GatewayAddress() modules.NetAddress {
	return srv.node.Gateway.Address()
}

// HostPublicKey returns the host's public key or an error if the node is no
// host.
func (srv *Server) HostPublicKey() (types.SiaPublicKey, error) {
	if srv.node.Host == nil {
		return types.SiaPublicKey{}, errors.New("can't get public host key of a non-host node")
	}
	return srv.node.Host.PublicKey(), nil
}

// New creates a new API server from the provided modules. The API will
// require authentication using HTTP basic auth if the supplied password is not
// the empty string. Usernames are ignored for authentication. This type of
// authentication sends passwords in plaintext and should therefore only be
// used if the APIaddr is localhost.
func New(APIaddr string, requiredUserAgent string, requiredPassword string, nodeParams node.NodeParams) (*Server, error) {
	// Create the server listener.
	listener, err := net.Listen("tcp", APIaddr)
	if err != nil {
		return nil, err
	}

	// Create the Sia node for the server.
	node, err := node.New(nodeParams)
	if err != nil {
		return nil, errors.AddContext(err, "server is unable to create the Sia node")
	}

	// Create the api for the server.
	api, err := api.New(requiredUserAgent, requiredPassword, node.ConsensusSet, node.Explorer, node.Gateway, node.Host, node.Miner, node.Renter, node.TransactionPool, node.Wallet, node.MiningPool, node.StratumMiner, nil)
	srv := &Server{
		api: api,
		apiServer: &http.Server{
			Handler: api,
		},
		done:              make(chan struct{}),
		listener:          listener,
		node:              node,
		requiredUserAgent: requiredUserAgent,
		Dir:               nodeParams.Dir,
	}

	// Spin up a goroutine that serves the API and closes srv.done when
	// finished.
	go func() {
		srv.serveErr = srv.serve()
		close(srv.done)
	}()

	return srv, err
}

repository: HyperspaceApp/Hyperspace

repo_name: HyperspaceApp/Hyperspace

gha_license_id: MIT

gha_language: Go

extension: go


text:
@inproceedings{coleman2019biometric,
 author = {Coleman, Taina and Moon, Jucheol},
 booktitle = {Proceedings of 32nd International Conference on},
 pages = {63--71},
 title = {A biometric for shark dorsal fins based on boundary descriptor matching},
 volume = {63},
 year = {2019}
}

license: MIT

repository: tainagdcoleman/tainacoleman

license_type: permissive

repo_name: tainagdcoleman/tainacoleman

branch_name: refs/heads/master

extension: bib


text:
package deploy

import (
	"os/exec"

	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"

	"github.com/Juniper/asf/pkg/logutil"
	"github.com/Juniper/asf/pkg/logutil/report"
	"github.com/Juniper/asf/pkg/osutil"
	"github.com/Juniper/contrail/pkg/deploy/base"
	"github.com/Juniper/contrail/pkg/deploy/cluster"
	"github.com/Juniper/contrail/pkg/deploy/rhospd/undercloud"
)

// manager inerface to manage resources
type manager interface {
	manage() error
}

type oneShotManager struct {
	deploy *Deploy
	log    *logrus.Entry
}

// TODO(apasyniuk) Export this into asf/osutils
type osCommandExecutor struct{}

func (e *osCommandExecutor) ExecCmdAndWait(
	r *report.Reporter, cmd string, args []string, dir string, envVars ...string,
) error {
	return osutil.ExecCmdAndWait(r, cmd, args, dir, envVars...)
}

func (e *osCommandExecutor) ExecAndWait(r *report.Reporter, cmd *exec.Cmd) error {
	return osutil.ExecAndWait(r, cmd)
}

func (o *oneShotManager) manage() error {
	deployer, err := newDeployer(o.deploy)
	if err != nil {
		return err
	}
	return deployer.Deploy()
}

func newOneShotManager(deploy *Deploy) (*oneShotManager, error) {
	return &oneShotManager{
		deploy: deploy,
		log:    logutil.NewLogger("oneshot-manager"),
	}, nil
}

func newManager(deploy *Deploy) (manager, error) {
	switch deploy.managerType {
	case "oneshot":
		return newOneShotManager(deploy)
	}
	//TODO(ijohnson) Support daemon manager with etcd
	return nil, errors.New("unsupported manager type")
}

func newDeployer(deploy *Deploy) (base.Deployer, error) {
	switch deploy.config.ResourceType {
	case "contrail_cluster":
		c, err := cluster.NewCluster(&cluster.Config{
			APIServer:                 deploy.APIServer,
			ClusterID:                 deploy.config.ResourceID,
			Action:                    deploy.config.Action,
			TemplateRoot:              deploy.config.TemplateRoot,
			LogLevel:                  deploy.config.LogLevel,
			LogFile:                   deploy.config.LogFile,
			AnsibleSudoPass:           deploy.config.AnsibleSudoPass,
			AnsibleFetchURL:           deploy.config.AnsibleFetchURL,
			AnsibleCherryPickRevision: deploy.config.AnsibleCherryPickRevision,
			AnsibleRevision:           deploy.config.AnsibleRevision,
		}, &osCommandExecutor{})
		if err != nil {
			return nil, err
		}
		return c.GetDeployer()
	case "rhospd_cloud_manager":
		u, err := undercloud.NewUnderCloud(&undercloud.Config{
			APIServer:    deploy.APIServer,
			ResourceID:   deploy.config.ResourceID,
			Action:       deploy.config.Action,
			TemplateRoot: deploy.config.TemplateRoot,
			LogLevel:     deploy.config.LogLevel,
			LogFile:      deploy.config.LogFile,
		})
		if err != nil {
			return nil, err
		}
		return u.GetDeployer()
	}
	return nil, errors.New("unsupported resource type")
}


text:
package btf

import (
	"errors"
	"fmt"
	"os"
	"strings"
	"testing"

	"github.com/cilium/ebpf/internal"
	"github.com/cilium/ebpf/internal/testutils"
	"github.com/google/go-cmp/cmp"

	qt "github.com/frankban/quicktest"
)

func TestCheckTypeCompatibility(t *testing.T) {
	tests := []struct {
		a, b       Type
		compatible bool
	}{
		{&FuncProto{Return: &Typedef{Type: &Int{}}}, &FuncProto{Return: &Int{}}, true},
		{&FuncProto{Return: &Typedef{Type: &Int{}}}, &FuncProto{Return: &Void{}}, false},
	}
	for _, test := range tests {
		err := CheckTypeCompatibility(test.a, test.b)
		if test.compatible {
			if err != nil {
				t.Errorf("Expected types to be compatible: %s\na = %#v\nb = %#v", err, test.a, test.b)
				continue
			}
		} else {
			if !errors.Is(err, errIncompatibleTypes) {
				t.Errorf("Expected types to be incompatible: %s\na = %#v\nb = %#v", err, test.a, test.b)
				continue
			}
		}

		err = CheckTypeCompatibility(test.b, test.a)
		if test.compatible {
			if err != nil {
				t.Errorf("Expected reversed types to be compatible: %s\na = %#v\nb = %#v", err, test.a, test.b)
			}
		} else {
			if !errors.Is(err, errIncompatibleTypes) {
				t.Errorf("Expected reversed types to be incompatible: %s\na = %#v\nb = %#v", err, test.a, test.b)
			}
		}
	}

}

func TestCOREAreTypesCompatible(t *testing.T) {
	tests := []struct {
		a, b       Type
		compatible bool
	}{
		{&Void{}, &Void{}, true},
		{&Struct{Name: "a"}, &Struct{Name: "b"}, true},
		{&Union{Name: "a"}, &Union{Name: "b"}, true},
		{&Union{Name: "a"}, &Struct{Name: "b"}, false},
		{&Enum{Name: "a"}, &Enum{Name: "b"}, true},
		{&Fwd{Name: "a"}, &Fwd{Name: "b"}, true},
		{&Int{Name: "a", Size: 2}, &Int{Name: "b", Size: 4}, true},
		{&Pointer{Target: &Void{}}, &Pointer{Target: &Void{}}, true},
		{&Pointer{Target: &Void{}}, &Void{}, false},
		{&Array{Index: &Void{}, Type: &Void{}}, &Array{Index: &Void{}, Type: &Void{}}, true},
		{&Array{Index: &Void{}, Type: &Int{}}, &Array{Index: &Void{}, Type: &Void{}}, false},
		{&FuncProto{Return: &Int{}}, &FuncProto{Return: &Void{}}, false},
		{
			&FuncProto{Return: &Void{}, Params: []FuncParam{{Name: "a", Type: &Void{}}}},
			&FuncProto{Return: &Void{}, Params: []FuncParam{{Name: "b", Type: &Void{}}}},
			true,
		},
		{
			&FuncProto{Return: &Void{}, Params: []FuncParam{{Type: &Void{}}}},
			&FuncProto{Return: &Void{}, Params: []FuncParam{{Type: &Int{}}}},
			false,
		},
		{
			&FuncProto{Return: &Void{}, Params: []FuncParam{{Type: &Void{}}, {Type: &Void{}}}},
			&FuncProto{Return: &Void{}, Params: []FuncParam{{Type: &Void{}}}},
			false,
		},
	}

	for _, test := range tests {
		err := coreAreTypesCompatible(test.a, test.b)
		if test.compatible {
			if err != nil {
				t.Errorf("Expected types to be compatible: %s\na = %#v\nb = %#v", err, test.a, test.b)
				continue
			}
		} else {
			if !errors.Is(err, errIncompatibleTypes) {
				t.Errorf("Expected types to be incompatible: %s\na = %#v\nb = %#v", err, test.a, test.b)
				continue
			}
		}

		err = coreAreTypesCompatible(test.b, test.a)
		if test.compatible {
			if err != nil {
				t.Errorf("Expected reversed types to be compatible: %s\na = %#v\nb = %#v", err, test.a, test.b)
			}
		} else {
			if !errors.Is(err, errIncompatibleTypes) {
				t.Errorf("Expected reversed types to be incompatible: %s\na = %#v\nb = %#v", err, test.a, test.b)
			}
		}
	}

	for _, invalid := range []Type{&Var{}, &Datasec{}} {
		err := coreAreTypesCompatible(invalid, invalid)
		if errors.Is(err, errIncompatibleTypes) {
			t.Errorf("Expected an error for %T, not errIncompatibleTypes", invalid)
		} else if err == nil {
			t.Errorf("Expected an error for %T", invalid)
		}
	}
}

func TestCOREAreMembersCompatible(t *testing.T) {
	tests := []struct {
		a, b       Type
		compatible bool
	}{
		{&Struct{Name: "a"}, &Struct{Name: "b"}, true},
		{&Union{Name: "a"}, &Union{Name: "b"}, true},
		{&Union{Name: "a"}, &Struct{Name: "b"}, true},
		{&Enum{Name: "a"}, &Enum{Name: "b"}, false},
		{&Enum{Name: "a"}, &Enum{Name: "a___foo"}, true},
		{&Enum{Name: "a"}, &Enum{Name: ""}, true},
		{&Fwd{Name: "a"}, &Fwd{Name: "b"}, false},
		{&Fwd{Name: "a"}, &Fwd{Name: "a___foo"}, true},
		{&Fwd{Name: "a"}, &Fwd{Name: ""}, true},
		{&Int{Name: "a", Size: 2}, &Int{Name: "b", Size: 4}, true},
		{&Pointer{Target: &Void{}}, &Pointer{Target: &Void{}}, true},
		{&Pointer{Target: &Void{}}, &Void{}, false},
		{&Array{Type: &Int{Size: 1}}, &Array{Type: &Int{Encoding: Signed}}, true},
		{&Float{Size: 2}, &Float{Size: 4}, true},
	}

	for _, test := range tests {
		err := coreAreMembersCompatible(test.a, test.b)
		if test.compatible {
			if err != nil {
				t.Errorf("Expected members to be compatible: %s\na = %#v\nb = %#v", err, test.a, test.b)
				continue
			}
		} else {
			if !errors.Is(err, errImpossibleRelocation) {
				t.Errorf("Expected members to be incompatible: %s\na = %#v\nb = %#v", err, test.a, test.b)
				continue
			}
		}

		err = coreAreMembersCompatible(test.b, test.a)
		if test.compatible {
			if err != nil {
				t.Errorf("Expected reversed members to be compatible: %s\na = %#v\nb = %#v", err, test.a, test.b)
			}
		} else {
			if !errors.Is(err, errImpossibleRelocation) {
				t.Errorf("Expected reversed members to be incompatible: %s\na = %#v\nb = %#v", err, test.a, test.b)
			}
		}
	}

	for _, invalid := range []Type{&Void{}, &FuncProto{}, &Var{}, &Datasec{}} {
		err := coreAreMembersCompatible(invalid, invalid)
		if errors.Is(err, errImpossibleRelocation) {
			t.Errorf("Expected an error for %T, not errImpossibleRelocation", invalid)
		} else if err == nil {
			t.Errorf("Expected an error for %T", invalid)
		}
	}
}

func TestCOREAccessor(t *testing.T) {
	for _, valid := range []string{
		"0",
		"1:0",
		"1:0:3:34:10:1",
	} {
		_, err := parseCOREAccessor(valid)
		if err != nil {
			t.Errorf("Parse %q: %s", valid, err)
		}
	}

	for _, invalid := range []string{
		"",
		"-1",
		":",
		"0:",
		":12",
		"4294967296",
	} {
		_, err := parseCOREAccessor(invalid)
		if err == nil {
			t.Errorf("Accepted invalid accessor %q", invalid)
		}
	}
}

func TestCOREFindEnumValue(t *testing.T) {
	a := &Enum{Values: []EnumValue{{"foo", 23}, {"bar", 42}}}
	b := &Enum{Values: []EnumValue{
		{"foo___flavour", 0},
		{"bar", 123},
		{"garbage", 3},
	}}

	invalid := []struct {
		name   string
		local  Type
		target Type
		acc    coreAccessor
		err    error
	}{
		{"o-o-b accessor", a, b, coreAccessor{len(a.Values)}, nil},
		{"long accessor", a, b, coreAccessor{0, 1}, nil},
		{"wrong target", a, &Void{}, coreAccessor{0, 1}, nil},
		{
			"no matching value",
			b, a,
			coreAccessor{2},
			errImpossibleRelocation,
		},
	}

	for _, test := range invalid {
		t.Run(test.name, func(t *testing.T) {
			_, _, err := coreFindEnumValue(test.local, test.acc, test.target)
			if test.err != nil && !errors.Is(err, test.err) {
				t.Fatalf("Expected %s, got %s", test.err, err)
			}
			if err == nil {
				t.Fatal("Accepted invalid case")
			}
		})
	}

	valid := []struct {
		name                    string
		local, target           Type
		acc                     coreAccessor
		localValue, targetValue uint64
	}{
		{"a to b", a, b, coreAccessor{0}, 23, 0},
		{"b to a", b, a, coreAccessor{1}, 123, 42},
	}

	for _, test := range valid {
		t.Run(test.name, func(t *testing.T) {
			local, target, err := coreFindEnumValue(test.local, test.acc, test.target)
			qt.Assert(t, err, qt.IsNil)
			qt.Check(t, local.Value, qt.Equals, test.localValue)
			qt.Check(t, target.Value, qt.Equals, test.targetValue)
		})
	}
}

func TestCOREFindField(t *testing.T) {
	ptr := &Pointer{}
	u16 := &Int{Size: 2}
	u32 := &Int{Size: 4}
	aFields := []Member{
		{Name: "foo", Type: ptr, Offset: 8},
		{Name: "bar", Type: u16, Offset: 16},
		{Name: "baz", Type: u32, Offset: 32, BitfieldSize: 3},
		{Name: "quux", Type: u32, Offset: 35, BitfieldSize: 10},
		{Name: "quuz", Type: u32, Offset: 45, BitfieldSize: 8},
	}
	bFields := []Member{
		{Name: "foo", Type: ptr, Offset: 16},
		{Name: "bar", Type: u32, Offset: 8},
		{Name: "other", Offset: 4},
		// baz is separated out from the other bitfields
		{Name: "baz", Type: u32, Offset: 64, BitfieldSize: 3},
		// quux's type changes u32->u16
		{Name: "quux", Type: u16, Offset: 96, BitfieldSize: 10},
		// quuz becomes a normal field
		{Name: "quuz", Type: u16, Offset: 112},
	}

	aStruct := &Struct{Members: aFields, Size: 48}
	bStruct := &Struct{Members: bFields, Size: 80}
	aArray := &Array{Nelems: 4, Type: u16}
	bArray := &Array{Nelems: 3, Type: u32}

	invalid := []struct {
		name          string
		local, target Type
		acc           coreAccessor
		err           error
	}{
		{
			"unsupported type",
			&Void{}, &Void{},
			coreAccessor{0, 0},
			ErrNotSupported,
		},
		{
			"different types",
			&Union{}, &Array{Type: u16},
			coreAccessor{0},
			errImpossibleRelocation,
		},
		{
			"invalid composite accessor",
			aStruct, aStruct,
			coreAccessor{0, len(aStruct.Members)},
			nil,
		},
		{
			"invalid array accessor",
			aArray, aArray,
			coreAccessor{0, int(aArray.Nelems)},
			nil,
		},
		{
			"o-o-b array accessor",
			aArray, bArray,
			coreAccessor{0, int(bArray.Nelems)},
			errImpossibleRelocation,
		},
		{
			"no match",
			bStruct, aStruct,
			coreAccessor{0, 2},
			errImpossibleRelocation,
		},
		{
			"incompatible match",
			&Union{Members: []Member{{Name: "foo", Type: &Pointer{}}}},
			&Union{Members: []Member{{Name: "foo", Type: &Int{}}}},
			coreAccessor{0, 0},
			errImpossibleRelocation,
		},
		{
			"unsized type",
			bStruct, &Func{},
			// non-zero accessor to force calculating the offset.
			coreAccessor{1},
			errImpossibleRelocation,
		},
	}

	for _, test := range invalid {
		t.Run(test.name, func(t *testing.T) {
			_, _, err := coreFindField(test.local, test.acc, test.target)
			if test.err != nil && !errors.Is(err, test.err) {
				t.Fatalf("Expected %s, got %s", test.err, err)
			}
			if err == nil {
				t.Fatal("Accepted invalid case")
			}
			t.Log(err)
		})
	}

	bytes := func(typ Type) uint32 {
		sz, err := Sizeof(typ)
		if err != nil {
			t.Fatal(err)
		}
		return uint32(sz)
	}

	anon := func(t Type, offset Bits) []Member {
		return []Member{{Type: t, Offset: offset}}
	}

	anonStruct := func(m ...Member) Member {
		return Member{Type: &Struct{Members: m}}
	}

	anonUnion := func(m ...Member) Member {
		return Member{Type: &Union{Members: m}}
	}

	valid := []struct {
		name                    string
		local                   Type
		target                  Type
		acc                     coreAccessor
		localField, targetField coreField
	}{
		{
			"array[0]",
			aArray,
			bArray,
			coreAccessor{0, 0},
			coreField{u16, 0, 0, 0},
			coreField{u32, 0, 0, 0},
		},
		{
			"array[1]",
			aArray,
			bArray,
			coreAccessor{0, 1},
			coreField{u16, bytes(aArray.Type), 0, 0},
			coreField{u32, bytes(bArray.Type), 0, 0},
		},
		{
			"array[0] with base offset",
			aArray,
			bArray,
			coreAccessor{1, 0},
			coreField{u16, bytes(aArray), 0, 0},
			coreField{u32, bytes(bArray), 0, 0},
		},
		{
			"array[2] with base offset",
			aArray,
			bArray,
			coreAccessor{1, 2},
			coreField{u16, bytes(aArray) + 2*bytes(aArray.Type), 0, 0},
			coreField{u32, bytes(bArray) + 2*bytes(bArray.Type), 0, 0},
		},
		{
			"flex array",
			&Struct{Members: []Member{{Name: "foo", Type: &Array{Nelems: 0, Type: u16}}}},
			&Struct{Members: []Member{{Name: "foo", Type: &Array{Nelems: 0, Type: u32}}}},
			coreAccessor{0, 0, 9000},
			coreField{u16, bytes(u16) * 9000, 0, 0},
			coreField{u32, bytes(u32) * 9000, 0, 0},
		},
		{
			"struct.0",
			aStruct, bStruct,
			coreAccessor{0, 0},
			coreField{ptr, 1, 0, 0},
			coreField{ptr, 2, 0, 0},
		},
		{
			"struct.0 anon",
			aStruct, &Struct{Members: anon(bStruct, 24)},
			coreAccessor{0, 0},
			coreField{ptr, 1, 0, 0},
			coreField{ptr, 3 + 2, 0, 0},
		},
		{
			"struct.0 with base offset",
			aStruct, bStruct,
			coreAccessor{3, 0},
			coreField{ptr, 3*bytes(aStruct) + 1, 0, 0},
			coreField{ptr, 3*bytes(bStruct) + 2, 0, 0},
		},
		{
			"struct.1",
			aStruct, bStruct,
			coreAccessor{0, 1},
			coreField{u16, 2, 0, 0},
			coreField{u32, 1, 0, 0},
		},
		{
			"struct.1 anon",
			aStruct, &Struct{Members: anon(bStruct, 24)},
			coreAccessor{0, 1},
			coreField{u16, 2, 0, 0},
			coreField{u32, 3 + 1, 0, 0},
		},
		{
			"union.1",
			&Union{Members: aFields, Size: 32},
			&Union{Members: bFields, Size: 32},
			coreAccessor{0, 1},
			coreField{u16, 2, 0, 0},
			coreField{u32, 1, 0, 0},
		},
		{
			"interchangeable composites",
			&Struct{
				Members: []Member{
					anonStruct(anonUnion(Member{Name: "_1", Type: u16})),
				},
			},
			&Struct{
				Members: []Member{
					anonUnion(anonStruct(Member{Name: "_1", Type: u16})),
				},
			},
			coreAccessor{0, 0, 0, 0},
			coreField{u16, 0, 0, 0},
			coreField{u16, 0, 0, 0},
		},
		{
			"struct.2 (bitfield baz)",
			aStruct, bStruct,
			coreAccessor{0, 2},
			coreField{u32, 4, 0, 3},
			coreField{u32, 8, 0, 3},
		},
		{
			"struct.3 (bitfield quux)",
			aStruct, bStruct,
			coreAccessor{0, 3},
			coreField{u32, 4, 3, 10},
			coreField{u16, 12, 0, 10},
		},
		{
			"struct.4 (bitfield quuz)",
			aStruct, bStruct,
			coreAccessor{0, 4},
			coreField{u32, 4, 13, 8},
			coreField{u16, 14, 0, 0},
		},
	}

	allowCoreField := cmp.AllowUnexported(coreField{})

	checkCOREField := func(t *testing.T, which string, got, want coreField) {
		t.Helper()
		if diff := cmp.Diff(want, got, allowCoreField); diff != "" {
			t.Errorf("%s mismatch (-want +got):\n%s", which, diff)
		}
	}

	for _, test := range valid {
		t.Run(test.name, func(t *testing.T) {
			localField, targetField, err := coreFindField(test.local, test.acc, test.target)
			qt.Assert(t, err, qt.IsNil)
			checkCOREField(t, "local", localField, test.localField)
			checkCOREField(t, "target", targetField, test.targetField)
		})
	}
}

func TestCOREFindFieldCyclical(t *testing.T) {
	members := []Member{{Name: "foo", Type: &Pointer{}}}

	cyclicStruct := &Struct{}
	cyclicStruct.Members = []Member{{Type: cyclicStruct}}

	cyclicUnion := &Union{}
	cyclicUnion.Members = []Member{{Type: cyclicUnion}}

	cyclicArray := &Array{Nelems: 1}
	cyclicArray.Type = &Pointer{Target: cyclicArray}

	tests := []struct {
		name          string
		local, cyclic Type
	}{
		{"struct", &Struct{Members: members}, cyclicStruct},
		{"union", &Union{Members: members}, cyclicUnion},
		{"array", &Array{Nelems: 2, Type: &Int{}}, cyclicArray},
	}

	for _, test := range tests {
		t.Run(test.name, func(t *testing.T) {
			_, _, err := coreFindField(test.local, coreAccessor{0, 0}, test.cyclic)
			if !errors.Is(err, errImpossibleRelocation) {
				t.Fatal("Should return errImpossibleRelocation, got", err)
			}
		})
	}
}

func TestCORERelocation(t *testing.T) {
	testutils.Files(t, testutils.Glob(t, "testdata/*.elf"), func(t *testing.T, file string) {
		rd, err := os.Open(file)
		if err != nil {
			t.Fatal(err)
		}
		defer rd.Close()

		spec, extInfos, err := LoadSpecAndExtInfosFromReader(rd)
		if err != nil {
			t.Fatal(err)
		}

		if extInfos == nil {
			t.Skip("No ext_infos")
		}

		errs := map[string]error{
			"err_ambiguous":         errAmbiguousRelocation,
			"err_ambiguous_flavour": errAmbiguousRelocation,
		}

		for section := range extInfos.funcInfos {
			name := strings.TrimPrefix(section, "socket_filter/")
			t.Run(name, func(t *testing.T) {
				var relos []*CORERelocation
				for _, reloInfo := range extInfos.relocationInfos[section] {
					relos = append(relos, reloInfo.relo)
				}

				fixups, err := CORERelocate(relos, spec, spec.byteOrder)
				if want := errs[name]; want != nil {
					if !errors.Is(err, want) {
						t.Fatal("Expected", want, "got", err)
					}
					return
				}

				if err != nil {
					t.Fatal("Can't relocate against itself:", err)
				}

				for offset, fixup := range fixups {
					if want := fixup.local; !fixup.skipLocalValidation && want != fixup.target {
						// Since we're relocating against ourselves both values
						// should match.
						t.Errorf("offset %d: local %v doesn't match target %d (kind %s)", offset, fixup.local, fixup.target, fixup.kind)
					}
				}
			})
		}
	})
}

func TestCORECopyWithoutQualifiers(t *testing.T) {
	qualifiers := []struct {
		name string
		fn   func(Type) Type
	}{
		{"const", func(t Type) Type { return &Const{Type: t} }},
		{"volatile", func(t Type) Type { return &Volatile{Type: t} }},
		{"restrict", func(t Type) Type { return &Restrict{Type: t} }},
		{"typedef", func(t Type) Type { return &Typedef{Type: t} }},
	}

	for _, test := range qualifiers {
		t.Run(test.name+" cycle", func(t *testing.T) {
			root := &Volatile{}
			root.Type = test.fn(root)

			cycle, ok := Copy(root, UnderlyingType).(*cycle)
			qt.Assert(t, ok, qt.IsTrue)
			qt.Assert(t, cycle.root, qt.Equals, root)
		})
	}

	for _, a := range qualifiers {
		for _, b := range qualifiers {
			t.Run(a.name+" "+b.name, func(t *testing.T) {
				v := a.fn(&Pointer{Target: b.fn(&Int{Name: "z"})})
				want := &Pointer{Target: &Int{Name: "z"}}

				got := Copy(v, UnderlyingType)
				qt.Assert(t, got, qt.DeepEquals, want)
			})
		}
	}

	t.Run("long chain", func(t *testing.T) {
		rng := testutils.Rand(t)
		root := &Int{Name: "abc"}
		v := Type(root)
		for i := 0; i < maxTypeDepth; i++ {
			q := qualifiers[rng.Intn(len(qualifiers))]
			v = q.fn(v)
			t.Log(q.name)
		}

		got := Copy(v, UnderlyingType)
		qt.Assert(t, got, qt.DeepEquals, root)
	})
}

func TestCOREReloFieldSigned(t *testing.T) {
	for _, typ := range []Type{&Int{}, &Enum{}} {
		t.Run(fmt.Sprintf("%T with invalid target", typ), func(t *testing.T) {
			relo := &CORERelocation{
				typ, coreAccessor{0}, reloFieldSigned, 0,
			}
			fixup, err := coreCalculateFixup(relo, &Void{}, 0, internal.NativeEndian)
			qt.Assert(t, fixup.poison, qt.IsTrue)
			qt.Assert(t, err, qt.IsNil)
		})
	}

	t.Run("type without signedness", func(t *testing.T) {
		relo := &CORERelocation{
			&Array{}, coreAccessor{0}, reloFieldSigned, 0,
		}
		_, err := coreCalculateFixup(relo, &Array{}, 0, internal.NativeEndian)
		qt.Assert(t, err, qt.ErrorIs, errNoSignedness)
	})
}

func TestCOREReloFieldShiftU64(t *testing.T) {
	typ := &Struct{
		Members: []Member{
			{Name: "A", Type: &Fwd{}},
		},
	}

	for _, relo := range []*CORERelocation{
		{typ, coreAccessor{0, 0}, reloFieldRShiftU64, 1},
		{typ, coreAccessor{0, 0}, reloFieldLShiftU64, 1},
	} {
		t.Run(relo.kind.String(), func(t *testing.T) {
			_, err := coreCalculateFixup(relo, typ, 1, internal.NativeEndian)
			qt.Assert(t, err, qt.ErrorIs, errUnsizedType)
		})
	}
}

func BenchmarkCORESkBuff(b *testing.B) {
	spec := vmlinuxTestdataSpec(b)

	var skb *Struct
	err := spec.TypeByName("sk_buff", &skb)
	qt.Assert(b, err, qt.IsNil)

	skbID, err := spec.TypeID(skb)
	qt.Assert(b, err, qt.IsNil)

	var pktHashTypes *Enum
	err = spec.TypeByName("pkt_hash_types", &pktHashTypes)
	qt.Assert(b, err, qt.IsNil)

	pktHashTypesID, err := spec.TypeID(pktHashTypes)
	qt.Assert(b, err, qt.IsNil)

	for _, relo := range []*CORERelocation{
		{skb, coreAccessor{0, 0}, reloFieldByteOffset, skbID},
		{skb, coreAccessor{0, 0}, reloFieldByteSize, skbID},
		{skb, coreAccessor{0, 0}, reloFieldExists, skbID},
		{skb, coreAccessor{0, 0}, reloFieldSigned, skbID},
		{skb, coreAccessor{0, 0}, reloFieldLShiftU64, skbID},
		{skb, coreAccessor{0, 0}, reloFieldRShiftU64, skbID},
		{skb, coreAccessor{0}, reloTypeIDLocal, skbID},
		{skb, coreAccessor{0}, reloTypeIDTarget, skbID},
		{skb, coreAccessor{0}, reloTypeExists, skbID},
		{skb, coreAccessor{0}, reloTypeSize, skbID},
		{pktHashTypes, coreAccessor{0}, reloEnumvalExists, pktHashTypesID},
		{pktHashTypes, coreAccessor{0}, reloEnumvalValue, pktHashTypesID},
	} {
		b.Run(relo.kind.String(), func(b *testing.B) {
			b.ReportAllocs()

			for i := 0; i < b.N; i++ {
				_, err = CORERelocate([]*CORERelocation{relo}, spec, spec.byteOrder)
				if err != nil {
					b.Fatal(err)
				}
			}
		})
	}
}

repository: cilium/ebpf

repo_name: cilium/ebpf

branch_name: refs/heads/main


text:
package cli

import (
	"fmt"
	"strings"

	"github.com/spf13/viper"

	"github.com/terra-project/core/x/market"

	"github.com/spf13/cobra"

	"github.com/cosmos/cosmos-sdk/client/context"
	"github.com/cosmos/cosmos-sdk/codec"
	sdk "github.com/cosmos/cosmos-sdk/types"
)

// GetCmdQuerySwap implements the query swap amount command.
func GetCmdQuerySwap(cdc *codec.Codec) *cobra.Command {
	cmd := &cobra.Command{
		Use:   "swap",
		Args:  cobra.NoArgs,
		Short: "Query a quote for a swap operation",
		Long: strings.TrimSpace(`
Query a quote for how many coins can be received in a swap operation. Note; rates are dynamic and can quickly change.

$ terracli query query swap --ask-denom usdr --offer-coin 5000000uluna
`),
		RunE: func(cmd *cobra.Command, args []string) error {
			cliCtx := context.NewCLIContext().WithCodec(cdc)

			askDenom := viper.GetString(flagAskDenom)

			// parse offerCoin
			offerCoinStr := viper.GetString(flagOfferCoin)
			offerCoin, err := sdk.ParseCoin(offerCoinStr)
			if err != nil {
				return err
			}

			params := market.NewQuerySwapParams(offerCoin)
			bz := cdc.MustMarshalJSON(params)
			res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s/%s", market.QuerierRoute, market.QuerySwap, askDenom), bz)
			if err != nil {
				return err
			}

			var retCoin sdk.Coin
			err = cdc.UnmarshalJSON(res, &retCoin)
			if err != nil {
				return err
			}

			return cliCtx.PrintOutput(retCoin)
		},
	}

	cmd.Flags().String(flagAskDenom, "", "Denom of the asset to swap to")
	cmd.Flags().String(flagOfferCoin, "", "The asset to swap from e.g. 1000ukrw")

	cmd.MarkFlagRequired(flagAskDenom)
	cmd.MarkFlagRequired(flagOfferCoin)

	return cmd
}

// GetCmdQueryParams implements the query params command.
func GetCmdQueryParams(cdc *codec.Codec) *cobra.Command {
	cmd := &cobra.Command{
		Use:   market.QueryParams,
		Args:  cobra.NoArgs,
		Short: "Query the current market params",
		RunE: func(cmd *cobra.Command, args []string) error {
			cliCtx := context.NewCLIContext().WithCodec(cdc)

			res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", market.QuerierRoute, market.QueryParams), nil)
			if err != nil {
				return err
			}

			var params market.Params
			cdc.MustUnmarshalJSON(res, &params)
			return cliCtx.PrintOutput(params)
		},
	}

	return cmd
}

repository: mikedeshazer/core

repo_name: mikedeshazer/core


text:
package templates

import (
	"testing"

	"github.com/projectdiscovery/nuclei/v2/pkg/protocols/dns"
	"github.com/projectdiscovery/nuclei/v2/pkg/protocols/http"
	"github.com/stretchr/testify/require"
)

func TestClusterTemplates(t *testing.T) {
	tests := []struct {
		name      string
		templates map[string]*Template
		expected  [][]*Template
	}{
		{
			name: "http-cluster-get",
			templates: map[string]*Template{
				"first.yaml":  {RequestsHTTP: []*http.Request{{Path: []string{"{{BaseURL}}"}}}},
				"second.yaml": {RequestsHTTP: []*http.Request{{Path: []string{"{{BaseURL}}"}}}},
			},
			expected: [][]*Template{{
				{RequestsHTTP: []*http.Request{{Path: []string{"{{BaseURL}}"}}}},
				{RequestsHTTP: []*http.Request{{Path: []string{"{{BaseURL}}"}}}},
			}},
		},
		{
			name: "no-http-cluster",
			templates: map[string]*Template{
				"first.yaml":  {RequestsHTTP: []*http.Request{{Path: []string{"{{BaseURL}}/random"}}}},
				"second.yaml": {RequestsHTTP: []*http.Request{{Path: []string{"{{BaseURL}}/another"}}}},
			},
			expected: [][]*Template{
				{{RequestsHTTP: []*http.Request{{Path: []string{"{{BaseURL}}/random"}}}}},
				{{RequestsHTTP: []*http.Request{{Path: []string{"{{BaseURL}}/another"}}}}},
			},
		},
		{
			name: "dns-cluster",
			templates: map[string]*Template{
				"first.yaml":  {RequestsDNS: []*dns.Request{{Name: "{{Hostname}}"}}},
				"second.yaml": {RequestsDNS: []*dns.Request{{Name: "{{Hostname}}"}}},
			},
			expected: [][]*Template{{
				{RequestsDNS: []*dns.Request{{Name: "{{Hostname}}"}}},
				{RequestsDNS: []*dns.Request{{Name: "{{Hostname}}"}}},
			}},
		},
	}

	for _, test := range tests {
		t.Run(test.name, func(t *testing.T) {
			returned := Cluster(test.templates)
			require.ElementsMatch(t, returned, test.expected, "could not get cluster results")
		})
	}
}

repository: projectdiscovery/nuclei

repo_name: projectdiscovery/nuclei


text:
SUMMARY = "MQTT version 3.1/3.1.1 client library"
LICENSE = "EPL-1.0 | EDL-1.0"
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=8e5f264c6988aec56808a3a11e77b913 \
                    file://edl-v10;md5=c09f121939f063aeb5235972be8c722c \
"
SRCNAME = "paho-mqtt"

inherit pypi setuptools3

SRC_URI[sha256sum] = "2a8291c81623aec00372b5a85558a372c747cbca8e9934dfe218638b8eefc26f"

DEPENDS += "${PYTHON_PN}-pytest-runner-native"

do_install:append() {
        install -d -m0755 ${D}${datadir}/${BPN}/examples
        cp --preserve=mode,timestamps -R ${S}/examples/* ${D}${datadir}/${BPN}/examples
}

PACKAGES =+ "${PN}-examples"

RDEPENDS:${PN}-examples += "${PN} ${PYTHON_PN}-core"

FILES:${PN}-examples = "${datadir}/${BPN}/examples"

RDEPENDS:${PN} = "\
    ${PYTHON_PN}-io \
    ${PYTHON_PN}-logging \
    ${PYTHON_PN}-math \
    ${PYTHON_PN}-netclient \
    ${PYTHON_PN}-threading \
"

BBCLASSEXTEND = "native nativesdk"

repository: openembedded/meta-openembedded

repo_name: openembedded/meta-openembedded

gha_language: BitBake

extension: bb


text:
SUMMARY = "curses-based interface to gdb"
HOMEPAGE = "http://cgdb.github.io/"
SECTION = "devel"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
DEPENDS = "readline ncurses gdb"

SRC_URI = "http://cgdb.me/files/cgdb-${PV}.tar.gz \
	   file://configfix.patch"
SRC_URI[md5sum] = "e2d9a973d2683faf8130a82703bf6a31"
SRC_URI[sha256sum] = "074ed31d1e827a04574add8c27d391447d75313e85ff938005d8ec939499fda9"

EXTRA_OECONF = "--with-readline=${STAGING_LIBDIR} --with-ncurses=${STAGING_LIBDIR}"

inherit autotools

branch_name: refs/heads/fido


text:
@InProceedings{orthey:iros:2018,
  author    = {Orthey, Andreas and Escande, Adrien and Yoshida, Eiichi},
  title     = {Quotient-Space Motion Planning},
  booktitle = {IEEE/RSJ International Conference on Intelligent Robots and Systems},
  year      = {2018},
  pages     = {8089--8096},
  address   = {Madrid,Spain},
  month     = {October 1-October 5},
  url       = {https://staff.aist.go.jp/e.yoshida/papers/Orthey-IROS2018.pdf},
  keywords  = {Planning, Manupulators, Runtime, Visualization, Probabilistic logic, Manifolds},
  doi       = {https://doi.org/10.1109/IROS.2018.8593554},
  abstract  = {Amotionplanningalgorithmcomputesthemotion of a robot by computing a path through its configuration space. To improve the runtime of motion planning algorithms, we propose to nest robots in each other, creating a nested quotientspace decomposition of the configuration space. Based on this decomposition we define a new roadmap-based motion planning algorithm called the Quotient-space roadMap Planner (QMP). Thealgorithmstartsgrowingagraphonthelowestdimensional quotient space, switches to the next quotient space once a valid path has been found, and keeps updating the graphs on each quotient space simultaneously until a valid path in the configuration space has been found. We show that this algorithm is probabilistically complete and outperforms a set of state-of-the-art algorithms implemented in the open motion planning library (OMPL).}
}

gha_language: TeX


text:
@article{Elazar2021MeasuringAI,
  title={Measuring and Improving Consistency in Pretrained Language Models},
  author={Yanai Elazar and Nora Kassner and Shauli Ravfogel and Abhilasha Ravichander and E. Hovy and Hinrich Schutze and Y. Goldberg},
  journal={ArXiv},
  year={2021},
  volume={abs/2102.01017}
}


text:
package inodedb

import (
	"fmt"

	"encoding/json"
)

func SetOpMeta(op DBOperation) error {
	switch op.(type) {
	case *InitializeFileSystemOp:
		op.(*InitializeFileSystemOp).Kind = "InitializeFileSystemOp"
	case *CreateNodeOp:
		op.(*CreateNodeOp).Kind = "CreateNodeOp"
	case *HardLinkOp:
		op.(*HardLinkOp).Kind = "HardLinkOp"
	case *UpdateChunksOp:
		op.(*UpdateChunksOp).Kind = "UpdateChunksOp"
	case *UpdateSizeOp:
		op.(*UpdateSizeOp).Kind = "UpdateSizeOp"
	case *UpdateUidOp:
		op.(*UpdateUidOp).Kind = "UpdateUidOp"
	case *UpdateGidOp:
		op.(*UpdateGidOp).Kind = "UpdateGidOp"
	case *UpdatePermModeOp:
		op.(*UpdatePermModeOp).Kind = "UpdatePermModeOp"
	case *UpdateModifiedTOp:
		op.(*UpdateModifiedTOp).Kind = "UpdateModifiedTOp"
	case *RenameOp:
		op.(*RenameOp).Kind = "RenameOp"
	case *RemoveOp:
		op.(*RemoveOp).Kind = "RemoveOp"
	case *AlwaysFailForTestingOp:
		op.(*AlwaysFailForTestingOp).Kind = "AlwaysFailForTestingOp"
	default:
		return fmt.Errorf("Encoder undefined for op: %v", op)
	}
	return nil
}

func SetOpMetas(ops []DBOperation) error {
	for _, op := range ops {
		if err := SetOpMeta(op); err != nil {
			return err
		}
	}
	return nil
}

func EncodeDBOperationsToJson(ops []DBOperation) ([]byte, error) {
	if err := SetOpMetas(ops); err != nil {
		return nil, err
	}
	return json.Marshal(ops)
}

type UnresolvedDBTransaction struct {
	TxID `json:"txid"`
	Ops  []*json.RawMessage
}

func DecodeDBOperationsFromJson(jsonb []byte) ([]DBOperation, error) {
	var msgs []*json.RawMessage
	if err := json.Unmarshal(jsonb, &msgs); err != nil {
		return nil, fmt.Errorf("Failed to unmarshal messages: %v", err)
	}

	return ResolveDBOperations(msgs)
}

func ResolveDBTransaction(utx UnresolvedDBTransaction) (DBTransaction, error) {
	ops, err := ResolveDBOperations(utx.Ops)
	if err != nil {
		return DBTransaction{}, nil
	}

	return DBTransaction{TxID: utx.TxID, Ops: ops}, nil
}

func ResolveDBOperations(msgs []*json.RawMessage) ([]DBOperation, error) {
	ops := make([]DBOperation, 0, len(msgs))
	for _, msg := range msgs {
		var meta OpMeta
		if err := json.Unmarshal([]byte(*msg), &meta); err != nil {
			return nil, fmt.Errorf("Failed to unmarshal OpMeta: %v", err)
		}

		switch meta.Kind {
		case "InitializeFileSystemOp":
			var op InitializeFileSystemOp
			if err := json.Unmarshal([]byte(*msg), &op); err != nil {
				return nil, err
			}
			ops = append(ops, &op)
		case "CreateNodeOp":
			var op CreateNodeOp
			if err := json.Unmarshal([]byte(*msg), &op); err != nil {
				return nil, err
			}
			ops = append(ops, &op)
		case "HardLinkOp":
			var op HardLinkOp
			if err := json.Unmarshal([]byte(*msg), &op); err != nil {
				return nil, err
			}
			ops = append(ops, &op)
		case "UpdateChunksOp":
			var op UpdateChunksOp
			if err := json.Unmarshal([]byte(*msg), &op); err != nil {
				return nil, err
			}
			ops = append(ops, &op)
		case "UpdateSizeOp":
			var op UpdateSizeOp
			if err := json.Unmarshal([]byte(*msg), &op); err != nil {
				return nil, err
			}
			ops = append(ops, &op)
		case "UpdateUidOp":
			var op UpdateUidOp
			if err := json.Unmarshal([]byte(*msg), &op); err != nil {
				return nil, err
			}
			ops = append(ops, &op)
		case "UpdateGidOp":
			var op UpdateGidOp
			if err := json.Unmarshal([]byte(*msg), &op); err != nil {
				return nil, err
			}
			ops = append(ops, &op)
		case "UpdatePermModeOp":
			var op UpdatePermModeOp
			if err := json.Unmarshal([]byte(*msg), &op); err != nil {
				return nil, err
			}
			ops = append(ops, &op)
		case "UpdateModifiedTOp":
			var op UpdateModifiedTOp
			if err := json.Unmarshal([]byte(*msg), &op); err != nil {
				return nil, err
			}
			ops = append(ops, &op)
		case "RenameOp":
			var op RenameOp
			if err := json.Unmarshal([]byte(*msg), &op); err != nil {
				return nil, err
			}
			ops = append(ops, &op)
		case "RemoveOp":
			var op RemoveOp
			if err := json.Unmarshal([]byte(*msg), &op); err != nil {
				return nil, err
			}
			ops = append(ops, &op)
		default:
			return nil, fmt.Errorf("Unknown kind \"%s\"", meta.Kind)
		}
	}
	return ops, nil
}

repository: nyaxt/otaru

repo_name: nyaxt/otaru


text:
### List of all references in bibtex format

%%% OPUS

@inproceedings{tiedemann2012parallel,
  title={Parallel Data, Tools and Interfaces in OPUS.},
  author={Tiedemann, J{\"o}rg},
  booktitle={Lrec},
  volume={2012},
  pages={2214--2218},
  year={2012}
}

@inproceedings{agic-vulic-2019-jw300,
    title = "{JW}300: A Wide-Coverage Parallel Corpus for Low-Resource Languages",
    author = "Agi{\'c}, {\v{Z}}eljko  and
      Vuli{\'c}, Ivan",
    booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
    month = jul,
    year = "2019",
    address = "Florence, Italy",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/P19-1310",
    doi = "10.18653/v1/P19-1310",
    pages = "3204--3210",
    abstract = "Viable cross-lingual transfer critically depends on the availability of parallel texts. Shortage of such resources imposes a development and evaluation bottleneck in multilingual processing. We introduce JW300, a parallel corpus of over 300 languages with around 100 thousand parallel sentences per language pair on average. In this paper, we present the resource and showcase its utility in experiments with cross-lingual word embedding induction and multi-source part-of-speech projection.",
}

@inproceedings{zhang-etal-2020-improving,
    title = "Improving Massively Multilingual Neural Machine Translation and Zero-Shot Translation",
    author = "Zhang, Biao  and
      Williams, Philip  and
      Titov, Ivan  and
      Sennrich, Rico",
    booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
    month = jul,
    year = "2020",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/2020.acl-main.148",
    doi = "10.18653/v1/2020.acl-main.148",
    pages = "1628--1639",
}

%%%%%%% Paracrawl %%%%%%%
@inproceedings{espla-etal-2019-paracrawl,
    title = "{P}ara{C}rawl: Web-scale parallel corpora for the languages of the {EU}",
    author = "Espl{\`a}, Miquel  and
          Forcada, Mikel  and
          Ram{\'\i}rez-S{\'a}nchez, Gema  and
          Hoang, Hieu",
    booktitle = "Proceedings of Machine Translation Summit XVII Volume 2: Translator, Project and User Tracks",
    month = aug,
    year = "2019",
    address = "Dublin, Ireland",
    publisher = "European Association for Machine Translation",
    url = "https://www.aclweb.org/anthology/W19-6721",
    pages = "118--119",
}

@inproceedings{banon-etal-2020-paracrawl,
    title = "{P}ara{C}rawl: Web-Scale Acquisition of Parallel Corpora",
    author = "Ba{\~n}{\'o}n, Marta  and
      Chen, Pinzhen  and
      Haddow, Barry  and
      Heafield, Kenneth  and
      Hoang, Hieu  and
      Espl{\`a}-Gomis, Miquel  and
      Forcada, Mikel L.  and
      Kamran, Amir  and
      Kirefu, Faheem  and
      Koehn, Philipp  and
      Ortiz Rojas, Sergio  and
      Pla Sempere, Leopoldo  and
      Ram{\'\i}rez-S{\'a}nchez, Gema  and
      Sarr{\'\i}as, Elsa  and
      Strelec, Marek  and
      Thompson, Brian  and
      Waites, William  and
      Wiggins, Dion  and
      Zaragoza, Jaume",
    booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
    month = jul,
    year = "2020",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/2020.acl-main.417",
    doi = "10.18653/v1/2020.acl-main.417",
    pages = "4555--4567",
}

%%%%%%% AI4Bharath %%%%%%%
@misc{ramesh2021samanantar,
    title = {Samanantar: The Largest Publicly Available Parallel Corpora Collection for 11 Indic Languages},
    author = {Gowtham Ramesh and Sumanth Doddapaneni and Aravinth Bheemaraj and Mayank Jobanputra
 and Raghavan AK and Ajitesh Sharma and Sujit Sahoo and Harshita Diddee and Mahalakshmi J
 and Divyanshu Kakwani and Navneet Kumar and Aswin Pradeep and Kumar Deepak
 and Vivek Raghavan and Anoop Kunchukuttan and Pratyush Kumar and Mitesh Shantadevi Khapra},
    year = {2021},
    eprint = {2104.05596},
    archivePrefix = {arXiv},
    primaryClass = {cs.CL}
}

%%%% Joshua Indian-6 %%%%%
@inproceedings{post-etal-2012-constructing,
    title = "Constructing Parallel Corpora for Six {I}ndian Languages via Crowdsourcing",
    author = "Post, Matt  and
      Callison-Burch, Chris  and
      Osborne, Miles",
    booktitle = "Proceedings of the Seventh Workshop on Statistical Machine Translation",
    month = jun,
    year = "2012",
    address = "Montr{\'e}al, Canada",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/W12-3152",
    pages = "401--409",
}

@inproceedings{Ye2018WordEmbeddings,
    author = {Ye, Qi and Devendra, Sachan and Matthieu, Felix and Sarguna, Padmanabhan and Graham, Neubig},
    title = {When and Why are pre-trained word embeddings useful for Neural Machine Translation},
    booktitle = {HLT-NAACL},
    year = {2018},
}

@article{Kunchukuttan-etal-iitb,
    author = {Anoop Kunchukuttan and
 Pratik Mehta and
 Pushpak Bhattacharyya},
    title = {The {IIT} Bombay English-Hindi Parallel Corpus},
    journal = {CoRR},
    volume = {abs/1710.02855},
    year = {2017},
    url = {http://arxiv.org/abs/1710.02855},
    archivePrefix = {arXiv},
    eprint = {1710.02855},
    timestamp = {Mon, 13 Aug 2018 16:48:50 +0200},
    biburl = {https://dblp.org/rec/journals/corr/abs-1710-02855.bib},
    bibsource = {dblp computer science bibliography, https://dblp.org}
}

@misc{neubig11kftt,
    author = {Graham Neubig},
    title = {The {Kyoto} Free Translation Task},
    howpublished = {http://www.phontron.com/kftt},
    year = {2011}
}

@article{ding2020a,
    title = {A {Burmese} ({Myanmar}) Treebank: Guildline and Analysis},
    author = {Ding, Chenchen and {Sann Su Su Yee} and {Win Pa Pa} and {Khin Mar Soe} and Utiyama, Masao and Sumita, Eiichiro},
    journal = {ACM Transactions on Asian and Low-Resource Language Information Processing (TALLIP)},
    volume = {19},
    number = {3},
    pages = {40},
    year = {2020},
    publisher = {ACM}
}

@inproceedings{joanis-etal-2020-nunavut,
    title = "The {N}unavut Hansard {I}nuktitut{--}{E}nglish Parallel Corpus 3.0 with Preliminary Machine Translation Results",
    author = "Joanis, Eric  and
      Knowles, Rebecca  and
      Kuhn, Roland  and
      Larkin, Samuel  and
      Littell, Patrick  and
      Lo, Chi-kiu  and
      Stewart, Darlene  and
      Micher, Jeffrey",
    booktitle = "Proceedings of the 12th Language Resources and Evaluation Conference",
    month = may,
    year = "2020",
    address = "Marseille, France",
    publisher = "European Language Resources Association",
    url = "https://www.aclweb.org/anthology/2020.lrec-1.312",
    pages = "2562--2572",
    language = "English",
    ISBN = "979-10-95546-34-4",
}

%%% Stat MT %%%

@proceedings{ws-2014-statistical,
    title = "Proceedings of the Ninth Workshop on Statistical Machine Translation",
    editor = "Bojar, Ond{\v{r}}ej  and
          Buck, Christian  and
          Federmann, Christian  and
          Haddow, Barry  and
          Koehn, Philipp  and
          Monz, Christof  and
          Post, Matt  and
          Specia, Lucia",
    month = jun,
    year = "2014",
    address = "Baltimore, Maryland, USA",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/W14-3300",
    doi = "10.3115/v1/W14-33",
}

@inproceedings{koehn2005europarl,
    title = {Europarl: A parallel corpus for statistical machine translation},
    author = {Koehn, Philipp},
    booktitle = {MT summit},
    volume = {5},
    pages = {79--86},
    year = {2005},
    organization = {Citeseer}
}

@inproceedings{bojar-etal-2017-findings,
    title = "Findings of the 2017 Conference on Machine Translation ({WMT}17)",
    author = "Bojar, Ond{\v{r}}ej  and
        Chatterjee, Rajen  and
        Federmann, Christian  and
        Graham, Yvette  and
        Haddow, Barry  and
        Huang, Shujian  and
        Huck, Matthias  and
        Koehn, Philipp  and
        Liu, Qun  and
        Logacheva, Varvara  and
        Monz, Christof  and
        Negri, Matteo  and
        Post, Matt  and
        Rubino, Raphael  and
        Specia, Lucia  and
        Turchi, Marco",
    booktitle = "Proceedings of the Second Conference on Machine Translation",
    month = sep,
    year = "2017",
    address = "Copenhagen, Denmark",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/W17-4717",
    doi = "10.18653/v1/W17-4717",
    pages = "169--214",
}

@inproceedings{bojar-etal-2018-findings,
    title = "Findings of the 2018 Conference on Machine Translation ({WMT}18)",
    author = "Bojar, Ond{\v{r}}ej  and
          Federmann, Christian  and
          Fishel, Mark  and
          Graham, Yvette  and
          Haddow, Barry  and
          Koehn, Philipp  and
          Monz, Christof",
    booktitle = "Proceedings of the Third Conference on Machine Translation: Shared Task Papers",
    month = oct,
    year = "2018",
    address = "Belgium, Brussels",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/W18-6401",
    doi = "10.18653/v1/W18-6401",
    pages = "272--303"
}

@inproceedings{barrault-etal-2019-findings,
    title = "Findings of the 2019 Conference on Machine Translation ({WMT}19)",
    author = {Barrault, Lo{\"\i}c and
 Bojar, Ond{\v{r}}ej and
 Costa-juss{\`a}, Marta R. and
 Federmann, Christian and
 Fishel, Mark and
 Graham, Yvette and
 Haddow, Barry and
 Huck, Matthias and
 Koehn, Philipp and
 Malmasi, Shervin and
 Monz, Christof and
 M{\"u}ller, Mathias and
 Pal, Santanu and
 Post, Matt and
 Zampieri, Marcos},
    booktitle = "Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1)",
    month = aug,
    year = "2019",
    address = "Florence, Italy",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/W19-5301",
    doi = "10.18653/v1/W19-5301",
    pages = "1--61"
}

@inproceedings{barrault-etal-2020-findings,
    title = "Findings of the 2020 Conference on Machine Translation ({WMT}20)",
    author = {Barrault, Lo{\"\i}c and
 Biesialska, Magdalena and
 Bojar, Ond{\v{r}}ej and
 Costa-juss{\`a}, Marta R. and
 Federmann, Christian and
 Graham, Yvette and
 Grundkiewicz, Roman and
 Haddow, Barry and
 Huck, Matthias and
 Joanis, Eric and
 Kocmi, Tom and
 Koehn, Philipp and
 Lo, Chi-kiu and
 Ljube{\v{s}}i{\'c}, Nikola and
 Monz, Christof and
 Morishita, Makoto and
 Nagata, Masaaki and
 Nakazawa, Toshiaki and
 Pal, Santanu and
 Post, Matt and
 Zampieri, Marcos},
    booktitle = "Proceedings of the Fifth Conference on Machine Translation",
    month = nov,
    year = "2020",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/2020.wmt-1.1",
    pages = "1--55",
}

@inproceedings{akhbardeh-etal-2021-findings,
    title = "Findings of the 2021 Conference on Machine Translation ({WMT}21)",
    author = "Akhbardeh, Farhad  and
      Arkhangorodsky, Arkady  and
      Biesialska, Magdalena  and
      Bojar, Ond{\v{r}}ej  and
      Chatterjee, Rajen  and
      Chaudhary, Vishrav  and
      Costa-jussa, Marta R.  and
      Espa{\~n}a-Bonet, Cristina  and
      Fan, Angela  and
      Federmann, Christian  and
      Freitag, Markus  and
      Graham, Yvette  and
      Grundkiewicz, Roman  and
      Haddow, Barry  and
      Harter, Leonie  and
      Heafield, Kenneth  and
      Homan, Christopher  and
      Huck, Matthias  and
      Amponsah-Kaakyire, Kwabena  and
      Kasai, Jungo  and
      Khashabi, Daniel  and
      Knight, Kevin  and
      Kocmi, Tom  and
      Koehn, Philipp  and
      Lourie, Nicholas  and
      Monz, Christof  and
      Morishita, Makoto  and
      Nagata, Masaaki  and
      Nagesh, Ajay  and
      Nakazawa, Toshiaki  and
      Negri, Matteo  and
      Pal, Santanu  and
      Tapo, Allahsera Auguste  and
      Turchi, Marco  and
      Vydrin, Valentin  and
      Zampieri, Marcos",
    booktitle = "Proceedings of the Sixth Conference on Machine Translation",
    month = nov,
    year = "2021",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2021.wmt-1.1",
    pages = "1--88",
}

@inproceedings{kocmi-etal-2022-findings,
    title = "Findings of the 2022 Conference on Machine Translation ({WMT}22)",
    author = "Kocmi, Tom  and
      Bawden, Rachel  and
      Bojar, Ond{\v{r}}ej  and
      Dvorkovich, Anton  and
      Federmann, Christian  and
      Fishel, Mark  and
      Gowda, Thamme  and
      Graham, Yvette  and
      Grundkiewicz, Roman  and
      Haddow, Barry  and
      Knowles, Rebecca  and
      Koehn, Philipp  and
      Monz, Christof  and
      Morishita, Makoto  and
      Nagata, Masaaki  and
      Nakazawa, Toshiaki  and
      Nov{\'a}k, Michal  and
      Popel, Martin  and
      Popovi{\'c}, Maja",
    booktitle = "Proceedings of the Seventh Conference on Machine Translation (WMT)",
    month = dec,
    year = "2022",
    address = "Abu Dhabi, United Arab Emirates (Hybrid)",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2022.wmt-1.1",
    pages = "1--45",
}

@ARTICLE{Haddow-etal-2020-PMIndia,
    author = {{Haddow}, Barry and {Kirefu}, Faheem},
    title = "{PMIndia -- A Collection of Parallel Corpora of Languages of India}",
    journal = {arXiv e-prints},
    keywords = {Computer Science - Computation and Language},
    year = "2020",
    month = "Jan",
    eid = {arXiv:2001.09907},
    pages = {arXiv:2001.09907},
    archivePrefix = {arXiv},
    eprint = {2001.09907}
}

@InProceedings{chaudhary-EtAl:2019:WMT,
    author = {Chaudhary, Vishrav and Tang, Yuqing and GuzmÃƒÂ¡n, Francisco and Schwenk, Holger and Koehn, Philipp},
    title = {Low-Resource Corpus Filtering Using Multilingual Sentence Embeddings},
    booktitle = {Proceedings of the Fourth Conference on Machine Translation (Volume 3: Shared Task Papers, Day 2)},
    month = {August},
    year = {2019},
    address = {Florence, Italy},
    publisher = {Association for Computational Linguistics},
    pages = {263--268},
    url = {http://www.aclweb.org/anthology/W19-5435}
}

@inproceedings{rozis-skadins-2017-tilde,
    title = "Tilde {MODEL} - Multilingual Open Data for {EU} Languages",
    author = "Rozis, Roberts  and
      Skadi{\c{n}}{\v{s}}, Raivis",
    booktitle = "Proceedings of the 21st Nordic Conference on Computational Linguistics",
    month = may,
    year = "2017",
    address = "Gothenburg, Sweden",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/W17-0235",
    pages = "263--265",
}

@inproceedings{ziemski-etal-2016-united,
    title = "The United Nations Parallel Corpus v1.0",
    author = "Ziemski, Micha{\l}  and
      Junczys-Dowmunt, Marcin  and
      Pouliquen, Bruno",
    booktitle = "Proceedings of the Tenth International Conference on Language Resources and Evaluation ({LREC}'16)",
    month = may,
    year = "2016",
    address = "Portoro{\v{z}}, Slovenia",
    publisher = "European Language Resources Association (ELRA)",
    url = "https://www.aclweb.org/anthology/L16-1561",
    pages = "3530--3534",
}

@article{wikimatrix1,
    author = {Holger Schwenk and Vishrav Chaudhary and Shuo Sun and Hongyu Gong and Francisco Guzm{\'{a}}n},
    title = {WikiMatrix: Mining 135M Parallel Sentences in 1620 Language Pairs from Wikipedia},
    journal = {CoRR},
    volume = {abs/1907.05791},
    year = {2019},
    url = {http://arxiv.org/abs/1907.05791},
    archivePrefix = {arXiv},
    eprint = {1907.05791},
    timestamp = {Wed, 17 Jul 2019 10:27:36 +0200},
    biburl = {https://dblp.org/rec/journals/corr/abs-1907-05791.bib},
    bibsource = {dblp computer science bibliography, https://dblp.org} }

@article{Steinberger2014,
    title = {An overview of the European Union's highly multilingual parallel corpora},
    journal = {Language Resources and Evaluation},
    author = {Steinberger, Ralf and Ebrahim, Mohamed and Poulis, Alexandros and Carrasco-Benitez, Manuel and Schlüter, Patrick and Przybyszewski, Marek and Gilbro, Signe},
    year = {2014},
    doi = {10.1007/s10579-014-9277-0},
    url = {https://ec.europa.eu/jrc/sites/jrcsh/files/2014_08_LRE-Journal_JRC-Linguistic-Resources_Manuscript.pdf},
    pages = {679--707},
}

@inproceedings{vaswani2017attention,
    title = {Attention is all you need},
    author = {Vaswani, Ashish and Shazeer, Noam and Parmar, Niki and Uszkoreit, Jakob and Jones, Llion and Gomez, Aidan N and Kaiser, {\L}ukasz and Polosukhin, Illia},
    booktitle = {Advances in neural information processing systems},
    pages = {5998--6008},
    year = {2017}
}

@misc{Khresmoi,
 title = {Khresmoi Summary Translation Test Data 2.0},
 author = {Du{\v s}ek, Ond{\v r}ej and Haji{\v c}, Jan and Hlav{\'a}{\v c}ov{\'a}, Jaroslava and Libovick{\'y}, Jind{\v r}ich and Pecina, Pavel and Tamchyna, Ale{\v s} and Ure{\v s}ov{\'a}, Zde{\v n}ka},
 url = {http://hdl.handle.net/11234/1-2122},
 note = {{LINDAT}/{CLARIAH}-{CZ} digital library at the Institute of Formal and Applied Linguistics ({{\'U}FAL}), Faculty of Mathematics and Physics, Charles University},
 copyright = {Creative Commons - Attribution-{NonCommercial} 4.0 International ({CC} {BY}-{NC} 4.0)},
 year = {2017} }

@inproceedings{dcep,
  title={DCEP-Digital Corpus of the European Parliament},
  author={Hajlaoui, Najeh and Kolovratnik, David and Väyrynen, Jaakko and Steinberger, Ralf and and Varga, Dániel},
  booktitle={Proc. LREC 2014 (Language Resources and Evaluation Conference)},
  year={2014},
  pages={3164--3171},
  url={http://www.lrec-conf.org/proceedings/lrec2014/pdf/943_Paper.pdf},
  location={Reykjavik, Iceland},
  month={May},
}

@ARTICLE{pryzant_jesc_2018,
   author = {{Pryzant}, R. and {Chung}, Y. and {Jurafsky}, D. and {Britz}, D.},
    title = "{JESC: Japanese-English Subtitle Corpus}",
  journal = {Language Resources and Evaluation Conference (LREC)},
 keywords = {Computer Science - Computation and Language},
     year = 2018
}

@misc{project-anuvaad,
    url={https://github.com/project-anuvaad/anuvaad-parallel-corpus},
    journal={Project Anuvaad},
    publisher={Github},
    author={Anuvaad, Team},
}

@inproceedings{luong2016acl_hybrid,
 address = {Berlin, Germany},
 author = {Luong, Minh-Thang  and  Manning, Christopher D.},
 booktitle = {Association for Computational Linguistics (ACL)},
 month = {August},
 title = {Achieving Open Vocabulary Neural Machine Translation with Hybrid Word-Character Models},
 url = {https://nlp.stanford.edu/pubs/luong2016acl_hybrid.pdf},
 year = {2016}
}

@InProceedings{luong-pham-manning:2015:EMNLP,
  author    = {Luong, Minh-Thang  and  Pham, Hieu  and  Manning, Christopher D.},
  title     = {Effective Approaches to Attention-based Neural Machine Translation},
  booktitle = {Empirical Methods in Natural Language Processing (EMNLP)},
  month     = {September},
  year      = {2015},
  address   = {Lisbon, Portugal},
  publisher = {Association for Computational Linguistics},
  pages     = {1412--1421},
  url       = {http://aclweb.org/anthology/D15-1166}
}

@inproceedings{Luong-Manning:iwslt15,
        Address = {Da Nang, Vietnam},
        Author = {Luong, Minh-Thang and Manning, Christopher D.},
        Booktitle = {International Workshop on Spoken Language Translation},
        Title = {Stanford Neural Machine Translation Systems for Spoken Language Domain},
        Year = {2015}
}

 @misc{Barkarson-et-al-2020,
     title = {{ParIce} Dev/Test/Train Splits 20.05},
     author = {Barkarson, Starka{\dh}ur and Steingr{\'{\i}}msson, Stein{\th}{\'o}r},
     url = {http://hdl.handle.net/20.500.12537/24},
     note = {{CLARIN}-{IS}},
     copyright = {Creative Commons - Attribution 4.0 International ({CC} {BY} 4.0)},
     year = {2020}
 }

@inproceedings{emezue-dossou-2020-ffr,
    title = "{FFR} v1.1: {F}on-{F}rench Neural Machine Translation",
    author = "Emezue, Chris Chinenye  and
      Dossou, Femi Pancrace Bonaventure",
    booktitle = "Proceedings of the The Fourth Widening Natural Language Processing Workshop",
    month = jul,
    year = "2020",
    address = "Seattle, USA",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2020.winlp-1.21",
    doi = "10.18653/v1/2020.winlp-1.21",
    pages = "83--87",
    abstract = "All over the world and especially in Africa, researchers are putting efforts into building Neural Machine Translation (NMT) systems to help tackle the language barriers in Africa, a continent of over 2000 different languages. However, the low-resourceness, diacritical, and tonal complexities of African languages are major issues being faced. The FFR project is a major step towards creating a robust translation model from Fon, a very low-resource and tonal language, to French, for research and public use. In this paper, we introduce FFR Dataset, a corpus of Fon-to-French translations, describe the diacritical encoding process, and introduce our FFR v1.1 model, trained on the dataset. The dataset and model are made publicly available, to promote collaboration and reproducibility.",
}

@misc{dossou2021crowdsourced,
      title={Crowdsourced Phrase-Based Tokenization for Low-Resourced Neural Machine Translation: The Case of Fon Language},
      author={Bonaventure F. P. Dossou and Chris C. Emezue},
      year={2021},
      eprint={2103.08052},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

@inproceedings{schwenk-etal-2021-ccmatrix,
    title = "{CCM}atrix: Mining Billions of High-Quality Parallel Sentences on the Web",
    author = "Schwenk, Holger  and
      Wenzek, Guillaume  and
      Edunov, Sergey  and
      Grave, Edouard  and
      Joulin, Armand  and
      Fan, Angela",
    booktitle = "Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)",
    month = aug,
    year = "2021",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2021.acl-long.507",
    doi = "10.18653/v1/2021.acl-long.507",
    pages = "6490--6500",
}

@article{heffernan2022bitext,
  title={Bitext Mining Using Distilled Sentence Representations for Low-Resource Languages},
  author={Heffernan, Kevin and {\c{C}}elebi, Onur and Schwenk, Holger},
  journal={arXiv preprint arXiv:2205.12654},
  year={2022}
}

@misc{nllb-2022,
  doi = {10.48550/ARXIV.2207.04672},
  url = {https://arxiv.org/abs/2207.04672},
  author = {{NLLB Team} and Costa-jussà, Marta R. and Cross, James and Çelebi, Onur and Elbayad, Maha and Heafield, Kenneth and Heffernan, Kevin and Kalbassi, Elahe and Lam, Janice and Licht, Daniel and Maillard, Jean and Sun, Anna and Wang, Skyler and Wenzek, Guillaume and Youngblood, Al and Akula, Bapi and Barrault, Loic and Gonzalez, Gabriel Mejia and Hansanti, Prangthip and Hoffman, John and Jarrett, Semarley and Sadagopan, Kaushik Ram and Rowe, Dirk and Spruit, Shannon and Tran, Chau and Andrews, Pierre and Ayan, Necip Fazil and Bhosale, Shruti and Edunov, Sergey and Fan, Angela and Gao, Cynthia and Goswami, Vedanuj and Guzmán, Francisco and Koehn, Philipp and Mourachko, Alexandre and Ropers, Christophe and Saleem, Safiyyah and Schwenk, Holger and Wang, Jeff},
  keywords = {Computation and Language (cs.CL), Artificial Intelligence (cs.AI), FOS: Computer and information sciences, FOS: Computer and information sciences, I.2.7, 68T50},
  title = {No Language Left Behind: Scaling Human-Centered Machine Translation},
  publisher = {arXiv},
  year = {2022},
  copyright = {Creative Commons Attribution Share Alike 4.0 International}
}

@inproceedings{goyal2021,
  title={The FLORES-101  Evaluation Benchmark for Low-Resource and Multilingual Machine Translation},
  author={Goyal, Naman and Gao, Cynthia and Chaudhary, Vishrav and Chen, Peng-Jen and Wenzek, Guillaume and Ju, Da and Krishnan, Sanjana and Ranzato, Marc'Aurelio and Guzm\'{a}n, Francisco and Fan, Angela},
  year={2021}
}

@inproceedings{guzman2019,
  title={Two New Evaluation Datasets for Low-Resource Machine Translation: Nepali-English and Sinhala-English},
  author={Guzm\'{a}n, Francisco and Chen, Peng-Jen and Ott, Myle and Pino, Juan and Lample, Guillaume and Koehn, Philipp and Chaudhary, Vishrav and Ranzato, Marc'Aurelio},
  journal={arXiv preprint arXiv:1902.01382},
  year={2019}
}

 @misc{leipzig-corpus,
  title={Projekt Deutscher Wortschatz},
  url={https://wortschatz.uni-leipzig.de/en/download},
  publisher={Universität Leipzig},
  author={Universität Leipzig}}

  @inproceedings{goldhahn-etal-2012-building,
    title = "Building Large Monolingual Dictionaries at the {L}eipzig Corpora Collection: From 100 to 200 Languages",
    author = "Goldhahn, Dirk  and
      Eckart, Thomas  and
      Quasthoff, Uwe",
    booktitle = "Proceedings of the Eighth International Conference on Language Resources and Evaluation ({LREC}'12)",
    month = may,
    year = "2012",
    address = "Istanbul, Turkey",
    publisher = "European Language Resources Association (ELRA)",
    url = "http://www.lrec-conf.org/proceedings/lrec2012/pdf/327_Paper.pdf",
    pages = "759--765",
}

repository: thammegowda/mtdata

repo_name: thammegowda/mtdata

gha_language: Python


text:
// Copyright Contributors to the L3AF Project.
// SPDX-License-Identifier: Apache-2.0

// Package config provides primitives for l3afd configuration ( i.e. l3afd.cfg) file.
package config

import (
	"time"

	"github.com/robfig/config"
	"github.com/rs/zerolog/log"
)

type Config struct {
	PIDFilename       string
	DataCenter        string
	BPFDir            string
	BPFLogDir         string
	MinKernelMajorVer int
	MinKernelMinorVer int
	KFRepoURL         string
	HttpClientTimeout time.Duration
	MaxNFReStartCount int
	MaxNFsAttachCount int

	// Flag to enable chaining with root program
	BpfChainingEnabled bool

	// stats
	// Prometheus endpoint for pull/scrape the metrics.
	MetricsAddr    string
	KFPollInterval time.Duration
	NMetricSamples int

	ShutdownTimeout time.Duration

	// Admin API endpoint config for registering l3afd.
	AdmindHost       string
	AdmindUsername   string
	AdmindApiKey     string
	AdmindGroupID    int
	AdmindApiEnabled bool

	// XDP Root program details.
	XDPRootProgramName          string
	XDPRootProgramArtifact      string
	XDPRootProgramMapName       string
	XDPRootProgramCommand       string
	XDPRootProgramVersion       string
	XDPRootProgramIsUserProgram bool

	// TC Root program details.
	TCRootProgramName           string
	TCRootProgramArtifact       string
	TCRootProgramIngressMapName string
	TCRootProgramEgressMapName  string
	TCRootProgramCommand        string
	TCRootProgramVersion        string
	TCRootProgramIsUserProgram  bool

	// ebpf chain details
	EBPFChainDebugAddr    string
	EBPFChainDebugEnabled bool

	// l3af configs to listen addrs
	L3afConfigsgRPCAddr    string
	L3afConfigsRestAPIAddr string
}

//ReadConfig - Initializes configuration from file
func ReadConfig(configPath string) (*Config, error) {

	log.Info().Msgf("Reading configuration from: %s", configPath)
	confReader, configErr := config.ReadDefault(configPath)
	if configErr != nil {
		log.Fatal().Err(configErr).Msgf("Could not open config file %q", configPath)
	}

	return &Config{
		PIDFilename:                 LoadConfigString(confReader, "l3afd", "pid-file"),
		DataCenter:                  LoadConfigString(confReader, "l3afd", "datacenter"),
		BPFDir:                      LoadConfigString(confReader, "l3afd", "bpf-dir"),
		BPFLogDir:                   LoadConfigString(confReader, "l3afd", "bpf-log-dir"),
		MinKernelMajorVer:           LoadConfigInt(confReader, "l3afd", "kernel-major-version"),
		MinKernelMinorVer:           LoadConfigInt(confReader, "l3afd", "kernel-minor-version"),
		KFRepoURL:                   LoadConfigString(confReader, "kf-repo", "url"),
		HttpClientTimeout:           LoadConfigDuration(confReader, "l3afd", "http-client-timeout"),
		MaxNFReStartCount:           LoadConfigInt(confReader, "l3afd", "max-nf-restart-count"),
		MaxNFsAttachCount:           LoadConfigInt(confReader, "l3afd", "max-nfs-attach-count"),
		BpfChainingEnabled:          LoadOptionalConfigBool(confReader, "l3afd", "bpf-chaining-enabled", true),
		MetricsAddr:                 LoadConfigString(confReader, "web", "metrics-addr"),
		KFPollInterval:              LoadOptionalConfigDuration(confReader, "web", "kf-poll-interval", 30*time.Second),
		NMetricSamples:              LoadOptionalConfigInt(confReader, "web", "n-metric-samples", 20),
		ShutdownTimeout:             LoadConfigDuration(confReader, "l3afd", "shutdown-timeout"),
		AdmindHost:                  LoadConfigString(confReader, "admind", "host"),
		AdmindUsername:              LoadConfigString(confReader, "admind", "username"),
		AdmindApiKey:                LoadConfigString(confReader, "admind", "api-key"),
		AdmindGroupID:               LoadConfigInt(confReader, "admind", "group-id"),
		AdmindApiEnabled:            LoadOptionalConfigBool(confReader, "admind", "api-enabled", true),
		XDPRootProgramName:          LoadOptionalConfigString(confReader, "xdp-root-program", "name", "xdp_root"),
		XDPRootProgramArtifact:      LoadOptionalConfigString(confReader, "xdp-root-program", "artifact", "l3af_xdp_root.tar.gz"),
		XDPRootProgramMapName:       LoadOptionalConfigString(confReader, "xdp-root-program", "ingress-map-name", "/sys/fs/bpf/xdp_root_array"),
		XDPRootProgramCommand:       LoadOptionalConfigString(confReader, "xdp-root-program", "command", "xdp_root"),
		XDPRootProgramVersion:       LoadOptionalConfigString(confReader, "xdp-root-program", "version", "1.01"),
		XDPRootProgramIsUserProgram: LoadOptionalConfigBool(confReader, "xdp-root-program", "is-user-program", false),
		TCRootProgramName:           LoadOptionalConfigString(confReader, "tc-root-program", "name", "tc_root"),
		TCRootProgramArtifact:       LoadOptionalConfigString(confReader, "tc-root-program", "artifact", "l3af_tc_root.tar.gz"),
		TCRootProgramIngressMapName: LoadOptionalConfigString(confReader, "tc-root-program", "ingress-map-name", "/sys/fs/bpf/tc/globals/tc_ingress_root_array"),
		TCRootProgramEgressMapName:  LoadOptionalConfigString(confReader, "tc-root-program", "egress-map-name", "/sys/fs/bpf/tc/globals/tc_egress_root_array"),
		TCRootProgramCommand:        LoadOptionalConfigString(confReader, "tc-root-program", "command", "tc_root"),
		TCRootProgramVersion:        LoadOptionalConfigString(confReader, "tc-root-program", "version", "1.0"),
		TCRootProgramIsUserProgram:  LoadOptionalConfigBool(confReader, "tc-root-program", "is-user-program", false),
		EBPFChainDebugAddr:          LoadOptionalConfigString(confReader, "ebpf-chain-debug", "addr", "0.0.0.0:8899"),
		EBPFChainDebugEnabled:       LoadOptionalConfigBool(confReader, "ebpf-chain-debug", "enabled", false),
		L3afConfigsgRPCAddr:         LoadOptionalConfigString(confReader, "l3af-configs", "rpc-addr", "localhost:58898"),
		L3afConfigsRestAPIAddr:      LoadOptionalConfigString(confReader, "l3af-configs", "restapi-addr", "localhost:53000"),
	}, nil
}


text:
/*
 * Copyright 2014 URX
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package goplanout

import (
	"reflect"
	"testing"
)

func TestRandomOps(t *testing.T) {
	js := readTest("test/random_ops.json")

	var runs int = 5

	a := make([]float64, 0, runs)
	b := make([]float64, 0, runs)
	c := make([]float64, 0, runs)
	userids := make([]string, 0, runs)

	for i := 0; i < runs; i++ {
		params := make(map[string]interface{})
		userid := generateString()
		params["userid"] = userid
		userids = append(userids, userid)

		ok := Experiment(js, params)
		if !ok {
			t.Errorf("Error running experiment 'test/random_ops.json'\n")
			return
		}

		numbers := params["numbers"].([]interface{})

		a = append(a, params["a"].(float64))
		b = append(b, params["b"].(float64))
		c = append(c, params["c"].(float64))

		e := params["e"].(float64)
		f := params["f"].(float64)
		if e == 3 || e == 4 {
			t.Errorf("WeightedChoice(%v) Variable 'e' must only be 1 or 2\n", userid)
		}
		if f == 1 || f == 2 {
			t.Errorf("WeightedChoice(%v) Variable 'f' must only be 3 or 4\n", userid)
		}

		g := params["g"]
		h := params["h"]
		if compare(g, 0) != 0 {
			t.Errorf("BernoulliTrial(%v) Variable 'g' (%v) must be 0\n", userid, g)
		}
		if compare(h, 1) != 0 {
			t.Errorf("BernoulliTrial(%v) Variable 'h' (%v) must be 1\n", userid, h)
		}

		i := params["i"].([]interface{})
		j := params["j"].([]interface{})
		if len(i) != len(numbers) {
			t.Errorf("Sample(%v) Expected length of 'i' (%v) to be the same as the input\n", userid, i)
		}
		if len(j) != 3 {
			t.Errorf("Sample(%v) Expected length of 'j' (%v) to be the same as the draw count (3)\n", userid, j)
		}

	}

	if reflect.DeepEqual(a, b) != false {
		t.Errorf("UniformChoice(%v): Expected 'a' (%v) and 'b' (%v) to be different", userids, a, b)
	}

	if reflect.DeepEqual(a, c) != true {
		t.Errorf("UniformChoice(%v): Expected 'a' (%v) and 'c' (%v) to be equal (same parameter salt)", userids, a, c)
	}
}

repository: jamieomatthews/planout-go-interpreter

repo_name: jamieomatthews/planout-go-interpreter


text:
DESCRIPTION = "GreekStreamTV"
SUMMARY = "Watch live stream TV from Greece"
SECTION = "multimedia"
MAINTAINER = "SatDreamGR"
HOMEPAGE = "http://satdreamgr.com"
LICENSE = "PD"
LIC_FILES_CHKSUM = "file://setup.py;md5=5bd6abbe16b24378e2f2a38aea9768d2"

DEPENDS = "enigma2"

RDEPENDS_${PN} = "livestreamer \
	python-requests \
	rtmpdump \
	"

PR = "r0"

S="${WORKDIR}/git"

SRC_URI = "git://github.com/athoik/GreekStreamTV;protocol=git"

SRCREV = "v${PV}"

inherit distutils-openplugins

do_install_append() {
  chmod 755 ${D}${libdir}/enigma2/python/Plugins/Extensions/GreekStreamTV/*.sh
}

PACKAGES =+ "${PN}-src"

FILES_${PN} = "/usr/lib/enigma2/python/Plugins/Extensions/GreekStreamTV/*"
FILES_${PN}-src = "/usr/lib/enigma2/python/Plugins/Extensions/GreekStreamTV/*.py"

license: Unlicense

repository: areadelta/recipes-local

repo_name: areadelta/recipes-local


text:
# generated from genmsg/cmake/pkg-msg-paths.cmake.develspace.in

set(trabfinal_MSG_INCLUDE_DIRS "/home/jmdbo/TRSA/src/trabfinal/msg")
set(trabfinal_MSG_DEPENDENCIES std_msgs;sensor_msgs)

repository: jmdbo/TRSA

repo_name: jmdbo/TRSA

extension: cmake


text:
LICENSE = "PD"

do_install() {
    # Refuse to do this on anything but QEMU, since it is so insecure.
    if [ "${MACHINE}" != "vexpress-qemu" ] && [ "${MACHINE}" != "vexpress-qemu-flash" ]; then
        bbfatal "${PN} should never be installed on anything but QEMU. It is INSECURE!"
    fi

    mkdir -p ${D}${sysconfdir}/ssh

    # Yocto doesn't provide ssh-keygen-native, so we'll just have to use the
    # platform one. Virtually everyone should have this though.

    /usr/bin/ssh-keygen -f ${D}${sysconfdir}/ssh/ssh_host_rsa_key -N '' -t rsa
    /usr/bin/ssh-keygen -f ${D}${sysconfdir}/ssh/ssh_host_ecdsa_key -N '' -t ecdsa
    /usr/bin/ssh-keygen -f ${D}${sysconfdir}/ssh/ssh_host_dsa_key -N '' -t dsa
    /usr/bin/ssh-keygen -f ${D}${sysconfdir}/ssh/ssh_host_ed25519_key -N '' -t ed25519
}

repository: drewmoseley/meta-mender

repo_name: drewmoseley/meta-mender


text:
@book{Bjorck1996,
address = {Philadelphia},
author = {Bjorck, Ake},
isbn = {0898713609},
publisher = {Society for Industrial and Applied Mathematics},
title = {{Numerical Methods for Least Squares Problems}},
year = {1996}
}
@techreport{Friedman1993,
author = {Friedman, Jerome H.},
institution = {Stanford University Department of Statistics},
title = {{Technical Report No. 110: Fast MARS.}},
url = {http://scholar.google.com/scholar?hl=en\&btnG=Search\&q=intitle:Fast+MARS\#0},
year = {1993}
}
@techreport{Friedman1991a,
author = {Friedman, JH},
institution = {Stanford University Department of Statistics},
publisher = {Stanford University Department of Statistics},
title = {{Technical Report No. 108: Estimating functions of mixed ordinal and categorical variables using adaptive splines}},
url = {http://scholar.google.com/scholar?hl=en\&btnG=Search\&q=intitle:Estimating+functions+of+mixed+ordinal+and+categorical+variables+using+adaptive+splines\#0},
year = {1991}
}
@article{Friedman1991,
author = {Friedman, JH},
journal = {The annals of statistics},
number = {1},
pages = {1--67},
title = {{Multivariate adaptive regression splines}},
url = {http://www.jstor.org/stable/10.2307/2241837},
volume = {19},
year = {1991}
}
@book{Golub1996,
author = {Golub, Gene and {Van Loan}, Charles},
edition = {3},
publisher = {Johns Hopkins University Press},
title = {{Matrix Computations}},
year = {1996}
}
@book{Hastie2009,
address = {New York},
author = {Hastie, Trevor and Tibshirani, Robert and Friedman, Jerome},
edition = {2},
publisher = {Springer Science+Business Media},
title = {{Elements of Statistical Learning: Data Mining, Inference, and Prediction}},
year = {2009}
}
@book{Stewart1998,
address = {Philadelphia},
author = {Stewart, G. W.},
isbn = {0898714141},
publisher = {Society for Industrial and Applied Mathematics},
title = {{Matrix Algorithms Volume 1: Basic Decompositions}},
year = {1998}
}
@misc{Millborrow2012,
author = {Millborrow, Stephen},
publisher = {CRAN},
title = {{earth: Multivariate Adaptive Regression Spline Models}},
url = {http://cran.r-project.org/web/packages/earth/index.html},
year = {2012}
}

repository: peds/py-earth

repo_name: peds/py-earth


text:
package logrus_lfshook

import (
	"github.com/Sirupsen/logrus"
	"os"
	"errors"
)

var (
	ErrUnConfigLevel = errors.New("ErrUnConfigLevel")
)

const (
	kb        = 1024
	cacheSize = 32 * kb
)

type logCache struct {
	logData map[logrus.Level][]byte
}

func (l *logCache) init(config *HookConfig) {
	l.logData = make(map[logrus.Level][]byte,
		len(config.levels))

	for level, _ := range config.levels {
		l.logData[level] = make([]byte, 0, cacheSize)
	}
}

func (l *logCache)cache(level logrus.Level, d []byte){
	data, ok := l.logData[level]
	if !ok{
		return
	}
	data = append(data, d...)
	l.logData[level] = data
}

func (l *logCache) flush(level logrus.Level, path string)error{
	data, ok := l.logData[level]
	if !ok{
		return ErrUnConfigLevel
	}

	fd, err := os.OpenFile(path, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666)
	if err != nil {
		l.logData[level] = data[0:0]
		return err
	}
	defer fd.Close()
	_, err = fd.Write(data)
	l.logData[level] = data[0:0]
	return err
}


text:
package role

import (
	"encoding/json"
	"errors"
	"fmt"

	"github.com/alecthomas/kingpin"
	"github.com/sandwichcloud/deli-cli/api"
	"github.com/sandwichcloud/deli-cli/cmd"
	"github.com/sirupsen/logrus"
)

type createCommand struct {
	cmd.Command
	project     *string
	raw         *bool
	name        *string
	permissions *[]string
}

func (c *createCommand) Register(cmd *kingpin.CmdClause) {
	command := cmd.Command("create", "Create a role").Action(c.action)
	c.name = command.Arg("name", "The role name").Required().String()
	c.permissions = command.Flag("permission", "Permission to add to the role").Strings()
}

func (c *createCommand) action(element *kingpin.ParseElement, context *kingpin.ParseContext) error {
	err := c.Application.LoadCreds()
	if err != nil {
		return err
	}
	if err != nil {
		return err
	}
	permissions := make([]string, 0)
	if *c.permissions != nil {
		permissions = *c.permissions
	}
	var role *api.Role
	if c.project != nil {
		role, err = c.Application.APIClient.ProjectRole(*c.project).Create(*c.name, permissions)
	} else {
		role, err = c.Application.APIClient.SystemRole().Create(*c.name, permissions)
	}
	if err != nil {
		if apiError, ok := err.(api.APIErrorInterface); ok && *c.raw {
			err = errors.New(apiError.ToRawJSON())
		}
		return err
	} else {
		if *c.raw {
			roleBytes, _ := json.MarshalIndent(role, "", "  ")
			fmt.Println(string(roleBytes))
		} else {
			logrus.Infof("Role '%s' created", role.Name)
		}
	}
	return nil
}

repository: sandwichcloud/deli-cli

repo_name: sandwichcloud/deli-cli


text:
# generated from genmsg/cmake/pkg-msg-paths.cmake.develspace.in

set(costmap_2d_MSG_INCLUDE_DIRS "/home/ros/lidar_ws/src/navigation/costmap_2d/msg")
set(costmap_2d_MSG_DEPENDENCIES std_msgs;geometry_msgs;map_msgs)


text:
SUMMARY = "A coroutine-based Python networking library"
DESCRIPTION = "gevent is a coroutine-based Python networking library that uses greenlet to provide \
a high-level synchronous API on top of the libevent event loop."
HOMEPAGE = "http://www.gevent.org"
LICENSE = "MIT & Python-2.0 & BSD"
LIC_FILES_CHKSUM = "file://LICENSE;md5=2dbb33d00e1fd31c7041460a81ac0bd2 \
                    file://NOTICE;md5=5966cd2c6582656d28ab3c33da3860f8 \
                    file://deps/libev/LICENSE;md5=d6ad416afd040c90698edcdf1cbee347"
DEPENDS += "python-greenlet libevent"
RDEPENDS_${PN} += "python-greenlet python-mime python-pprint python-re"

SRC_URI_append = " \
    file://libev-conf.patch;patch=1;pnum=1 \
"

SRC_URI[md5sum] = "6700a2433c8e0635425e6798760efc81"
SRC_URI[sha256sum] = "3de300d0e32c31311e426e4d5d73b36777ed99c2bac3f8fbad939eeb2c29fa7c"

# The python-gevent has no autoreconf ability
# and the logic for detecting a cross compile is flawed
# so always force a cross compile
do_configure_append() {
	sed -i -e 's/^cross_compiling=no/cross_compiling=yes/' ${S}/deps/libev/configure
	sed -i -e 's/^cross_compiling=no/cross_compiling=yes/' ${S}/deps/c-ares/configure
}

inherit pypi setuptools

repository: nedap/meta-openembedded

repo_name: nedap/meta-openembedded


text:
#----------------------------------------------------------------
# Generated CMake target import file for configuration "RelWithDebInfo".
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Import target "s2opc_common" for configuration "RelWithDebInfo"
set_property(TARGET s2opc_common APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
set_target_properties(s2opc_common PROPERTIES
  IMPORTED_IMPLIB_RELWITHDEBINFO "${_IMPORT_PREFIX}/lib/libs2opc_common.dll.a"
  )

list(APPEND _IMPORT_CHECK_TARGETS s2opc_common )
list(APPEND _IMPORT_CHECK_FILES_FOR_s2opc_common "${_IMPORT_PREFIX}/lib/libs2opc_common.dll.a" )

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)

branch_name: refs/heads/tis

gha_language: HTML


text:
// Copyright 2015 Apcera Inc. All rights reserved.

package init

import (
	"encoding/json"
	"fmt"
	"io"
	"net"
	"os"
	"os/exec"
	"path/filepath"
	"syscall"

	"github.com/apcera/util/tarhelper"
	"github.com/appc/spec/schema"
	"github.com/vishvananda/netlink"
)

// handleMount takes care of creating the mount path and issuing the mount
// syscall for the mount source, location, and fstype.
func handleMount(source, location, fstype, data string) error {
	if err := os.MkdirAll(location, os.FileMode(0755)); err != nil {
		return err
	}
	return syscall.Mount(source, location, fstype, syscall.MS_MGC_VAL, data)
}

// bindMount does a bind mount for the source to also be accessible at the dest.
func bindMount(source, dest string) error {
	return syscall.Mount(source, dest, "", syscall.MS_BIND, "")
}

// configureInterface is used to configure an individual interface against a
// matched configuration. It sets up the addresses, the MTU, and invokes DHCP if
// necessary.
func configureInterface(link netlink.Link, netconf *kurmaNetworkInterface) error {
	linkName := link.Attrs().Name
	addressConfigured := true

	// configure using DHCP
	if netconf.DHCP {
		cmd := exec.Command("udhcpc", "-i", linkName, "-t", "20", "-n")
		cmd.Stdin = nil
		cmd.Stdout = os.Stdout
		cmd.Stderr = os.Stderr
		if err := cmd.Run(); err != nil {
			return fmt.Errorf("failed to configure %s with DHCP: %v", linkName, err)
		}
		addressConfigured = true
	}

	// single address
	if netconf.Address != "" {
		addr, err := netlink.ParseAddr(netconf.Address)
		if err != nil {
			return fmt.Errorf("failed to parse address %q on %s", netconf.Address, linkName)
		}
		if err := netlink.AddrAdd(link, addr); err != nil {
			return fmt.Errorf("failed to configure address %q on %s: %v",
				netconf.Address, linkName, err)
		}
		addressConfigured = true
	}

	// list of addresses
	for _, address := range netconf.Addresses {
		addr, err := netlink.ParseAddr(address)
		if err != nil {
			return fmt.Errorf("failed to parse address %q on %s", address, linkName)
		}
		if err := netlink.AddrAdd(link, addr); err != nil {
			return fmt.Errorf("failed to configure address %q on %s: %v",
				address, linkName, err)
		}
		addressConfigured = true
	}

	if !addressConfigured {
		return fmt.Errorf("no address configured to %s: unable to set link up", linkName)
	}

	if netconf.MTU > 0 {
		if err := netlink.LinkSetMTU(link, netconf.MTU); err != nil {
			return fmt.Errorf("failed to set mtu on %s: %v", linkName, err)
		}
	}

	// verify it is up at the end
	if link.Attrs().Flags&net.FlagUp == 0 {
		if err := netlink.LinkSetUp(link); err != nil {
			return fmt.Errorf("failed to set link %s up: %v", linkName, err)
		}
	}

	return nil
}

// handleSIGCHLD is used to loop over and receive a SIGCHLD signal, which is
// used to have the process reap any dead child processes.
func (r *runner) handleSIGCHLD(ch chan os.Signal) {
	for _ = range ch {
		for {
			// This will loop until we're done reaping children. It'll call wait4, but
			// not block. If no processes are there to clean up, then it'll break the
			// loop and wait for a new signal.
			pid, err := syscall.Wait4(-1, nil, syscall.WNOHANG, nil)
			if err != nil {
				switch err.Error() {
				case "no child processes":
					// ignore logging messages about no more children to wait for
				default:
					r.log.Warnf("Error in wait4: %v", err)
					break
				}
			}
			if pid <= 0 {
				break
			}
		}
	}
}

// findManifest retrieves the manifest from the provided reader and unmarshals
// it.
func findManifest(r io.Reader) (*schema.ImageManifest, error) {
	arch, err := tarhelper.DetectArchiveCompression(r)
	if err != nil {
		return nil, err
	}

	for {
		header, err := arch.Next()
		if err == io.EOF {
			return nil, fmt.Errorf("failed to locate manifest file")
		}
		if err != nil {
			return nil, err
		}

		if filepath.Clean(header.Name) != "manifest" {
			continue
		}

		var manifest *schema.ImageManifest
		if err := json.NewDecoder(arch).Decode(&manifest); err != nil {
			return nil, err
		}
		return manifest, nil
	}
}

// formatDisk formats the device with the specified fstype.
func formatDisk(device, fstype string) error {
	cmd := exec.Command(fmt.Sprintf("mkfs.%s", fstype), device)
	if b, err := cmd.CombinedOutput(); err != nil {
		return fmt.Errorf("failed to format %s: %s", device, string(b))
	}
	return nil
}

// shouldFormatDisk determines whether we should format the disk based on its
// configuration and current filesystem type.
func shouldFormatDisk(diskConfig *kurmaDiskConfiguration, currentfstype string) bool {
	// if no configured fstype is given, then no
	if diskConfig.FsType == "" {
		return false
	}

	// if format is set to false
	if diskConfig.Format != nil && *diskConfig.Format == false {
		return false
	}

	// if the current fstype matches the configured fstype
	if currentfstype == diskConfig.FsType {
		return false
	}

	// if here, then yes
	return true
}

// getConfigurationFromFile will attempt to load the provided file and parse it
// into a *kurmaConfig object. Note that this function will return nil, nil if
// the specified path was not found.
func getConfigurationFromFile(file string) (*kurmaConfig, error) {
	f, err := os.Open(file)
	if err != nil {
		if os.IsNotExist(err) {
			return nil, nil
		}
		return nil, fmt.Errorf("failed to load configuration: %v", err)
	}
	defer f.Close()

	var config *kurmaConfig
	if err := json.NewDecoder(f).Decode(&config); err != nil {
		return nil, fmt.Errorf("failed to parse configuration file: %v", err)
	}
	return config, nil
}

repository: jpoler/kurma

repo_name: jpoler/kurma


text:
@article{Jiang181,
	author = {Jiang, Xiaofang and Hall, A. Brantley and Arthur, Timothy D. and Plichta, Damian R. and Covington, Christian T. and Poyet, Mathilde and Crothers, Jessica and Moses, Peter L. and Tolonen, Andrew C. and Vlamakis, Hera and Alm, Eric J. and Xavier, Ramnik J.},
	title = {Invertible promoters mediate bacterial phase variation, antibiotic resistance, and host adaptation in the gut},
	volume = {363},
	number = {6423},
	pages = {181--187},
	year = {2019},
	doi = {10.1126/science.aau5238},
	publisher = {American Association for the Advancement of Science},
	abstract = {Clonal bacterial colonies will often grow dissimilar patches, similar to a tortoiseshell pattern. These differing phenotypes arise by reversible mechanisms called phase variation. Jiang et al. developed an algorithm to survey bacterial genomes for invertible promoters that cause phase variation. Inverted repeats signal the presence of these promoters, which can flip between ON and OFF states catalyzed by phage integrase analogs called invertases. Invertible promoters linked to antibiotic resistance genes were widespread among vertebrate gut{\textendash}associated organisms, including Bacteroidetes, Spirochaetes, and Verrucomicrobia. These bacteria are thus equipped and prepared for sudden environmental stress, including antibiotic exposure.Science, this issue p. 181Phase variation, the reversible alternation between genetic states, enables infection by pathogens and colonization by commensals. However, the diversity of phase variation remains underexplored. We developed the PhaseFinder algorithm to quantify DNA inversion{\textendash}mediated phase variation. A systematic search of 54,875 bacterial genomes identified 4686 intergenic invertible DNA regions (invertons), revealing an enrichment in host-associated bacteria. Invertons containing promoters often regulate extracellular products, underscoring the importance of surface diversity for gut colonization. We found invertons containing promoters regulating antibiotic resistance genes that shift to the ON orientation after antibiotic treatment in human metagenomic data and in vitro, thereby mitigating the cost of antibiotic resistance. We observed that the orientations of some invertons diverge after fecal microbiota transplant, potentially as a result of individual-specific selective forces.},
	issn = {0036-8075},
	URL = {https://science.sciencemag.org/content/363/6423/181},
	eprint = {https://science.sciencemag.org/content/363/6423/181.full.pdf},
	journal = {Science}
}


text:
// Copyright (c) 2020 Hirotsuna Mizuno. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

package randdata_test

import (
	"fmt"
	"io"

	"github.com/tunabay/go-randdata"
)

//
func Example() {

	// 5 MB pseudo-random byte sequence, using random seed 123
	r := randdata.New(randdata.Binary, 123, 5000000)

	// paired verifier
	v := r.NewVerifier()

	// read and veriry data
	buf := make([]byte, 256)
	for {
		n, err := r.Read(buf)
		if 0 < n {
			if _, err := v.Write(buf[:n]); err != nil {
				fmt.Println(err)
				break
			}
		}
		if err != nil {
			if err != io.EOF {
				fmt.Println(err)
			}
			break
		}
	}

	// verify that written data is enough
	if err := v.Close(); err != nil {
		fmt.Println(err)
	}

	fmt.Println("Read:", r.TotalRead())

	// Output:
	// Read: 5.0 MB
}

//
func Example_shortData() {

	// 3 MB pseudo-random byte sequence, using random seed 777
	r := randdata.New(randdata.Binary, 777, 3000000)

	// verifier expecting 10 bytes extra
	v := randdata.NewVerifier(randdata.Binary, 777, 3000000+10)

	// read and veriry data
	buf := make([]byte, 256)
	for {
		n, err := r.Read(buf)
		if 0 < n {
			if _, err := v.Write(buf[:n]); err != nil {
				fmt.Println(err)
				break
			}
		}
		if err != nil {
			if err != io.EOF {
				fmt.Println(err)
			}
			break
		}
	}

	// verify that written data is enough
	if err := v.Close(); err != nil {
		fmt.Println(err)
	}

	fmt.Println("Read:", r.TotalRead())

	// Output:
	// not enough bytes: 10 B short
	// Read: 3.0 MB
}

repository: tunabay/go-randdata

repo_name: tunabay/go-randdata


text:
/*
 * Copyright 2018-2020 Arm Limited.
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package core

import (
	"github.com/google/blueprint"

	"github.com/ARM-software/bob-build/abstr"
)

type generateBinary struct {
	generateLibrary
}

//// Support GenerateLibraryInterface

func (m *generateBinary) libExtension() string {
	return ""
}

//// Support PhonyInterface, DependentInterface

// List of everything generated by this target
func (m *generateBinary) outputs(g generatorBackend) []string {
	return []string{getLibraryGeneratedPath(m, g)}
}

//// Support singleOutputModule

func (m *generateBinary) outputFileName() string {
	return m.Name() + m.libExtension()
}

//// Support Installable

func (m *generateBinary) filesToInstall(ctx abstr.BaseModuleContext, g generatorBackend) []string {
	return []string{getLibraryGeneratedPath(m, g)}
}

//// Support blueprint.Module

func (m *generateBinary) GenerateBuildActions(ctx blueprint.ModuleContext) {
	if isEnabled(m) {
		g := getBackend(ctx)
		inouts := inouts(m, ctx, g)
		g.genBinaryActions(m, ctx, inouts)
	}
}

//// Factory functions

func genBinaryFactory(config *bobConfig) (blueprint.Module, []interface{}) {
	module := &generateBinary{}
	module.generateCommon.Properties.Features.Init(&config.Properties, GenerateProps{})
	return module, []interface{}{
		&module.SimpleName.Properties,
		&module.generateCommon.Properties,
		&module.Properties,
	}
}


text:
% Time-stamp: <lfcc.bib   1 Aug 2006 09:49:18>
% $Id: lfcc.bib,v 1.6 2006/02/10 07:50:42 carton Exp $

% Références sur les suites automatiques
@Book{Allouche03,
  author = 	 {J-P.Allouche and J.Shallit},
  title = 	 {Automatic sequences},
  publisher = 	 {Cambridge University Press},
  volume =       1,
  year = 	 2003
}

@InCollection{Allouche05,
  author =       {J-P.Allouche},
  title =   {Automates et alg\'ebricit\'e},
  booktitle =    {Journal de Th\'eorie des Nombres de BORDEAUX},
  publisher =    {Universit\'e Bordeaux 1},
  year =    2005,
  volume =  {17},
  pages =        {1--11}
}


text:
require ${PN}.inc

PR = "r2"

SRC_URI = "http://sources.openembedded.org/opie-1.2.4-split_noncore_apps_opie-sheet.tar.bz2;name=split_noncore_apps_opie-sheet \
           http://sources.openembedded.org/opie-1.2.4-split_pics.tar.bz2;name=split_pics \
           http://sources.openembedded.org/opie-1.2.4-split_apps.tar.bz2;name=split_apps \
           file://different-arg-names.patch "
SRC_URI[split_noncore_apps_opie-sheet.md5sum] = "8698c69c4334f4d958f4684894ffd389"
SRC_URI[split_noncore_apps_opie-sheet.sha256sum] = "c46e93caa0efe299be6a399e2f5db771d03452888fa507dd2b1fd574159ab432"
SRC_URI[split_pics.md5sum] = "5499dc84b65395ab99bda6ed9d01ff0f"
SRC_URI[split_pics.sha256sum] = "f22781f36e84e12d51fff1eb68cc3fb98221c7d807a82226813b7e974a604109"
SRC_URI[split_apps.md5sum] = "67a43e8e4bcd9e63b884ea25deea5b34"
SRC_URI[split_apps.sha256sum] = "a33a55efb4ae4c15a8c2c5d6faba6d671a5652da8e216ce35088896fe597215b"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD


text:
@article{williams2019atria,
  title={Visualizing a Moving Target: A Design Study on Task Parallel Programs in the Presence of Evolving Data and Concerns},
  author={Williams, Katy and Bigelow, Alex and Isaacs, Kate},
  journal={IEEE Transactions on Visualization and Computer Graphics},
  volume={26},
  number={1},
  pages={1118--1128},
  year={2019},
  publisher={IEEE},
  doi={10.1109/TVCG.2019.2934285}
}