text:
package day11

// import (
// 	"fmt"
// 	"strings"

// 	"regexp"

// 	"sort"

// 	"github.com/gsmcwhirter/advent2016/lib"
// )

// type Piece struct {
// 	Element string
// 	Type    string
// }

// type Move struct {
// 	TargetFloor int
// 	Pieces      []Piece
// }

// func (m *Move) HasPiece(p Piece) bool {
// 	for _, piece := range m.Pieces {
// 		if piece.Element == p.Element && piece.Type == p.Type {
// 			return true
// 		}
// 	}

// 	return false
// }

// func (m *Move) GeneratorTypes() []string {
// 	types := []string{}
// 	for _, piece := range m.Pieces {
// 		if piece.Type == "generator" {
// 			types = append(types, piece.Element)
// 		}
// 	}

// 	return types
// }

// func (m *Move) ChipTypes() []string {
// 	types := []string{}
// 	for _, piece := range m.Pieces {
// 		if piece.Type == "chip" {
// 			types = append(types, piece.Element)
// 		}
// 	}

// 	return types
// }

// type Floor struct {
// 	Num    int
// 	Pieces []Piece
// }

// func (f *Floor) Equal(other Floor) bool {
// 	if f.Num != other.Num {
// 		return false
// 	}

// 	allPieces := append(f.Pieces, other.Pieces...)
// 	for _, piece := range allPieces {
// 		if !f.HasPiece(piece) || !other.HasPiece(piece) {
// 			return false
// 		}
// 	}

// 	return true
// }

// func (f *Floor) HasPiece(p Piece) bool {
// 	for _, piece := range f.Pieces {
// 		if piece.Element == p.Element && piece.Type == p.Type {
// 			return true
// 		}
// 	}

// 	return false
// }

// func (f *Floor) HasGenerator(elem string) bool {
// 	for _, piece := range f.Pieces {
// 		if piece.Element == elem && piece.Type == "generator" {
// 			return true
// 		}
// 	}

// 	return false
// }

// func (f *Floor) GeneratorTypes(excepts ...string) []string {
// 	types := []string{}
// 	for _, piece := range f.Pieces {
// 		if piece.Type == "generator" {
// 			toAdd := true
// 			for _, except := range excepts {
// 				if except == piece.Element {
// 					toAdd = false
// 				}
// 			}

// 			if toAdd {
// 				types = append(types, piece.Element)
// 			}
// 		}
// 	}

// 	return types
// }

// func (f *Floor) HasChip(elem string) bool {
// 	for _, piece := range f.Pieces {
// 		if piece.Element == elem && piece.Type == "chip" {
// 			return true
// 		}
// 	}

// 	return false
// }

// func (f *Floor) ChipTypes(excepts ...string) []string {
// 	types := []string{}
// 	for _, piece := range f.Pieces {
// 		if piece.Type == "chip" {
// 			toAdd := true
// 			for _, except := range excepts {
// 				if except == piece.Element {
// 					toAdd = false
// 				}
// 			}

// 			if toAdd {
// 				types = append(types, piece.Element)
// 			}
// 		}
// 	}

// 	return types
// }

// func (f *Floor) NumPairs() int {
// 	gens := f.GeneratorTypes("")

// 	count := 0
// 	for _, gen := range gens {
// 		if f.HasChip(gen) {
// 			count++
// 		}
// 	}

// 	return count
// }

// func (f *Floor) NumUnpairedChips() int {
// 	chips := f.ChipTypes("")

// 	count := 0
// 	for _, chip := range chips {
// 		if !f.HasGenerator(chip) {
// 			count++
// 		}
// 	}

// 	return count
// }

// func (f *Floor) NumUnpairedGenerators() int {
// 	gens := f.GeneratorTypes("")

// 	count := 0
// 	for _, gen := range gens {
// 		if !f.HasChip(gen) {
// 			count++
// 		}
// 	}

// 	return count
// }

// type State struct {
// 	Elevator  int
// 	Floors    []Floor
// 	Elements  []string
// 	MoveCount int
// }

// func (s *State) GenerateMoves(history []State) []MoveStatePair {
// 	movesUp := []MoveStatePair{}
// 	movesDown := []MoveStatePair{}

// 	// minFloor := 0

// 	// for i := 0; i < 4; i++ {
// 	// 	if len(s.Floors[i].Pieces) == 0 {
// 	// 		minFloor++
// 	// 	} else {
// 	// 		break
// 	// 	}
// 	// }

// 	floor := s.Floors[s.Elevator-1]

// 	var move Move
// 	var valid bool
// 	var nextState State

// 	for i, piece := range floor.Pieces {
// 		for j, piece2 := range floor.Pieces {
// 			if i <= j {
// 				continue
// 			}

// 			move = Move{s.Elevator + 1, []Piece{piece, piece2}}
// 			valid, nextState = s.MoveIsValid(move, history)
// 			// fmt.Println(valid)
// 			// fmt.Println(nextState)
// 			if valid {
// 				movesUp = append(movesUp, MoveStatePair{move, nextState})
// 			}
// 		}

// 		// if s.Elevator > minFloor {
// 		move = Move{s.Elevator - 1, []Piece{piece}}
// 		valid, nextState = s.MoveIsValid(move, history)
// 		if valid {
// 			movesDown = append(movesDown, MoveStatePair{move, nextState})
// 		}
// 		// }

// 	}

// 	onePieceUp := len(movesUp) == 0 || true
// 	twoPieceDown := len(movesDown) == 0 || true

// 	for i, piece := range floor.Pieces {
// 		if onePieceUp {
// 			move = Move{s.Elevator + 1, []Piece{piece}}
// 			valid, nextState = s.MoveIsValid(move, history)
// 			if valid {
// 				movesUp = append(movesUp, MoveStatePair{move, nextState})
// 			}
// 		}

// 		if twoPieceDown {
// 			for j, piece2 := range floor.Pieces {
// 				if i <= j {
// 					continue
// 				}

// 				// if s.Elevator > minFloor {
// 				move = Move{s.Elevator - 1, []Piece{piece, piece2}}
// 				valid, nextState = s.MoveIsValid(move, history)
// 				if valid {
// 					movesDown = append(movesDown, MoveStatePair{move, nextState})
// 				}
// 				// }
// 			}
// 		}
// 	}

// 	moves := append(movesUp, movesDown...)
// 	// fmt.Println(moves)

// 	return moves
// }

// func (s *State) MoveIsValid(move Move, history []State) (bool, State) {
// 	// Are we moving within bounds?
// 	if move.TargetFloor > 4 || move.TargetFloor < 1 {
// 		return false, State{}
// 	}

// 	// Are we moving enough things?
// 	if len(move.Pieces) < 1 || len(move.Pieces) > 2 {
// 		return false, State{}
// 	}

// 	currentFloor := s.Floors[s.Elevator-1]
// 	targetFloor := s.Floors[move.TargetFloor-1]

// 	moveGenerators := move.GeneratorTypes()
// 	moveChips := move.ChipTypes()

// 	// Can we move these things together?
// 	if len(moveGenerators) > 0 && len(moveChips) > 0 {
// 		for _, gen := range moveGenerators {
// 			for _, chip := range moveChips {
// 				if gen == chip {
// 					return false, State{}
// 				}
// 			}
// 		}

// 		return false, State{}
// 	}

// 	//Will removing these things fry the current floor?
// 	currentFloorRemainingGenerators := currentFloor.GeneratorTypes(moveGenerators...)
// 	for _, chip := range currentFloor.ChipTypes(moveChips...) {
// 		if !currentFloor.HasGenerator(chip) && len(currentFloorRemainingGenerators) > 0 {
// 			return false, State{}
// 		}
// 	}

// 	// Will we fry something on the target floor?
// 	targetFloorOtherChips := targetFloor.ChipTypes(moveGenerators...)
// 	for _, chip := range targetFloorOtherChips {
// 		if !targetFloor.HasGenerator(chip) {
// 			return false, State{}
// 		}
// 	}

// 	// Will we fry a chip in the elevator on the target floor?
// 	for _, chip := range moveChips {
// 		if !targetFloor.HasGenerator(chip) && len(targetFloor.GeneratorTypes(chip)) > 0 {
// 			return false, State{}
// 		}
// 	}

// 	newState := AdvanceState(*s, move)
// 	if StateInHistory(history, newState) {
// 		return false, State{}
// 	}

// 	return true, newState
// }

// func (s *State) Print() {
// 	var floor Floor
// 	for floorNum := len(s.Floors); floorNum > 0; floorNum-- {
// 		floor = s.Floors[floorNum-1]
// 		fmt.Printf("F%v", floorNum)
// 		if s.Elevator == floorNum {
// 			fmt.Print(" E")
// 		} else {
// 			fmt.Print(" .")
// 		}

// 		for _, elem := range s.Elements {
// 			if floor.HasGenerator(elem) {
// 				fmt.Printf(" %v-G", string([]rune(elem)[0]))
// 			} else {
// 				fmt.Print("  . ")
// 			}

// 			if floor.HasChip(elem) {
// 				fmt.Printf(" %v-C", string([]rune(elem)[0]))
// 			} else {
// 				fmt.Print("  . ")
// 			}
// 		}

// 		fmt.Println()
// 	}
// 	fmt.Printf("\nMoves: %v\n\n", s.MoveCount)
// }

// func (s *State) GoalReached() bool {
// 	for _, floor := range s.Floors[:3] {
// 		if len(floor.Pieces) > 0 {
// 			return false
// 		}
// 	}

// 	return true
// }

// func (s *State) Equal(other State) bool {
// 	if s.Elevator != other.Elevator {
// 		return false
// 	}

// 	for i, sflr := range s.Floors {
// 		oflr := other.Floors[i]

// 		if !sflr.Equal(oflr) {
// 			return false
// 		}
// 	}

// 	return true
// }

// func (s *State) IsoState() [][2]int {
// 	isoState := make([][2]int, len(s.Elements))
// 	for i, elem := range s.Elements {
// 		isoState[i] = [2]int{-1, -1}
// 		for j, floor := range s.Floors {
// 			if floor.HasGenerator(elem) {
// 				isoState[i][0] = j
// 			}

// 			if floor.HasChip(elem) {
// 				isoState[i][1] = j
// 			}
// 		}
// 	}

// 	// fmt.Println(isoState)

// 	return isoState
// }

// func (s *State) Isomorphic(other State) bool {
// 	if s.Elevator != other.Elevator {
// 		return false
// 	}

// 	isoState1 := s.IsoState()
// 	isoState2 := other.IsoState()

// 	for _, s1 := range isoState1 {
// 		existsInOther := false
// 		for _, s2 := range isoState2 {
// 			if s1[0] == s2[0] && s1[1] == s2[1] {
// 				existsInOther = true
// 				break
// 			}
// 		}

// 		if !existsInOther {
// 			// fmt.Printf("%v !~= %v\n", isoState1, isoState2)
// 			return false
// 		}
// 	}

// 	// for _, s1 := range isoState2 {
// 	// 	existsInOther := false

// 	// 	for _, s2 := range isoState1 {
// 	// 		if s1[0] == s2[0] && s1[1] == s2[1] {
// 	// 			existsInOther = true
// 	// 			break
// 	// 		}
// 	// 	}

// 	// 	if !existsInOther {
// 	// 		fmt.Printf("%v !~= %v\n", isoState1, isoState2)
// 	// 		return false
// 	// 	}
// 	// }

// 	// fmt.Printf("%v ~= %v\n", isoState1, isoState2)
// 	return true
// }

// func (s *State) NumPieces() int {
// 	count := 0

// 	for _, floor := range s.Floors {
// 		count += len(floor.Pieces)
// 	}

// 	return count
// }

// func StateInHistory(history []State, ns State) bool {
// 	for _, oldS := range history {
// 		if oldS.Equal(ns) { // was Equal
// 			return true
// 		}
// 	}

// 	return false
// }

// func AdvanceState(oldState State, move Move) State {
// 	// oldState.Print()

// 	newFloors := []Floor{}
// 	// fmt.Println("\n")
// 	// oldState.Print()
// 	// fmt.Printf("Move Applied: %+v\n", move)

// 	for i, floor := range oldState.Floors {
// 		newPieces := []Piece{}
// 		// fmt.Print("Floor Index:", i, " ")
// 		// fmt.Printf("Floor: %+v\n", floor)
// 		switch i + 1 {
// 		case oldState.Elevator:
// 			fmt.Println("Cleaning out old floor")
// 			for _, piece := range floor.Pieces {
// 				if !move.HasPiece(piece) {
// 					newPieces = append(newPieces, piece)
// 				}
// 			}

// 			newFloor := Floor{
// 				Num:    floor.Num,
// 				Pieces: newPieces,
// 			}
// 			fmt.Printf("Result: %+v\n", newFloor)

// 			newFloors = append(newFloors, newFloor)
// 		case move.TargetFloor:
// 			fmt.Println("Creating new floor")

// 			newPieces = append(newPieces, floor.Pieces...)
// 			newPieces = append(newPieces, move.Pieces...)

// 			newFloor := Floor{
// 				Num:    floor.Num,
// 				Pieces: newPieces,
// 			}
// 			fmt.Printf("Result: %+v\n", newFloor)

// 			newFloors = append(newFloors, newFloor)
// 		default:
// 			fmt.Println("Floor unchanged")

// 			newFloor := Floor{
// 				Num:    floor.Num,
// 				Pieces: append(newPieces, floor.Pieces...),
// 			}
// 			fmt.Printf("Result: %+v\n", newFloor)

// 			newFloors = append(newFloors, newFloor)
// 		}
// 	}

// 	newState := State{
// 		Elevator:  move.TargetFloor,
// 		Floors:    newFloors,
// 		Elements:  oldState.Elements,
// 		MoveCount: oldState.MoveCount + 1,
// 	}

// 	if oldState.NumPieces() != newState.NumPieces() {
// 		fmt.Println("ERROR! Lost or duplicate Pieces!")
// 		oldState.Print()
// 		fmt.Printf("Move Applied: %+v\n", move)
// 		newState.Print()
// 		panic("Quitting")
// 	} else {
// 		newState.Print()
// 		fmt.Println("-----------------------------")
// 	}

// 	// newState.Print()

// 	return newState
// }

// type MoveStatePair struct {
// 	Move  Move
// 	State State
// }

// type MoveStateQueue struct {
// 	Items []*MoveStatePair
// }

// func (q *MoveStateQueue) push(move Move, state State) {
// 	msp := &MoveStatePair{move, state}
// 	q.Items = append(q.Items, msp)
// }

// func (q *MoveStateQueue) pop() *MoveStatePair {
// 	if len(q.Items) == 0 {
// 		return nil
// 	}

// 	item := q.Items[0]
// 	q.Items = q.Items[1:]

// 	return item
// }

// func BFS(startState State) {
// 	state := startState
// 	queue := MoveStateQueue{[]*MoveStatePair{}}
// 	statesInQueue := []State{state}

// 	newMoves := state.GenerateMoves(statesInQueue)
// 	fmt.Printf("Adding %v moves to the queue (current length %v)\n", len(newMoves), len(newMoves)+len(queue.Items))
// 	for _, move := range newMoves {
// 		fmt.Println(move)
// 		if !StateInHistory(statesInQueue, move.State) {
// 			queue.push(move.Move, state)
// 			statesInQueue = append(statesInQueue, move.State)
// 		}
// 	}

// 	lastMoveCount := 0

// 	item := queue.pop()
// 	var newState State
// 	for item != nil {
// 		// fmt.Println(item.Move)
// 		newState = AdvanceState(item.State, item.Move)
// 		newState.Print()

// 		if newState.MoveCount > lastMoveCount {
// 			lastMoveCount = newState.MoveCount
// 			fmt.Printf("Considering states %v moves out\n", lastMoveCount)
// 		}

// 		// if StateInHistory(statesInQueue, newState) {
// 		// 	// fmt.Println("Skipping state")
// 		// 	item = queue.pop()
// 		// 	continue
// 		// } else {
// 		// 	// statesInQueue = append(statesInQueue, newState)
// 		// }

// 		if newState.GoalReached() {
// 			newState.Print()
// 			break
// 		}

// 		newMoves := newState.GenerateMoves(statesInQueue)
// 		fmt.Printf("Adding %v moves to the queue (current length %v)\n", len(newMoves), len(newMoves)+len(queue.Items))
// 		for _, move := range newMoves {
// 			if !StateInHistory(statesInQueue, move.State) {
// 				queue.push(move.Move, newState)
// 				statesInQueue = append(statesInQueue, move.State)
// 			}
// 		}

// 		item = queue.pop()
// 	}
// }

// func ParseDataString(dat string) ([]Floor, []string) {
// 	floors := []Floor{}
// 	typesMap := map[string]bool{}

// 	generatorRegex := regexp.MustCompile("a ([^\\s]+) generator")
// 	chipRegex := regexp.MustCompile("a ([^\\s]+)-compatible microchip")

// 	for num, line := range strings.Split(dat, "\n") {
// 		pieces := []Piece{}
// 		generatorMatches := generatorRegex.FindAllStringSubmatch(line, -1)
// 		for _, match := range generatorMatches {
// 			pieces = append(pieces, Piece{
// 				Element: match[1],
// 				Type:    "generator",
// 			})
// 			typesMap[match[1]] = true
// 		}

// 		chipMatches := chipRegex.FindAllStringSubmatch(line, -1)
// 		for _, match := range chipMatches {
// 			pieces = append(pieces, Piece{
// 				Element: match[1],
// 				Type:    "chip",
// 			})
// 			typesMap[match[1]] = true
// 		}

// 		floors = append(floors, Floor{
// 			Num:    num + 1,
// 			Pieces: pieces,
// 		})
// 	}

// 	types := make([]string, len(typesMap))
// 	i := -1

// 	for key := range typesMap {
// 		i++
// 		types[i] = key
// 	}

// 	sort.Strings(types)

// 	return floors, types
// }

// func LoadData(filename string) ([]Floor, []string) {
// 	dat := lib.ReadFileData(filename)

// 	return ParseDataString(strings.Trim(string(dat), "\n"))
// }

// func RunPartA(filename string) {
// 	floors, allTypes := LoadData(filename)

// 	state := State{
// 		Elevator:  1,
// 		Floors:    floors,
// 		Elements:  allTypes,
// 		MoveCount: 0,
// 	}

// 	state.Print()

// 	BFS(state)
// }

// func RunPartB(filename string) {

// }

license: MIT

extension: go


text:
class RunSummaryDto {
    total: number;
    success: number;
    errors: number;
    failures: number;
    inconclusive: number;
    ignored: number;
    unknown: number;
}

license_type: permissive

branch_name: refs/heads/master

gha_license_id: MIT

gha_language: C#

extension: ts


text:
// Copyright 2020 Trey Dockendorf
// 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 collectors

import (
	"bytes"
	"context"
	"fmt"
	"net/url"
	"os"
	"os/exec"
	"sort"
	"strconv"
	"strings"
	"sync"
	"time"

	"github.com/alecthomas/kingpin/v2"
	"github.com/go-kit/log"
	"github.com/go-kit/log/level"
	"github.com/prometheus/client_golang/prometheus"
)

const (
	namespace = "gpfs"
)

var (
	collectorState = make(map[string]*bool)
	factories      = make(map[string]func(logger log.Logger) Collector)
	execCommand    = exec.CommandContext
	MmlsfsExec     = mmlsfs
	MmdiagExec     = mmdiag
	NowLocation    = func() *time.Location {
		return time.Now().Location()
	}
	collectDuration = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, "exporter", "collector_duration_seconds"),
		"Collector time duration.",
		[]string{"collector"}, nil)
	collectError = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, "exporter", "collect_error"),
		"Indicates if error has occurred during collection",
		[]string{"collector"}, nil)
	collecTimeout = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, "exporter", "collect_timeout"),
		"Indicates the collector timed out",
		[]string{"collector"}, nil)
	lastExecution = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, "exporter", "last_execution"),
		"Last execution time of ", []string{"collector"}, nil)
	sudoCmd       = kingpin.Flag("config.sudo.command", "The command to run sudo").Default("sudo").String()
	mmlsfsTimeout = kingpin.Flag("config.mmlsfs.timeout", "Timeout for mmlsfs execution").Default("5").Int()
)

type DurationBucketValues []float64

func (d *DurationBucketValues) Set(value string) error {
	buckets := []float64{}
	bucketDurations := strings.Split(value, ",")
	for _, bucketDuration := range bucketDurations {
		duration, err := time.ParseDuration(bucketDuration)
		if err != nil {
			return fmt.Errorf("'%s' is not a valid bucket duration", value)
		}
		buckets = append(buckets, duration.Seconds())
	}
	sort.Float64s(buckets)
	*d = buckets
	return nil
}

func (d *DurationBucketValues) String() string {
	return ""
}

func DurationBuckets(s kingpin.Settings) (target *[]float64) {
	target = &[]float64{}
	s.SetValue((*DurationBucketValues)(target))
	return
}

type GPFSFilesystem struct {
	Name       string
	Mountpoint string
}

type GPFSCollector struct {
	sync.Mutex
	Collectors map[string]Collector
}

type Collector interface {
	// Get new metrics and expose them via prometheus registry.
	Describe(ch chan<- *prometheus.Desc)
	Collect(ch chan<- prometheus.Metric)
}

func registerCollector(collector string, isDefaultEnabled bool, factory func(logger log.Logger) Collector) {
	var helpDefaultState string
	if isDefaultEnabled {
		helpDefaultState = "enabled"
	} else {
		helpDefaultState = "disabled"
	}
	flagName := fmt.Sprintf("collector.%s", collector)
	flagHelp := fmt.Sprintf("Enable the %s collector (default: %s).", collector, helpDefaultState)
	defaultValue := fmt.Sprintf("%v", isDefaultEnabled)
	flag := kingpin.Flag(flagName, flagHelp).Default(defaultValue).Bool()
	collectorState[collector] = flag
	factories[collector] = factory
}

func NewGPFSCollector(logger log.Logger) *GPFSCollector {
	collectors := make(map[string]Collector)
	for key, enabled := range collectorState {
		var collector Collector
		if *enabled {
			collector = factories[key](log.With(logger, "collector", key))
			collectors[key] = collector
		}
	}
	return &GPFSCollector{Collectors: collectors}
}

func SliceContains(slice []string, str string) bool {
	for _, s := range slice {
		if str == s {
			return true
		}
	}
	return false
}

func SliceIndex(slice []string, str string) int {
	for i, v := range slice {
		if v == str {
			return i
		}
	}
	return -1
}

func ParseFloat(str string, toBytes bool, logger log.Logger) (float64, error) {
	if val, err := strconv.ParseFloat(str, 64); err == nil {
		if toBytes {
			val = val * 1024
		}
		return val, nil
	} else {
		level.Error(logger).Log("msg", fmt.Sprintf("Error parsing %s: %s", str, err.Error()))
		return 0, err
	}
}

func FileExists(filename string) bool {
	info, err := os.Stat(filename)
	if os.IsNotExist(err) {
		return false
	}
	return !info.IsDir()
}

func mmdiag(arg string, ctx context.Context) (string, error) {
	cmd := execCommand(ctx, *sudoCmd, "/usr/lpp/mmfs/bin/mmdiag", arg, "-Y")
	var out bytes.Buffer
	cmd.Stdout = &out
	err := cmd.Run()
	if ctx.Err() == context.DeadlineExceeded {
		return "", ctx.Err()
	} else if err != nil {
		return "", err
	}
	return out.String(), nil
}

func mmlfsfsFilesystems(ctx context.Context, logger log.Logger) ([]string, error) {
	var filesystems []string
	out, err := MmlsfsExec(ctx)
	if err != nil {
		return nil, err
	}
	mmlsfs_filesystems := parse_mmlsfs(out)
	for _, fs := range mmlsfs_filesystems {
		filesystems = append(filesystems, fs.Name)
	}
	return filesystems, nil
}

func mmlsfs(ctx context.Context) (string, error) {
	cmd := execCommand(ctx, *sudoCmd, "/usr/lpp/mmfs/bin/mmlsfs", "all", "-Y", "-T")
	var out bytes.Buffer
	cmd.Stdout = &out
	err := cmd.Run()
	if ctx.Err() == context.DeadlineExceeded {
		return "", ctx.Err()
	} else if err != nil {
		return "", err
	}
	return out.String(), nil
}

func parse_mmlsfs(out string) []GPFSFilesystem {
	var filesystems []GPFSFilesystem
	lines := strings.Split(out, "\n")
	for _, line := range lines {
		items := strings.Split(line, ":")
		if len(items) < 7 {
			continue
		}
		if items[2] == "HEADER" {
			continue
		}
		var fs GPFSFilesystem
		fs.Name = items[6]
		mountpoint, err := url.QueryUnescape(items[8])
		if err != nil {
			continue
		}
		fs.Mountpoint = mountpoint
		filesystems = append(filesystems, fs)
	}
	return filesystems
}

gha_language: Go


text:
DESCRIPTION = "RaspberryPi Test Packagegroup"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"

inherit packagegroup

RDEPENDS_${PN} = "\
    omxplayer \
    bcm2835-tests \
    wiringpi \
    rpio \
    rpi-gpio \
    pi-blaster \
    python-rtimu \
    python-sense-hat \
"

RRECOMMENDS_${PN} = "\
    bigbuckbunny-1080p \
    bigbuckbunny-480p \
    bigbuckbunny-720p \
"

repository: TizenTeam/meta-raspberrypi-tizen

repo_name: TizenTeam/meta-raspberrypi-tizen

extension: bb


text:
SUMMARY = "OpenSource MultiAP Agent implementation"
LICENSE = "BSD-2-Clause-Patent"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e1988ff7324cb957bcbf231f1bc6486c"

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI = "git://github.com/TechnicolorEDGM/libmultiap_platform.git;protocol=https \
           file://0001-Makefile-changes.patch \
          "

SRCREV = "${AUTOREV}"

S = "${WORKDIR}/git"

DEPENDS = "libuv"

CFLAGS_append = " -I./include"

LDFLAGS_append = " "

do_install () {
    # installing headers and libraries
    install -d ${D}/usr/lib
}

repository: scthunderbolt/meta-turris

repo_name: scthunderbolt/meta-turris


text:
set(MARSHMALLOW_GRAPHICS_DUMMY  OFF  CACHE BOOL   "")
set(MARSHMALLOW_GRAPHICS_OPENGL ON   CACHE BOOL   "")

set(MARSHMALLOW_OPENGL_WGL      ON   CACHE BOOL   "")

branch_name: refs/heads/staging

gha_license_id: NOASSERTION

gha_language: C

extension: cmake


text:
package leetcode

import (
	"math"
	"testing"
)

func TestMyPow(t *testing.T) {
	var tests = []struct {
		x  float64
		n  int
		xn float64
	}{
		{x: 2, n: 10},
		{x: 2.1, n: 3},
		{x: 2, n: -2},
		{x: 1, n: math.MaxInt32},
		{x: -2.1, n: math.MinInt32},
	}

	for _, tt := range tests {
		tt.xn = math.Pow(tt.x, float64(tt.n))

		xn := myPow(tt.x, tt.n)
		if xn != tt.xn {
			t.Errorf("myPow(%v, %v) return %v, want %v", tt.x, tt.n, xn, tt.xn)
		}
	}
}

license: Unlicense

repository: invzhi/LeetCode

repo_name: invzhi/LeetCode


text:
//
// CVPixelBuffer.cs: Implements the managed CVPixelBuffer
//
// Authors: Mono Team
//
// Copyright 2010 Novell, Inc
// Copyright 2011, 2012 Xamarin Inc
//
using System;
using System.Runtime.InteropServices;
using MonoMac.CoreFoundation;
using MonoMac.ObjCRuntime;
using MonoMac.Foundation;

namespace MonoMac.CoreVideo {

	[Since (4,0)]
	public class CVPixelBuffer : CVImageBuffer {
		public static readonly NSString PixelFormatTypeKey;
		public static readonly NSString MemoryAllocatorKey;
		public static readonly NSString WidthKey;
		public static readonly NSString HeightKey;
		public static readonly NSString ExtendedPixelsLeftKey;
		public static readonly NSString ExtendedPixelsTopKey;
		public static readonly NSString ExtendedPixelsRightKey;
		public static readonly NSString ExtendedPixelsBottomKey;
		public static readonly NSString BytesPerRowAlignmentKey;
		public static readonly NSString CGBitmapContextCompatibilityKey;
		public static readonly NSString CGImageCompatibilityKey;
		public static readonly NSString OpenGLCompatibilityKey;
		public static readonly NSString IOSurfacePropertiesKey;
		public static readonly NSString PlaneAlignmentKey;
		public static readonly NSString OpenGLESCompatibilityKey;

		public static readonly int CVImageBufferType;

		[DllImport (Constants.CoreVideoLibrary)]
		extern static int CVPixelBufferGetTypeID ();

		static CVPixelBuffer ()
		{
			var handle = Dlfcn.dlopen (Constants.CoreVideoLibrary, 0);
			if (handle == IntPtr.Zero)
				return;
			try {
				PixelFormatTypeKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferPixelFormatTypeKey");
				MemoryAllocatorKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferMemoryAllocatorKey");
				WidthKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferWidthKey");
				HeightKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferHeightKey");
				ExtendedPixelsLeftKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferExtendedPixelsLeftKey");
				ExtendedPixelsTopKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferExtendedPixelsTopKey");
				ExtendedPixelsRightKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferExtendedPixelsRightKey");
				ExtendedPixelsBottomKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferExtendedPixelsBottomKey");
				BytesPerRowAlignmentKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferBytesPerRowAlignmentKey");
				CGBitmapContextCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferCGBitmapContextCompatibilityKey");
				CGImageCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferCGImageCompatibilityKey");
				OpenGLCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferOpenGLCompatibilityKey");
				IOSurfacePropertiesKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferIOSurfacePropertiesKey");
				PlaneAlignmentKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferPlaneAlignmentKey");
				CVImageBufferType = CVPixelBufferGetTypeID ();
				OpenGLESCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelBufferOpenGLESCompatibilityKey");
			}
			finally {
				Dlfcn.dlclose (handle);
			}
		}

		internal CVPixelBuffer (IntPtr handle) : base (handle)
		{
		}

		[Preserve (Conditional=true)]
		internal CVPixelBuffer (IntPtr handle, bool owns) : base (handle, owns)
		{
		}

#if !COREBUILD
		[DllImport (Constants.CoreVideoLibrary)]
		extern static CVReturn CVPixelBufferCreate (IntPtr allocator, IntPtr width, IntPtr height, CVPixelFormatType pixelFormatType, IntPtr pixelBufferAttributes, IntPtr pixelBufferOut);

#if SDCONVERT
		public CVPixelBuffer (System.Drawing.Size size, CVPixelFormatType pixelFormat)
			: this (size.Width, size.Height, pixelFormat, (NSDictionary)null)
		{
		}

		public CVPixelBuffer (System.Drawing.Size size, CVPixelFormatType pixelFormatType, CVPixelBufferAttributes attributes)
			: this (size.Width, size.Height, pixelFormatType, attributes == null ? null : attributes.Dictionary)
		{
		}
#endif
		public CVPixelBuffer (int width, int height, CVPixelFormatType pixelFormatType)
			: this (width, height, pixelFormatType, (NSDictionary)null)
		{
		}

		public CVPixelBuffer (int width, int height, CVPixelFormatType pixelFormatType, CVPixelBufferAttributes attributes)
			: this (width, height, pixelFormatType, attributes == null ? null : attributes.Dictionary)
		{
		}

		[Advice ("Use constructor with CVPixelBufferAttributes")]
		public CVPixelBuffer (int width, int height, CVPixelFormatType pixelFormatType, NSDictionary pixelBufferAttributes)
		{
			if (width <= 0)
				throw new ArgumentOutOfRangeException ("width");

			if (height <= 0)
				throw new ArgumentOutOfRangeException ("height");

			IntPtr pixelBufferOut = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (IntPtr)));
			CVReturn ret = CVPixelBufferCreate (IntPtr.Zero, (IntPtr) width, (IntPtr) height, pixelFormatType,
				pixelBufferAttributes == null ? IntPtr.Zero : pixelBufferAttributes.Handle, pixelBufferOut);

			if (ret != CVReturn.Success) {
				Marshal.FreeHGlobal (pixelBufferOut);
				throw new ArgumentException (ret.ToString ());
			}

			this.handle = Marshal.ReadIntPtr (pixelBufferOut);
			Marshal.FreeHGlobal (pixelBufferOut);
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static CVReturn CVPixelBufferCreateResolvedAttributesDictionary (IntPtr allocator, IntPtr attributes, IntPtr resolvedDictionaryOut);
		public NSDictionary GetAttributes (NSDictionary [] attributes)
		{
			IntPtr resolvedDictionaryOut = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (IntPtr)));
			NSArray attributeArray = NSArray.FromNSObjects (attributes);
			CVReturn ret = CVPixelBufferCreateResolvedAttributesDictionary (IntPtr.Zero, attributeArray.Handle, resolvedDictionaryOut);

			if (ret != CVReturn.Success) {
				Marshal.FreeHGlobal (resolvedDictionaryOut);
				throw new Exception ("CVPixelBufferCreate returned: " + ret);
			}

			NSDictionary dictionary = Runtime.GetNSObject<NSDictionary> (Marshal.ReadIntPtr (resolvedDictionaryOut));
			Marshal.FreeHGlobal (resolvedDictionaryOut);

			return dictionary;
		}
#endif

		// TODO: CVPixelBufferCreateWithBytes
		// TODO: CVPixelBufferCreateWithPlanarBytes
		// TODO: CVPixelBufferGetExtendedPixels
		// TODO: CVPixelBufferGetTypeID

		[DllImport (Constants.CoreVideoLibrary)]
		extern static CVReturn CVPixelBufferFillExtendedPixels (IntPtr pixelBuffer);
		public CVReturn FillExtendedPixels ()
		{
			return CVPixelBufferFillExtendedPixels (handle);
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static IntPtr CVPixelBufferGetBaseAddress (IntPtr pixelBuffer);
		public IntPtr BaseAddress {
			get {
				return CVPixelBufferGetBaseAddress (handle);
			}
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static IntPtr CVPixelBufferGetBytesPerRow (IntPtr pixelBuffer);
		public int BytesPerRow {
			get {
				return (int) CVPixelBufferGetBytesPerRow (handle);
			}
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static IntPtr CVPixelBufferGetDataSize (IntPtr pixelBuffer);
		public int DataSize {
			get {
				return (int) CVPixelBufferGetDataSize (handle);
			}
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static IntPtr CVPixelBufferGetHeight (IntPtr pixelBuffer);
		public int Height {
			get {
				return (int) CVPixelBufferGetHeight (handle);
			}
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static IntPtr CVPixelBufferGetWidth (IntPtr pixelBuffer);
		public int Width {
			get {
				return (int) CVPixelBufferGetWidth (handle);
			}
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static IntPtr CVPixelBufferGetPlaneCount (IntPtr pixelBuffer);
		public int PlaneCount {
			get {
				return (int) CVPixelBufferGetPlaneCount (handle);
			}
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static bool CVPixelBufferIsPlanar (IntPtr pixelBuffer);
		public bool IsPlanar {
			get {
				return CVPixelBufferIsPlanar (handle);
			}
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static CVPixelFormatType CVPixelBufferGetPixelFormatType (IntPtr pixelBuffer);
		public CVPixelFormatType PixelFormatType {
			get {
				return CVPixelBufferGetPixelFormatType (handle);
			}
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static IntPtr CVPixelBufferGetBaseAddressOfPlane (IntPtr pixelBuffer, IntPtr planeIndex);
		public IntPtr GetBaseAddress (int planeIndex) {
			return CVPixelBufferGetBaseAddressOfPlane (handle, (IntPtr) planeIndex);
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static IntPtr CVPixelBufferGetBytesPerRowOfPlane (IntPtr pixelBuffer, IntPtr planeIndex);
		public int GetBytesPerRowOfPlane (int planeIndex) {
			return (int) CVPixelBufferGetBytesPerRowOfPlane (handle, (IntPtr) planeIndex);
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static IntPtr CVPixelBufferGetHeightOfPlane (IntPtr pixelBuffer, IntPtr planeIndex);
		public int GetHeightOfPlane (int planeIndex) {
			return (int) CVPixelBufferGetHeightOfPlane (handle, (IntPtr) planeIndex);
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static IntPtr CVPixelBufferGetWidthtOfPlane (IntPtr pixelBuffer, IntPtr planeIndex);
		public int GetWidthtOfPlane (int planeIndex) {
			return (int) CVPixelBufferGetWidthtOfPlane (handle, (IntPtr) planeIndex);
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static CVReturn CVPixelBufferLockBaseAddress (IntPtr pixelBuffer, CVOptionFlags lockFlags);
		public CVReturn Lock (CVOptionFlags lockFlags) {
			return CVPixelBufferLockBaseAddress (handle, lockFlags);
		}

		[DllImport (Constants.CoreVideoLibrary)]
		extern static CVReturn CVPixelBufferUnlockBaseAddress (IntPtr pixelBuffer, CVOptionFlags unlockFlags);
		public CVReturn Unlock (CVOptionFlags unlockFlags) {
			return CVPixelBufferUnlockBaseAddress (handle, unlockFlags);
		}
	}
}

repository: cwensley/monomac

repo_name: cwensley/monomac

extension: cs


text:
DESCRIPTION = "NVIDIA TensorRT Core (GPU Inference Engine) for deep learning"
LICENSE = "Proprietary"

inherit l4t_deb_pkgfeed container-runtime-csv features_check

HOMEPAGE = "http://developer.nvidia.com/tensorrt"

L4T_DEB_GROUP = "tensorrt"

SRC_COMMON_DEBS = "\
    libnvinfer8_${PV}+cuda10.2_arm64.deb;downloadfilename=libnvinfer8_${PV}+cuda10.2_arm64.deb;name=lib;subdir=tensorrt \
    libnvinfer-dev_${PV}+cuda10.2_arm64.deb;downloadfilename=libnvinfer-dev_${PV}+cuda10.2_arm64.deb;name=dev;subdir=tensorrt \
    libnvparsers8_${PV}+cuda10.2_arm64.deb;downloadfilename=libnvparsers8_${PV}+cuda10.2_arm64.deb;name=nvp;subdir=tensorrt \
    libnvparsers-dev_${PV}+cuda10.2_arm64.deb;downloadfilename=libnvparsers-dev_${PV}+cuda10.2_arm64.deb;name=nvpdev;subdir=tensorrt \
"
LIBSHA256SUM = "af79b941988fff6daec89a663fd5bc12541df8c568e4e0c66c4e1991ec4c923c"
DEVSHA256SUM = "54c79348f364731d90aa857597185d73067864e208fb24a8fb7675405661c6d6"
NVPSHA256SUM = "f2ab966c85b6e8a36098a6bc05e0ac478bd1cc9d966373223c0ec56dc73d302b"
NVPDEVSHA256SUM = "816c0f9daa031be52e873907662c26d8d58e29cc2603a5d7ba1e60a0d76d00fd"

SRC_URI[lib.sha256sum] = "${LIBSHA256SUM}"
SRC_URI[dev.sha256sum] = "${DEVSHA256SUM}"
SRC_URI[nvp.sha256sum] = "${NVPSHA256SUM}"
SRC_URI[nvpdev.sha256sum] = "${NVPDEVSHA256SUM}"

COMPATIBLE_MACHINE = "(tegra)"

LIC_FILES_CHKSUM = "file://usr/include/aarch64-linux-gnu/NvInfer.h;endline=48;md5=3d6981c1227c404d42d710f96a875a1b"

REQUIRED_DISTRO_FEATURES = "opengl"

DEPENDS = "tegra-libraries-multimedia"

S = "${WORKDIR}/tensorrt"

CONTAINER_CSV_FILES = "${libdir}/*.so*"

do_configure() {
    :
}

do_compile() {
    :
}

do_install() {
    install -d ${D}${includedir}
    install -m 0644 ${S}/usr/include/aarch64-linux-gnu/*.h ${D}${includedir}
    install -d ${D}${libdir}
    cp --preserve=mode,timestamps,links --no-dereference ${S}/usr/lib/aarch64-linux-gnu/*.so* ${D}${libdir}
}

INSANE_SKIP:${PN} = "already-stripped"
PACKAGE_ARCH = "${TEGRA_PKGARCH}"

repository: danielwangksu/meta-tegra

repo_name: danielwangksu/meta-tegra


text:
package cmd

import (
	"github.com/alecthomas/kong"
	"github.com/bcneng/candebot/bot"
)

type Help struct{}

func (c *Help) Run(cliCtx *kong.Context, _ bot.Context, _ bot.SlackContext) error {
	// Don't need to explicitly run the command since help does not execute Run because it exits early. See kong/help.go
	_, _ = cliCtx.Parse([]string{"--help"})
	return nil
}

repository: bcneng/candebot

repo_name: bcneng/candebot

branch_name: refs/heads/main


text:
SUMMARY = "Access to the windowing system"
LICENSE = "GPLv2 | LGPLv2.1"
LIC_FILES_CHKSUM = " \
	file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
"

inherit kde-kf5 cmake-lib cmake-auto-align-paths

DEPENDS += "${@bb.utils.contains("DISTRO_FEATURES", "x11", "virtual/xserver qtx11extras", "", d)}"

PV = "${KF5_VERSION}"
SRC_URI[md5sum] = "ae52891201ea66b15d94a4f5a2717a5f"
SRC_URI[sha256sum] = "b8228dddcc6487e234f81239bea7ca7ae261af8fef7b9e5d7a8b49aa3ac5d0dd"

FILES_${PN} += "${OE_QMAKE_PATH_PLUGINS}"
FILES_${PN}-dbg += "${OE_QMAKE_PATH_PLUGINS}/*/*/.debug"

CMAKE_ALIGN_SYSROOT[1] = "KF5WindowSystem, -S${libdir}/lib, -S${STAGING_LIBDIR}/lib"
CMAKE_ALIGN_SYSROOT[2] = "KF5WindowSystem, -S${includedir}, -S${STAGING_INCDIR}"


text:
DESCRIPTION = "libID3 is a small C library to parse ID3 tags. \
It uses as little memory as possible, and has both DOM- and SAX-like models."
SECTION = "libs/multimedia"
LICENSE = "LGPL"

SRC_URI = "http://download.tangent.org/libid3-${PV}.tar.gz"

inherit autotools pkgconfig

SRC_URI[md5sum] = "e089e8c8c7276373db0a856c508bd8f9"
SRC_URI[sha256sum] = "117831ba06b255ede3cc318278108d19db972b6365c3d80d374d8f888f834c98"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD


text:
require xorg-driver-video.inc
PE = "1"
PR = "${INC_PR}.0"

SRC_URI += "file://fix-includepath.patch"
SRC_URI[archive.md5sum] = "4a307852f3b4850e436a41dab2a73676"
SRC_URI[archive.sha256sum] = "b96c80ae81f5123ecef344dac4c734b2e281143d3ab7a7e633d6bf04c893e203"

repository: trini/openembedded

repo_name: trini/openembedded


text:
// Copyright 2018 The Gini Authors. All rights reserved.  Use of this source
// code is governed by a license that can be found in the License file.

// BUG(wsc): This package does not support adding or retrieving aiger comments
// by an API.

// Package aiger implements aiger format version 1.9 ascii and binary
// readers and writers.
//
// The aiger objects are backed by sequential circuits
// as represented in *logic.S
package aiger

repository: go-air/gini

repo_name: go-air/gini


text:
FIND_LIBRARY(DLib_LIBRARY DLib
    PATHS @CMAKE_INSTALL_PREFIX@/lib
)

SET(DLib_INCLUDE_DIR  "@CMAKE_INSTALL_PREFIX@/include")
#For backward compatibility (i.e. use of "header.h" instead of "dir/header.h"
LIST(APPEND DLib_INCLUDE_DIR ${DLib_INCLUDE_DIR}/../DUtils
  ${DLib_INCLUDE_DIR}/../DUtilsCV ${DLib_INCLUDE_DIR}/../DVision)

SET(DLib_LIBRARIES ${DLib_LIBRARY})
SET(DLib_LIBS ${DLib_LIBRARY})
SET(DLib_INCLUDE_DIRS ${DLib_INCLUDE_DIR})

repository: felixendres/DLib

repo_name: felixendres/DLib

extension: in


text:
# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)

SUMMARY = "Python library to use the AMG88xx Grid-EYE 8x8 thermal sensor with raspberry pi or other linux boards."
HOMEPAGE = "https://github.com/adafruit/Adafruit_AMG88xx_python/"
# Unable to find any files that looked like license statements. Check the accompanying
# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.
#
# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if
# this is not accurate with respect to the licensing of the software being built (it
# will not be in most cases) you must specify the correct value before using this
# recipe for anything other than initial testing/development!
# NOTE: Original package / source metadata indicates license is: MIT
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

SRC_URI = "https://files.pythonhosted.org/packages/c8/e2/39584452778fa85f333446418a37ea09d5cee1a01885e111f401f9900c92/Adafruit_AMG88xx-${PV}.tar.gz"
SRC_URI[md5sum] = "c416a0c5dad6c5a0863dbc91b438ae7d"
SRC_URI[sha256sum] = "e4e0b77396d308b546b5383ac0e4a67077e5d11c51bb762a893b0ab8c4a3cd6e"

S = "${WORKDIR}/Adafruit_AMG88xx-${PV}"

inherit setuptools3

# WARNING: the following rdepends are from setuptools install_requires. These
# upstream names may not correspond exactly to bitbake package names.
RDEPENDS_${PN} += "adafruit-gpio adafruit-bitfield"

# WARNING: the following rdepends are determined through basic analysis of the
# python sources, and might not be 100% accurate.
RDEPENDS_${PN} += "python3-core python3-logging"

# WARNING: We were unable to map the following python package/module
# dependencies to the bitbake packages which include them:
#    Adafruit_GPIO.I2C
#    Adafruit_bitfield


text:
// Code generated by go-swagger; DO NOT EDIT.

package operations

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"net/http"
	"time"

	"golang.org/x/net/context"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	cr "github.com/go-openapi/runtime/client"

	strfmt "github.com/go-openapi/strfmt"
)

// NewGetHeaderByHashParams creates a new GetHeaderByHashParams object
// with the default values initialized.
func NewGetHeaderByHashParams() *GetHeaderByHashParams {
	var ()
	return &GetHeaderByHashParams{

		timeout: cr.DefaultTimeout,
	}
}

// NewGetHeaderByHashParamsWithTimeout creates a new GetHeaderByHashParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetHeaderByHashParamsWithTimeout(timeout time.Duration) *GetHeaderByHashParams {
	var ()
	return &GetHeaderByHashParams{

		timeout: timeout,
	}
}

// NewGetHeaderByHashParamsWithContext creates a new GetHeaderByHashParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetHeaderByHashParamsWithContext(ctx context.Context) *GetHeaderByHashParams {
	var ()
	return &GetHeaderByHashParams{

		Context: ctx,
	}
}

// NewGetHeaderByHashParamsWithHTTPClient creates a new GetHeaderByHashParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetHeaderByHashParamsWithHTTPClient(client *http.Client) *GetHeaderByHashParams {
	var ()
	return &GetHeaderByHashParams{
		HTTPClient: client,
	}
}

/*GetHeaderByHashParams contains all the parameters to send to the API endpoint
for the get header by hash operation typically these are written to a http.Request
*/
type GetHeaderByHashParams struct {

	/*Hash
	  Hash of the block header to fetch

	*/
	Hash string

	timeout    time.Duration
	Context    context.Context
	HTTPClient *http.Client
}

// WithTimeout adds the timeout to the get header by hash params
func (o *GetHeaderByHashParams) WithTimeout(timeout time.Duration) *GetHeaderByHashParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the get header by hash params
func (o *GetHeaderByHashParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the get header by hash params
func (o *GetHeaderByHashParams) WithContext(ctx context.Context) *GetHeaderByHashParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the get header by hash params
func (o *GetHeaderByHashParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the get header by hash params
func (o *GetHeaderByHashParams) WithHTTPClient(client *http.Client) *GetHeaderByHashParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the get header by hash params
func (o *GetHeaderByHashParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithHash adds the hash to the get header by hash params
func (o *GetHeaderByHashParams) WithHash(hash string) *GetHeaderByHashParams {
	o.SetHash(hash)
	return o
}

// SetHash adds the hash to the get header by hash params
func (o *GetHeaderByHashParams) SetHash(hash string) {
	o.Hash = hash
}

// WriteToRequest writes these params to a swagger request
func (o *GetHeaderByHashParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

	if err := r.SetTimeout(o.timeout); err != nil {
		return err
	}
	var res []error

	// query param hash
	qrHash := o.Hash
	qHash := qrHash
	if qHash != "" {
		if err := r.SetQueryParam("hash", qHash); err != nil {
			return err
		}
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

license: ISC

repository: Aeroglyphic/aepp-sdk-go

repo_name: Aeroglyphic/aepp-sdk-go


text:
@misc{singleton,
	title = {Java Singleton Design Pattern Practices with Examples},
	howpublished = {\url{https://www.geeksforgeeks.org/java-singleton-design-pattern-practices-examples/}},
	author = {Geeks for Geeks}
},
@misc{absfact,
	title = {Abstract Factory Pattern – Design Patterns (ep 5)},
	howpublished = {\url{https://www.youtube.com/watch?v=v-GiuMmsXj4}},
	author = {Christopher Okhravi}
},
@book{headfirst,
	title = {Head First Design Patterns},
	publisher={O'Reilly},
	author = {Eric Freeman, Elisabeth Robson}
},
@inbook{hfabsfact,
chapter = {The Factory Pattern},
pages = {pp158 - 163},
crossref = {headfirst}
},
@inbook{hfstrategy,
chapter = {Intro to Design Patterns},
pages = {pp1 - 24},
crossref = {headfirst}
}
@inbook{hfsimple,
chapter = {The Factory Pattern},
pages = {pp1199 - 134},
crossref = {headfirst}
}

extension: bib


text:
package k8s

import (
	"fmt"
	"reflect"

	v1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func ExtractPods(obj interface{}) ([]*v1.PodSpec, error) {
	extracted, err := newExtractor(reflect.TypeOf(v1.PodSpec{})).extractPointersFrom(obj)
	if err != nil {
		return nil, err
	}

	result := make([]*v1.PodSpec, len(extracted))
	for i, e := range extracted {
		c, ok := e.(*v1.PodSpec)
		if !ok {
			return nil, fmt.Errorf("extractPods: expected Pod, actual %T", e)
		}
		result[i] = c
	}
	return result, nil
}

func ExtractPodTemplateSpec(obj interface{}) ([]*v1.PodTemplateSpec, error) {
	extracted, err := newExtractor(reflect.TypeOf(v1.PodTemplateSpec{})).extractPointersFrom(obj)
	if err != nil {
		return nil, err
	}

	result := make([]*v1.PodTemplateSpec, len(extracted))
	for i, e := range extracted {
		c, ok := e.(*v1.PodTemplateSpec)
		if !ok {
			return nil, fmt.Errorf("extractPods: expected Pod, actual %T", e)
		}
		result[i] = c
	}
	return result, nil
}

func extractObjectMetas(obj interface{}, filter func(v reflect.Value) bool) ([]*metav1.ObjectMeta, error) {
	extracted, err := newExtractor(reflect.TypeOf(metav1.ObjectMeta{})).
		withFilter(filter).
		extractPointersFrom(obj)
	if err != nil {
		return nil, err
	}

	result := make([]*metav1.ObjectMeta, len(extracted))
	for i, e := range extracted {
		c, ok := e.(*metav1.ObjectMeta)
		if !ok {
			return nil, fmt.Errorf("ExtractObjectMetas: expected ObjectMeta, actual %T", e)
		}
		result[i] = c
	}
	return result, nil
}

func extractSelectors(obj interface{}, filter func(v reflect.Value) bool) ([]*metav1.LabelSelector, error) {
	extracted, err := newExtractor(reflect.TypeOf(metav1.LabelSelector{})).
		withFilter(filter).
		extractPointersFrom(obj)
	if err != nil {
		return nil, err
	}

	result := make([]*metav1.LabelSelector, len(extracted))
	for i, e := range extracted {
		c, ok := e.(*metav1.LabelSelector)
		if !ok {
			return nil, fmt.Errorf("ExtractSelectors: expected LabelSelector, actual %T", e)
		}
		result[i] = c
	}
	return result, nil
}

func extractServiceSpecs(obj interface{}) ([]*v1.ServiceSpec, error) {
	extracted, err := newExtractor(reflect.TypeOf(v1.ServiceSpec{})).
		extractPointersFrom(obj)
	if err != nil {
		return nil, err
	}

	result := make([]*v1.ServiceSpec, len(extracted))
	for i, e := range extracted {
		c, ok := e.(*v1.ServiceSpec)
		if !ok {
			return nil, fmt.Errorf("ExtractSelectors: expected ServiceSpec, actual %T", e)
		}
		result[i] = c
	}
	return result, nil
}

func extractEnvVars(obj interface{}) ([]*v1.EnvVar, error) {
	extracted, err := newExtractor(reflect.TypeOf(v1.EnvVar{})).extractPointersFrom(obj)
	if err != nil {
		return nil, err
	}

	result := make([]*v1.EnvVar, len(extracted))
	for i, e := range extracted {
		ev, ok := e.(*v1.EnvVar)
		if !ok {
			return nil, fmt.Errorf("extractEnvVars: expected %T, actual %T", v1.EnvVar{}, e)
		}
		result[i] = ev
	}
	return result, nil
}

func extractContainers(obj interface{}) ([]*v1.Container, error) {
	extracted, err := newExtractor(reflect.TypeOf(v1.Container{})).extractPointersFrom(obj)
	if err != nil {
		return nil, err
	}

	result := make([]*v1.Container, len(extracted))
	for i, e := range extracted {
		c, ok := e.(*v1.Container)
		if !ok {
			return nil, fmt.Errorf("extractContainers: expected Container, actual %T", e)
		}
		result[i] = c
	}
	return result, nil
}

type extractor struct {
	// The type we want to return pointers to
	pType reflect.Type

	// Return true to visit the value, or false to skip it.
	filter func(v reflect.Value) bool
}

func newExtractor(pType reflect.Type) extractor {
	return extractor{
		pType:  pType,
		filter: NoFilter,
	}
}

func (e extractor) withFilter(f func(v reflect.Value) bool) extractor {
	e.filter = f
	return e
}

// Get pointers to all the pType structs in this object.
func (e extractor) extractPointersFrom(obj interface{}) ([]interface{}, error) {
	v := reflect.ValueOf(obj)
	result := make([]interface{}, 0)

	// Recursively iterate over the struct fields.
	var extract func(v reflect.Value) error
	extract = func(v reflect.Value) error {
		if !e.filter(v) {
			return nil
		}

		switch v.Kind() {
		case reflect.Ptr, reflect.Interface:
			if v.IsNil() {
				return nil
			}
			return extract(v.Elem())

		case reflect.Struct:
			if v.Type() == e.pType {
				if !v.CanAddr() {
					return fmt.Errorf("Error addressing: %v", v)
				}
				result = append(result, v.Addr().Interface())
				return nil
			}

			for i := 0; i < v.NumField(); i++ {
				field := v.Field(i)
				err := extract(field)
				if err != nil {
					return err
				}
			}
			return nil

		case reflect.Slice:
			for i := 0; i < v.Len(); i++ {
				field := v.Index(i)
				err := extract(field)
				if err != nil {
					return err
				}
			}
			return nil

		}
		return nil
	}

	err := extract(v)
	if err != nil {
		return nil, err
	}
	return result, nil
}

var NoFilter = func(v reflect.Value) bool {
	return true
}

repository: tilt-dev/tilt

repo_name: tilt-dev/tilt


text:
# Copyright (C) 2014-2016 Freescale Semiconductor
# Copyright 2017 NXP
# Released under the MIT license (see COPYING.MIT for the terms)

DESCRIPTION = "Freescale QT Multimedia applications"
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://COPYING;md5=6b552f505eedab4a11ab538cf3db743a"

inherit fsl-eula-unpack pkgconfig

# base on QtMultimedia v5.2.1
DEPENDS += "qtmultimedia gstreamer1.0 gstreamer1.0-plugins-base imx-gst1.0-plugin qtquickcontrols"

SRC_URI = "${FSL_MIRROR}/${PN}-${PV}.bin;fsl-eula=true \
           file://qtimxplayer.desktop \
           file://qtimxcamera.desktop \
"
SRC_URI[md5sum] = "e65c9a365a4ed76efd4e5de8c3b35293"
SRC_URI[sha256sum] = "4a43cc4ec58827dda287e2f3c4700bfa821c5075ffefa06056a33290ccaede9a"

USE_X11 = "${@bb.utils.contains("DISTRO_FEATURES", "x11", "yes", "no", d)}"
PLATFORM_HAS_VPU = " "
PLATFORM_HAS_VPU_imxvpu = "yes"

# imx-qtapplications will be enabled on board with GPU 3D
# For now, imxcamera & imxplayer can only be supported on x11 backend for SoC with VPU only (including i.MX6Q & i.MX6DL)
# And test_qmlglsrc & test_qmlglsink can be supported on all backends
do_install () {
    if [ "${USE_X11}" = "yes" ]; then
        if [ "${PLATFORM_HAS_VPU}" = "yes" ]; then
            install -d ${D}${datadir}/applications
            install -m 0644 ${WORKDIR}/qt*.desktop ${D}${datadir}/applications
            install -d ${D}${datadir}/qt5
            cp -r ${S}/usr/share/qt5/examples ${D}${datadir}/qt5
            install -d ${D}${datadir}/pixmaps
            cp -r ${S}/usr/share/pixmaps/* ${D}${datadir}/pixmaps
        else
            install -d ${D}${datadir}/qt5/examples/multimedia/
            cp -r ${S}/usr/share/qt5/examples/multimedia/qmlgltest/ ${D}${datadir}/qt5/examples/multimedia/
        fi
    else
        install -d ${D}${datadir}/qt5/examples/multimedia/
        cp -r ${S}/usr/share/qt5/examples/multimedia/qmlgltest/ ${D}${datadir}/qt5/examples/multimedia/
    fi
}

FILES_${PN} = " \
    ${datadir}/qt5/examples/*/* \
    ${datadir}/applications/* \
    ${datadir}/pixmaps/* \
"

INSANE_SKIP_${PN} += "debug-files"

COMPATIBLE_MACHINE = "(mx6|mx7ulp)"


text:
@article{
	Coppersmith,
	author="Don Coppersmith and Shmuel Winograd",
	title="Matrix multiplication via arithmetic progressions",
	journal="Journal of Symbolic Computation",
	number=9,
	pages="251--280",
	language="english",
	year=1990,
}

@article{
	Cohn,
	author="Henry Cohn and Robert Kleinberg and Balazs Szegedy and Chris Umans",
	title="Group-theoretic Algorithms for Matrix Multiplication",
	journal="Proceedings of the 46th Annual Symposium on Foundations of Computer Science",
	pages="379--388",
	language="english",
	year=2005,
	month="October"
}

@article{
	Robinson,
	author="Robinson, Sara",
	title="Toward an Optimal Algorithm for Matrix Multiplication",
	journal="SIAM News",
	volume=38,
	number=9,
	language="english",
	year=2005,
	month="November"
}

@article{
	Strassen,
	author="Strassen, Volker",
	title="Gaussian Elimination is not Optimal",
	journal="Numerische Mathematik",
	volume=13,
	number=9,
	pages="354--356",
	language="english",
	year=2005
}

@misc{rusttest,
	title="Документация по ЯП Rust: бенчмарки [Электронный ресурс]",
	howpublished="Режим доступа: \url{https://doc.rust-lang.org/1.7.0/book/benchmark-tests.html} (дата обращения: 21.09.2020)"
}

@misc{manjaro,
	title="Manjaro -- enjoy the simplicity [Электронный ресурс]",
	howpublished="Режим доступа: \url{https://manjaro.org/} (дата обращения: 21.09.2020)"
}

@misc{linux,
	title="Русская информация об ОС Linux [Электронный ресурс]",
	howpublished="Режим доступа: \url{https://www.linux.org.ru/} (дата обращения: 21.09.2020)"
}

@misc{intel,
	title="Процессор Intel® Core™ i7-8550U [Электронный ресурс]",
	howpublished="Режим доступа: \url{https://ark.intel.com/content/www/ru/ru/ark/products/122589/intel-core-i7-8550u-processor-8m-cache-up-to-4-00-ghz.html} (дата обращения: 21.09.2020)"
}
@misc{
	rustlang,
	title="Rust Programming Language [Электронный ресурс].",
	howpublished="URL: \url{https://doc.rust-lang.org/std/index.html}",
	year=2017
}

@article{
	Pogorelov,
	author="Погорелов Дмитрий Александрович, Таразанов Артемий Михайлович, Волкова Лилия Леонидовна",
	title="Оптимизация классического алгоритма Винограда для перемножения матриц",
	journal="Журнал №1",
	volume=49,
	year=2019
}

repository: Justarone/bmstu-aa

repo_name: Justarone/bmstu-aa