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

package models

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

import (
	strfmt "github.com/go-openapi/strfmt"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// Payment payment
// swagger:model Payment
type Payment struct {

	// attributes
	// Required: true
	Attributes *PaymentAttributes `json:"attributes"`

	// created on
	CreatedOn *int64 `json:"created_on,omitempty"`

	// Unique resource ID
	// Pattern: ^[[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$
	ID string `json:"id,omitempty"`

	// modified on
	ModifiedOn *int64 `json:"modified_on,omitempty"`

	// Unique ID of the organisation this resource is created by
	// Required: true
	// Pattern: ^[[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$
	OrganisationID *string `json:"organisation_id"`

	// Name of the resource type
	// Pattern: ^[A-Za-z_]*$
	Type string `json:"type,omitempty"`

	// Version number
	// Minimum: 0
	Version *int64 `json:"version,omitempty"`
}

// Validate validates this payment
func (m *Payment) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateAttributes(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateID(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateOrganisationID(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateType(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateVersion(formats); err != nil {
		res = append(res, err)
	}

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

func (m *Payment) validateAttributes(formats strfmt.Registry) error {

	if err := validate.Required("attributes", "body", m.Attributes); err != nil {
		return err
	}

	if m.Attributes != nil {
		if err := m.Attributes.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("attributes")
			}
			return err
		}
	}

	return nil
}

func (m *Payment) validateID(formats strfmt.Registry) error {

	if swag.IsZero(m.ID) { // not required
		return nil
	}

	if err := validate.Pattern("id", "body", string(m.ID), `^[[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$`); err != nil {
		return err
	}

	return nil
}

func (m *Payment) validateOrganisationID(formats strfmt.Registry) error {

	if err := validate.Required("organisation_id", "body", m.OrganisationID); err != nil {
		return err
	}

	if err := validate.Pattern("organisation_id", "body", string(*m.OrganisationID), `^[[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$`); err != nil {
		return err
	}

	return nil
}

func (m *Payment) validateType(formats strfmt.Registry) error {

	if swag.IsZero(m.Type) { // not required
		return nil
	}

	if err := validate.Pattern("type", "body", string(m.Type), `^[A-Za-z_]*$`); err != nil {
		return err
	}

	return nil
}

func (m *Payment) validateVersion(formats strfmt.Registry) error {

	if swag.IsZero(m.Version) { // not required
		return nil
	}

	if err := validate.MinimumInt("version", "body", int64(*m.Version), 0, false); err != nil {
		return err
	}

	return nil
}

// MarshalBinary interface implementation
func (m *Payment) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *Payment) UnmarshalBinary(b []byte) error {
	var res Payment
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// PaymentAttributes payment attributes
// swagger:model PaymentAttributes
type PaymentAttributes struct {

	// Amount of money moved between the instructing agent and instructed agent
	// Pattern: ^[0-9.]{0,20}$
	Amount string `json:"amount,omitempty"`

	// beneficiary party
	BeneficiaryParty *PaymentAttributesBeneficiaryParty `json:"beneficiary_party,omitempty"`

	// Currency of the transaction amount. Currency code as defined in [ISO 4217](http://www.iso.org/iso/home/standards/currency_codes.htm)
	Currency string `json:"currency,omitempty"`

	// debtor party
	DebtorParty *PaymentAttributesDebtorParty `json:"debtor_party,omitempty"`

	// Payment reference for beneficiary use
	Reference string `json:"reference,omitempty"`
}

// Validate validates this payment attributes
func (m *PaymentAttributes) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateAmount(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateBeneficiaryParty(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateDebtorParty(formats); err != nil {
		res = append(res, err)
	}

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

func (m *PaymentAttributes) validateAmount(formats strfmt.Registry) error {

	if swag.IsZero(m.Amount) { // not required
		return nil
	}

	if err := validate.Pattern("attributes"+"."+"amount", "body", string(m.Amount), `^[0-9.]{0,20}$`); err != nil {
		return err
	}

	return nil
}

func (m *PaymentAttributes) validateBeneficiaryParty(formats strfmt.Registry) error {

	if swag.IsZero(m.BeneficiaryParty) { // not required
		return nil
	}

	if m.BeneficiaryParty != nil {
		if err := m.BeneficiaryParty.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("attributes" + "." + "beneficiary_party")
			}
			return err
		}
	}

	return nil
}

func (m *PaymentAttributes) validateDebtorParty(formats strfmt.Registry) error {

	if swag.IsZero(m.DebtorParty) { // not required
		return nil
	}

	if m.DebtorParty != nil {
		if err := m.DebtorParty.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("attributes" + "." + "debtor_party")
			}
			return err
		}
	}

	return nil
}

// MarshalBinary interface implementation
func (m *PaymentAttributes) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *PaymentAttributes) UnmarshalBinary(b []byte) error {
	var res PaymentAttributes
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// PaymentAttributesBeneficiaryParty payment attributes beneficiary party
// swagger:model PaymentAttributesBeneficiaryParty
type PaymentAttributesBeneficiaryParty struct {

	// Name of beneficiary as given with account
	AccountName string `json:"account_name,omitempty"`

	// Beneficiary account number
	AccountNumber string `json:"account_number,omitempty"`
}

// Validate validates this payment attributes beneficiary party
func (m *PaymentAttributesBeneficiaryParty) Validate(formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *PaymentAttributesBeneficiaryParty) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *PaymentAttributesBeneficiaryParty) UnmarshalBinary(b []byte) error {
	var res PaymentAttributesBeneficiaryParty
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// PaymentAttributesDebtorParty payment attributes debtor party
// swagger:model PaymentAttributesDebtorParty
type PaymentAttributesDebtorParty struct {

	// Name of debtor as given with account
	AccountName string `json:"account_name,omitempty"`

	// Debtor account number. Allows upper case and numeric characters.
	AccountNumber string `json:"account_number,omitempty"`
}

// Validate validates this payment attributes debtor party
func (m *PaymentAttributesDebtorParty) Validate(formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *PaymentAttributesDebtorParty) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *PaymentAttributesDebtorParty) UnmarshalBinary(b []byte) error {
	var res PaymentAttributesDebtorParty
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}


text:
package hook

import (
	"path/filepath"
	"runtime"
	"strconv"
	"strings"

	"github.com/Sirupsen/logrus"
)

type CallerHook struct {
}

func (hook *CallerHook) Fire(entry *logrus.Entry) error {
	switch len(entry.Data) {
	case 0:
		// used without logrus.WithFields
		entry.Data["context"] = hook.caller(7)
	default:
		// used with logrus.WithFields
		entry.Data["context"] = hook.caller(5)
	}

	return nil
}

func (hook *CallerHook) Levels() []logrus.Level {
	return []logrus.Level{
		logrus.PanicLevel,
		logrus.FatalLevel,
		logrus.ErrorLevel,
		logrus.WarnLevel,
		logrus.InfoLevel,
		logrus.DebugLevel,
	}
}

func (hook *CallerHook) caller(skip int) string {
	if _, file, line, ok := runtime.Caller(skip); ok {
		return strings.Join([]string{filepath.Base(file), strconv.Itoa(line)}, ":")
	}
	// Unable to determine caller
	return "???"
}

license: MIT

repository: ryancouto/logrus-hook

license_type: permissive

repo_name: ryancouto/logrus-hook

branch_name: refs/heads/master

extension: go


text:
package minerpool

import (
	"fmt"
	"github.com/hacash/chain/leveldb"
	"github.com/hacash/chain/mapset"
	"github.com/hacash/core/fields"
	"github.com/hacash/core/interfaces"
	interfaces2 "github.com/hacash/miner/interfaces"
	"github.com/hacash/miner/message"
	"sync"
)

type findBlockMsg struct {
	msg     *message.PowMasterMsg
	account *Account
}

type MinerPool struct {
	Conf *MinerPoolConfig

	currentTcpConnectingCount int32 // Current TCP connections

	blockchain interfaces.BlockChain
	txpool     interfaces.TxPool

	storedb *leveldb.DB

	prevRealtimePeriod    *RealtimePeriod
	currentRealtimePeriod *RealtimePeriod

	/////////////////////////////////////

	checkBlockHeightMiningDict  map[uint64]bool
	successFindNewBlockHashOnce fields.Hash

	successFindNewBlockHashs mapset.Set

	successFindBlockCh chan *findBlockMsg
	//settleRealtimePeriodCh     chan *SettlementPeriod

	/////////////////////////////////////

	status *MinerPoolStatus

	periodChange sync.Mutex
}

func (m *MinerPool) Config() interfaces2.PoWConfig {
	return m.Conf
}

func NewMinerPool(cnf *MinerPoolConfig) *MinerPool {

	db, err := leveldb.OpenFile(cnf.Datadir, nil)
	if err != nil {
		fmt.Println("cnf.Datadir: ", cnf.Datadir)
		panic(err)
	}

	pool := &MinerPool{
		Conf:                        cnf,
		currentTcpConnectingCount:   0,
		checkBlockHeightMiningDict:  make(map[uint64]bool),
		successFindNewBlockHashOnce: nil,
		successFindNewBlockHashs:    mapset.NewSet(),
		successFindBlockCh:          make(chan *findBlockMsg, 4),
		//settleRealtimePeriodCh:     make(chan *SettlementPeriod, 4),
		storedb: db,
		txpool:  nil,
	}

	// read status
	pool.status = pool.readStatus()

	return pool

}

func (p *MinerPool) Start() error {
	if p.blockchain == nil {
		err := fmt.Errorf("p.blockchain not be set yet.")
		return err
	}

	err := p.startServerListen()
	if err != nil {
		return err
	}

	go p.loop()

	return nil
}

func (p *MinerPool) SetBlockChain(blockchain interfaces.BlockChain) {
	if p.blockchain != nil {
		panic("p.blockchain already be set.")
	}
	p.blockchain = blockchain
}

func (p *MinerPool) SetTxPool(tp interfaces.TxPool) {
	p.txpool = tp
}

func (p *MinerPool) GetCurrentAddressCount() int {
	if p.currentRealtimePeriod == nil {
		return 0
	}
	return len(p.currentRealtimePeriod.realtimeAccounts)
}

func (p *MinerPool) GetCurrentMiningAccounts() map[string]*Account {
	if p.currentRealtimePeriod == nil {
		return map[string]*Account{}
	}
	return p.currentRealtimePeriod.realtimeAccounts
}

func (p *MinerPool) GetCurrentTcpConnectingCount() int {
	return int(p.currentTcpConnectingCount)
}

func (p *MinerPool) GetCurrentRealtimePeriod() *RealtimePeriod {
	return p.currentRealtimePeriod
}

func (m *MinerPool) Init() error {
	return nil
}

func (m *MinerPool) DoMining(input interfaces.Block, resCh chan interfaces.Block) error {
	m.Excavate(input, resCh)
	return nil
}

repository: hacash/miner

repo_name: hacash/miner

gha_license_id: MIT

gha_language: Go


text:
@article{2006ApJ...644..432Z,
 abstract = {We present optical and infrared monitoring of the 2005 outburst of the
halo black hole X-ray transient XTE J1118+480. We measured a
total outburst amplitude of
åisebox-0.5ex~5.7+/-0.1 mag in the R band and
\i̊sebox-0.5ex~5 mag in the infrared J, H, and
K$_s$ bands. The hardness ratio HR2 (5-12 keV:3-5 keV) from
the RXTE ASM data is 1.53+/-0.02 at the peak of the outburst,
indicating a hard spectrum. Both the shape of the light curve
and the ratio L$_X$(1-10 keV)/L$_opt$ resemble the
minioutbursts observed in GRO J0422+32 and XTE J1859+226. During
early decline, we find a 0.02 mag amplitude variation consistent
with a superhump modulation, like the one observed during the
2000 outburst. Similarly, XTE J1118+480 displayed a double-
humped ellipsoidal modulation distorted by a superhump wave when
settled into a near-quiescence level, suggesting that the disk
expanded to the 3:1 resonance radius after outburst, where it
remained until early quiescence. The system reached quiescence
at R=19.02+/-0.03, about 3 months after the onset of the
outburst. The optical rise preceded the X-ray rise by at most 4
days. The spectral energy distributions (SEDs) at the different
epochs during outburst are all quasi-power laws with F$_\ensur
emathν$\rs̊ebox-0.5ex~\ensuremathν$
^\ensuremathα$ increasing toward the blue. At the
peak of the outburst, we derived
\ensuremathα=0.49+/-0.04 for the optical data alone and
\ensuremathα=0.1+/-0.1 when fitting solely the
infrared. This difference between the optical and the infrared
SEDs suggests that the infrared is dominated by a different
component (a jet?), whereas the optical is presumably showing
the disk evolution.},
 adsnote = {Provided by the SAO/NASA Astrophysics Data System},
 adsurl = {https://ui.adsabs.harvard.edu/abs/2006ApJ...644..432Z},
 archiveprefix = {arXiv},
 author = {Zurita, C. and Torres, M.~A.~P. and Steeghs, D. and
Rodrı́guez-Gil, P. and Muñoz-Darias, T. and Casares, J. and
Shahbaz, T. and Mart\ńez-Pais, I.~G. and Zhao, P. and
Garcia, M.~R. and Piccioni, A. and Bartolini, C. and
Guarnieri, A. and Bloom, J.~S. and Blake, C.~H. and
Falco, E.~E. and Szentgyorgyi, A. and Skrutskie, M.},
 doi = {10.1086/503286},
 eprint = {astro-ph/0602222},
 journal = {\apj},
 keywords = {Accretion, Accretion Disks, Stars: Binaries: Close, Stars: Individual: Alphanumeric: XTE J1118+480, stars: individual (KV UMa), X-Rays: Stars, Astrophysics},
 month = {Jun},
 number = {1},
 pages = {432-438},
 primaryclass = {astro-ph},
 title = {The 2005 Outburst of the Halo Black Hole X-Ray Transient XTE J1118+480},
 volume = {644},
 year = {2006}
}

repository: profjsb/my-content

repo_name: profjsb/my-content

gha_language: TeX

extension: bib


text:
SUMMARY = "Audio glitch effect sequencer LV2 plugin"
HOMEPAGE = "https://github.com/sjaehn/BOops"
LICENSE = "GPL-3.0-only"
LIC_FILES_CHKSUM = "file://LICENSE;md5=d32239bcb673463ab874e80d47fae504"

REQUIRED_DISTRO_FEATURES = "x11"

inherit pkgconfig features_check

DEPENDS += " \
    virtual/libx11 \
    cairo \
    lv2 \
    libsndfile1 \
"

SRC_URI = "git://github.com/sjaehn/BOops.git;branch=master;protocol=https"
SRCREV = "8ed638cfd035e244e0848b107c9668b76dfacb49"
S = "${WORKDIR}/git"
PE = "1"
PV = "1.8.2"

EXTRA_OEMAKE += " \
    STRIP=echo \
"

do_install() {
    DESTDIR=${D} PREFIX=${prefix} oe_runmake install
}

FILES:${PN} += "${libdir}/lv2"

repository: schnitzeltony/meta-musicians

repo_name: schnitzeltony/meta-musicians

gha_language: BitBake

extension: bb


text:
%% Copyright 2016 Daniel Ballester Marques
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Daniel Ballester Marques.

@mvbook{assis08,
    author      = {Machado de Assis},
    title       = {Obra completa em quatro volumes},
    year        = {2008},
    editor      = {Aluizio Leite and Ana Lima Cecilio and Heloisa Jahn},
    editortype  = {organizer},
    edition     = {2},
    volumes     = {4},
    publisher   = {Nova Fronteira},
    location    = {Rio de Janeiro},
    series      = {Biblioteca luso-brasileira. Série brasileira},
}

@book{assis08:1,
    crossref    = {assis08},
    volume      = {1},
    title       = {Fortuna crítica/Romance},
    pagetotal   = {1340},
}

@bookinbook{assis08:1b,
    crossref    = {assis08:1},
    title       = {Esaú e Jacó},
    pages       = {1073-1226},
}

@inbook{bosi08,
    crossref    = {assis08:1},
    title       = {Uma figura machadiana},
    author      = {Alfredo Bosi},
    pages       = {179-189},
}

@suppbook{leite08,
    crossref    = {assis08:1},
    title       = {Nota Editorial},
    author      = {Aluizio Leite and Ana Lima Cecilio and Heloisa Jahn},
    pages       = {1-5},
}

@mvcollection{moretti09,
    editor      = {Franco Moretti},
    editortype  = {organizer},
    translator  = {Denise Bottmann},
    title       = {O Romance},
    volumes     = {5},
    publisher   = {Cosac Naify},
    location    = {São Paulo},
    year        = {2009},
}

@collection{moretti09:1,
    crossref    = {moretti09},
    volume      = {1},
    title       = {A cultura do romance},
    pagetotal   = {1120},
    illustrated = {40 ils.},
}

@incollection{mann09,
    crossref    = {moretti09:1},
    author      = {Thomas Mann},
    title       = {Bilse e eu},
    pages       = {217},
}

@suppcollection{moretti09:1b,
    crossref    = {moretti09:1},
    title       = {Apresentação geral},
    author      = {Franco Moretti},
}

@article{negrão14,
    title       = {Brazilian Portuguese as a transatlantic language},
    subtitle    = {agents of linguistic contact},
    author      = {Esmeralda Vailati Negrão and Evani Viotti},
    journal     = {Interdisciplinary Journal of Portuguese Diaspora Studies},
    volume      = {3},
    pages       = {135-154},
    year        = {2014},
}

@thesis{eliseu84,
    title       = {Verbos ergativos do Português},
    subtitle    = {descrição e análise},
    author      = {André Manuel Godinho Simões Eliseu},
    type        = {Dissertação (Mestrado em Linguística)},
    institution = {Universidade de Lisboa},
    location    = {Lisboa},
    eventdate   = {1985},
}

@thesis{amaral15,
    title       = {A alternância transitivo-intransitiva no português brasileiro},
    subtitle    = {fenômenos semânticos},
    author      = {Luana Lopes Amaral},
    type        = {Tese (Doutorado em Linguística)},
    institution = {Universidade Federal de Minas Gerais},
    location    = {Belo Horizonte},
    eventdate   = {2015},
}

@inproceedings{negrão13,
    title       = {A emergência da sintaxe do português brasileiro},
    subtitle    = {absolutas, alçamento do possuidor e passivas},
    author      = {Esmeralda Vailati Negrão and Evani Viotti},
    eventtitle  = {Encontro nacional do gt de teoria da gramática da ANPOLL},
    number      = {28},
    venue       = {Florianópolis},
    eventdate   = {2013},
    booktitle   = {Caderno de Resumos},
    publisher   = {\mkbibacro{ANPOLL}},
    location    = {Campinas},
    year        = {2013},
}

@article{lucca2009,
  keywords          = {7.7,7.7.5},
  author            = {Gabriella {De Lucca}},
  title             = {Notas curtas},
  journaltitle      = {Getulio},
  location          = {São Paulo},
  volume            = {ano 3},
  pages             = {9},
  % Alternativa 1:
  date              = {2009-07/2009-08},
  % Alternativa 2:
  % month             = {07},
  % year              = {2009},
  % endmonth          = {08},
  % endyear           = {2009},
  options           = {slashdaterange}
}

@inthesis{rodrigues2009parte,
    keywords        = {7.3},
    author          = {Ana Lúcia Aquilas Rodrigues},
    title           = {Aspectos éticos},
    booktitle       = {Impacto de um programa de exercícios no local de trabalho sobre o nível de atividade física e o estágio de prontidão para a mudança de comportamento},
    bookauthor      = {Ana Lúcia Aquilas Rodrigues},
    date            = {2009},
    type            = {Dissertação (Mestrado em Fisiopatologia Experimental)},
    institution     = {Faculdade de Medicina, Universidade de São Paulo},
    location        = {São Paulo},
    eventdate       = {2009},
    pages           = {19-20},
    bookpagination  = {sheet},
}

repository: abntex/biblatex-abnt

repo_name: abntex/biblatex-abnt

branch_name: refs/heads/dev


text:
# This recipe creates a module for the initramfs-framework in OE-core
# which opens the partition identified via the "root"
# kernel parameter using the dm-verity hashes stored in
# the partition identified via the "dmverity" kernel
# parameter and changes bootparam_root so
# that the following init code uses the read-only,
# integrity protected mapped partition.

SUMMARY = "dm-verity module for the modular initramfs system"
LICENSE = "MIT"
DEPENDS = "openssl-native"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

# We depend on secret keys, which (in refkit) get set depending on IMAGE_MODE.
# Therefore create variants of this recipe for each image mode. refkit-initramfs.bb pulls
# in the variant that matches its own image mode.
IMAGE_MODE_VALID = "${REFKIT_IMAGE_MODE_VALID}"
inherit image-mode-variants

require refkit-boot-settings.inc

inherit check-available
CHECK_AVAILABLE[cryptsetup] = "${HAVE_CRYPTSETUP}"

refkit_dmverity[shellcheck] = "sh"
refkit_dmverity () {

    dmverity_enabled() {
        [ "$bootparam_dmverity" ]
    }

    dmverity_run () {
        C=0
        delay=${bootparam_rootdelay:-1}
        timeout=${bootparam_roottimeout:-5}

        if [ "$(echo "$bootparam_root" | cut -c1-5)" = "UUID=" ]; then
            root_uuid=$(echo "$bootparam_root" | cut -c6-)
            bootparam_root=/dev/disk/by-uuid/$root_uuid
        fi

        if [ "$(echo "$bootparam_root" | cut -c1-9)" = "PARTUUID=" ]; then
            root_uuid=$(echo "$bootparam_root" | cut -c10-)
            bootparam_root=/dev/disk/by-partuuid/$root_uuid
        fi

        if [ "$(echo "$bootparam_dmverity" | cut -c1-5)" = "UUID=" ]; then
            root_uuid=$(echo "$bootparam_dmverity" | cut -c6-)
            bootparam_dmverity=/dev/disk/by-uuid/$root_uuid
        fi

        if [ "$(echo "$bootparam_dmverity" | cut -c1-9)" = "PARTUUID=" ]; then
            root_uuid=$(echo "$bootparam_dmverity" | cut -c10-)
            bootparam_dmverity=/dev/disk/by-partuuid/$root_uuid
        fi

        while true; do
            seconds=$( expr "$C" '*' "$delay" )
            # shellcheck disable=SC2035
            if [ "$seconds" -gt "$timeout" ]; then
                fatal "root partition $bootparam_root and/or dm-verity hash partition $bootparam_dmverity not found."
            fi

            if [ -e "$bootparam_root" ] && [ -e "$bootparam_dmverity" ]; then
                signature=$(grep -n -m 1 -e "^signature=" "$bootparam_dmverity")
                if [ ! "$signature" ]; then
                    fatal "no signature found in dm-verity hash partition $bootparam_dmverity"
                fi
                header_lines="$( expr "$(echo "$signature" | sed -e 's/:.*//')" - 1 )"
                header=$(mktemp)
                if ! head "-$header_lines" "$bootparam_dmverity" >"$header"; then
                    fatal "failed to read header from $bootparam_dmverity"
                fi
                sigfile=$(mktemp)
                echo "$signature" | sed -e 's/^[0-9]*:signature=//' | openssl base64 -d >"$sigfile"
                result=$(openssl dgst -sha256 -verify /etc/dm-verity-pubkey.pem -signature "$sigfile" "$header")
                if [ "$?" != 0 ] || [ "$result" != "Verified OK" ]; then
                    fatal "dm-verity header in $bootparam_dmverity did not pass OpenSSL signature verification"
                fi

                eval "$(grep -e ^roothash= -e ^headersize= "$header")"
                if ! veritysetup create "${REFKIT_DEVICE_MAPPER_ROOTFS_NAME}" "$bootparam_root" "$bootparam_dmverity" "$roothash" --hash-offset "$headersize"; then
                    fatal "veritysetup of rootfs $bootparam_root using dm-verity hash partition $bootparam_dmverity failed"
                fi
                bootparam_root="/dev/mapper/${REFKIT_DEVICE_MAPPER_ROOTFS_NAME}"
                return
            fi

            debug "Sleeping for $delay second(s) to wait root to settle..."
            sleep "$delay"
            C=$( expr $C + 1 )
        done
    }

}

python do_install () {
    import os
    import subprocess

    os.makedirs(os.path.join(d.getVar('D'), 'init.d'))
    with open(os.path.join(d.getVar('D'), 'init.d', '80-dmverity'), 'w') as f:
        f.write(d.getVar('refkit_dmverity'))

    privkey = d.getVar('REFKIT_DMVERITY_PRIVATE_KEY')
    password = d.getVar('REFKIT_DMVERITY_PASSWORD')
    pubkey = os.path.join(d.getVar('D'), 'etc', 'dm-verity-pubkey.pem')
    os.makedirs(os.path.dirname(pubkey))
    subprocess.check_output(['openssl', 'rsa', '-in', privkey, '-passin', password, '-pubout', '-out', pubkey],
                            stderr=subprocess.STDOUT)
}

# Skip this recipe if the key isn't set.
REFKIT_DM_VERITY_KEY_NEEDED = "1"
inherit refkit-hash-dm-verity-key
do_install[vardeps] += "REFKIT_DMVERITY_PRIVATE_KEY_HASH"

FILES_${PN} = "/init.d /etc"
RDEPENDS_${PN} += " \
    initramfs-framework-base \
    cryptsetup \
    openssl \
"

repository: intel/intel-iot-refkit

repo_name: intel/intel-iot-refkit

gha_language: Python


text:
DESCRIPTION = "GStreamer elements to use the multimedia accelerators available on some TI parts"
LICENSE = "LGPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24"

require gst-plugins-ti.inc

PR = "${INC_PR}.1"
SRCREV = "6ca21aa3ec8b88b051013af503ef6b702d3c5477"

SRC_URI = "git://git.ti.com/glsdk/gst-plugin-ducati.git;protocol=git"

repository: varigit/meta-arago-var

repo_name: varigit/meta-arago-var


text:
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: api/synchronizer.proto

package pb

import (
	context "context"
	fmt "fmt"
	proto "github.com/golang/protobuf/proto"
	_ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"
	_ "google.golang.org/genproto/googleapis/api/annotations"
	grpc "google.golang.org/grpc"
	math "math"
	pb "open-match.dev/open-match/pkg/pb"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package

type RegisterRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *RegisterRequest) Reset()         { *m = RegisterRequest{} }
func (m *RegisterRequest) String() string { return proto.CompactTextString(m) }
func (*RegisterRequest) ProtoMessage()    {}
func (*RegisterRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_9dbd55595bca25da, []int{0}
}

func (m *RegisterRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_RegisterRequest.Unmarshal(m, b)
}
func (m *RegisterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_RegisterRequest.Marshal(b, m, deterministic)
}
func (m *RegisterRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_RegisterRequest.Merge(m, src)
}
func (m *RegisterRequest) XXX_Size() int {
	return xxx_messageInfo_RegisterRequest.Size(m)
}
func (m *RegisterRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_RegisterRequest.DiscardUnknown(m)
}

var xxx_messageInfo_RegisterRequest proto.InternalMessageInfo

type RegisterResponse struct {
	// Identifier for this request valid for the current synchronization cycle.
	Id                   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *RegisterResponse) Reset()         { *m = RegisterResponse{} }
func (m *RegisterResponse) String() string { return proto.CompactTextString(m) }
func (*RegisterResponse) ProtoMessage()    {}
func (*RegisterResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_9dbd55595bca25da, []int{1}
}

func (m *RegisterResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_RegisterResponse.Unmarshal(m, b)
}
func (m *RegisterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_RegisterResponse.Marshal(b, m, deterministic)
}
func (m *RegisterResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_RegisterResponse.Merge(m, src)
}
func (m *RegisterResponse) XXX_Size() int {
	return xxx_messageInfo_RegisterResponse.Size(m)
}
func (m *RegisterResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_RegisterResponse.DiscardUnknown(m)
}

var xxx_messageInfo_RegisterResponse proto.InternalMessageInfo

func (m *RegisterResponse) GetId() string {
	if m != nil {
		return m.Id
	}
	return ""
}

type EvaluateProposalsRequest struct {
	// List of proposals to evaluate in the current synchronization cycle.
	Match []*pb.Match `protobuf:"bytes,1,rep,name=match,proto3" json:"match,omitempty"`
	// Identifier for this request issued during request registration.
	Id                   string   `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *EvaluateProposalsRequest) Reset()         { *m = EvaluateProposalsRequest{} }
func (m *EvaluateProposalsRequest) String() string { return proto.CompactTextString(m) }
func (*EvaluateProposalsRequest) ProtoMessage()    {}
func (*EvaluateProposalsRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_9dbd55595bca25da, []int{2}
}

func (m *EvaluateProposalsRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_EvaluateProposalsRequest.Unmarshal(m, b)
}
func (m *EvaluateProposalsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_EvaluateProposalsRequest.Marshal(b, m, deterministic)
}
func (m *EvaluateProposalsRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_EvaluateProposalsRequest.Merge(m, src)
}
func (m *EvaluateProposalsRequest) XXX_Size() int {
	return xxx_messageInfo_EvaluateProposalsRequest.Size(m)
}
func (m *EvaluateProposalsRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_EvaluateProposalsRequest.DiscardUnknown(m)
}

var xxx_messageInfo_EvaluateProposalsRequest proto.InternalMessageInfo

func (m *EvaluateProposalsRequest) GetMatch() []*pb.Match {
	if m != nil {
		return m.Match
	}
	return nil
}

func (m *EvaluateProposalsRequest) GetId() string {
	if m != nil {
		return m.Id
	}
	return ""
}

type EvaluateProposalsResponse struct {
	// Results from evaluating proposals for this request.
	Match                []*pb.Match `protobuf:"bytes,1,rep,name=match,proto3" json:"match,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

func (m *EvaluateProposalsResponse) Reset()         { *m = EvaluateProposalsResponse{} }
func (m *EvaluateProposalsResponse) String() string { return proto.CompactTextString(m) }
func (*EvaluateProposalsResponse) ProtoMessage()    {}
func (*EvaluateProposalsResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_9dbd55595bca25da, []int{3}
}

func (m *EvaluateProposalsResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_EvaluateProposalsResponse.Unmarshal(m, b)
}
func (m *EvaluateProposalsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_EvaluateProposalsResponse.Marshal(b, m, deterministic)
}
func (m *EvaluateProposalsResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_EvaluateProposalsResponse.Merge(m, src)
}
func (m *EvaluateProposalsResponse) XXX_Size() int {
	return xxx_messageInfo_EvaluateProposalsResponse.Size(m)
}
func (m *EvaluateProposalsResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_EvaluateProposalsResponse.DiscardUnknown(m)
}

var xxx_messageInfo_EvaluateProposalsResponse proto.InternalMessageInfo

func (m *EvaluateProposalsResponse) GetMatch() []*pb.Match {
	if m != nil {
		return m.Match
	}
	return nil
}

func init() {
	proto.RegisterType((*RegisterRequest)(nil), "api.RegisterRequest")
	proto.RegisterType((*RegisterResponse)(nil), "api.RegisterResponse")
	proto.RegisterType((*EvaluateProposalsRequest)(nil), "api.EvaluateProposalsRequest")
	proto.RegisterType((*EvaluateProposalsResponse)(nil), "api.EvaluateProposalsResponse")
}

func init() { proto.RegisterFile("api/synchronizer.proto", fileDescriptor_9dbd55595bca25da) }

var fileDescriptor_9dbd55595bca25da = []byte{
	// 532 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x4d, 0x6f, 0xd3, 0x40,
	0x10, 0x95, 0x1d, 0x28, 0xb0, 0x45, 0xd0, 0xae, 0xa0, 0x4a, 0xc3, 0x87, 0xb6, 0xee, 0xa5, 0x8a,
	0x88, 0xb7, 0x0d, 0x3d, 0x05, 0x55, 0x6a, 0x81, 0x1e, 0x2a, 0x85, 0x0f, 0xb9, 0x12, 0x87, 0xde,
	0x36, 0xf6, 0x60, 0x2f, 0xb2, 0x77, 0x97, 0x9d, 0x75, 0x0a, 0x1c, 0xfb, 0x13, 0xe0, 0xc6, 0x0f,
	0xe1, 0x8f, 0x70, 0xe6, 0xc6, 0x19, 0xfe, 0x02, 0xb2, 0x9d, 0x90, 0x92, 0xb4, 0xe2, 0x64, 0x79,
	0xde, 0x9b, 0xf7, 0x3c, 0x6f, 0xc6, 0x64, 0x4d, 0x18, 0xc9, 0xf1, 0xa3, 0x8a, 0x33, 0xab, 0x95,
	0xfc, 0x04, 0x36, 0x34, 0x56, 0x3b, 0x4d, 0x5b, 0xc2, 0xc8, 0x0e, 0xad, 0xc0, 0x02, 0x10, 0x45,
	0x0a, 0xd8, 0x00, 0x9d, 0xfb, 0xa9, 0xd6, 0x69, 0x0e, 0xbc, 0x82, 0x84, 0x52, 0xda, 0x09, 0x27,
	0xb5, 0x9a, 0xa2, 0x8f, 0xea, 0x47, 0xdc, 0x4b, 0x41, 0xf5, 0xf0, 0x54, 0xa4, 0x29, 0x58, 0xae,
	0x4d, 0xcd, 0x58, 0x64, 0x07, 0xab, 0xe4, 0x76, 0x04, 0xa9, 0x44, 0x07, 0x36, 0x82, 0xf7, 0x25,
	0xa0, 0x0b, 0x02, 0xb2, 0x32, 0x2b, 0xa1, 0xd1, 0x0a, 0x81, 0xde, 0x22, 0xbe, 0x4c, 0xda, 0x1e,
	0xf3, 0xb6, 0x6e, 0x44, 0xbe, 0x4c, 0x82, 0x21, 0x69, 0x1f, 0x8e, 0x45, 0x5e, 0x0a, 0x07, 0xaf,
	0xad, 0x36, 0x1a, 0x45, 0x8e, 0x93, 0x7e, 0xca, 0xc8, 0xd5, 0x42, 0xb8, 0x38, 0x6b, 0x7b, 0xac,
	0xb5, 0xb5, 0xdc, 0x27, 0xa1, 0x30, 0x32, 0x7c, 0x51, 0x55, 0xa2, 0x06, 0x98, 0xa8, 0xf9, 0x7f,
	0xd5, 0xf6, 0xc8, 0xfa, 0x05, 0x6a, 0x13, 0xeb, 0xff, 0xca, 0xf5, 0x7f, 0x7b, 0xe4, 0xe6, 0xf1,
	0xb9, 0xfc, 0xe8, 0x09, 0xb9, 0x3e, 0x9d, 0x80, 0xde, 0xa9, 0xf9, 0x73, 0x33, 0x76, 0xee, 0xce,
	0x55, 0x1b, 0xaf, 0x60, 0xe3, 0xec, 0xfb, 0xcf, 0x2f, 0xfe, 0x3d, 0xba, 0xce, 0xc7, 0x3b, 0xff,
	0xac, 0x84, 0xdb, 0xa9, 0xde, 0x99, 0x47, 0x56, 0x17, 0x3e, 0x96, 0x3e, 0xa8, 0xf5, 0x2e, 0x8b,
	0xa4, 0xf3, 0xf0, 0x32, 0x78, 0xe2, 0x1b, 0xd6, 0xbe, 0x5b, 0xc1, 0xe6, 0x82, 0xaf, 0x99, 0x72,
	0x07, 0x30, 0xe9, 0x1e, 0x78, 0xdd, 0xa7, 0xbf, 0xfc, 0xcf, 0x07, 0x3f, 0x7c, 0xfa, 0x6d, 0x6e,
	0xf0, 0xe0, 0x88, 0x90, 0x57, 0x06, 0x14, 0xab, 0xe3, 0xa1, 0x6b, 0x99, 0x73, 0x06, 0x07, 0x9c,
	0x6b, 0x03, 0xaa, 0x57, 0x67, 0x15, 0x26, 0x30, 0xee, 0x6c, 0xce, 0xde, 0x7b, 0x89, 0xc4, 0xb8,
	0x44, 0xdc, 0x6f, 0x4e, 0x2a, 0xb5, 0xba, 0x34, 0x18, 0xc6, 0xba, 0xe8, 0xbe, 0x21, 0xf4, 0xc0,
	0x88, 0x38, 0x03, 0xd6, 0x0f, 0xb7, 0xd9, 0x50, 0xc6, 0x50, 0x2d, 0x63, 0x7f, 0x2a, 0x99, 0x4a,
	0x97, 0x95, 0xa3, 0x8a, 0xc9, 0x9b, 0xd6, 0xb7, 0xda, 0xa6, 0xa2, 0x00, 0x3c, 0x67, 0xc6, 0x47,
	0xb9, 0x1e, 0xf1, 0x42, 0x54, 0xb9, 0xf1, 0xe1, 0xd1, 0xb3, 0xc3, 0x97, 0xc7, 0x87, 0xfd, 0xd6,
	0x4e, 0xb8, 0xdd, 0xf5, 0x3d, 0xbf, 0xbf, 0x22, 0x8c, 0xc9, 0x65, 0x5c, 0x5f, 0x23, 0x7f, 0x87,
	0x5a, 0x0d, 0x16, 0x2a, 0xd1, 0x13, 0xd2, 0xda, 0xdd, 0xde, 0xa5, 0xbb, 0xa4, 0x1b, 0x81, 0x2b,
	0xad, 0x82, 0x84, 0x9d, 0x66, 0xa0, 0x98, 0xcb, 0x80, 0x59, 0x40, 0x5d, 0xda, 0x18, 0x58, 0xa2,
	0x01, 0x99, 0xd2, 0x8e, 0xc1, 0x07, 0x89, 0x2e, 0xa4, 0x4b, 0xe4, 0xca, 0x57, 0xdf, 0xbb, 0x66,
	0xf7, 0x48, 0x7b, 0x16, 0x06, 0x7b, 0xae, 0xe3, 0xb2, 0x00, 0xd5, 0x5c, 0x3f, 0xdd, 0xb8, 0x38,
	0x1a, 0x8e, 0xd2, 0x01, 0x4f, 0x74, 0x8c, 0xfc, 0x64, 0x59, 0x2a, 0x07, 0x56, 0x89, 0x9c, 0x9b,
	0xd1, 0x68, 0xa9, 0xfe, 0x5b, 0x1e, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xc1, 0xcf, 0x1f, 0xc5,
	0xac, 0x03, 0x00, 0x00,
}

// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4

// SynchronizerClient is the client API for Synchronizer service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type SynchronizerClient interface {
	// Register associates this request with the current synchronization cycle and
	// returns an identifier for this registration. The caller returns this
	// identifier back in the evaluation request. This enables synchronizer to
	// identify stale evaluation requests belonging to a prior window.
	Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error)
	// EvaluateProposals accepts a list of proposals and a registration identifier
	// for this request. If the synchronization cycle to which the request was
	// registered is completed, this request fails otherwise the proposals are
	// added to the list of proposals to be evaluated in the current cycle. At the
	//  end of the cycle, the user defined evaluation method is triggered and the
	// matches accepted by it are returned as results.
	EvaluateProposals(ctx context.Context, in *EvaluateProposalsRequest, opts ...grpc.CallOption) (*EvaluateProposalsResponse, error)
}

type synchronizerClient struct {
	cc *grpc.ClientConn
}

func NewSynchronizerClient(cc *grpc.ClientConn) SynchronizerClient {
	return &synchronizerClient{cc}
}

func (c *synchronizerClient) Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error) {
	out := new(RegisterResponse)
	err := c.cc.Invoke(ctx, "/api.Synchronizer/Register", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *synchronizerClient) EvaluateProposals(ctx context.Context, in *EvaluateProposalsRequest, opts ...grpc.CallOption) (*EvaluateProposalsResponse, error) {
	out := new(EvaluateProposalsResponse)
	err := c.cc.Invoke(ctx, "/api.Synchronizer/EvaluateProposals", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// SynchronizerServer is the server API for Synchronizer service.
type SynchronizerServer interface {
	// Register associates this request with the current synchronization cycle and
	// returns an identifier for this registration. The caller returns this
	// identifier back in the evaluation request. This enables synchronizer to
	// identify stale evaluation requests belonging to a prior window.
	Register(context.Context, *RegisterRequest) (*RegisterResponse, error)
	// EvaluateProposals accepts a list of proposals and a registration identifier
	// for this request. If the synchronization cycle to which the request was
	// registered is completed, this request fails otherwise the proposals are
	// added to the list of proposals to be evaluated in the current cycle. At the
	//  end of the cycle, the user defined evaluation method is triggered and the
	// matches accepted by it are returned as results.
	EvaluateProposals(context.Context, *EvaluateProposalsRequest) (*EvaluateProposalsResponse, error)
}

func RegisterSynchronizerServer(s *grpc.Server, srv SynchronizerServer) {
	s.RegisterService(&_Synchronizer_serviceDesc, srv)
}

func _Synchronizer_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(RegisterRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SynchronizerServer).Register(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/api.Synchronizer/Register",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SynchronizerServer).Register(ctx, req.(*RegisterRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Synchronizer_EvaluateProposals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(EvaluateProposalsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SynchronizerServer).EvaluateProposals(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/api.Synchronizer/EvaluateProposals",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SynchronizerServer).EvaluateProposals(ctx, req.(*EvaluateProposalsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

var _Synchronizer_serviceDesc = grpc.ServiceDesc{
	ServiceName: "api.Synchronizer",
	HandlerType: (*SynchronizerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Register",
			Handler:    _Synchronizer_Register_Handler,
		},
		{
			MethodName: "EvaluateProposals",
			Handler:    _Synchronizer_EvaluateProposals_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/synchronizer.proto",
}

repository: TienHP/open-match

repo_name: TienHP/open-match


text:
package cmds

import (
	"context"

	"github.com/appscode/go/flags"
	"github.com/appscode/go/term"
	api "github.com/appscode/pharmer/apis/v1alpha1"
	"github.com/appscode/pharmer/cloud"
	"github.com/appscode/pharmer/config"
	"github.com/spf13/cobra"
)

func NewCmdDeleteNodeGroup() *cobra.Command {
	cmd := &cobra.Command{
		Use: api.ResourceNameNodeGroup,
		Aliases: []string{
			api.ResourceTypeNodeGroup,
			api.ResourceCodeNodeGroup,
			api.ResourceKindNodeGroup,
		},
		Short:             "Delete a Kubernetes cluster NodeGroup",
		Example:           "pharmer delete nodegroup -k <cluster_name>",
		DisableAutoGenTag: true,
		Run: func(cmd *cobra.Command, args []string) {
			flags.EnsureRequiredFlags(cmd, "cluster")

			cfgFile, _ := config.GetConfigFile(cmd.Flags())
			cfg, err := config.LoadConfig(cfgFile)
			term.ExitOnError(err)

			ctx := cloud.NewContext(context.Background(), cfg, config.GetEnv(cmd.Flags()))
			clusterName, _ := cmd.Flags().GetString("cluster")

			nodeGroups, err := getNodeGroupList(ctx, clusterName, args...)
			term.ExitOnError(err)

			for _, ng := range nodeGroups {
				err := cloud.DeleteNG(ctx, ng.Name, clusterName)
				term.ExitOnError(err)
			}
		},
	}

	cmd.Flags().StringP("cluster", "k", "", "Name of the Kubernetes cluster")
	return cmd
}


text:
package httpx

import (
	"fmt"
	"net/url"

	"github.com/weblazy/easy/utils/stringx"
)

// @desc 编译http参数
// @auth liuguoqiang 2020-03-20
// @param
// @return
func MapToQuery(params map[string]interface{}, urlEncode ...bool) (string, error) {
	if params == nil {
		return "", fmt.Errorf("param is nil")
	}
	v := make(url.Values)
	for key := range params {
		value, err := stringx.ToString(params[key])
		if err != nil {
			return "", nil
		}
		v.Add(key, value)
	}
	encodeStr := v.Encode()
	if len(urlEncode) > 0 && urlEncode[0] {
		return encodeStr, nil
	}
	decodeStr, _ := url.QueryUnescape(encodeStr)
	return decodeStr, nil

}


text:
function(gauze_create_avd)
  if("${ANDROID-SDK_ROOT}" STREQUAL "")
    message(FATAL_ERROR "Internal error")
  endif()

  if("${GAUZE_DEVICE_NAME}" STREQUAL "")
    message(FATAL_ERROR "Internal error")
  endif()

  set(android_tool "${ANDROID-SDK_ROOT}/android-sdk/tools/android")

  set(cmd "${android_tool}" "list" "avd")
  execute_process(
      COMMAND ${cmd}
      RESULT_VARIABLE result
      OUTPUT_VARIABLE output
      ERROR_VARIABLE error
      OUTPUT_STRIP_TRAILING_WHITESPACE
      ERROR_STRIP_TRAILING_WHITESPACE
  )

  if(NOT result EQUAL 0)
    message(FATAL_ERROR "Command failed: ${cmd} (${result}, ${output}, ${error})")
  endif()

  string(REGEX MATCH "\n    Name: ${GAUZE_DEVICE_NAME}\n" avd_found "${output}")
  if(NOT "${avd_found}" STREQUAL "")
    message("AVD with name '${GAUZE_DEVICE_NAME}' already exist")
    return()
  endif()

  set(abi "${CMAKE_ANDROID_ARCH_ABI}")
  string(COMPARE EQUAL "${CMAKE_ANDROID_ARCH_ABI}" "armeabi" is_armeabi)
  if(is_armeabi)
    set(abi "armeabi-v7a")
  endif()

  string(TIMESTAMP timestamp)
  message("[${timestamp}] Creating AVD with name '${GAUZE_DEVICE_NAME}'")
  set(
      cmd
      ${android_tool}
      create
      avd
      "--name" "${GAUZE_DEVICE_NAME}"
      "--target" "android-${CMAKE_SYSTEM_VERSION}"
      "--abi" "${abi}"
  )
  execute_process(
      COMMAND ${CMAKE_COMMAND} -E echo no
      COMMAND ${cmd}
      RESULT_VARIABLE result
      OUTPUT_VARIABLE output
      ERROR_VARIABLE error
      OUTPUT_STRIP_TRAILING_WHITESPACE
      ERROR_STRIP_TRAILING_WHITESPACE
  )

  if(result EQUAL 0)
    string(TIMESTAMP timestamp)
    message("[${timestamp}] Done")
  else()
    message(FATAL_ERROR "Command failed: ${cmd} (${result}, ${output}, ${error})")
  endif()
endfunction()

repository: hunter-packages-archive/gauze

repo_name: hunter-packages-archive/gauze

extension: cmake


text:
# (C) Hiventive 2018
# Guillaume Delbergue <guillaume.delbergue@hiventive.com>
# MIT License

# YAML CMake parser
# FIXME: This parser is broken with depth >= 1

function(yaml_parse FILENAME PREFIX)
	file(READ ${FILENAME} _YAML_FILE_CONTENT)
	string(REGEX REPLACE "\n" ";" _YAML_FILE_CONTENT_LINES "${_YAML_FILE_CONTENT}")
	set(_YAML_INDENT 2)
	set(_YAML_DEPTH 0)
	set(_YAML_NODE "")
	set(_YAML_PREFIX ${PREFIX})
	foreach(_YAML_FILE_CONTENT_LINE ${_YAML_FILE_CONTENT_LINES})
		if(${_YAML_FILE_CONTENT_LINE} MATCHES ".*([0-9_a-zA-Z]+):$")
			# Get map name
			string(REGEX REPLACE "^[ ]*([0-9_a-zA-Z]+):$" "\\1" _YAML_MAP_NAME "${_YAML_FILE_CONTENT_LINE}")
			string(TOUPPER ${_YAML_MAP_NAME} _YAML_MAP_NAME)
			# Count number of whitespaces to get the depth
			string(REGEX MATCHALL " " _YAML_MAP_INDENT "${_YAML_FILE_CONTENT_LINE}")
			list(LENGTH _YAML_MAP_INDENT _YAML_DEPTH)
			# Store name
			# FIXME: broken here
			if(NOT ${_YAML_DEPTH})
				set(_YAML_NODE ${_YAML_MAP_NAME})
			else()
				set(_YAML_NODE "${_YAML_NODE}_${_YAML_MAP_NAME}")
			endif()
		elseif(${_YAML_FILE_CONTENT_LINE} MATCHES ".*([0-9_a-zA-Z]+): ([0-9_a-zA-Z.-]+)")
			# Get scalar name and value
			string(REGEX REPLACE "^[ ]*([0-9_a-zA-Z]+): [0-9_a-zA-Z.-]+$" "\\1" _YAML_SCALAR_NAME "${_YAML_FILE_CONTENT_LINE}")
			string(TOUPPER ${_YAML_SCALAR_NAME} _YAML_SCALAR_NAME)
			# Get scalar value
			string(REGEX REPLACE "^[ ]*[0-9_a-zA-Z]+: ([0-9_a-zA-Z.-]+)$" "\\1" _YAML_SCALAR_VALUE "${_YAML_FILE_CONTENT_LINE}")
			# Store value
			set(${_YAML_PREFIX}_${_YAML_NODE}_${_YAML_SCALAR_NAME} "${_YAML_SCALAR_VALUE}" PARENT_SCOPE)
		endif()
	endforeach()
endfunction()

repository: hiventive/hvcommon

repo_name: hiventive/hvcommon


text:
@article{pickard2018,
 abstract = {},
 author = {Pickard, K and Harris, S},
 editor = {},
 journal = {Br J Hosp Med (Lond)},
 keywords = {},
 location = {CT2 Doctor, Department of Critical Care, University College London, London NW1 2BU. Consultant in Anaesthesia and Critical Care, Department of Critical Care, University College London, London.},
 number = {1},
 pages = {C13–C15},
 title = {High flow nasal oxygen therapy.},
 volume = {79},
 year = {2018}
}

repository: docsteveharris/harris-data-lab

repo_name: docsteveharris/harris-data-lab

branch_name: refs/heads/main


text:
package asmcgocall

import (
	"reflect"
	"unsafe"
)

//go:linkname asmcgocall runtime.asmcgocall
//go:noescape
func asmcgocall(fn unsafe.Pointer, arg unsafe.Pointer) int32

type parameter struct {
	packedOffset, offset, size uintptr
}

func Register(cfn unsafe.Pointer, caller interface{}) {
	fn := reflect.TypeOf(caller)

	if fn.Kind() != reflect.Ptr {
		panic("caller must be pointer to variable with function type")
	}

	fn = fn.Elem()

	if fn.Kind() != reflect.Func {
		panic("caller must be pointer to variable with function type")
	}

	parameters, returns := calcPadding(fn)

	var proxy func(args [0]byte) (ret [0]byte)

	if returns {
		proxy = createProxyRet(cfn, parameters)
	} else {
		proxy = createProxy(cfn, parameters)
	}

	/*
		let proxy(function above) be callable with passed function signature of call
	*/
	eface := (*[2]unsafe.Pointer)(unsafe.Pointer(&caller))[1]
	*(*unsafe.Pointer)(eface) = *(*unsafe.Pointer)(unsafe.Pointer(&proxy))
}

func calcPadding(fn reflect.Type) (parameters []parameter, returns bool) {
	if Debug {
		logf("struct argument_frame {\n")
	}

	var padoffset uintptr
	parameters = make([]parameter, 0, 1)

	off := int(0)
	for i, n := 0, fn.NumIn(); i < n; i++ {
		param := fn.In(i)
		psize := param.Size()

		palign := param.Align()
		if off%palign != 0 {
			pad := palign - off%palign

			if Debug {
				logf("\tchar __pad%d[%d]; // %d %s\n", off, pad, pad, bytes(pad))
			}

			off += pad
			padoffset += uintptr(pad)
		}

		if Debug {
			logf("\t%s p%d; // %d %s\n", param.Name(), i, psize, bytes(psize))
		}

		parameters = append(parameters, parameter{uintptr(off) - padoffset, uintptr(off), psize})

		off += int(psize)
	}

	const ptrsize = int(unsafe.Sizeof(uintptr(0)))

	if off%ptrsize != 0 {
		pad := ptrsize - off%ptrsize

		if Debug {
			logf("\tchar __pad%d[%d]; // %d %s\n", off, pad, pad, bytes(pad))
		}

		off += pad
		padoffset += uintptr(pad)
	}

	returns = false
	if fn.NumOut() > 0 {
		t := fn.Out(0)
		retalign := t.Align()
		retsize := t.Size()

		if off%retalign != 0 {
			pad := retalign - off%retalign

			if Debug {
				logf("\tchar __pad%d[%d]; // %d %s\n", off, pad, pad, bytes(pad))
			}

			off += pad
			padoffset += uintptr(pad)
		}

		if Debug {
			logf("\t%s ret;  // %d %s\n", t.Name(), retsize, bytes(retsize))
		}

		parameters = append(parameters, parameter{uintptr(off) - padoffset, uintptr(off), retsize})

		off += int(retsize)

		returns = true
	}

	if Debug && off%ptrsize != 0 {
		pad := ptrsize - off%ptrsize
		logf("\tchar __pad%d[%d]; // %d %s\n", off, pad, pad, bytes(pad))
		off += pad
	}

	if Debug && off == 0 {
		logf("\tchar unused;\n") // avoid empty struct
	}

	if Debug {
		logf("}; // %d bytes\n", off)
	}

	return
}

func createProxy(cfn unsafe.Pointer, parameters []parameter) func(args [0]byte) (ret [0]byte) {
	if len(parameters) == 0 {
		return func(args [0]byte) (ret [0]byte) {
			asmcgocall(cfn, nil)

			return
		}
	}

	return func(args [0]byte) (ret [0]byte) {
		params := parameters

		pargs := unsafe.Pointer(&args)

		var (
			p parameter
			i uintptr
		)

		/*
			Pack parameters
		*/
		for c := 1; c < len(params); c++ {
			p = params[c]

			if p.offset == p.packedOffset {
				continue
			}

			for i = 0; i < p.size; i++ {
				*(*byte)(unsafe.Pointer(uintptr(pargs) + p.packedOffset + i)) = *(*byte)(unsafe.Pointer(uintptr(pargs) + p.offset + i))
			}
		}

		asmcgocall(cfn, pargs)

		return
	}
}

func createProxyRet(cfn unsafe.Pointer, parameters []parameter) func(args [0]byte) (ret [0]byte) {
	if len(parameters) == 1 {
		return func(args [0]byte) (ret [0]byte) {
			asmcgocall(cfn, unsafe.Pointer(&args))

			return
		}
	}

	return func(args [0]byte) (ret [0]byte) {
		params := parameters

		pargs := unsafe.Pointer(&args)

		var (
			p parameter
			i uintptr
		)

		/*
			Pack parameters
		*/
		n := len(params) - 1
		for c := 1; c < n; c++ {
			p = params[c]

			if p.offset == p.packedOffset {
				continue
			}

			for i = 0; i < p.size; i++ {
				*(*byte)(unsafe.Pointer(uintptr(pargs) + p.packedOffset + i)) = *(*byte)(unsafe.Pointer(uintptr(pargs) + p.offset + i))
			}
		}

		p = params[n]
		if p.offset == p.packedOffset {
			asmcgocall(cfn, pargs)

			return
		}

		/*
			Fill return value with nulls (taking pad's spot)
		*/
		for i = 0; i < p.size; i++ {
			*(*byte)(unsafe.Pointer(uintptr(pargs) + p.packedOffset + i)) = 0
		}

		asmcgocall(cfn, pargs)

		/*
			Reposition(unpack) return value back before exit
		*/
		for i = 0; i < p.size; i++ {
			*(*byte)(unsafe.Pointer(uintptr(pargs) + p.offset + i)) = *(*byte)(unsafe.Pointer(uintptr(pargs) + p.packedOffset + i))
		}

		return
	}
}

repository: LaevusDexter/asmcgocall

repo_name: LaevusDexter/asmcgocall


text:
package fako

import (
	"reflect"

	"github.com/serenize/snaker"
)

//Fill fills all the fields that have a fako: tag
func Fill(elems ...interface{}) {
	for _, elem := range elems {
		FillElem(elem)
	}
}

//FillElem provides a way to fill a simple interface
func FillElem(strukt interface{}) {
	fillWithDetails(strukt, []string{}, []string{})
}

//FillOnly fills fields that have a fako: tag and its name is on the second argument array
func FillOnly(strukt interface{}, fields ...string) {
	fillWithDetails(strukt, fields, []string{})
}

//FillExcept fills fields that have a fako: tag and its name is not on the second argument array
func FillExcept(strukt interface{}, fields ...string) {
	fillWithDetails(strukt, []string{}, fields)
}

func fillWithDetails(strukt interface{}, only []string, except []string) {
	elem := reflect.ValueOf(strukt).Elem()
	elemT := reflect.TypeOf(strukt).Elem()

	for i := 0; i < elem.NumField(); i++ {
		field := elem.Field(i)
		fieldt := elemT.Field(i)
		fakeType := fieldt.Tag.Get("fako")

		if fakeType != "" {
			fakeType = snaker.SnakeToCamel(fakeType)
			function := findFakeFunctionFor(fakeType)

			inOnly := len(only) == 0 || (len(only) > 0 && contains(only, fieldt.Name))
			notInExcept := len(except) == 0 || (len(except) > 0 && !contains(except, fieldt.Name))

			if field.CanSet() && fakeType != "" && inOnly && notInExcept {
				field.SetString(function())
			}
		}

	}
}

repository: kaporzhu/fako

repo_name: kaporzhu/fako


text:
package product

import (
	"context"
	"fmt"
	"github.com/gingerxman/eel"
	"strings"
)

type EncodePoolProductService struct {
	eel.ServiceBase
}

func NewEncodePoolProductService(ctx context.Context) *EncodePoolProductService {
	service := new(EncodePoolProductService)
	service.Ctx = ctx
	return service
}

//Encode 对单个实体对象进行编码
func (this *EncodePoolProductService) Encode(poolProduct *PoolProduct) *RPoolProduct {
	if poolProduct == nil {
		return nil
	}

	//对BaseInfo进行编码
	product := poolProduct.Product
	rProductBaseInfo := RProductBaseInfo{}
	rProductBaseInfo.Id = product.Id
	rProductBaseInfo.Name = product.Name
	rProductBaseInfo.Type = product.Type
	rProductBaseInfo.CreateType = poolProduct.Type
	rProductBaseInfo.PromotionTitle = product.PromotionTitle
	rProductBaseInfo.Code = product.Code
	if product.Description != nil {
		rProductBaseInfo.Detail = product.Description.Detail
	}
	rProductBaseInfo.ShelveType = poolProduct.Status
	rProductBaseInfo.Thumbnail = product.Thumbnail
	if strings.Index(rProductBaseInfo.Thumbnail, ".oss-") != -1 {
		thumbnail := strings.Replace(rProductBaseInfo.Thumbnail, "vxiaocheng-jh.oss-cn-beijing.aliyuncs.com", "resource.vxiaocheng.com", 1)
		thumbnail = fmt.Sprintf("%s?x-oss-process=image/resize,w_100/quality,q_80/interlace,1/format,jpg", thumbnail)
		rProductBaseInfo.Thumbnail = thumbnail
	}

	//对Medias进行编码
	rProductMedias := make([]*RProductMedia, 0)
	for _, media := range product.Medias {
		rProductMedias = append(rProductMedias, &RProductMedia{
			Id: media.Id,
			Type: media.Type,
			Url: media.Url,
		})
	}

	//对Skus进行编码
	rSkus := make([]*RProductSku, 0)
	for _, sku := range product.Skus {
		rSku := &RProductSku{
			Id: sku.Id,
			Name: sku.Name,
			Code: sku.Code,
			Price: sku.Price,
			CostPrice: sku.CostPrice,
			Stocks: sku.Stocks,
		}

		rPropertyValues := make([]*RProductPropertyValue, 0)
		buf := make([]string, 0)
		for _, propertyValue := range sku.PropertyValues {
			rPropertyValue := &RProductPropertyValue{
				Id: propertyValue.Id,
				PropertyId: propertyValue.PropertyId,
				PropertyName: propertyValue.PropertyName,
				Text: propertyValue.Text,
				Image: propertyValue.Image,
			}
			rPropertyValues = append(rPropertyValues, rPropertyValue)
			buf = append(buf, propertyValue.Text)
		}
		rSku.PropertyValues = rPropertyValues
		rSku.DisplayName = strings.Join(buf, " ")

		rSkus = append(rSkus, rSku)
	}

	//对Labels进行编码
	rLabels := make([]*RProductLabel, 0)
	if len(product.Labels) > 0 {
		rLabels = NewEncodeProductLabelService(this.Ctx).EncodeMany(product.Labels)
	} else {
		rLabels = make([]*RProductLabel, 0)
	}

	//对Category进行编码
	var rCategory *RLintProductCategory
	if len(product.Categories) > 0 {
		//TODO: 将product.Categories改为product.Category
		category := product.Categories[0]
		rCategory = &RLintProductCategory{
			Id: category.Id,
			Name: category.Name,
		}
	}

	//对logistics info进行编码
	//supplierCorp := account.NewCorpFromOnlyId(this.Ctx, poolProduct.SupplierId)
	//postageConfig := postage.NewPostageConfigRepository(this.Ctx).GetActivePostageConfigInCorp(supplierCorp)
	//if postageConfig == nil {
	//	postage.NewPostageConfigFactory(this.Ctx).MakeSureDefaultPostageConfigExits(supplierCorp)
	//	postageConfig = postage.NewPostageConfigRepository(this.Ctx).GetActivePostageConfigInCorp(supplierCorp)
	//}
	//postage.NewFillPostageConfigService(this.Ctx).FillOne(postageConfig, eel.FillOption{})
	//rPostageConfig := postage.NewEncodePostageConfigService(this.Ctx).Encode(postageConfig)
	rLogisticsInfo := RProductLogisticsInfo{
		PostageType: product.PostageType,
		UnifiedPostageMoney: product.UnifiedPostageMoney,
		//PostageConfig: rPostageConfig,
		LimitZoneType: product.LimitZoneType,
		LimitZoneTypeCode: product.GetLimitZontTypeText(),
		LimitZoneId: product.LimitZoneId,
		LimitZoneAreas: product.GetLimitZoneAreas(),
	}

	return &RPoolProduct{
		Id: poolProduct.Id,
		CorpId: poolProduct.CorpId,
		Type: poolProduct.Type,
		BaseInfo: &rProductBaseInfo,
		LogisticsInfo: &rLogisticsInfo,
		Medias: rProductMedias,
		Category: rCategory,
		SoldCount: poolProduct.SoldCount,
		VisitInfo: &RVisitInfo{
			UserCount: 5,
			ViewCount: 20,
		},
		Skus: rSkus,
		Labels: rLabels,
		IsDeleted: false,
		Status: poolProduct.Status,
		CreatedAt: poolProduct.CreatedAt.Format("2006-01-02 15:04"),
	}
}

//EncodeMany 对实体对象进行批量编码
func (this *EncodePoolProductService) EncodeMany(poolProducts []*PoolProduct) []*RPoolProduct {
	rDatas := make([]*RPoolProduct, 0)
	for _, poolProduct := range poolProducts {
		rDatas = append(rDatas, this.Encode(poolProduct))
	}

	return rDatas
}

func init() {
}

repository: gingerxman/ginger-mall

repo_name: gingerxman/ginger-mall


text:
SECTION = "devel/chicken"
DESCRIPTION = "load and compile groups of files"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://system.meta;md5=9c308b3885d72785c9e03ab26294b188"
DEPENDS_append_class-cross = " chicken-egg-coops-cross chicken-egg-shell-cross"
DEPENDS_append_class-crosssdk = " chicken-egg-coops-crosssdk chicken-egg-shell-crosssdk"
DEPENDS_append_class-nativesdk = " nativesdk-chicken-egg-coops nativesdk-chicken-egg-shell chicken-egg-coops-crosssdk chicken-egg-shell-crosssdk"
DEPENDS = " chicken-egg-coops chicken-egg-shell chicken-egg-coops-cross chicken-egg-shell-cross"
RDEPENDS_${PN} = " chicken-egg-coops chicken-egg-shell"

SRC_URI = "http://code.call-cc.org/egg-tarballs/4/system/system-${PV}.tar.gz"

SRC_URI[md5sum] = "5808a54937b8e06268fc31991109ef71"
SRC_URI[sha256sum] = "83bbb1b952c8838c9ab3c91c89d926b1560deca2adb36eaeb9731b9dbae50764"

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

inherit chicken_install

BBCLASSEXTEND = "cross crosssdk nativesdk"

repository: OSSystems/meta-chicken

repo_name: OSSystems/meta-chicken


text:
/*

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 main

import (
	"flag"
	"fmt"
	"runtime"

	apiruntime "k8s.io/apimachinery/pkg/runtime"
	utilruntime "k8s.io/apimachinery/pkg/util/runtime"
	clientgoscheme "k8s.io/client-go/kubernetes/scheme"
	"k8s.io/klog"

	ctrl "sigs.k8s.io/controller-runtime"

	pod_restarter "github.com/cynepco3ahue/pod-restarter/pkg/controllers/pod-restarter"
	"github.com/cynepco3ahue/pod-restarter/pkg/version"
)

// Change below variables to serve metrics on different host or port.
var (
	metricsHost       = "0.0.0.0"
	metricsPort int32 = 8383
)

var (
	scheme = apiruntime.NewScheme()
)

func init() {
	utilruntime.Must(clientgoscheme.AddToScheme(scheme))
}

func printVersion() {
	klog.Infof("Operator Version: %s", version.Version)
	klog.Infof("Git Commit: %s", version.GitCommit)
	klog.Infof("Build Date: %s", version.BuildDate)
	klog.Infof("Go Version: %s", runtime.Version())
	klog.Infof("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH)
}

func main() {
	var metricsAddr string
	var enableLeaderElection bool

	// Add klog flags
	klog.InitFlags(nil)
	flag.StringVar(&metricsAddr, "metrics-addr", fmt.Sprintf("%s:%d", metricsHost, metricsPort),
		"The address the metric endpoint binds to.")
	flag.BoolVar(&enableLeaderElection, "enable-leader-election", true,
		"Enable leader election for controller manager. "+
			"Enabling this will ensure there is only one active controller manager.")
	flag.Parse()

	printVersion()

	mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
		Scheme:             scheme,
		MetricsBindAddress: metricsAddr,
	})
	if err != nil {
		klog.Exit(err.Error())
	}

	if err = (&pod_restarter.PodRestartReconciler{
		Client:   mgr.GetClient(),
		Scheme:   mgr.GetScheme(),
		Recorder: mgr.GetEventRecorderFor("pod-restart-controller"),
	}).SetupWithManager(mgr); err != nil {
		klog.Exitf("unable to create pod-restart controller : %v", err)
	}

	klog.Info("Starting the Cmd.")
	if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
		klog.Exitf("Manager exited with non-zero code: %v", err)
	}
}


text:
package nineteen_test

import (
	"testing"

	"github.com/grellyd/adventofcode/nineteen"
)

func TestOnePartOne(t *testing.T) {
	var tests = []struct {
		input int
		want  int
	}{
		{12, 2},
		{14, 2},
		{1969, 654},
		{100756, 33583},
	}

	for _, test := range tests {
		result, err := nineteen.CalculateFuel(test.input)
		if err != nil {
			t.Errorf("failed to run test: %s", err.Error())
		}
		if result != test.want {
			t.Errorf("output does not match: '%d' != '%d'", result, test.want)
		}
	}
}

func TestOnePartTwo(t *testing.T) {
	var tests = []struct {
		input int
		want  int
	}{
		{14, 2},
		{1969, 966},
		{100756, 50346},
	}

	for _, test := range tests {
		result, err := nineteen.CalculateCombinedFuel(test.input)
		if err != nil {
			t.Errorf("failed to run test: %s", err.Error())
		}
		if result != test.want {
			t.Errorf("output does not match: '%d' != '%d'", result, test.want)
		}
	}
}

repository: grellyd/adventofcode

repo_name: grellyd/adventofcode


text:
@inproceedings{10.1145/3058555.3058566,
 address = {New York, NY, USA},
 articleno = {Article 20},
 author = {Eraslan, Sukru and Yaneva, Victoria and Yesilada, Yeliz and Harper, Simon},
 booktitle = {Proceedings of the 14th Web for All Conference on The Future of Accessible Work},
 doi = {10.1145/3058555.3058566},
 isbn = {9781450349000},
 keywords = {Eye Tracking, Accessibility Guidelines, Autism, Web Accessibility},
 location = {Perth, Western Australia, Australia},
 numpages = {4},
 publisher = {Association for Computing Machinery},
 series = {W4A ’17},
 title = {Do Web Users with Autism Experience Barriers When Searching for Information Within Web Pages?},
 url = {https://doi.org/10.1145/3058555.3058566},
 year = {2017}
}

repository: sharpic/academic-kickstart

repo_name: sharpic/academic-kickstart


text:
@InProceedings{weinstein12a,
  title = {Rollout-based Game-tree Search Outprunes Traditional Alpha-beta},
  author = {Ari Weinstein and Michael L. Littman and Sergiu Goschin},
  pages = {155--167},
  abstract = {Recently, rollout-based planning and search methods have emerged as an alternative to traditional tree-search methods. The fundamental operation in rollout-based tree search is the generation of trajectories in the search tree from root to leaf. Game-playing programs based on Monte-Carlo rollouts methods such as ``UCT'' have proven remarkably effective at using information from trajectories to make state-of-the-art decisions at the root. In this paper, we show that trajectories can be used to prune more aggressively than classical alpha-beta search. We modify a rollout-based method, FSSS, to allow for use in game-tree search and show it outprunes alpha-beta both empirically and formally.},
  pdf = {http://jmlr.org/proceedings/papers/v24/weinstein12a/weinstein12a.pdf},
}

repository: mreid/papersite

repo_name: mreid/papersite


text:
@inproceedings{Bellemare:2017:DPR:3305381.3305428,
 author = {Bellemare, Marc G. and Dabney, Will and Munos, R{\'e}mi},
 title = {A Distributional Perspective on Reinforcement Learning},
 booktitle = {Proceedings of the 34th International Conference on Machine Learning - Volume 70},
 series = {ICML'17},
 year = {2017},
 location = {Sydney, NSW, Australia},
 pages = {449--458},
 numpages = {10},
 url = {http://dl.acm.org/citation.cfm?id=3305381.3305428},
 acmid = {3305428},
 publisher = {JMLR.org},
}

url: https://raw.githubusercontent.com/Hugh-Shi/DL-NLP-Readings/924e4d189e5660c5b5d4854278f3df755ae2231d/Bibtex/A Distributional Perspective on Reinforcement Learning.bib

repository: Hugh-Shi/DL-NLP-Readings

repo_name: Hugh-Shi/DL-NLP-Readings


text:
package controller

import (
	"context"
	"crypto/rsa"
	"encoding/json"
	"errors"
	"fmt"
	"reflect"
	"time"

	corev1 "k8s.io/api/core/v1"
	apiequality "k8s.io/apimachinery/pkg/api/equality"
	k8serrors "k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	utilruntime "k8s.io/apimachinery/pkg/util/runtime"
	"k8s.io/apimachinery/pkg/util/wait"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/kubernetes/scheme"
	v1 "k8s.io/client-go/kubernetes/typed/core/v1"
	"k8s.io/client-go/tools/cache"
	"k8s.io/client-go/tools/record"
	"k8s.io/client-go/util/workqueue"
	"k8s.io/klog"

	"k8s.io/client-go/informers"

	ssv1alpha1 "github.com/bitnami-labs/sealed-secrets/pkg/apis/sealedsecrets/v1alpha1"
	ssclientset "github.com/bitnami-labs/sealed-secrets/pkg/client/clientset/versioned"
	ssscheme "github.com/bitnami-labs/sealed-secrets/pkg/client/clientset/versioned/scheme"
	ssv1alpha1client "github.com/bitnami-labs/sealed-secrets/pkg/client/clientset/versioned/typed/sealedsecrets/v1alpha1"
	ssinformer "github.com/bitnami-labs/sealed-secrets/pkg/client/informers/externalversions"
	"github.com/bitnami-labs/sealed-secrets/pkg/log"
	"github.com/bitnami-labs/sealed-secrets/pkg/multidocyaml"
)

const (
	maxRetries = 5

	// SuccessUnsealed is used as part of the Event 'reason' when
	// a SealedSecret is unsealed successfully.
	SuccessUnsealed = "Unsealed"

	// ErrUpdateFailed is used as part of the Event 'reason' when
	// a SealedSecret fails to update the target Secret for a
	// non-cryptography reason. Typically this is due to API I/O
	// or RBAC issues.
	ErrUpdateFailed = "ErrUpdateFailed"

	// ErrUnsealFailed is used as part of the Event 'reason' when a
	// SealedSecret fails the unsealing process.  Typically this
	// is because it is encrypted with the wrong key or has been
	// renamed from its original namespace/name.
	ErrUnsealFailed = "ErrUnsealFailed"
)

var (
	// ErrCast happens when a K8s any type cannot be casted to the expected type.
	ErrCast = errors.New("cast error")
)

// Controller implements the main sealed-secrets-controller loop.
type Controller struct {
	queue       workqueue.RateLimitingInterface
	ssInformer  cache.SharedIndexInformer
	sInformer   cache.SharedIndexInformer
	sclient     v1.SecretsGetter
	ssclient    ssv1alpha1client.SealedSecretsGetter
	recorder    record.EventRecorder
	keyRegistry *KeyRegistry

	oldGCBehavior bool // feature flag to revert to old behavior where we delete the secrets instead of relying on owners reference.
	updateStatus  bool // feature flag that enables updating the status subresource.
}

// NewController returns the main sealed-secrets controller loop.
func NewController(clientset kubernetes.Interface, ssclientset ssclientset.Interface, ssinformer ssinformer.SharedInformerFactory, sinformer informers.SharedInformerFactory, keyRegistry *KeyRegistry) (*Controller, error) {
	queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter())

	utilruntime.Must(ssscheme.AddToScheme(scheme.Scheme))
	eventBroadcaster := record.NewBroadcaster()
	eventBroadcaster.StartLogging(log.Infof)
	eventBroadcaster.StartRecordingToSink(&v1.EventSinkImpl{Interface: clientset.CoreV1().Events("")})
	recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: "sealed-secrets"})

	ssInformer, err := watchSealedSecrets(ssinformer, queue)
	if err != nil {
		return nil, err
	}

	var sInformer cache.SharedIndexInformer
	if sinformer != nil {
		sInformer, err = watchSecrets(sinformer, ssclientset, queue)
		if err != nil {
			return nil, err
		}
	}

	return &Controller{
		ssInformer:  ssInformer,
		sInformer:   sInformer,
		queue:       queue,
		sclient:     clientset.CoreV1(),
		ssclient:    ssclientset.BitnamiV1alpha1(),
		recorder:    recorder,
		keyRegistry: keyRegistry,
	}, nil
}

func watchSealedSecrets(ssinformer ssinformer.SharedInformerFactory, queue workqueue.RateLimitingInterface) (cache.SharedIndexInformer, error) {
	ssInformer := ssinformer.Bitnami().V1alpha1().SealedSecrets().Informer()
	_, err := ssInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
		AddFunc: func(obj interface{}) {
			key, err := cache.MetaNamespaceKeyFunc(obj)
			if err == nil {
				queue.Add(key)
			}
		},
		UpdateFunc: func(oldObj, newObj interface{}) {
			key, err := cache.MetaNamespaceKeyFunc(newObj)
			if err == nil {
				if sealedSecretChanged(oldObj, newObj) {
					queue.Add(key)
				} else {
					log.Infof("update suppressed, no changes in sealed secret spec of %v", key)
				}
			}
		},
		DeleteFunc: func(obj interface{}) {
			key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
			if err == nil {
				queue.Add(key)
			}
			if ssecret, ok := obj.(*ssv1alpha1.SealedSecret); ok {
				UnregisterCondition(ssecret)
			}
		},
	})
	if err != nil {
		return nil, fmt.Errorf("could not add event handler to sealed secrets informer: %w", err)
	}
	return ssInformer, nil
}

func sealedSecretChanged(oldObj, newObj interface{}) bool {
	oldSealedSecret, err := convertSealedSecret(oldObj)
	if err != nil {
		return true // any conversion error means we assume it might have changed
	}
	newSealedSecret, err := convertSealedSecret(newObj)
	if err != nil {
		return true
	}
	return !reflect.DeepEqual(oldSealedSecret.Spec, newSealedSecret.Spec)
}

func watchSecrets(sinformer informers.SharedInformerFactory, ssclientset ssclientset.Interface, queue workqueue.RateLimitingInterface) (cache.SharedIndexInformer, error) {
	sInformer := sinformer.Core().V1().Secrets().Informer()
	_, err := sInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
		DeleteFunc: func(obj interface{}) {
			skey, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
			if err != nil {
				log.Errorf("failed to fetch Secret key: %v", err)
				return
			}

			ns, name, err := cache.SplitMetaNamespaceKey(skey)
			if err != nil {
				log.Errorf("failed to get namespace and name from key: %v", err)
				return
			}

			ssecret, err := ssclientset.BitnamiV1alpha1().SealedSecrets(ns).Get(context.Background(), name, metav1.GetOptions{})
			if err != nil {
				if !k8serrors.IsNotFound(err) {
					log.Errorf("failed to get SealedSecret: %v", err)
				}
				return
			}

			if !metav1.IsControlledBy(obj.(*corev1.Secret), ssecret) && !isAnnotatedToBeManaged(obj.(*corev1.Secret)) {
				return
			}

			sskey, err := cache.MetaNamespaceKeyFunc(ssecret)
			if err != nil {
				log.Errorf("failed to fetch SealedSecret key: %v", err)
				return
			}

			queue.Add(sskey)
		},
	})
	if err != nil {
		return nil, fmt.Errorf("could not add event handler to secrets informer: %w", err)
	}
	return sInformer, nil
}

// HasSynced returns true once this controller has completed an
// initial resource listing.
func (c *Controller) HasSynced() bool {
	var synced bool
	if c.sInformer == nil {
		synced = c.ssInformer.HasSynced()
	} else {
		synced = c.ssInformer.HasSynced() && c.sInformer.HasSynced()
	}
	return synced
}

// LastSyncResourceVersion is the resource version observed when last
// synced with the underlying store. The value returned is not
// synchronized with access to the underlying store and is not
// thread-safe.
func (c *Controller) LastSyncResourceVersion() string {
	return c.ssInformer.LastSyncResourceVersion()
}

// Run begins processing items, and will continue until a value is
// sent down stopCh.  It's an error to call Run more than once.  Run
// blocks; call via go.
func (c *Controller) Run(stopCh <-chan struct{}) {
	defer utilruntime.HandleCrash()

	defer c.queue.ShutDown()

	go c.ssInformer.Run(stopCh)
	if c.sInformer != nil {
		go c.sInformer.Run(stopCh)
	}

	if !cache.WaitForCacheSync(stopCh, c.HasSynced) {
		utilruntime.HandleError(fmt.Errorf("timed out waiting for caches to sync"))
		return
	}

	wait.Until(func() {
		c.runWorker(context.Background())
	}, time.Second, stopCh)

	log.Errorf("Shutting down controller")
}

func (c *Controller) runWorker(ctx context.Context) {
	for c.processNextItem(ctx) {
		// continue looping
	}
}

func (c *Controller) processNextItem(ctx context.Context) bool {
	key, quit := c.queue.Get()
	if quit {
		return false
	}

	defer c.queue.Done(key)
	err := c.unseal(ctx, key.(string))
	if err == nil {
		// No error, reset the ratelimit counters
		c.queue.Forget(key)
	} else if c.queue.NumRequeues(key) < maxRetries {
		log.Errorf("Error updating %s, will retry: %v", key, err)
		c.queue.AddRateLimited(key)
	} else {
		// err != nil and too many retries
		log.Errorf("Error updating %s, giving up: %v", key, err)
		c.queue.Forget(key)
		utilruntime.HandleError(err)
	}

	return true
}

func (c *Controller) unseal(ctx context.Context, key string) (unsealErr error) {
	unsealRequestsTotal.Inc()
	obj, exists, err := c.ssInformer.GetIndexer().GetByKey(key)
	if err != nil {
		log.Errorf("Error fetching object with key %s from store: %v", key, err)
		unsealErrorsTotal.WithLabelValues("fetch", "").Inc()
		return err
	}

	if !exists {
		// the dependent secret will be GC: by k8s itself, see:
		// https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/#owners-and-dependents

		// TODO: remove this feature flag in a subsequent release.
		if c.oldGCBehavior {
			log.Infof("SealedSecret %s has gone, deleting Secret", key)
			ns, name, err := cache.SplitMetaNamespaceKey(key)
			if err != nil {
				return err
			}
			err = c.sclient.Secrets(ns).Delete(ctx, name, metav1.DeleteOptions{})
			if err != nil && !k8serrors.IsNotFound(err) {
				return err
			}
		}
		return nil
	}

	ssecret, err := convertSealedSecret(obj)
	if err != nil {
		return err
	}
	log.Infof("Updating %s", key)

	// any exit of this function at this point will cause an update to the status subresource
	// of the SealedSecret custom resource. The return value of the unseal function is available
	// to the deferred function body in the unsealErr named return value (even if explicit return
	// statements are used to return).
	defer func() {
		if err := c.updateSealedSecretStatus(ssecret, unsealErr); err != nil {
			// Non-fatal.  Log and continue.
			log.Errorf("Error updating SealedSecret %s status: %v", key, err)
			unsealErrorsTotal.WithLabelValues("status", ssecret.GetNamespace()).Inc()
		} else {
			ObserveCondition(ssecret)
		}
	}()

	newSecret, err := c.attemptUnseal(ssecret)
	if err != nil {
		c.recorder.Eventf(ssecret, corev1.EventTypeWarning, ErrUnsealFailed, "Failed to unseal: %v", err)
		unsealErrorsTotal.WithLabelValues("unseal", ssecret.GetNamespace()).Inc()
		return err
	}

	secret, err := c.sclient.Secrets(ssecret.GetObjectMeta().GetNamespace()).Get(ctx, newSecret.GetObjectMeta().GetName(), metav1.GetOptions{})
	if k8serrors.IsNotFound(err) {
		secret, err = c.sclient.Secrets(ssecret.GetObjectMeta().GetNamespace()).Create(ctx, newSecret, metav1.CreateOptions{})
	}
	if err != nil {
		c.recorder.Event(ssecret, corev1.EventTypeWarning, ErrUpdateFailed, err.Error())
		unsealErrorsTotal.WithLabelValues("update", ssecret.GetNamespace()).Inc()
		return err
	}

	if !metav1.IsControlledBy(secret, ssecret) && !isAnnotatedToBeManaged(secret) && !isAnnotatedToBePatched(secret) {
		msg := fmt.Sprintf("Resource %q already exists and is not managed by SealedSecret", secret.Name)
		c.recorder.Event(ssecret, corev1.EventTypeWarning, ErrUpdateFailed, msg)
		unsealErrorsTotal.WithLabelValues("unmanaged", ssecret.GetNamespace()).Inc()
		return fmt.Errorf("failed update: %s", msg)
	}

	origSecret := secret
	secret = secret.DeepCopy()

	if isAnnotatedToBePatched(secret) {
		for k, v := range newSecret.Data {
			secret.Data[k] = v
		}

		for k, v := range newSecret.ObjectMeta.Annotations {
			secret.ObjectMeta.Annotations[k] = v
		}

		for k, v := range newSecret.ObjectMeta.Labels {
			secret.ObjectMeta.Labels[k] = v
		}

		if isAnnotatedToBeManaged(secret) {
			secret.ObjectMeta.OwnerReferences = newSecret.ObjectMeta.OwnerReferences
		}
	} else {
		secret.Data = newSecret.Data
		secret.ObjectMeta.Annotations = newSecret.ObjectMeta.Annotations
		secret.ObjectMeta.Labels = newSecret.ObjectMeta.Labels
		secret.ObjectMeta.OwnerReferences = newSecret.ObjectMeta.OwnerReferences
	}

	secret.Type = newSecret.Type

	if !apiequality.Semantic.DeepEqual(origSecret, secret) {
		_, err = c.sclient.Secrets(ssecret.GetObjectMeta().GetNamespace()).Update(ctx, secret, metav1.UpdateOptions{})
		if err != nil {
			c.recorder.Event(ssecret, corev1.EventTypeWarning, ErrUpdateFailed, err.Error())
			unsealErrorsTotal.WithLabelValues("update", ssecret.GetNamespace()).Inc()
			return err
		}
	}

	c.recorder.Event(ssecret, corev1.EventTypeNormal, SuccessUnsealed, "SealedSecret unsealed successfully")
	return nil
}

func convertSealedSecret(obj any) (*ssv1alpha1.SealedSecret, error) {
	sealedSecret, ok := (obj).(*ssv1alpha1.SealedSecret)
	if !ok {
		return nil, fmt.Errorf("%w: failed to cast %v into SealedSecret", ErrCast, obj)
	}
	if sealedSecret.APIVersion == "" || sealedSecret.Kind == "" {
		// https://github.com/operator-framework/operator-sdk/issues/727
		gv := schema.GroupVersion{Group: ssv1alpha1.GroupName, Version: "v1alpha1"}
		gvk := gv.WithKind("SealedSecret")
		sealedSecret.APIVersion = gvk.GroupVersion().String()
		sealedSecret.Kind = gvk.Kind
	}
	return sealedSecret, nil
}

func (c *Controller) updateSealedSecretStatus(ssecret *ssv1alpha1.SealedSecret, unsealError error) error {
	if !c.updateStatus {
		klog.V(2).Infof("not updating status because updateStatus feature flag not turned on")
		return nil
	}

	if ssecret.Status == nil {
		ssecret.Status = &ssv1alpha1.SealedSecretStatus{}
	}

	// No need to update the status if we already have observed it from the
	// current generation of the resource.
	if ssecret.Status.ObservedGeneration == ssecret.ObjectMeta.Generation {
		return nil
	}

	ssecret.Status.ObservedGeneration = ssecret.ObjectMeta.Generation
	updateSealedSecretsStatusConditions(ssecret.Status, unsealError)

	_, err := c.ssclient.SealedSecrets(ssecret.GetObjectMeta().GetNamespace()).UpdateStatus(context.Background(), ssecret, metav1.UpdateOptions{})
	return err
}

func updateSealedSecretsStatusConditions(st *ssv1alpha1.SealedSecretStatus, unsealError error) {
	cond := func() *ssv1alpha1.SealedSecretCondition {
		for i := range st.Conditions {
			if st.Conditions[i].Type == ssv1alpha1.SealedSecretSynced {
				return &st.Conditions[i]
			}
		}
		st.Conditions = append(st.Conditions, ssv1alpha1.SealedSecretCondition{
			Type: ssv1alpha1.SealedSecretSynced,
		})
		return &st.Conditions[len(st.Conditions)-1]
	}()

	var status corev1.ConditionStatus
	if unsealError == nil {
		status = corev1.ConditionTrue
		cond.Message = ""
	} else {
		status = corev1.ConditionFalse
		cond.Message = unsealError.Error()
	}
	cond.LastUpdateTime = metav1.Now()
	if cond.Status != status {
		cond.LastTransitionTime = cond.LastUpdateTime
		cond.Status = status
	}
}

func isAnnotatedToBeManaged(secret *corev1.Secret) bool {
	return secret.Annotations[ssv1alpha1.SealedSecretManagedAnnotation] == "true"
}

func isAnnotatedToBePatched(secret *corev1.Secret) bool {
	return secret.Annotations[ssv1alpha1.SealedSecretPatchAnnotation] == "true"
}

// AttemptUnseal tries to unseal a secret.
func (c *Controller) AttemptUnseal(content []byte) (bool, error) {
	if err := multidocyaml.EnsureNotMultiDoc(content); err != nil {
		return false, err
	}

	object, err := runtime.Decode(scheme.Codecs.UniversalDecoder(ssv1alpha1.SchemeGroupVersion), content)
	if err != nil {
		return false, err
	}

	switch s := object.(type) {
	case *ssv1alpha1.SealedSecret:
		if _, err := c.attemptUnseal(s); err != nil {
			return false, nil
		}
		return true, nil
	default:
		return false, fmt.Errorf("unexpected resource type: %s", s.GetObjectKind().GroupVersionKind().String())
	}
}

// Rotate takes a sealed secret and returns a sealed secret that has been encrypted
// with the latest private key. If the secret is already encrypted with the latest,
// returns the input.
func (c *Controller) Rotate(content []byte) ([]byte, error) {
	object, err := runtime.Decode(scheme.Codecs.UniversalDecoder(ssv1alpha1.SchemeGroupVersion), content)
	if err != nil {
		return nil, err
	}

	switch s := object.(type) {
	case *ssv1alpha1.SealedSecret:
		secret, err := c.attemptUnseal(s)
		if err != nil {
			return nil, fmt.Errorf("error decrypting secret. %v", err)
		}
		latestPrivKey := c.keyRegistry.latestPrivateKey()
		resealedSecret, err := ssv1alpha1.NewSealedSecret(scheme.Codecs, &latestPrivKey.PublicKey, secret)
		if err != nil {
			return nil, fmt.Errorf("error creating new sealed secret. %v", err)
		}
		data, err := json.Marshal(resealedSecret)
		if err != nil {
			return nil, fmt.Errorf("error marshalling new secret to json. %v", err)
		}
		return data, nil
	default:
		return nil, fmt.Errorf("unexpected resource type: %s", s.GetObjectKind().GroupVersionKind().String())
	}
}

func (c *Controller) attemptUnseal(ss *ssv1alpha1.SealedSecret) (*corev1.Secret, error) {
	return attemptUnseal(ss, c.keyRegistry)
}

func attemptUnseal(ss *ssv1alpha1.SealedSecret, keyRegistry *KeyRegistry) (*corev1.Secret, error) {
	privateKeys := map[string]*rsa.PrivateKey{}
	for k, v := range keyRegistry.keys {
		privateKeys[k] = v.private
	}
	return ss.Unseal(scheme.Codecs, privateKeys)
}

repository: bitnami-labs/sealed-secrets

repo_name: bitnami-labs/sealed-secrets


text:
require libglade.inc

PR = "r2"

inherit gnome

SRC_URI += "file://glade-cruft.patch file://no-xml2.patch \
	    file://no-deprecation.patch"

EXTRA_OECONF += "--without-libxml2"

LDFLAGS += "-lz"

SRC_URI[archive.md5sum] = "e4734a59f1f2308d7714dc0ebf8163f1"
SRC_URI[archive.sha256sum] = "15e4c95402caa3c97394189a6b1b693eced23d80e292fcca12585317434adc2e"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD