text:
package devtestlabs

// Copyright (c) Microsoft and contributors.  All rights reserved.
//
// 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.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

import (
	"github.com/Azure/go-autorest/autorest"
	"github.com/Azure/go-autorest/autorest/date"
	"github.com/Azure/go-autorest/autorest/to"
	"net/http"
)

// CustomImageOsType enumerates the values for custom image os type.
type CustomImageOsType string

const (
	// Linux specifies the linux state for custom image os type.
	Linux CustomImageOsType = "Linux"
	// None specifies the none state for custom image os type.
	None CustomImageOsType = "None"
	// Windows specifies the windows state for custom image os type.
	Windows CustomImageOsType = "Windows"
)

// EnableStatus enumerates the values for enable status.
type EnableStatus string

const (
	// Disabled specifies the disabled state for enable status.
	Disabled EnableStatus = "Disabled"
	// Enabled specifies the enabled state for enable status.
	Enabled EnableStatus = "Enabled"
)

// LabCostType enumerates the values for lab cost type.
type LabCostType string

const (
	// Projected specifies the projected state for lab cost type.
	Projected LabCostType = "Projected"
	// Reported specifies the reported state for lab cost type.
	Reported LabCostType = "Reported"
	// Unavailable specifies the unavailable state for lab cost type.
	Unavailable LabCostType = "Unavailable"
)

// LabStorageType enumerates the values for lab storage type.
type LabStorageType string

const (
	// Premium specifies the premium state for lab storage type.
	Premium LabStorageType = "Premium"
	// Standard specifies the standard state for lab storage type.
	Standard LabStorageType = "Standard"
)

// LinuxOsState enumerates the values for linux os state.
type LinuxOsState string

const (
	// DeprovisionApplied specifies the deprovision applied state for linux os
	// state.
	DeprovisionApplied LinuxOsState = "DeprovisionApplied"
	// DeprovisionRequested specifies the deprovision requested state for
	// linux os state.
	DeprovisionRequested LinuxOsState = "DeprovisionRequested"
	// NonDeprovisioned specifies the non deprovisioned state for linux os
	// state.
	NonDeprovisioned LinuxOsState = "NonDeprovisioned"
)

// PolicyEvaluatorType enumerates the values for policy evaluator type.
type PolicyEvaluatorType string

const (
	// AllowedValuesPolicy specifies the allowed values policy state for
	// policy evaluator type.
	AllowedValuesPolicy PolicyEvaluatorType = "AllowedValuesPolicy"
	// MaxValuePolicy specifies the max value policy state for policy
	// evaluator type.
	MaxValuePolicy PolicyEvaluatorType = "MaxValuePolicy"
)

// PolicyFactName enumerates the values for policy fact name.
type PolicyFactName string

const (
	// PolicyFactNameGalleryImage specifies the policy fact name gallery image
	// state for policy fact name.
	PolicyFactNameGalleryImage PolicyFactName = "GalleryImage"
	// PolicyFactNameLabVMCount specifies the policy fact name lab vm count
	// state for policy fact name.
	PolicyFactNameLabVMCount PolicyFactName = "LabVmCount"
	// PolicyFactNameLabVMSize specifies the policy fact name lab vm size
	// state for policy fact name.
	PolicyFactNameLabVMSize PolicyFactName = "LabVmSize"
	// PolicyFactNameUserOwnedLabVMCount specifies the policy fact name user
	// owned lab vm count state for policy fact name.
	PolicyFactNameUserOwnedLabVMCount PolicyFactName = "UserOwnedLabVmCount"
	// PolicyFactNameUserOwnedLabVMCountInSubnet specifies the policy fact
	// name user owned lab vm count in subnet state for policy fact name.
	PolicyFactNameUserOwnedLabVMCountInSubnet PolicyFactName = "UserOwnedLabVmCountInSubnet"
)

// PolicyStatus enumerates the values for policy status.
type PolicyStatus string

const (
	// PolicyStatusDisabled specifies the policy status disabled state for
	// policy status.
	PolicyStatusDisabled PolicyStatus = "Disabled"
	// PolicyStatusEnabled specifies the policy status enabled state for
	// policy status.
	PolicyStatusEnabled PolicyStatus = "Enabled"
)

// SourceControlType enumerates the values for source control type.
type SourceControlType string

const (
	// GitHub specifies the git hub state for source control type.
	GitHub SourceControlType = "GitHub"
	// VsoGit specifies the vso git state for source control type.
	VsoGit SourceControlType = "VsoGit"
)

// SubscriptionNotificationState enumerates the values for subscription
// notification state.
type SubscriptionNotificationState string

const (
	// Deleted specifies the deleted state for subscription notification state.
	Deleted SubscriptionNotificationState = "Deleted"
	// NotDefined specifies the not defined state for subscription
	// notification state.
	NotDefined SubscriptionNotificationState = "NotDefined"
	// Registered specifies the registered state for subscription notification
	// state.
	Registered SubscriptionNotificationState = "Registered"
	// Suspended specifies the suspended state for subscription notification
	// state.
	Suspended SubscriptionNotificationState = "Suspended"
	// Unregistered specifies the unregistered state for subscription
	// notification state.
	Unregistered SubscriptionNotificationState = "Unregistered"
	// Warned specifies the warned state for subscription notification state.
	Warned SubscriptionNotificationState = "Warned"
)

// UsagePermissionType enumerates the values for usage permission type.
type UsagePermissionType string

const (
	// Allow specifies the allow state for usage permission type.
	Allow UsagePermissionType = "Allow"
	// Default specifies the default state for usage permission type.
	Default UsagePermissionType = "Default"
	// Deny specifies the deny state for usage permission type.
	Deny UsagePermissionType = "Deny"
)

// WindowsOsState enumerates the values for windows os state.
type WindowsOsState string

const (
	// NonSysprepped specifies the non sysprepped state for windows os state.
	NonSysprepped WindowsOsState = "NonSysprepped"
	// SysprepApplied specifies the sysprep applied state for windows os state.
	SysprepApplied WindowsOsState = "SysprepApplied"
	// SysprepRequested specifies the sysprep requested state for windows os
	// state.
	SysprepRequested WindowsOsState = "SysprepRequested"
)

// ApplyArtifactsRequest is request body for applying artifacts to a virtual
// machine.
type ApplyArtifactsRequest struct {
	Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"`
}

// ArmTemplateInfo is information about a generated ARM template.
type ArmTemplateInfo struct {
	autorest.Response `json:"-"`
	Template          *map[string]interface{} `json:"template,omitempty"`
	Parameters        *map[string]interface{} `json:"parameters,omitempty"`
}

// Artifact is an artifact.
type Artifact struct {
	autorest.Response `json:"-"`
	Properties        *ArtifactProperties `json:"properties,omitempty"`
	ID                *string             `json:"id,omitempty"`
	Name              *string             `json:"name,omitempty"`
	Type              *string             `json:"type,omitempty"`
	Location          *string             `json:"location,omitempty"`
	Tags              *map[string]*string `json:"tags,omitempty"`
}

// ArtifactDeploymentStatusProperties is properties of an artifact deployment.
type ArtifactDeploymentStatusProperties struct {
	DeploymentStatus *string `json:"deploymentStatus,omitempty"`
	ArtifactsApplied *int32  `json:"artifactsApplied,omitempty"`
	TotalArtifacts   *int32  `json:"totalArtifacts,omitempty"`
}

// ArtifactInstallProperties is properties of an artifact.
type ArtifactInstallProperties struct {
	ArtifactID *string                        `json:"artifactId,omitempty"`
	Parameters *[]ArtifactParameterProperties `json:"parameters,omitempty"`
}

// ArtifactParameterProperties is properties of an artifact parameter.
type ArtifactParameterProperties struct {
	Name  *string `json:"name,omitempty"`
	Value *string `json:"value,omitempty"`
}

// ArtifactProperties is properties of an artifact.
type ArtifactProperties struct {
	Title        *string                 `json:"title,omitempty"`
	Description  *string                 `json:"description,omitempty"`
	FilePath     *string                 `json:"filePath,omitempty"`
	Icon         *string                 `json:"icon,omitempty"`
	TargetOsType *string                 `json:"targetOsType,omitempty"`
	Parameters   *map[string]interface{} `json:"parameters,omitempty"`
}

// ArtifactSource is properties of an artifact source.
type ArtifactSource struct {
	autorest.Response `json:"-"`
	Properties        *ArtifactSourceProperties `json:"properties,omitempty"`
	ID                *string                   `json:"id,omitempty"`
	Name              *string                   `json:"name,omitempty"`
	Type              *string                   `json:"type,omitempty"`
	Location          *string                   `json:"location,omitempty"`
	Tags              *map[string]*string       `json:"tags,omitempty"`
}

// ArtifactSourceProperties is properties of an artifact source.
type ArtifactSourceProperties struct {
	DisplayName       *string           `json:"displayName,omitempty"`
	URI               *string           `json:"uri,omitempty"`
	SourceType        SourceControlType `json:"sourceType,omitempty"`
	FolderPath        *string           `json:"folderPath,omitempty"`
	BranchRef         *string           `json:"branchRef,omitempty"`
	SecurityToken     *string           `json:"securityToken,omitempty"`
	Status            EnableStatus      `json:"status,omitempty"`
	ProvisioningState *string           `json:"provisioningState,omitempty"`
	UniqueIdentifier  *string           `json:"uniqueIdentifier,omitempty"`
}

// CloudError is
type CloudError struct {
	Error *CloudErrorBody `json:"error,omitempty"`
}

// CloudErrorBody is
type CloudErrorBody struct {
	Code    *string           `json:"code,omitempty"`
	Message *string           `json:"message,omitempty"`
	Target  *string           `json:"target,omitempty"`
	Details *[]CloudErrorBody `json:"details,omitempty"`
}

// Cost is a cost item.
type Cost struct {
	autorest.Response `json:"-"`
	Properties        *CostProperties     `json:"properties,omitempty"`
	ID                *string             `json:"id,omitempty"`
	Name              *string             `json:"name,omitempty"`
	Type              *string             `json:"type,omitempty"`
	Location          *string             `json:"location,omitempty"`
	Tags              *map[string]*string `json:"tags,omitempty"`
}

// CostPerDayProperties is the properties of a lab cost item.
type CostPerDayProperties struct {
	Date     *date.Time  `json:"date,omitempty"`
	Cost     *float64    `json:"cost,omitempty"`
	CostType LabCostType `json:"costType,omitempty"`
}

// CostProperties is properties of a cost item.
type CostProperties struct {
	CurrencyCode  *string                   `json:"currencyCode,omitempty"`
	Costs         *[]CostPerDayProperties   `json:"costs,omitempty"`
	ResourceCosts *[]ResourceCostProperties `json:"resourceCosts,omitempty"`
}

// CustomImage is a custom image.
type CustomImage struct {
	autorest.Response `json:"-"`
	Properties        *CustomImageProperties `json:"properties,omitempty"`
	ID                *string                `json:"id,omitempty"`
	Name              *string                `json:"name,omitempty"`
	Type              *string                `json:"type,omitempty"`
	Location          *string                `json:"location,omitempty"`
	Tags              *map[string]*string    `json:"tags,omitempty"`
}

// CustomImageProperties is properties of a custom image.
type CustomImageProperties struct {
	VM                *CustomImagePropertiesFromVM `json:"vm,omitempty"`
	Vhd               *CustomImagePropertiesCustom `json:"vhd,omitempty"`
	Description       *string                      `json:"description,omitempty"`
	Author            *string                      `json:"author,omitempty"`
	CreationDate      *date.Time                   `json:"creationDate,omitempty"`
	ProvisioningState *string                      `json:"provisioningState,omitempty"`
	UniqueIdentifier  *string                      `json:"uniqueIdentifier,omitempty"`
}

// CustomImagePropertiesCustom is properties for creating a custom image from
// a VHD.
type CustomImagePropertiesCustom struct {
	ImageName *string           `json:"imageName,omitempty"`
	SysPrep   *bool             `json:"sysPrep,omitempty"`
	OsType    CustomImageOsType `json:"osType,omitempty"`
}

// CustomImagePropertiesFromVM is properties for creating a custom image from
// a virtual machine.
type CustomImagePropertiesFromVM struct {
	SourceVMID    *string        `json:"sourceVmId,omitempty"`
	WindowsOsInfo *WindowsOsInfo `json:"windowsOsInfo,omitempty"`
	LinuxOsInfo   *LinuxOsInfo   `json:"linuxOsInfo,omitempty"`
}

// DayDetails is properties of a daily schedule.
type DayDetails struct {
	Time *string `json:"time,omitempty"`
}

// EvaluatePoliciesProperties is properties for evaluating a policy set.
type EvaluatePoliciesProperties struct {
	FactName    *string `json:"factName,omitempty"`
	FactData    *string `json:"factData,omitempty"`
	ValueOffset *string `json:"valueOffset,omitempty"`
}

// EvaluatePoliciesRequest is request body for evaluating a policy set.
type EvaluatePoliciesRequest struct {
	Policies *[]EvaluatePoliciesProperties `json:"policies,omitempty"`
}

// EvaluatePoliciesResponse is response body for evaluating a policy set.
type EvaluatePoliciesResponse struct {
	autorest.Response `json:"-"`
	Results           *[]PolicySetResult `json:"results,omitempty"`
}

// Formula is a formula.
type Formula struct {
	autorest.Response `json:"-"`
	Properties        *FormulaProperties  `json:"properties,omitempty"`
	ID                *string             `json:"id,omitempty"`
	Name              *string             `json:"name,omitempty"`
	Type              *string             `json:"type,omitempty"`
	Location          *string             `json:"location,omitempty"`
	Tags              *map[string]*string `json:"tags,omitempty"`
}

// FormulaProperties is properties of a formula.
type FormulaProperties struct {
	Description       *string                  `json:"description,omitempty"`
	Author            *string                  `json:"author,omitempty"`
	OsType            *string                  `json:"osType,omitempty"`
	CreationDate      *date.Time               `json:"creationDate,omitempty"`
	FormulaContent    *LabVirtualMachine       `json:"formulaContent,omitempty"`
	VM                *FormulaPropertiesFromVM `json:"vm,omitempty"`
	ProvisioningState *string                  `json:"provisioningState,omitempty"`
	UniqueIdentifier  *string                  `json:"uniqueIdentifier,omitempty"`
}

// FormulaPropertiesFromVM is information about a VM from which a formula is
// to be created.
type FormulaPropertiesFromVM struct {
	LabVMID *string `json:"labVmId,omitempty"`
}

// GalleryImage is a gallery image.
type GalleryImage struct {
	Properties *GalleryImageProperties `json:"properties,omitempty"`
	ID         *string                 `json:"id,omitempty"`
	Name       *string                 `json:"name,omitempty"`
	Type       *string                 `json:"type,omitempty"`
	Location   *string                 `json:"location,omitempty"`
	Tags       *map[string]*string     `json:"tags,omitempty"`
}

// GalleryImageProperties is properties of a gallery image.
type GalleryImageProperties struct {
	Author         *string                `json:"author,omitempty"`
	CreatedDate    *date.Time             `json:"createdDate,omitempty"`
	Description    *string                `json:"description,omitempty"`
	ImageReference *GalleryImageReference `json:"imageReference,omitempty"`
	Icon           *string                `json:"icon,omitempty"`
	Enabled        *bool                  `json:"enabled,omitempty"`
}

// GalleryImageReference is the reference information for an Azure Marketplace
// image.
type GalleryImageReference struct {
	Offer     *string `json:"offer,omitempty"`
	Publisher *string `json:"publisher,omitempty"`
	Sku       *string `json:"sku,omitempty"`
	OsType    *string `json:"osType,omitempty"`
	Version   *string `json:"version,omitempty"`
}

// GenerateArmTemplateRequest is parameters for generating an ARM template for
// deploying artifacts.
type GenerateArmTemplateRequest struct {
	VirtualMachineName *string          `json:"virtualMachineName,omitempty"`
	Parameters         *[]ParameterInfo `json:"parameters,omitempty"`
	Location           *string          `json:"location,omitempty"`
}

// GenerateUploadURIParameter is properties for generating an upload URI.
type GenerateUploadURIParameter struct {
	BlobName *string `json:"blobName,omitempty"`
}

// GenerateUploadURIResponse is reponse body for generating an upload URI.
type GenerateUploadURIResponse struct {
	autorest.Response `json:"-"`
	UploadURI         *string `json:"uploadUri,omitempty"`
}

// HourDetails is properties of an hourly schedule.
type HourDetails struct {
	Minute *int32 `json:"minute,omitempty"`
}

// Lab is a lab.
type Lab struct {
	autorest.Response `json:"-"`
	Properties        *LabProperties      `json:"properties,omitempty"`
	ID                *string             `json:"id,omitempty"`
	Name              *string             `json:"name,omitempty"`
	Type              *string             `json:"type,omitempty"`
	Location          *string             `json:"location,omitempty"`
	Tags              *map[string]*string `json:"tags,omitempty"`
}

// LabProperties is properties of a lab.
type LabProperties struct {
	DefaultStorageAccount   *string        `json:"defaultStorageAccount,omitempty"`
	ArtifactsStorageAccount *string        `json:"artifactsStorageAccount,omitempty"`
	VaultName               *string        `json:"vaultName,omitempty"`
	LabStorageType          LabStorageType `json:"labStorageType,omitempty"`
	CreatedDate             *date.Time     `json:"createdDate,omitempty"`
	ProvisioningState       *string        `json:"provisioningState,omitempty"`
	UniqueIdentifier        *string        `json:"uniqueIdentifier,omitempty"`
}

// LabVhd is properties of a VHD in the lab.
type LabVhd struct {
	ID *string `json:"id,omitempty"`
}

// LabVirtualMachine is a virtual machine.
type LabVirtualMachine struct {
	autorest.Response `json:"-"`
	Properties        *LabVirtualMachineProperties `json:"properties,omitempty"`
	ID                *string                      `json:"id,omitempty"`
	Name              *string                      `json:"name,omitempty"`
	Type              *string                      `json:"type,omitempty"`
	Location          *string                      `json:"location,omitempty"`
	Tags              *map[string]*string          `json:"tags,omitempty"`
}

// LabVirtualMachineProperties is properties of a virtual machine.
type LabVirtualMachineProperties struct {
	Notes                      *string                             `json:"notes,omitempty"`
	OwnerObjectID              *string                             `json:"ownerObjectId,omitempty"`
	CreatedByUserID            *string                             `json:"createdByUserId,omitempty"`
	CreatedByUser              *string                             `json:"createdByUser,omitempty"`
	ComputeID                  *string                             `json:"computeId,omitempty"`
	CustomImageID              *string                             `json:"customImageId,omitempty"`
	OsType                     *string                             `json:"osType,omitempty"`
	Size                       *string                             `json:"size,omitempty"`
	UserName                   *string                             `json:"userName,omitempty"`
	Password                   *string                             `json:"password,omitempty"`
	SSHKey                     *string                             `json:"sshKey,omitempty"`
	IsAuthenticationWithSSHKey *bool                               `json:"isAuthenticationWithSshKey,omitempty"`
	Fqdn                       *string                             `json:"fqdn,omitempty"`
	LabSubnetName              *string                             `json:"labSubnetName,omitempty"`
	LabVirtualNetworkID        *string                             `json:"labVirtualNetworkId,omitempty"`
	DisallowPublicIPAddress    *bool                               `json:"disallowPublicIpAddress,omitempty"`
	Artifacts                  *[]ArtifactInstallProperties        `json:"artifacts,omitempty"`
	ArtifactDeploymentStatus   *ArtifactDeploymentStatusProperties `json:"artifactDeploymentStatus,omitempty"`
	GalleryImageReference      *GalleryImageReference              `json:"galleryImageReference,omitempty"`
	ProvisioningState          *string                             `json:"provisioningState,omitempty"`
	UniqueIdentifier           *string                             `json:"uniqueIdentifier,omitempty"`
}

// LinuxOsInfo is information about a Linux OS.
type LinuxOsInfo struct {
	LinuxOsState LinuxOsState `json:"linuxOsState,omitempty"`
}

// ParameterInfo is
type ParameterInfo struct {
	Name  *string `json:"name,omitempty"`
	Value *string `json:"value,omitempty"`
}

// Policy is a Policy.
type Policy struct {
	autorest.Response `json:"-"`
	Properties        *PolicyProperties   `json:"properties,omitempty"`
	ID                *string             `json:"id,omitempty"`
	Name              *string             `json:"name,omitempty"`
	Type              *string             `json:"type,omitempty"`
	Location          *string             `json:"location,omitempty"`
	Tags              *map[string]*string `json:"tags,omitempty"`
}

// PolicyProperties is properties of a Policy.
type PolicyProperties struct {
	Description       *string             `json:"description,omitempty"`
	Status            PolicyStatus        `json:"status,omitempty"`
	FactName          PolicyFactName      `json:"factName,omitempty"`
	FactData          *string             `json:"factData,omitempty"`
	Threshold         *string             `json:"threshold,omitempty"`
	EvaluatorType     PolicyEvaluatorType `json:"evaluatorType,omitempty"`
	ProvisioningState *string             `json:"provisioningState,omitempty"`
	UniqueIdentifier  *string             `json:"uniqueIdentifier,omitempty"`
}

// PolicySetResult is result of a policy set evaluation.
type PolicySetResult struct {
	HasError         *bool              `json:"hasError,omitempty"`
	PolicyViolations *[]PolicyViolation `json:"policyViolations,omitempty"`
}

// PolicyViolation is policy violation.
type PolicyViolation struct {
	Code    *string `json:"code,omitempty"`
	Message *string `json:"message,omitempty"`
}

// ResourceCostProperties is the properties of a resource cost item.
type ResourceCostProperties struct {
	Resourcename      *string  `json:"resourcename,omitempty"`
	ResourceGroupName *string  `json:"resourceGroupName,omitempty"`
	ResourceCost      *float64 `json:"resourceCost,omitempty"`
	Owner             *string  `json:"owner,omitempty"`
	Category          *string  `json:"category,omitempty"`
	Exists            *bool    `json:"exists,omitempty"`
	ResourceType      *string  `json:"resourceType,omitempty"`
}

// ResponseWithContinuationArtifact is the response of a list operation.
type ResponseWithContinuationArtifact struct {
	autorest.Response `json:"-"`
	Value             *[]Artifact `json:"value,omitempty"`
	NextLink          *string     `json:"nextLink,omitempty"`
}

// ResponseWithContinuationArtifactPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResponseWithContinuationArtifact) ResponseWithContinuationArtifactPreparer() (*http.Request, error) {
	if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(client.NextLink)))
}

// ResponseWithContinuationArtifactSource is the response of a list operation.
type ResponseWithContinuationArtifactSource struct {
	autorest.Response `json:"-"`
	Value             *[]ArtifactSource `json:"value,omitempty"`
	NextLink          *string           `json:"nextLink,omitempty"`
}

// ResponseWithContinuationArtifactSourcePreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResponseWithContinuationArtifactSource) ResponseWithContinuationArtifactSourcePreparer() (*http.Request, error) {
	if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(client.NextLink)))
}

// ResponseWithContinuationCustomImage is the response of a list operation.
type ResponseWithContinuationCustomImage struct {
	autorest.Response `json:"-"`
	Value             *[]CustomImage `json:"value,omitempty"`
	NextLink          *string        `json:"nextLink,omitempty"`
}

// ResponseWithContinuationCustomImagePreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResponseWithContinuationCustomImage) ResponseWithContinuationCustomImagePreparer() (*http.Request, error) {
	if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(client.NextLink)))
}

// ResponseWithContinuationFormula is the response of a list operation.
type ResponseWithContinuationFormula struct {
	autorest.Response `json:"-"`
	Value             *[]Formula `json:"value,omitempty"`
	NextLink          *string    `json:"nextLink,omitempty"`
}

// ResponseWithContinuationFormulaPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResponseWithContinuationFormula) ResponseWithContinuationFormulaPreparer() (*http.Request, error) {
	if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(client.NextLink)))
}

// ResponseWithContinuationGalleryImage is the response of a list operation.
type ResponseWithContinuationGalleryImage struct {
	autorest.Response `json:"-"`
	Value             *[]GalleryImage `json:"value,omitempty"`
	NextLink          *string         `json:"nextLink,omitempty"`
}

// ResponseWithContinuationGalleryImagePreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResponseWithContinuationGalleryImage) ResponseWithContinuationGalleryImagePreparer() (*http.Request, error) {
	if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(client.NextLink)))
}

// ResponseWithContinuationLab is the response of a list operation.
type ResponseWithContinuationLab struct {
	autorest.Response `json:"-"`
	Value             *[]Lab  `json:"value,omitempty"`
	NextLink          *string `json:"nextLink,omitempty"`
}

// ResponseWithContinuationLabPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResponseWithContinuationLab) ResponseWithContinuationLabPreparer() (*http.Request, error) {
	if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(client.NextLink)))
}

// ResponseWithContinuationLabVhd is the response of a list operation.
type ResponseWithContinuationLabVhd struct {
	autorest.Response `json:"-"`
	Value             *[]LabVhd `json:"value,omitempty"`
	NextLink          *string   `json:"nextLink,omitempty"`
}

// ResponseWithContinuationLabVhdPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResponseWithContinuationLabVhd) ResponseWithContinuationLabVhdPreparer() (*http.Request, error) {
	if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(client.NextLink)))
}

// ResponseWithContinuationLabVirtualMachine is the response of a list
// operation.
type ResponseWithContinuationLabVirtualMachine struct {
	autorest.Response `json:"-"`
	Value             *[]LabVirtualMachine `json:"value,omitempty"`
	NextLink          *string              `json:"nextLink,omitempty"`
}

// ResponseWithContinuationLabVirtualMachinePreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResponseWithContinuationLabVirtualMachine) ResponseWithContinuationLabVirtualMachinePreparer() (*http.Request, error) {
	if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(client.NextLink)))
}

// ResponseWithContinuationPolicy is the response of a list operation.
type ResponseWithContinuationPolicy struct {
	autorest.Response `json:"-"`
	Value             *[]Policy `json:"value,omitempty"`
	NextLink          *string   `json:"nextLink,omitempty"`
}

// ResponseWithContinuationPolicyPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResponseWithContinuationPolicy) ResponseWithContinuationPolicyPreparer() (*http.Request, error) {
	if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(client.NextLink)))
}

// ResponseWithContinuationSchedule is the response of a list operation.
type ResponseWithContinuationSchedule struct {
	autorest.Response `json:"-"`
	Value             *[]Schedule `json:"value,omitempty"`
	NextLink          *string     `json:"nextLink,omitempty"`
}

// ResponseWithContinuationSchedulePreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResponseWithContinuationSchedule) ResponseWithContinuationSchedulePreparer() (*http.Request, error) {
	if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(client.NextLink)))
}

// ResponseWithContinuationVirtualNetwork is the response of a list operation.
type ResponseWithContinuationVirtualNetwork struct {
	autorest.Response `json:"-"`
	Value             *[]VirtualNetwork `json:"value,omitempty"`
	NextLink          *string           `json:"nextLink,omitempty"`
}

// ResponseWithContinuationVirtualNetworkPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResponseWithContinuationVirtualNetwork) ResponseWithContinuationVirtualNetworkPreparer() (*http.Request, error) {
	if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
		return nil, nil
	}
	return autorest.Prepare(&http.Request{},
		autorest.AsJSON(),
		autorest.AsGet(),
		autorest.WithBaseURL(to.String(client.NextLink)))
}

// Schedule is a schedule.
type Schedule struct {
	autorest.Response `json:"-"`
	Properties        *ScheduleProperties `json:"properties,omitempty"`
	ID                *string             `json:"id,omitempty"`
	Name              *string             `json:"name,omitempty"`
	Type              *string             `json:"type,omitempty"`
	Location          *string             `json:"location,omitempty"`
	Tags              *map[string]*string `json:"tags,omitempty"`
}

// ScheduleProperties is properties of a schedule.
type ScheduleProperties struct {
	Status            EnableStatus `json:"status,omitempty"`
	TaskType          *string      `json:"taskType,omitempty"`
	WeeklyRecurrence  *WeekDetails `json:"weeklyRecurrence,omitempty"`
	DailyRecurrence   *DayDetails  `json:"dailyRecurrence,omitempty"`
	HourlyRecurrence  *HourDetails `json:"hourlyRecurrence,omitempty"`
	TimeZoneID        *string      `json:"timeZoneId,omitempty"`
	ProvisioningState *string      `json:"provisioningState,omitempty"`
	UniqueIdentifier  *string      `json:"uniqueIdentifier,omitempty"`
}

// Subnet is
type Subnet struct {
	ResourceID    *string             `json:"resourceId,omitempty"`
	LabSubnetName *string             `json:"labSubnetName,omitempty"`
	AllowPublicIP UsagePermissionType `json:"allowPublicIp,omitempty"`
}

// SubnetOverride is property overrides on a subnet of a virtual network.
type SubnetOverride struct {
	ResourceID                   *string             `json:"resourceId,omitempty"`
	LabSubnetName                *string             `json:"labSubnetName,omitempty"`
	UseInVMCreationPermission    UsagePermissionType `json:"useInVmCreationPermission,omitempty"`
	UsePublicIPAddressPermission UsagePermissionType `json:"usePublicIpAddressPermission,omitempty"`
}

// SubscriptionNotification is
type SubscriptionNotification struct {
	RegistrationDate *string                             `json:"registrationDate,omitempty"`
	State            SubscriptionNotificationState       `json:"state,omitempty"`
	Properties       *SubscriptionNotificationProperties `json:"properties,omitempty"`
}

// SubscriptionNotificationProperties is
type SubscriptionNotificationProperties struct {
	TenantID *string `json:"tenantId,omitempty"`
}

// VirtualNetwork is a virtual network.
type VirtualNetwork struct {
	autorest.Response `json:"-"`
	Properties        *VirtualNetworkProperties `json:"properties,omitempty"`
	ID                *string                   `json:"id,omitempty"`
	Name              *string                   `json:"name,omitempty"`
	Type              *string                   `json:"type,omitempty"`
	Location          *string                   `json:"location,omitempty"`
	Tags              *map[string]*string       `json:"tags,omitempty"`
}

// VirtualNetworkProperties is properties of a virtual network.
type VirtualNetworkProperties struct {
	AllowedSubnets             *[]Subnet         `json:"allowedSubnets,omitempty"`
	Description                *string           `json:"description,omitempty"`
	ExternalProviderResourceID *string           `json:"externalProviderResourceId,omitempty"`
	SubnetOverrides            *[]SubnetOverride `json:"subnetOverrides,omitempty"`
	ProvisioningState          *string           `json:"provisioningState,omitempty"`
	UniqueIdentifier           *string           `json:"uniqueIdentifier,omitempty"`
}

// WeekDetails is properties of a weekly schedule.
type WeekDetails struct {
	Weekdays *[]string `json:"weekdays,omitempty"`
	Time     *string   `json:"time,omitempty"`
}

// WindowsOsInfo is information about a Windows OS.
type WindowsOsInfo struct {
	WindowsOsState WindowsOsState `json:"windowsOsState,omitempty"`
}


text:
<?php

namespace Itkg\Bundle\PhpRedmonBundle\Logger;

use Itkg\Bundle\PhpRedmonBundle\Model\Instance;
use Itkg\Bundle\PhpRedmonBundle\Manager\InstanceManager;
use Itkg\Bundle\PhpRedmonBundle\Worker\InstanceWorker;
use Itkg\Bundle\PhpRedmonBundle\Model\Log;

/**
 * Class InstanceLogger
 *
 * This class manage instance's logs
 *
 * @author Patrick Deroubaix <patrick.deroubaix@gmail.com>
 * @author Pascal DENIS <pascal.denis.75@gmail.com>
 */
class InstanceLogger
{
    /**
     * Current instance
     *
     * @var \Itkg\Bundle\PhpRedmonBundle\Model\Instance
     */
    protected $instance;

    /**
     * Expired timestamp
     *
     * @var int
     */
    protected $expiredTimestamp;

    /**
     * Current instance manager
     *
     * @var \Itkg\Bundle\PhpRedmonBundle\Manager\InstanceManager
     */
    protected $manager;

    /**
     * Constructor
     *
     * @param \Itkg\Bundle\PhpRedmonBundle\Manager\InstanceManager $manager
     * @param \Itkg\Bundle\PhpRedmonBundle\Worker\InstanceWorker $worker
     * @param int $nbDays
     */
    public function __construct(InstanceManager $manager, InstanceWorker $worker, $nbDays)
    {
        $this->manager = $manager;
        $this->worker  = $worker;
        $this->expiredTimestamp  = $nbDays * 24 * 60 * 60;
    }

    /**
     * Get current instance
     *
     * @return \Itkg\Bundle\PhpRedmonBundle\Model\Instance
     */
    public function getInstance()
    {
        return $this->instance;
    }

    /**
     * Set current instance
     *
     * @param \Itkg\Bundle\PhpRedmonBundle\Model\Instance $instance
     * @return \Itkg\Bundle\PhpRedmonBundle\Logger\InstanceLogger
     */
    public function setInstance(Instance $instance)
    {
        $this->instance = $instance;

        return $this;
    }

    /**
     * Get instance manager
     *
     * @return \Itkg\Bundle\PhpRedmonBundle\Manager\InstanceManager
     */
    public function getManager()
    {
        return $this->manager;
    }

    /**
     * Set instance manager
     *
     * @param \Itkg\Bundle\PhpRedmonBundle\Manager\InstanceManager $manager
     * @return \Itkg\Bundle\PhpRedmonBundle\Logger\InstanceLogger
     */
    public function setManager(InstanceManager $manager)
    {
        $this->manager = $manager;

        return $this;
    }

    /**
     * Get instance worker
     *
     * @return \Itkg\Bundle\PhpRedmonBundle\Worker\InstanceWorker
     */
    public function getWorker()
    {
        return $this->worker;
    }

    /**
     * Set instance worker
     *
     * @param \Itkg\Bundle\PhpRedmonBundle\Worker\InstanceWorker $worker
     * @return \Itkg\Bundle\PhpRedmonBundle\Logger\InstanceLogger
     */
    public function setWorker(InstanceWorker $worker)
    {
        $this->worker = $worker;

        return $this;
    }

    /**
     * Clean instance history. Delete expired logs
     */
    protected function cleanHistory()
    {
        $createdAt = new \DateTime();
        $logs = $this->instance->getLogs();
        foreach($logs as $log) {
            if(($createdAt->getTimestamp() - $log->getCreatedAt()->getTimestamp()) > $this->expiredTimestamp) {
                $this->instance->removeLog($log);
            }
        }
    }

    /**
     * Create new log for the current instance
     */
    protected function log()
    {

        $this->worker
            ->setInstance($this->instance);
        // If instance can be called
        if($this->worker->ping()) {
            $infos = $this->worker->getInfos();
            $createdAt = new \DateTime();
            $graphInfo = array();
            $graphInfo['memory'] = $infos['Memory']['used_memory'];
            $log = new Log();
            $log->setCreatedAt($createdAt);
            // Log infos
            $log->setDatas($graphInfo);
            // Add log
            $this->instance->addLog($log);
        }

    }

    /**
     * Execute all steps for current instance
     * - Clean history
     * - Add log
     * - Save current instance state
     */
    public function execute()
    {
        $this->cleanHistory();
        $this->log();
        $this->manager->update($this->instance);
    }
}

redpajama_set_name: RedPajamaGithub


text:
/**
 * Created by Think on 2017/5/17.
 */
import React from 'react';
import { Link  } from 'react-router-dom';
import Paper from 'material-ui/Paper';
// import AutoComplete from 'material-ui/AutoComplete';

import Sign from './sign/Sign';
import Auth from '../Auth';
import './Header.css';

import logo from './lottostar.png';

export default class Header extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            open: false,
            data_source: [],

            username: 'nobody',
            to_login: true,

            redirect: null,
        };
        window.__clear = this.handleSignOut;
    }

    handleUpdateInput = (value) => {
        this.setState({
            data_source: [
                value,
                value + value,
                value + value + value,
            ],
        });
    };

    handleRequestClose = () => {
        this.setState({ open: false });
    };

    handleSign = (tab) => {
        this.refs.sign.handleOpen(tab);
    };

    handleRefreshStatus = () => {
        let user_info = Auth.getUserInfo();
        let to_login = user_info.to_login;
        this.setState({
            username: to_login ? 'nobody' : user_info.username,
            to_login: to_login,
        })
    };

    handleSignOut = () => {
        Auth.clearUserInfo();
        this.handleRefreshStatus();
        // window.location.pathname = '/';
    };

    componentDidMount() {
        this.handleRefreshStatus();
    }

    render() {
        return (

                <Paper>

<Link className="link" to="/">欢迎来到乐透星!</Link>

                            {this.state.to_login ?
this.handleSign(true)}>请登录
 : null}
                            {this.state.to_login ?
this.handleSign(false)}>免费注册
 : null}
                            {this.state.to_login ? null :

                                <Link className="link" to="/home">{this.state.username}</Link>
}
                            {this.state.to_login ? null :

                                <Link className="link" to="/pay">购物车</Link>
}
                            {this.state.to_login ? null :
注销
}

                </Paper>

                        <Link className="link" to="/" style={{display: 'flex', alignItems: 'center'}}>

                            Lotto Star
                        </Link>

                    {/*
*/}
                        {/*<AutoComplete*/}
                            {/*hintText={请输入要搜索的商品}*/}
                            {/*dataSource={this.state.data_source}*/}
                            {/*onUpdateInput={this.handleUpdateInput}*/}
                        {/*/>*/}
                    {/*
*/}

                <Sign ref="sign" success={this.handleRefreshStatus} />

        );
    }
}


text:
namespace steve {

namespace {

// -------------------------------------------------------------------------- //
// Module map
//
// A module is loaded exactly once. Subsequent imports of the same
// module do not cause it to be reloaded.

using Module_map = std::map<Path, Module*>;
Module_map modules_;

// Returns the module at the given path or nullptr if no such module
// exists.
inline Module*
lookup_module(const Path& p) {
  auto iter = modules_.find(p);
  if (iter != modules_.end())
    return iter->second;
  return nullptr;
}

// Register the module to the given path. No module shall have been
// previously associated with the given path.
inline Module*
register_module(Module* m) {
  steve_assert(modules_.count(m->path()) == 0,
               format("module '{}' already registered", m->path().c_str()));
  modules_.insert({m->path(), m});
  return m;
}

// Create an initial module. This allocates the module type, but leaves
// the declaration sequence uninitialized.
inline Module*
init_module(const Path& p, Name* n) {
  return make_expr<Module>(no_location, get_typename_type(), p, n, nullptr);
}

// Create an initial module. This allocates the module type, but leaves
// the declaration sequence uninitialized.
inline Module*
make_module(const Path& p, Name* n, Decl_seq* ds) {
  return make_expr<Module>(no_location, get_typename_type(), p, n, ds);
}

// Complete the construction of the module by assigning it a sequence
// of nested declarations (possibly empty).
inline Module*
finish_module(Module* m, Decl_seq* ds) {
  m->second = ds;
  return m;
}

// -------------------------------------------------------------------------- //
// Module loading

// Parse the module in the given file, returning its sequence of
// declarations.
//
// FIXME: We should be recurs
Decl_seq*
parse_module(const Location& loc, File* f) {
  // Save off the current diagnostics so we don't overwrite them
  // with the lexer, parser, and elaborator.
  Diagnostics_guard guard;

  // Get the text.
  Expected<std::string> text = f->text();
  if (not text) {
    error(loc) << text.error().message();
    return nullptr;
  }

  // Lex the module.
  Lexer lex;
  Tokens toks = lex(f);
  if (not lex.diags.empty()) {
    std::cerr << lex.diags;
    return nullptr;
  }

  // Parse the module.
  Parser parse;
  Tree* pt = parse(toks);
  if (not parse.diags.empty()) {
    std::cerr << parse.diags;
    return nullptr;
  }

  // Elaborate the contents.
  Elaborator elab;
  Expr* ast = elab(pt);
  if (not elab.diags.empty()) {
    std::cerr << elab.diags;
    return nullptr;
  }
  return as<Top>(ast)->decls();
}

// Load the file module.
Module*
load_file_module(const Location& loc, File* f, const Path& p, Name* n) {
  Module* m = register_module(init_module(p, n));
  if (Decl_seq* ds = parse_module(loc, f))
    return finish_module(m, ds);
  else
    return nullptr;
}

// Try to load a module from the file with the given name.
//
// Note that a module is free to import itself. This has no effect
// other than the names in the module are now available via its
// fully qualified form.
Module*
load_file_module(const Location& loc, const Path& p, Name* n) {
  if (Module* m = lookup_module(p))
    return m;
  try {
    return load_file_module(loc, get_file(p), p, n);
  } catch (std::system_error& err) {
    error(loc) << format("error loading '{}': {}", p, err.what());
    return nullptr;
  }
}

// Create a module corresponding to the given directory. When loaded
// the directory contains a top-declaration with an empty sequence
// of declarations.
//
// FIXME: Check directory permissions on the path name.
//
// TODO: It should be possible to load code for a directory
// module. For example, in Python, this code is in the __init__.py
// file. We could have a nested file named __module__.steve
// provide the same benefit.
Module*
load_directory_module(const Location& loc, const Path& p, Name* n) {
  if (Module* m = lookup_module(p))
    return m;
  return register_module(make_module(p, n, new Decl_seq()));
}

// Try to load a directory module at path p.
Module*
try_load_dir(const Location& loc, const Path& p, Name* n) {
  if (fs::exists(p))
    return load_directory_module(loc, p, n);
  return nullptr;
}

// Try to load a file module at path p.
Module*
try_load_file(const Location& loc, const Path& p, Name* n) {
  if (fs::exists(p))
    return load_file_module(loc, p, n);
  return nullptr;
}

// Construct a path to a directory from a module-id.
inline Path
steve_dir_name(String id) { return id.str(); }

// Construct a path ot a Steve file from a module-id.
inline Path
steve_file_name(String id) { return id.str() + ".steve"; }

// Normalize a path name as an id.
//
// TODO: What if the input file has a non-empty directory?
// We should probably strip the directory also.
String
path_to_id(Path p) {
  p.replace_extension();
  return p.c_str();
}

// Try to load a module in the given directory with the
// given name. Note that id could name a file module or
// a directory module.
Module*
try_load_module(const Location& loc, const Path& dir, String id, Name* n) {
  if (Module* m = try_load_dir(loc, dir / steve_dir_name(id), n))
    return m;
  if (Module* m = try_load_file(loc, dir / steve_file_name(id), n))
    return m;
  return nullptr;
}

// Load the module from the given file or directory.
Module*
load_module(const Location& loc, const Path& dir, String id, Name* n) {
  if (Module* m = try_load_module(loc, dir, id, n))
    return m;
  error(loc) << format("no module named '{}' in '{}'", id, dir.c_str());
  return nullptr;
}

// Search in the module paths for a module with the given name.
// The search order is defined as:
//
// - search starting from the current working directory.
// - search each module in the module path.
Module*
find_module(const Location& loc, String id, Name* n) {
  // Search locally.
  if (Module* m = try_load_module(loc, fs::current_path(), id, n))
    return m;

  // Look in the module path.
  for(const Path& search : config().module_path)
    if (Module* m = try_load_module(loc, search, id, n))
      return m;

  error(loc) << format("no module named '{}' in module path", id);
  return nullptr;
}

} // namespace

// Load a module. The search rules are as follows;
//
// - if parent is null, search each directory in the module path
//   for a module with the name `id` or `id.steve`;
// - otherwise, the parent module is a directory, search for
//   a nested module named `id` or `id.steve`.
//
// TODO: Big project. It would be great if we saved this as in
// a lowered, elaborated form.
Module*
load_module(Location loc, Module* parent, String id) {
  Name* n = new Basic_id(id);
  if (not parent)
    return find_module(loc, id, n);
  else {
    if (Module* m = load_module(loc, parent->path(), id, n)) {
      Name* n = new Basic_id(id);
      Decl* d = new Import(n, m);
      parent->decls()->push_back(d);
      return m;
    }
  }
  return nullptr;
}

// Load a module.
Module*
load_module(Module* parent, String id) {
  return load_module(no_location, parent, id);
}

// Load the input file as a module.
//
// FIXME: The diagnostics are a bit wonky here... There should be a
// uniform way of managing diagnostics for module loading.
Module*
load_file(const Path& input) {
  Diagnostics diags;
  Diagnostics_guard guard(diags);

  String id = path_to_id(input);
  Path p = fs::canonical(input);
  if (Module* m = try_load_file(no_location, p, new Basic_id(id)))
    return m;

  error(no_location) << format("error loading file '{}'", id);

  if (not diags.empty())
    std::cerr << diags;
  return nullptr;
}

// Load the declaration corresponding to the given identifier.
Expr*
load_name(const std::string& s) {
  Lexer lex;
  Tokens toks = lex(nullptr, s.begin(), s.end());
  if (not lex.diags.empty()) {
    std::cerr << lex.diags;
    return nullptr;
  }

  Parser parse;
  Tree* id = parse(toks, postfix_parse);
  if (not parse.diags.empty()) {
    std::cerr << parse.diags;
    return nullptr;
  }
  id = new Load_tree(id);

  Elaborator elab;
  return elab(id);
}

} // namesapce steve


text:
//
// Copyright (c) 2013 Danny Havenith
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef FLARES_HPP_
#define FLARES_HPP_
#include <stdlib.h>
#include <Adafruit_NeoPixel.h>

namespace
{
using ws2811::rgb;

class flare
{
public:
  void step( rgb *leds)
  {
    step();
    set( leds);
  }

  flare()
  :color( 255,255,255), position(0), amplitude(0), speed(0)
  {}

  rgb    color;
  uint16_t position;
  uint16_t amplitude;
  int8_t    speed;

private:

  /// multiply an 8-bit value with an 8.8 bit fixed point number.
  /// multiplier should not be higher than 1.00 (or 256).
  static uint8_t mult( uint8_t value, uint16_t multiplier)
  {
    return (static_cast<uint16_t>( value) * multiplier) >> 8;
  }

  rgb calculate() const
  {
    return rgb(
        mult( color.red, amplitude),
        mult( color.green, amplitude),
        mult( color.blue, amplitude)
    );
  }

  void set( rgb *leds) const
  {
    rgb *myled = leds + position;
    *myled = calculate();
  }

  void step()
  {
    if (speed < 0 && static_cast<uint16_t>(-speed) > amplitude)
    {
      amplitude = 0;
    }
    else
    {
      amplitude += speed;
      if (amplitude > 256)
      {
        amplitude = 256;
        speed = -(speed/4 + 1);
      }
    }
  }

};

uint8_t random_brightness()
{
  return  150 - (rand() % 80);
}

void create_random_flare( flare &f, uint16_t count)
{
  f.color = rgb( random_brightness(), random_brightness(), random_brightness());
  f.amplitude = 0;
  f.position = rand() % count; // not completely random.
  f.speed = (2 * (rand() & 0x07))+4;
}

} // end namespace flares

class Flares
{

public:

Flares( Adafruit_NeoPixel *strip)
{
  this->strip = strip;
    current_flare = 0;
    flare_pause = 1;

}

void animate()
{
  rgb *leds = (rgb *)strip->getPixels();

      if (flare_pause)
      {
        --flare_pause;
      }
      else
      {
        if (!flares[current_flare].amplitude)
        {
          create_random_flare( flares[current_flare], strip->numPixels());
          ++current_flare;
          if (current_flare >= flare_count) current_flare = 0;
          flare_pause = rand() % 40;
        }
      }

      for (uint8_t idx = 0; idx < flare_count; ++idx)
      {
        flares[idx].step( leds);
      }

  for (uint8_t i = 0; i < strip->numPixels(); i++)
  {
    strip->setPixelColor(0, leds->red, leds->green, leds->blue); // overwrite with brightness
    leds++;
  }
}

private:
  Adafruit_NeoPixel *strip;
    static const uint8_t flare_count = 40;
    flare flares[flare_count];
    uint8_t current_flare;
    uint8_t flare_pause;

};

#endif /* FLARES_HPP_ */


text:
Introduction
============

The bip32utils library is a pure Python implementation of Bitcoin
hierarchical deterministic wallet ("HD Wallet") ECDSA key generation
as specified in BIP0032 (Bitcoin Improvement Proposal #0032).

Deterministic ECDSA key generation allows creating a sequence of
Bitcoin private and public ECDSA keys from an initial seed and a
hierarchical set of indices.  A number of benefits follow:

* An entire wallet can be backed up once by storing the wallet seed or
  master extended private key, and all future addresses in the wallet
  can be restored from it.

* The creation of public and private ECDSA keys may be separated from
  each other.  That is, it is possible to create only the public ECDSA
  key half (and receiving address) of an ECDSA key pair, without the
  ability to create the private half.  Thus, one can create receiving
  addresses on a public facing system that if compromised would not
  give the attacker the ability to spend bitcoin received at those
  addresses. A separate, offline machine can generate the
  corresponding private ECDSA keys and sign transactions.

* Public and private ECDSA keys may be created in a hierarchy, and
  control over or visibility of portions of the hierarchy may be
  delegated to third parties.  This has uses for auditing, for
  separating ECDSA key sequences into different logical groups or
  accounts, and for giving 3rd parties the ability to create spending
  transactions without first getting a receiving address in advance.

BIP0032 is in draft stage, is subject to change, and is documented at:

https://github.com/sipa/bips/blob/bip32update/bip-0032.mediawiki

Python bip32gen Script
======================

This library installs the bip32gen script into $PREFIX/bin, which
wraps a command-line interface around the BIP32Key class functionality
described in a later section:

## Script Parameters
```
$ bip32gen -h
usage: bip32gen [-h] [-x] [-X] -i {entropy,xprv,xpub} [-n AMOUNT]
                [-f FROM_FILE] [-F TO_FILE] -o OUTPUT_TYPE [-v] [-d]
                chain [chain ...]

Create hierarchical deterministic wallet addresses

positional arguments:
  chain                 list of hierarchical key specifiers

optional arguments:
  -h, --help            show this help message and exit
  -x, --input-hex       input supplied as hex-encoded ascii
  -X, --output-hex      output generated (where applicable) as hex-encoded
                        ascii
  -i {entropy,xprv,xpub}, --input-type {entropy,xprv,xpub}
                        source material to generate key
  -n AMOUNT, --amount AMOUNT
                        amount of entropy to to read (bits), None for all of
                        input
  -f FROM_FILE, --from-file FROM_FILE
                        filespec of input data, '-' for stdin
  -F TO_FILE, --to-file TO_FILE
                        filespec of output data, '-' for stdout
  -o OUTPUT_TYPE, --output-type OUTPUT_TYPE
                        output types, comma separated, from
                        addr|privkey|wif|pubkey|xprv|xpub|chain
  -v, --verbose         verbose output, not for machine parsing
  -d, --debug           enable debugging output
```

The user specifies the type of input data (currently from entropy, a
serialized extended private key, or serialized extended public key),
the filespec to get that input data from (or stdin), the set of output
fields to generate, whether to hex encode those outputs when
applicable, and a list of key specifier(s).  A key specifier will
either start with 'm' or 'M' when using entropy as an input source;
otherwise, when importing from a serialized extended key, the key
specifier(s) start with the first hierarchical child index to create.

For example, to generate a new master wallet key from entropy and
output the serialized extended private key for that to stdout:

```
$ bip32gen -i entropy -f /dev/random -n 128 -o xprv -F - m
xprv9s21ZrQH143K3eqKCaAW9CvAiKR8SHdikQnR8dVs8eBxC9fYtW69k1gLRTG5o2Rn3gtz651yFGzxRFjtfjLQHmh4kT7YF3vZcZgGdfX7ZVS
```

To generate the BIP0032 test vector #1, using entropy
supplied as a hex-encoded string on stdin, and output the private
ECDSA key, wallet import format for that private ECDSA key, public
ECDSA key, address, and serialized extended private and public keys,
hex encoding where applicable, and writing to stdout:

```
$ echo 000102030405060708090A0B0C0D0E0F | \
    bip32gen -v \
    -i entropy -f - -x \
    -o privkey,wif,pubkey,addr,xprv,xpub -F - -X \
    m \
    m/0h \
    m/0h/1 \
    m/0h/1/2h \
    m/0h/1/2h/2 \
    m/0h/1/2h/2/1000000000
```

(output not listed)

BIP0032 outlines a hierarchy where individual "accounts" and key series have the following form:

```
m/ih/0/k - Receiving address series for account 'i', with 'k' as index
m/ih/1/k - Change address series for spends from account 'i', with 'k' as index
```

So, to give someone the ability to create receving addresses for
account 0, (but not the ability to spend from those addresses), one
would export an _extended public key_ for m/0h/0 (we'll use again the
entropy from BIP0032 test vector #1 for purpose of explanation, but of
course this would be unique for each situation):

```
$ echo 000102030405060708090A0B0C0D0E0F | \
    bip32gen \
    -i entropy -f - -x \
    -o xpub -F - \
    m/0h/0
xpub6ASuArnXKPbfEVRpCesNx4P939HDXENHkksgxsVG1yNp9958A33qYoPiTN9QrJmWFa2jNLdK84bWmyqTSPGtApP8P7nHUYwxHPhqmzUyeFG
```

Then, to derive public child keys, that person would run the
key generator using that extended public key as input:

```
$ echo xpub6ASuArnXKPbfEVRpCesNx4P939HDXENHkksgxsVG1yNp9958A33qYoPiTN9QrJmWFa2jNLdK84bWmyqTSPGtApP8P7nHUYwxHPhqmzUyeFG | \
     bip32gen \
     -i xpub -f - \
     -o addr -F - \
     0 1 2 3 4 5 6 7 8 9
1BvgsfsZQVtkLS69NvGF8rw6NZW2ShJQHr
1B1TKfsCkW5LQ6R1kSXUx7hLt49m1kwz75
1D2LvY1T3yT4xWgoXkXhAbh1fbY39owifJ
1L71JnrWfB45Z1g2et1zeDAkzrpY8eyJMH
1ACa2mfirthEwmnHVHcBEAVfTHJkajpjod
1CR1rZqA8cwbohoj9bNmcrYxx31Zx2jw4c
1PkyqPChrqwM1dee8KTMpsWWBuXgmGVNoi
1L3HVcGagSUEb2d24SfHV7Kyu6kUNpDL51
17JbSP83rPWmbdcdtiiTNqBE8MgGN8kmUk
1MWb4Pv4ZCUmbnFgA5D3MtYyhMh4q8KCrd
```
An offline machine could generate the corresponding private keys to
spend from those addresses by using an _extended private key_ for the
account:
```
$ echo 000102030405060708090A0B0C0D0E0F | \
    bip32gen \
    -i entropy -f - -x \
    -o xprv -F - \
    m/0h/0
xprv9wTYmMFdV23N21MM6dLNavSQV7Sj7meSPXx6AV5eTdqqGLjycVjb115Ec5LgRAXscPZgy5G4jQ9csyyZLN3PZLxoM1h3BoPuEJzsgeypdKj
```
Then to generate the corresponding private keys (here shown in wallet import format):
```
$ echo xprv9wTYmMFdV23N21MM6dLNavSQV7Sj7meSPXx6AV5eTdqqGLjycVjb115Ec5LgRAXscPZgy5G4jQ9csyyZLN3PZLxoM1h3BoPuEJzsgeypdKj | \
     bip32gen \
     -i xprv -f - \
     -o wif -F - \
     0 1 2 3 4 5 6 7 8 9
L3dzheSvHWc2scJdiikdZmYdFzPcvZMAnT5g62ikVWZdBewoWpL1
L22jhG8WTNmuRtqFvzvpnhe32F8FefJFfsLJpSr1CYsRrZCyTwKZ
KwhVMKLLSMt7DemnUxhSftkdqPjWYmPKt31nmV3BB7TdVaMFzqgP
KySK2geQrXWYR7f2p9C9Exr4CLngFQnnzQegSaKAfxNupqecSwdU
KxSKj3b3EdHSyN3C5sSwRL7TMmxpEVkJ7Cw4fQTMUYXsCZRbmBAP
L5kxG5qokHeTJSwco5JzCEdAy5TN2M2Tj2QvxGpvVuSVP5bJRAUT
L3oTQGyHQvE3GkRQJkgPs9vY8NRTxdwacHu9Xu9QBPTpgHCSGume
KxABnXp7SiuWi218c14KkjEMV7SjcfXnvsWaveNVxWZU1Rwi8zNQ
L1Zku8j3mCiiHxZdo6NDLHv6jcA1JyNufUSHBMiznML38vNr9Agh
L46bxscw878ytxNHro7ghNXuybUv8aNJAY1UudH1HUxD2pecBhR8
```

Python bip32utils Library
=========================

## The BIP32Key Class

The bip32utils python library currently has a single class, BIP32Key,
which encapsulates a single node in a BIP0032 wallet hierarchy. A
terminology distinction is made between an ECDSA private and public
key pair and a full BIP32Key, which internally holds an ECDSA key pair
and other data.

A BIP32Key may act like a standard Bitcoin keypair, providing the
means to sign transactions with its internal ECDSA private key or to
generate a receiving address with its internal ECDSA public key. In
addition, a BIP32Key can act as the parent node for a set of indexed
children and thus form a tree of BIP32Key sequences.

A BIP32Key may also be deemed a private or public BIP32Key, depending
upon whether the secret half of the internal ECDSA key pair is
present.  Private BIP32Keys are able to generate either public or
private child BIP32Keys, while public BIP32Keys can only generate
public children.

In other words, a private BIP32Key internally stores an ECDSA private
key, an ECDSA public key, and some additional pseudorandom bits named
the _chain code_.  Public BIP32Keys are only different in that the
secret half of the ECDSA key pair does not exist; only the public half
does.

## Creating a BIP32Key

A BIP32Key may come into existence in one of four ways:

* Using the BIP32Key.fromEntropy(entropy, public=False) method, one
  may provide a string of at least 32 bytes (128 bits) to construct a
  new master BIP32Key for an entire tree. From this initial >= 128
  bits of entropy a new ECDSA private key, ECDSA public key, and
  pseudorandom chain code are derived that preserves the 128 bit
  security parameter as described in BIP0032. This is termed a private
  BIP32Key, and may be used to derive child BIP32Keys that are either
  private or public.

  If the public parameter is set to True, then the internal ECDSA
  private key is discarded, the resulting BIP32Key is known as a
  public BIP32Key, and may only be used to generate further public
  BIP32Keys.

* Using the BIP32Key.fromExtendedKey(xkey, public=False) static
  method, one may provide a 78-byte serialized string that is
  formatted as an Extended Private Key, as documented in BIP0032. From
  this, the ECDSA private key, ECDSA public key, and chain code are
  extracted.

  If the public parameter is set to True, then the internal ECDSA
  private key is discarded, converting the resulting BIP32Key into a
  public BIP32Key, and may only be used to generate further public
  BIP32Keys.

* Using the BIP32Key.fromExtendedKey(xkey) static method, one may
  provide a 78-byte serialized string that is formatted as an Extended
  Public Key, as documented in BIP0032. From this, the ECDSA public
  key and chain code are extracted, resulting in a public BIP32Key
  that may only be used to generate further public BIP32Keys.

* Finally, using an instance of a BIP32Key resulting from any of the
  three methods above, one may call the member function ChildKey(i) to
  create a child BIP32Key one level lower in the hierarchy, at integer
  index 'i'. If the starting BIP32Key is a private one, then the
  resulting child BIP32Key will also be a private one, using the
  CKDpriv derivation formula in BIP0032.

  Likewise, if the starting BIP32Key is a public one (i.e., does not
  contain an internal ECDSA private key half), then the child BIP32Key
  will also be a public one, derived using the CKDpub algorithm in
  BIP0032.

At any time, a private BIP32Key may be turned into a public one by
calling the instance member function SetPublic(), which discards the
internal private ECDSA key half and sets an internal flag.

When creating a child BIP32Key from an existing private BIP32Key, one
may also select from an alternate set of child keys, called _hardened_
keys, by adding the constant BIP32_HARDEN to the integer index.  A
hardened child BIP32Key avoids a known issue with non-hardened child
keys where a compromise of one child key may result in a compromise of
all child keys in the same sequence.


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
in Kunze & Schmidt, Mykologische Hefte (Leipzig) 1: 9 (1817)

#### Original name
Arthrinium caricicola Kunze & J.C. Schmidt, 1817

### Remarks
null


text:
define(function(require, exports, module) {

  var m                   = require('wombs/utils/Math'              );
  var AudioGeometry       = require('wombs/three/AudioGeometry'     );
  var AnalyzingFunctions  = require('wombs/utils/AnalyzingFunctions');

  var Womb                = require( 'wombs/Womb'                       );

  var recursiveFunctions  = require( 'wombs/utils/RecursiveFunctions'   );

  var fragmentShaders     = require( 'wombs/shaders/fragmentShaders'    );
  var vertexShaders       = require( 'wombs/shaders/vertexShaders'      );
  var physicsShaders      = require( 'wombs/shaders/physicsShaders'     );
  var shaderChunks        = require( 'wombs/shaders/shaderChunks'       );

  var PhysicsSimulator    = require( 'wombs/shaders/PhysicsSimulator'   );
  var physicsShaders      = require( 'wombs/shaders/physicsShaders'     );

  function Ring( womb , params ){

    this.womb = womb;

    this.womb.loader.addToLoadBar();

    var self = this;
    this.params = _.defaults( params || {} , {

      spin: .001,
      color: new THREE.Vector3( .3 , .5 , 1.9 ),
      radius: 10,
      modelScale: .1,
      audioPower: 0.5,
      noisePower: 0.1,
      texture: self.womb.stream.texture.texture,
      geo: new THREE.CubeGeometry( self.womb.size , self.womb.size , self.womb.size ),
      numOf: 20

    });
    this.world = this.womb.sceneController.createScene();

    this.scene = this.world.scene;

    this.texture = this.params.texture;

    var self = this;

    this.geo = this.params.geo

    this.u = {

      texture:    { type: "t", value: womb.stream.texture.texture },
      image:      { type: "t", value: womb.stream.texture.texture },

      color:      { type: "v3", value: this.params.color },
      time:       womb.time,
      pow_noise:  { type: "f" , value: 0.2 },
      pow_audio:  { type: "f" , value: .3 },

    }

    this.uniforms = THREE.UniformsUtils.merge( [
        THREE.ShaderLib['basic'].uniforms,
        this.u,
    ]);

    this.uniforms.texture.value    = this.womb.stream.texture.texture;
    this.uniforms.image.value      = this.texture;
    this.uniforms.time             = womb.time;
    this.uniforms.pow_noise.value  = this.params.noisePower;
    this.uniforms.pow_audio.value  = this.params.audioPower;

    this.material = new THREE.ShaderMaterial( {
      uniforms:       this.uniforms,
      vertexShader:   vertexShaders.audio.noise.position,
      fragmentShader: fragmentShaders.audio.color.image.sample_pos_diamond,
      transparent:    true,
      fog:            true,
      blending:       THREE.AdditiveBlending,
      opacity:        0.1,
      depthWrite:     false
    });

    this.size = this.womb.size / 50;

    var numOf = this.params.numOf;

    this.geo.boundingSphere.radius *= 3;
    this.meshes = [];
    for( var i = 0; i < numOf;  i++ ){
      var mesh = new THREE.Mesh( this.geo , this.material );

      var angle = 2 * Math.PI * i / numOf;

      mesh.rotation.y = angle;
      mesh.position = Math.toCart( this.params.radius ,  angle , 0 );

      mesh.scale.multiplyScalar( this.params.modelScale );

      mesh.geometry.computeBoundingBox();

      this.scene.add( mesh );

      this.meshes.push( mesh );

    }

    //this.mesh = new THREE.Mesh( this.fullFullGeo , this.material );
    //this.scene.add( this.mesh );

    var self = this;
    this.world.update = function(){
      self.update();
    }

    womb.loader.loadBarAdd();

  }

  Ring.prototype.update = function(){

  }

  Ring.prototype.enter = function(){
    this.world.enter();
  }

  Ring.prototype.exit = function(){
    this.world.exit();
  }

  module.exports = Ring;

});


text:
#ifndef __TOUCH_DISPATHCHER_CCTOUCH_DELEGATE_PROTOCOL_H__
#define __TOUCH_DISPATHCHER_CCTOUCH_DELEGATE_PROTOCOL_H__

#include "CCObject.h"
#include "ccConfig.h"

namespace   cocos2d {

class CCTouch;
class CCEvent;
class CCSet;
class CCTouchDispatcher;

class CC_DLL CCTouchDelegate
{
public:

	CCTouchDelegate() {}

	virtual ~CCTouchDelegate()
	{
	}

	virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent); return false;};
	// optional

	virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
	virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
	virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}

	// optional
 	virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
 	virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
 	virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
 	virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}

};
/**
 @brief
 Using this type of delegate results in two benefits:
 - 1. You don't need to deal with CCSets, the dispatcher does the job of splitting
 them. You get exactly one UITouch per call.
 - 2. You can *claim* a UITouch by returning YES in ccTouchBegan. Updates of claimed
 touches are sent only to the delegate(s) that claimed them. So if you get a move/
 ended/cancelled update you're sure it's your touch. This frees you from doing a
 lot of checks when doing multi-touch.

 (The name TargetedTouchDelegate relates to updates "targeting" their specific
 handler, without bothering the other handlers.)
 @since v0.8
 */
 class CC_DLL CCTargetedTouchDelegate : public CCTouchDelegate
 {
 public:
 	/** Return YES to claim the touch.
 	 @since v0
	 */
 	virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);return false;};

 	// optional
 	virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
 	virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
 	virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
 };

/** @brief
 This type of delegate is the same one used by CocoaTouch. You will receive all the events (Began,Moved,Ended,Cancelled).
 @since v0.8
 */
 class CC_DLL CCStandardTouchDelegate : public CCTouchDelegate
 {
 public:
 	// optional
 	virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
 	virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
 	virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
    virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent) {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
 };

}//namespace   cocos2d

#endif // __TOUCH_DISPATHCHER_CCTOUCH_DELEGATE_PROTOCOL_H__


text:
automator-log-converter
=======================

Android UI Automator to JUnit Format Converter

Reads Android UI automator file outout and write a JUNIT Xml file. For example for usage in CI server as Jenkins

input: file with output from automator (simply redirect it to file)
output: file with JUnit XML

("usage: java -jar uiautomator2junit.jar convert <filename>");

(c) Danny Preussler, 2012 - 2015

Contains Apache ANT. Android DDMLib, licensed under Apache 2.0

LICENSED UNDER THE APACHE LICENSE, VERSION 2.0 (THE "LICENSE"); YOU MAY NOT USE THIS FILE EXCEPT IN COMPLIANCE WITH THE LICENSE. YOU MAY OBTAIN A COPY OF THE LICENSE AT HTTP://WWW.APACHE.ORG/LICENSES/LICENSE-2.0.


text:
package org.apache.syncope.core.spring.security;

import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWSAlgorithm;
import com.nimbusds.jose.KeyLengthException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.core.spring.ApplicationContextProvider;
import org.apache.syncope.core.spring.security.jws.AccessTokenJWSSigner;
import org.apache.syncope.core.spring.security.jws.AccessTokenJWSVerifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.core.GrantedAuthorityDefaults;

@EnableConfigurationProperties(SecurityProperties.class)
@Configuration(proxyBeanMethods = false)
public class SecurityContext {

    private static final Logger LOG = LoggerFactory.getLogger(SecurityContext.class);

    @Bean
    public CipherAlgorithm adminPasswordAlgorithm(final SecurityProperties props) {
        return props.getAdminPasswordAlgorithm();
    }

    @Bean
    public JWSAlgorithm jwsAlgorithm(final SecurityProperties props) {
        return JWSAlgorithm.parse(props.getJwsAlgorithm().toUpperCase());
    }

    private static String jwsKey(final JWSAlgorithm jwsAlgorithm, final SecurityProperties props) {
        String jwsKey = props.getJwsKey();
        if (jwsKey == null) {
            throw new IllegalArgumentException("No JWS key provided");
        }

        if (JWSAlgorithm.Family.HMAC_SHA.contains(jwsAlgorithm)) {
            int minLength = jwsAlgorithm.equals(JWSAlgorithm.HS256)
                    ? 256 / 8
                    : jwsAlgorithm.equals(JWSAlgorithm.HS384)
                    ? 384 / 8
                    : 512 / 8;
            if (jwsKey.length() < minLength) {
                jwsKey = SecureRandomUtils.generateRandomPassword(minLength);
                props.setJwsKey(jwsKey);
                LOG.warn("The configured key for {} must be at least {} bits, generating random: {}",
                        jwsAlgorithm, minLength * 8, jwsKey);
            }
        }

        return jwsKey;
    }

    @ConditionalOnMissingBean
    @Bean
    public DefaultCredentialChecker credentialChecker(
            final SecurityProperties props,
            final JWSAlgorithm jwsAlgorithm) {

        return new DefaultCredentialChecker(
                jwsKey(jwsAlgorithm, props),
                props.getAdminPassword(),
                props.getAnonymousKey());
    }

    @ConditionalOnMissingBean
    @Bean
    public AccessTokenJWSVerifier accessTokenJWSVerifier(
            final JWSAlgorithm jwsAlgorithm,
            final SecurityProperties props)
            throws JOSEException, NoSuchAlgorithmException, InvalidKeySpecException {

        return new AccessTokenJWSVerifier(jwsAlgorithm, jwsKey(jwsAlgorithm, props));
    }

    @ConditionalOnMissingBean
    @Bean
    public AccessTokenJWSSigner accessTokenJWSSigner(
            final JWSAlgorithm jwsAlgorithm,
            final SecurityProperties props)
            throws KeyLengthException, NoSuchAlgorithmException, InvalidKeySpecException {

        return new AccessTokenJWSSigner(jwsAlgorithm, jwsKey(jwsAlgorithm, props));
    }

    @ConditionalOnMissingBean
    @Bean
    public PasswordGenerator passwordGenerator() {
        return new DefaultPasswordGenerator();
    }

    @Bean
    public GrantedAuthorityDefaults grantedAuthorityDefaults() {
        return new GrantedAuthorityDefaults(""); // Remove the ROLE_ prefix
    }

    @Bean
    public ApplicationContextProvider applicationContextProvider() {
        return new ApplicationContextProvider();
    }
}


text:
package test_locally.servlet_test;

import com.slack.api.bolt.App;
import com.slack.api.bolt.AppConfig;
import com.slack.api.bolt.WebEndpoint;
import com.slack.api.bolt.handler.WebEndpointHandler;
import com.slack.api.bolt.response.Response;
import com.slack.api.bolt.servlet.WebEndpointServlet;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.jetty.http.HttpTester;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.servlet.ServletTester;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

@Slf4j
public class EndpointTest {

    private AppConfig appConfig = new AppConfig();
    // For real apps, you should not go with empty middleware
    private App app = new App(appConfig, Collections.emptyList());

    {
        app.endpoint("GET", "/hello-world", (req, ctx) -> {
            Map<String, String> body = new HashMap<>();
            body.put("message", "Hello World!");
            body.put("query", req.getQueryString());
            return Response.json(200, body);
        });
    }

    @Before
    public void setUp() {
        app.start();
    }

    @After
    public void tearDown() {
        app.stop();
    }

    @Test
    public void helloWorld() throws Exception {
        ServletTester tester = new ServletTester();
        Map.Entry<WebEndpoint, WebEndpointHandler> e = app.getWebEndpointHandlers().entrySet().iterator().next();
        WebEndpointServlet app = new WebEndpointServlet(e.getKey(), e.getValue(), appConfig);
        tester.addServlet(new ServletHolder(app), "/");
        tester.start();

        HttpTester.Request request = TestUtils.prepareRequest();
        request.setURI("/hello-world");
        request.setMethod("GET");
        request.setContent("dummy");

        HttpTester.Response response = HttpTester.parseResponse(tester.getResponses(request.generate()));

        assertThat(response.getStatus(), is(equalTo(200)));
        assertThat(response.getContent(), is(equalTo("{\"message\":\"Hello World!\"}")));
    }

    @Test
    public void helloWorld_with_query_string() throws Exception {
        ServletTester tester = new ServletTester();
        Map.Entry<WebEndpoint, WebEndpointHandler> e = app.getWebEndpointHandlers().entrySet().iterator().next();
        WebEndpointServlet app = new WebEndpointServlet(e.getKey(), e.getValue(), appConfig);
        tester.addServlet(new ServletHolder(app), "/");
        tester.start();

        HttpTester.Request request = TestUtils.prepareRequest();
        request.setURI("/hello-world?foo=bar&baz=var");
        request.setMethod("GET");
        request.setContent("dummy");

        HttpTester.Response response = HttpTester.parseResponse(tester.getResponses(request.generate()));

        assertThat(response.getStatus(), is(equalTo(200)));
        assertThat(response.getContent(),
                is(equalTo("{\"query\":\"foo\\u003dbar\\u0026baz\\u003dvar\",\"message\":\"Hello World!\"}")));
    }
}


text:
import React from 'react';
import { render } from 'react-dom';
import './styles/config.less';

class App extends React.Component {

  constructor(props) {
    super(props);
  }

  render() {

    return (

AppName

AppDescription

    );
  }
}

render(<App />, document.getElementById('root'));


text:
<?php
/**
 * CreateTileSheet special page file
 *
 * @file
 * @ingroup Extensions
 * @version 1.1.1
 * @author Jinbobo <paullee05149745@gmail.com>
 * @license
 */

class CreateTileSheet extends SpecialPage {
	/**
	 * Calls parent constructor and sets special page title
	 */
	public function __construct() {
		parent::__construct('CreateTileSheet', 'importtilesheets');
	}

	/**
	 * Return the group name for this special page.
	 *
	 * @access	protected
	 * @return	string
	 */
	protected function getGroupName() {
		return 'tilesheet';
	}

	/**
	 * Build special page
	 *
	 * @param null|string $par Subpage name
	 */
	public function execute($par) {
		// Restrict access from unauthorized users
		$this->checkPermissions();

		$out = $this->getOutput();
		$out->enableOOUI();
		$out->addModuleStyles('ext.tilesheets.special');

		$this->setHeaders();
		$this->outputHeader();

		$opts = new FormOptions();

		$opts->add( 'mod', 0 );
		$opts->add( 'sizes', 0 );
		$opts->add( 'input', 0 );
		$opts->add( 'update_table', 0 );

		$opts->fetchValuesFromRequest( $this->getRequest() );

		$opts->setValue('mod', $this->getRequest()->getText('mod'));
		$opts->setValue('sizes', $this->getRequest()->getText('sizes'));
		$opts->setValue('input', $this->getRequest()->getText('input'));
		$opts->setValue('update_table', intval($this->getRequest()->getText('update_table')));

		// Process and save POST data
		if ($_POST) {
			// XSRF prevention
			if ( !$this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) {
				return;
			}

			$out->addHtml('<tt>');
			$mod = $opts->getValue('mod');
			$sizes = $opts->getValue('sizes');
			// If update mode
			if ($opts->getValue('update_table') == 1) {
				// Delete sheet
				$out->addHtml($this->returnMessage(SheetManager::deleteEntry($mod, $this->getUser(), $this->msg('tilesheet-create-summary-deletesheet')->text()), $this->msg('tilesheet-create-response-msg-deletesheet')->text()));
				// Truncate table
				$out->addHtml($this->returnMessage(SheetManager::truncateTable($mod, $this->getUser(), $this->msg('tilesheet-create-summary-deletesheet')->text()), $this->msg('tilesheet-create-response-msg-truncate')->text()));
			}

			// Create sheet
			$out->addHtml($this->returnMessage(SheetManager::createSheet($mod, $sizes, $this->getUser()), $this->msg('tilesheet-create-response-msg-newsheet')->text()));

			$input = explode("\n", trim($opts->getValue('input')));
			foreach ($input as $line) {
				if (trim($line) == "") continue;
				list($x, $y, $z, $item) = explode(" ", $line, 4);
				$item = trim($item);

				// Create tile
				$out->addHtml($this->returnMessage(TileManager::createTile($mod, $item, $x, $y, $z, $this->getUser(), $this->msg('tilesheet-create-summary-newtile')->text()), $this->msg('tilesheet-create-response-msg-newtile')->params($item, $mod, $x, $y, $z)->text()));
			}
		$out->addHtml('</tt>');
		} else {
			$this->displayForm();
		}

	}

	private function displayForm() {
	    global $wgArticlePath;

        $formDescriptor = [
            'mod' => [
                'type' => 'text',
                'name' => 'mod',
                'label-message' => 'tilesheet-create-mod',
                'id' => 'mod',
                'help-message' => 'tilesheet-create-mod-hint'
            ],
            'sizes' => [
                'type' => 'text',
                'name' => 'sizes',
                'label-message' => 'tilesheet-create-sizes',
                'id' => 'sizes',
                'help-message' => 'tilesheet-create-sizes-hint'
            ],
            'input' => [
                'type' => 'textarea',
                'name' => 'input',
                'rows' => 40,
                'label-message' => 'tilesheet-create-input',
                'cssclass' => 'tilesheet-importer-textarea',
                'help-message' => 'tilesheet-create-input-hint'
            ],
            'update' => [
                'type' => 'check',
                'name' => 'update_table',
                'default' => 0,
                'label-message' => 'tilesheet-create-update',
                'id' => 'update_table',
                'help-message' => 'tilesheet-create-update-hint',
                'csshelpclass' => 'tilesheet-create-update-hint'
            ]
        ];

        $htmlForm = HTMLForm::factory('ooui', $formDescriptor, $this->getContext());
        $htmlForm
            ->setMethod('post')
            ->setAction(str_replace('$1', 'Special:CreateTileSheet', $wgArticlePath))
            ->setWrapperLegendMsg('tilesheet-create-legend')
            ->setId('ext-tilesheet-create-form')
            ->setSubmitTextMsg('tilesheet-create-submit')
            ->setSubmitProgressive()
            ->prepareForm()
            ->displayForm(false);
	}

	/**
	 * Helper function for displaying results
	 *
	 * @param bool $state Return value an action
	 * @param string $message Message to display
	 * @return string
	 */
	private function returnMessage($state, $message) {
		if ($state) {
			$out = '' . $this->msg('tilesheet-create-response-success')->text() . ' '.$message."
";
		} else {
			$out = '' . $this->msg('tilesheet-create-response-fail')->text() . ' '.$message."
";
		}
		return $out;
	}
}


text:
using QuizEngine.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QuizEngine.SDK.Interfaces
{
    public interface IQuizEngineProvider
    {
        #region Quiz
        ApiResponse<List<Quiz>> GetAllQuizzes(bool activeOnly = true);
        ApiResponse<Quiz> GetQuiz(long quizId, bool activeOnly = true);
        ApiResponse<Quiz> AddQuiz(Quiz quiz);
        ApiResponse<Quiz> UpdateQuiz(Quiz quiz);
        ApiResponse<Quiz> DeleteQuiz(long quizId);
        #endregion

        #region Question
        ApiResponse<List<Question>> GetQuestionsForQuiz(long quizId, bool activeQuizOnly = true);
        ApiResponse<Question> GetQuestion(long questionId, bool activeQuizOnly = true);
        ApiResponse<Question> AddQuestion(Question question);
        ApiResponse<Question> UpdateQuestion(Question question);
        ApiResponse<Question> DeleteQuestion(long questionId);
        #endregion

        #region Answer
        ApiResponse<List<Answer>> GetAnswersForQuestion(long questionId, bool activeQuizOnly = true);
        ApiResponse<Answer> GetAnswer(long answerId, bool activeQuizOnly = true);
        ApiResponse<Answer> AddAnswer(Answer answer);
        ApiResponse<Answer> UpdateAnswer(Answer answer);
        ApiResponse<Answer> DeleteAnswer(long answerId);
        #endregion

        #region Result
        ApiResponse<List<Result>> GetResultsForQuiz(long quizId, bool activeQuizOnly = true);
        ApiResponse<Result> GetResult(long resultId, bool activeQuizOnly = true);
        ApiResponse<Result> AddResult(Result result);
        ApiResponse<Result> UpdateResult(Result result);
        ApiResponse<Result> DeleteResult(long resultId);
        #endregion
    }
}


text:
__author__ = 'Daniel Zhang (張道博)'

import unittest
from sek.logger import SEKLogger

# @todo Replace strings with enumeration types.
from logging import INFO
from logging import DEBUG
from logging import ERROR

import re

class MSGLoggerTester(unittest.TestCase):

    def setUp(self):
        self.logger = SEKLogger(__name__, level='DEBUG')
        print 'logger level: %s' % self.logger.loggerLevel

    def testInit(self):
        self.logger.log('Testing init.',level='info')

        self.assertIsNotNone(self.logger)

    def testLogRecording(self):
        self.logger.log('Testing log recording.','info')

        msg = "Recording test."

        self.logger.startRecording()
        self.logger.log(msg, 'info')
        self.logger.endRecording()
        self.logger.log("This should not be logged.", 'info')

        result = re.search(msg, self.logger.recording).group(0)

        self.logger.log("recording result: %s" % self.logger.recording)

        self.assertEqual(result, msg)

    def testSilentLogging(self):
        return

        self.logger.log('Testing silent logging.','info')

        msg = "Recording test."

        self.logger.startRecording()
        self.logger.log(msg, 'silent')
        self.logger.endRecording()

        self.assertEqual(self.logger.recording, '')

    def testDebugLogging(self):
        self.logger.log('Testing debug logging','DEBUG')

    def testDoublingOfLoggingOutput(self):
        self.logger.log('This is a test of doubling of logger output at the beginning of a test.')

if __name__ == '__main__':
    unittest.main()


text:
package io.github.dawncraft.client.renderer.block;

import io.github.dawncraft.Dawncraft;
import io.github.dawncraft.block.BlockInit;
import io.github.dawncraft.core.client.DawnClientHooks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.IStateMapper;
import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fluids.BlockFluidBase;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;

/**
 * Register custom blocks' model.
 *
 * @author QingChenW
 */
@Mod.EventBusSubscriber(modid = Dawncraft.MODID, value = Side.CLIENT)
public class BlockModelInit
{
    @SubscribeEvent
    public static void registerBlockModels(ModelRegistryEvent event)
    {
        registerFluidModel(BlockInit.PETROLEUM);

        registerStateMapper(BlockInit.ALARM_CLOCK, new StateMap.Builder().ignore(BlockHorizontal.FACING).build());

        registerBuiltIn(BlockInit.SUPER_CHEST, "minecraft:blocks/planks_oak");
        registerBuiltIn(BlockInit.SKULL, "minecraft:blocks/soul_sand");
    }

    @SubscribeEvent
    public static void blockColors(ColorHandlerEvent.Block event)
    {

    }

    /**
     * Register a fluid's model.
     *
     * @param block Fluid block to register
     */
    private static void registerFluidModel(Block block)
    {
        if (!(block instanceof BlockFluidBase)) return;
        BlockFluidBase blockFluid = (BlockFluidBase) block;
        final String name = blockFluid.getRegistryName().toString();
        registerStateMapper(blockFluid, new StateMapperBase()
        {
            @Override
            protected ModelResourceLocation getModelResourceLocation(IBlockState state)
            {
                return new ModelResourceLocation(name, "fluid");
            }
        });
    }

    /**
     * Register a block state mapper.
     *
     * @param block block to register
     * @param mapper block's state mapper
     */
    private static void registerStateMapper(Block block, IStateMapper mapper)
    {
        ModelLoader.setCustomStateMapper(block, mapper);
    }

    /**
     * Register a builtin block.
     *
     * @param block builtin block to register
     * @param iconName the name of texture
     */
    private static void registerBuiltIn(Block block, String iconName)
    {
        DawnClientHooks.registerBuiltInBlocks(block);
        DawnClientHooks.registerBlockParticle(block, iconName);
    }
}


text:
title: Binding to LinqDataSource
page_title: Binding to LinqDataSource - RadGrid
description: Check our Web Forms article about Binding to LinqDataSource.
slug: grid/data-binding/server-side-binding/various-data-sources/binding-to-linqdatasource
previous_url: controls/grid/data-binding/understanding-data-binding/server-side-binding/various-data-sources/binding-to-linqdatasource
published: True
position: 7
---

# Binding To LinqDataSource control

RadGrid Markup

````ASP.NET
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="LinqDataSource1">
</telerik:RadGrid>

<asp:LinqDataSource ID="LinqDataSource1" runat="server" OnSelecting="LinqDataSource1_Selecting"></asp:LinqDataSource>
````

Code behind section (dummy data generated using an Enumerable)

````C#
protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
    e.Result = Enumerable.Range(1, 100).Select(x => new Order()
    {
        OrderID = x,
        OrderDate = DateTime.Now.Date.AddDays(x).AddHours(x).AddMinutes(x),
        Freight = x * 0.1,
        ShipName = "Name " + x,
        ShipCountry = "Country " + x
    });
}
public class Order
{
    public int OrderID { get; set; }
    public DateTime OrderDate { get; set; }
    public double Freight { get; set; }
    public string ShipName { get; set; }
    public string ShipCountry { get; set; }
}
````
````VB
Protected Sub LinqDataSource1_Selecting(sender As Object, e As LinqDataSourceSelectEventArgs)
    e.Result = Enumerable.Range(1, 100).Select(Function(x) New Order() With {
        .OrderID = x,
        .OrderDate = DateTime.Now.Date.AddDays(x).AddHours(x).AddMinutes(x),
        .Freight = x * 0.1,
        .ShipName = "Name " & x,
        .ShipCountry = "Country " & x
    })
End Sub
Public Class Order
    Public Property OrderID As Integer
    Public Property OrderDate As DateTime
    Public Property Freight As Double
    Public Property ShipName As String
    Public Property ShipCountry As String
End Class
````


text:
require 'noodall/routes'

Noodall::Routes.draw(Dummy::Application)


text:
from google.cloud import texttospeech_v1beta1

def sample_synthesize_speech():
    # Create a client
    client = texttospeech_v1beta1.TextToSpeechClient()

    # Initialize request argument(s)
    input = texttospeech_v1beta1.SynthesisInput()
    input.text = "text_value"

    voice = texttospeech_v1beta1.VoiceSelectionParams()
    voice.language_code = "language_code_value"

    audio_config = texttospeech_v1beta1.AudioConfig()
    audio_config.audio_encoding = "ALAW"

    request = texttospeech_v1beta1.SynthesizeSpeechRequest(
        input=input,
        voice=voice,
        audio_config=audio_config,
    )

    # Make the request
    response = client.synthesize_speech(request=request)

    # Handle the response
    print(response)

# [END texttospeech_v1beta1_generated_TextToSpeech_SynthesizeSpeech_sync]