text:
package organization

import (
	"context"
	"fmt"
	"net/http"
	"time"

	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"

	"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
	"github.com/philips-software/go-hsdp-api/iam"
	"github.com/philips-software/terraform-provider-hsdp/internal/config"
	"github.com/philips-software/terraform-provider-hsdp/internal/tools"

	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

var descriptions = map[string]string{
	"organization": "An organization is a container that owns sub-organizations, groups, and users, as well as other identities like devices and services.",
}

func ResourceIAMOrg() *schema.Resource {
	return &schema.Resource{
		Description: descriptions["organization"],
		Importer: &schema.ResourceImporter{
			StateContext: schema.ImportStatePassthroughContext,
		},
		SchemaVersion: 4,
		CreateContext: resourceIAMOrgCreate,
		ReadContext:   resourceIAMOrgRead,
		UpdateContext: resourceIAMOrgUpdate,
		DeleteContext: resourceIAMOrgDelete,

		Schema: map[string]*schema.Schema{
			"name": {
				Type:        schema.TypeString,
				ForceNew:    true,
				Required:    true,
				Description: "The name of the IAM Organization.",
			},
			"description": {
				Type:        schema.TypeString,
				Optional:    true,
				Description: "The description of the organization.",
			},
			"display_name": {
				Type:        schema.TypeString,
				Optional:    true,
				Description: "The display name to use for this organization.",
			},
			"type": {
				Type:        schema.TypeString,
				Optional:    true,
				Description: "The organization type.",
			},
			"external_id": {
				Type:        schema.TypeString,
				Optional:    true,
				Description: "An optional external identifier for this organization.",
			},
			"is_root_org": {
				Type:        schema.TypeBool,
				Optional:    true,
				Deprecated:  "This field is deprecated, please remove it",
				Description: "Deprecated, do not use.",
			},
			"parent_org_id": {
				Type:        schema.TypeString,
				Optional:    true,
				Description: "The parent organization ID.",
			},
			"wait_for_delete": {
				Type:        schema.TypeBool,
				Optional:    true,
				Description: "Blocks until the organization delete has completed. Default: false. The organization delete process can take some time as all its associated resources like users, groups, roles etc. are removed recursively. This option is useful for ephemeral environments where the same organization might be recreated shortly after a destroy operation.",
			},
			"active": {
				Type:        schema.TypeBool,
				Computed:    true,
				Description: "Weather the organization is active or not.",
			},
		},
	}
}

func resourceIAMOrgCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
	c := m.(*config.Config)

	client, err := c.IAMClient()
	if err != nil {
		return diag.FromErr(err)
	}

	name := d.Get("name").(string)
	description := d.Get("description").(string)
	externalID := d.Get("external_id").(string)
	orgType := d.Get("type").(string)
	displayName := d.Get("display_name").(string)
	parentOrgID, ok := d.Get("parent_org_id").(string)
	if !ok {
		return diag.FromErr(config.ErrMissingParentOrgID)
	}
	var newOrg iam.Organization
	newOrg.Name = name
	newOrg.Description = description
	newOrg.Parent.Value = parentOrgID
	newOrg.ExternalID = externalID
	newOrg.DisplayName = displayName
	newOrg.Type = orgType

	var org *iam.Organization
	var resp *iam.Response
	err = tools.TryHTTPCall(ctx, 10, func() (*http.Response, error) {
		var err error
		org, resp, err = client.Organizations.CreateOrganization(newOrg)
		if err != nil {
			_ = client.TokenRefresh()
		}
		if resp == nil {
			return nil, err
		}
		return resp.Response, err
	})
	if err != nil {
		return diag.FromErr(err)
	}
	if org == nil {
		return diag.FromErr(fmt.Errorf("failed to create organization: %d", resp.StatusCode()))
	}
	d.SetId(org.ID)
	return resourceIAMOrgRead(ctx, d, m)
}

func resourceIAMOrgRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
	c := m.(*config.Config)

	var diags diag.Diagnostics

	client, err := c.IAMClient()
	if err != nil {
		return diag.FromErr(err)
	}

	id := d.Id()
	var resp *iam.Response
	var org *iam.Organization

	err = tools.TryHTTPCall(ctx, 8, func() (*http.Response, error) {
		org, resp, err = client.Organizations.GetOrganizationByID(id)
		if resp == nil {
			return nil, err
		}
		return resp.Response, err
	})
	if err != nil {
		if resp != nil && resp.StatusCode() == http.StatusNotFound { // Gone
			d.SetId("")
			return nil
		}
		return diag.FromErr(err)
	}
	_ = d.Set("description", org.Description)
	_ = d.Set("name", org.Name)
	_ = d.Set("external_id", org.ExternalID)
	_ = d.Set("parent_org_id", org.Parent.Value)
	_ = d.Set("display_name", org.DisplayName)
	_ = d.Set("active", org.Active)
	_ = d.Set("type", org.Type)
	return diags
}

func resourceIAMOrgUpdate(_ context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
	c := m.(*config.Config)

	var diags diag.Diagnostics

	client, err := c.IAMClient()
	if err != nil {
		return diag.FromErr(err)
	}

	id := d.Id()
	org, _, err := client.Organizations.GetOrganizationByID(id)
	if err != nil {
		return diag.FromErr(err)
	}

	if d.HasChange("description") || d.HasChange("name") ||
		d.HasChange("type") || d.HasChange("external_id") || d.HasChange("display_name") {
		org.Name = d.Get("name").(string)
		org.Description = d.Get("description").(string)
		org.Type = d.Get("type").(string)
		org.ExternalID = d.Get("external_id").(string)
		org.DisplayName = d.Get("display_name").(string)
		_, _, err = client.Organizations.UpdateOrganization(*org)
		if err != nil {
			diags = append(diags, diag.FromErr(err)...)
		}
	}
	return diags
}

func resourceIAMOrgDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
	c := m.(*config.Config)

	var diags diag.Diagnostics

	client, err := c.IAMClient()
	if err != nil {
		return diag.FromErr(err)
	}

	id := d.Id()
	org, _, err := client.Organizations.GetOrganizationByID(id)
	if err != nil {
		return diag.FromErr(err)
	}
	waitForDelete := d.Get("wait_for_delete").(bool)

	ok, _, err := client.Organizations.DeleteOrganization(*org)
	if err != nil {
		return diag.FromErr(err)
	}
	if !ok {
		return diag.FromErr(config.ErrInvalidResponse)
	}
	if waitForDelete {
		stateConf := &retry.StateChangeConf{
			Pending:    []string{"IN_PROGRESS", "QUEUED", "indeterminate"},
			Target:     []string{"SUCCESS"},
			Refresh:    checkOrgDeleteStatus(client, id),
			Timeout:    d.Timeout(schema.TimeoutCreate),
			Delay:      5 * time.Second,
			MinTimeout: time.Duration(5) * time.Second,
		}
		_, err = stateConf.WaitForStateContext(ctx)
		if err != nil {
			return diag.FromErr(fmt.Errorf("waiting for delete: %w", err))
		}
	}
	return diags
}

func checkOrgDeleteStatus(client *iam.Client, id string) retry.StateRefreshFunc {
	return func() (result interface{}, state string, err error) {
		orgStatus, resp, err := client.Organizations.DeleteStatus(id)
		if err != nil {
			return resp, "FAILED", err
		}
		if orgStatus != nil {
			return resp, orgStatus.Status, nil
		}
		// We may need to return an error here
		return resp, "IN_PROGRESS", nil
	}
}


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

package falconx_sandbox

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

import (
	"fmt"
	"io"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"

	"github.com/crowdstrike/gofalcon/falcon/models"
)

// GetSummaryReportsReader is a Reader for the GetSummaryReports structure.
type GetSummaryReportsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetSummaryReportsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetSummaryReportsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetSummaryReportsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetSummaryReportsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 429:
		result := NewGetSummaryReportsTooManyRequests()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetSummaryReportsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /falconx/entities/report-summaries/v1] GetSummaryReports", response, response.Code())
	}
}

// NewGetSummaryReportsOK creates a GetSummaryReportsOK with default headers values
func NewGetSummaryReportsOK() *GetSummaryReportsOK {
	return &GetSummaryReportsOK{}
}

/*
GetSummaryReportsOK describes a response with status code 200, with default header values.

OK
*/
type GetSummaryReportsOK struct {

	/* Trace-ID: submit to support if resolving an issue
	 */
	XCSTRACEID string

	/* Request limit per minute.
	 */
	XRateLimitLimit int64

	/* The number of requests remaining for the sliding one minute window.
	 */
	XRateLimitRemaining int64

	Payload *models.FalconxSummaryReportV1Response
}

// IsSuccess returns true when this get summary reports o k response has a 2xx status code
func (o *GetSummaryReportsOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get summary reports o k response has a 3xx status code
func (o *GetSummaryReportsOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get summary reports o k response has a 4xx status code
func (o *GetSummaryReportsOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get summary reports o k response has a 5xx status code
func (o *GetSummaryReportsOK) IsServerError() bool {
	return false
}

// IsCode returns true when this get summary reports o k response a status code equal to that given
func (o *GetSummaryReportsOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the get summary reports o k response
func (o *GetSummaryReportsOK) Code() int {
	return 200
}

func (o *GetSummaryReportsOK) Error() string {
	return fmt.Sprintf("[GET /falconx/entities/report-summaries/v1][%d] getSummaryReportsOK  %+v", 200, o.Payload)
}

func (o *GetSummaryReportsOK) String() string {
	return fmt.Sprintf("[GET /falconx/entities/report-summaries/v1][%d] getSummaryReportsOK  %+v", 200, o.Payload)
}

func (o *GetSummaryReportsOK) GetPayload() *models.FalconxSummaryReportV1Response {
	return o.Payload
}

func (o *GetSummaryReportsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// hydrates response header X-CS-TRACEID
	hdrXCSTRACEID := response.GetHeader("X-CS-TRACEID")

	if hdrXCSTRACEID != "" {
		o.XCSTRACEID = hdrXCSTRACEID
	}

	// hydrates response header X-RateLimit-Limit
	hdrXRateLimitLimit := response.GetHeader("X-RateLimit-Limit")

	if hdrXRateLimitLimit != "" {
		valxRateLimitLimit, err := swag.ConvertInt64(hdrXRateLimitLimit)
		if err != nil {
			return errors.InvalidType("X-RateLimit-Limit", "header", "int64", hdrXRateLimitLimit)
		}
		o.XRateLimitLimit = valxRateLimitLimit
	}

	// hydrates response header X-RateLimit-Remaining
	hdrXRateLimitRemaining := response.GetHeader("X-RateLimit-Remaining")

	if hdrXRateLimitRemaining != "" {
		valxRateLimitRemaining, err := swag.ConvertInt64(hdrXRateLimitRemaining)
		if err != nil {
			return errors.InvalidType("X-RateLimit-Remaining", "header", "int64", hdrXRateLimitRemaining)
		}
		o.XRateLimitRemaining = valxRateLimitRemaining
	}

	o.Payload = new(models.FalconxSummaryReportV1Response)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewGetSummaryReportsBadRequest creates a GetSummaryReportsBadRequest with default headers values
func NewGetSummaryReportsBadRequest() *GetSummaryReportsBadRequest {
	return &GetSummaryReportsBadRequest{}
}

/*
GetSummaryReportsBadRequest describes a response with status code 400, with default header values.

Bad Request
*/
type GetSummaryReportsBadRequest struct {

	/* Trace-ID: submit to support if resolving an issue
	 */
	XCSTRACEID string

	/* Request limit per minute.
	 */
	XRateLimitLimit int64

	/* The number of requests remaining for the sliding one minute window.
	 */
	XRateLimitRemaining int64

	Payload *models.FalconxSummaryReportV1Response
}

// IsSuccess returns true when this get summary reports bad request response has a 2xx status code
func (o *GetSummaryReportsBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get summary reports bad request response has a 3xx status code
func (o *GetSummaryReportsBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get summary reports bad request response has a 4xx status code
func (o *GetSummaryReportsBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this get summary reports bad request response has a 5xx status code
func (o *GetSummaryReportsBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this get summary reports bad request response a status code equal to that given
func (o *GetSummaryReportsBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the get summary reports bad request response
func (o *GetSummaryReportsBadRequest) Code() int {
	return 400
}

func (o *GetSummaryReportsBadRequest) Error() string {
	return fmt.Sprintf("[GET /falconx/entities/report-summaries/v1][%d] getSummaryReportsBadRequest  %+v", 400, o.Payload)
}

func (o *GetSummaryReportsBadRequest) String() string {
	return fmt.Sprintf("[GET /falconx/entities/report-summaries/v1][%d] getSummaryReportsBadRequest  %+v", 400, o.Payload)
}

func (o *GetSummaryReportsBadRequest) GetPayload() *models.FalconxSummaryReportV1Response {
	return o.Payload
}

func (o *GetSummaryReportsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// hydrates response header X-CS-TRACEID
	hdrXCSTRACEID := response.GetHeader("X-CS-TRACEID")

	if hdrXCSTRACEID != "" {
		o.XCSTRACEID = hdrXCSTRACEID
	}

	// hydrates response header X-RateLimit-Limit
	hdrXRateLimitLimit := response.GetHeader("X-RateLimit-Limit")

	if hdrXRateLimitLimit != "" {
		valxRateLimitLimit, err := swag.ConvertInt64(hdrXRateLimitLimit)
		if err != nil {
			return errors.InvalidType("X-RateLimit-Limit", "header", "int64", hdrXRateLimitLimit)
		}
		o.XRateLimitLimit = valxRateLimitLimit
	}

	// hydrates response header X-RateLimit-Remaining
	hdrXRateLimitRemaining := response.GetHeader("X-RateLimit-Remaining")

	if hdrXRateLimitRemaining != "" {
		valxRateLimitRemaining, err := swag.ConvertInt64(hdrXRateLimitRemaining)
		if err != nil {
			return errors.InvalidType("X-RateLimit-Remaining", "header", "int64", hdrXRateLimitRemaining)
		}
		o.XRateLimitRemaining = valxRateLimitRemaining
	}

	o.Payload = new(models.FalconxSummaryReportV1Response)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewGetSummaryReportsForbidden creates a GetSummaryReportsForbidden with default headers values
func NewGetSummaryReportsForbidden() *GetSummaryReportsForbidden {
	return &GetSummaryReportsForbidden{}
}

/*
GetSummaryReportsForbidden describes a response with status code 403, with default header values.

Forbidden
*/
type GetSummaryReportsForbidden struct {

	/* Trace-ID: submit to support if resolving an issue
	 */
	XCSTRACEID string

	/* Request limit per minute.
	 */
	XRateLimitLimit int64

	/* The number of requests remaining for the sliding one minute window.
	 */
	XRateLimitRemaining int64

	Payload *models.MsaReplyMetaOnly
}

// IsSuccess returns true when this get summary reports forbidden response has a 2xx status code
func (o *GetSummaryReportsForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get summary reports forbidden response has a 3xx status code
func (o *GetSummaryReportsForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get summary reports forbidden response has a 4xx status code
func (o *GetSummaryReportsForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this get summary reports forbidden response has a 5xx status code
func (o *GetSummaryReportsForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this get summary reports forbidden response a status code equal to that given
func (o *GetSummaryReportsForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the get summary reports forbidden response
func (o *GetSummaryReportsForbidden) Code() int {
	return 403
}

func (o *GetSummaryReportsForbidden) Error() string {
	return fmt.Sprintf("[GET /falconx/entities/report-summaries/v1][%d] getSummaryReportsForbidden  %+v", 403, o.Payload)
}

func (o *GetSummaryReportsForbidden) String() string {
	return fmt.Sprintf("[GET /falconx/entities/report-summaries/v1][%d] getSummaryReportsForbidden  %+v", 403, o.Payload)
}

func (o *GetSummaryReportsForbidden) GetPayload() *models.MsaReplyMetaOnly {
	return o.Payload
}

func (o *GetSummaryReportsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// hydrates response header X-CS-TRACEID
	hdrXCSTRACEID := response.GetHeader("X-CS-TRACEID")

	if hdrXCSTRACEID != "" {
		o.XCSTRACEID = hdrXCSTRACEID
	}

	// hydrates response header X-RateLimit-Limit
	hdrXRateLimitLimit := response.GetHeader("X-RateLimit-Limit")

	if hdrXRateLimitLimit != "" {
		valxRateLimitLimit, err := swag.ConvertInt64(hdrXRateLimitLimit)
		if err != nil {
			return errors.InvalidType("X-RateLimit-Limit", "header", "int64", hdrXRateLimitLimit)
		}
		o.XRateLimitLimit = valxRateLimitLimit
	}

	// hydrates response header X-RateLimit-Remaining
	hdrXRateLimitRemaining := response.GetHeader("X-RateLimit-Remaining")

	if hdrXRateLimitRemaining != "" {
		valxRateLimitRemaining, err := swag.ConvertInt64(hdrXRateLimitRemaining)
		if err != nil {
			return errors.InvalidType("X-RateLimit-Remaining", "header", "int64", hdrXRateLimitRemaining)
		}
		o.XRateLimitRemaining = valxRateLimitRemaining
	}

	o.Payload = new(models.MsaReplyMetaOnly)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewGetSummaryReportsTooManyRequests creates a GetSummaryReportsTooManyRequests with default headers values
func NewGetSummaryReportsTooManyRequests() *GetSummaryReportsTooManyRequests {
	return &GetSummaryReportsTooManyRequests{}
}

/*
GetSummaryReportsTooManyRequests describes a response with status code 429, with default header values.

Too Many Requests
*/
type GetSummaryReportsTooManyRequests struct {

	/* Trace-ID: submit to support if resolving an issue
	 */
	XCSTRACEID string

	/* Request limit per minute.
	 */
	XRateLimitLimit int64

	/* The number of requests remaining for the sliding one minute window.
	 */
	XRateLimitRemaining int64

	/* Too many requests, retry after this time (as milliseconds since epoch)
	 */
	XRateLimitRetryAfter int64

	Payload *models.MsaReplyMetaOnly
}

// IsSuccess returns true when this get summary reports too many requests response has a 2xx status code
func (o *GetSummaryReportsTooManyRequests) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get summary reports too many requests response has a 3xx status code
func (o *GetSummaryReportsTooManyRequests) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get summary reports too many requests response has a 4xx status code
func (o *GetSummaryReportsTooManyRequests) IsClientError() bool {
	return true
}

// IsServerError returns true when this get summary reports too many requests response has a 5xx status code
func (o *GetSummaryReportsTooManyRequests) IsServerError() bool {
	return false
}

// IsCode returns true when this get summary reports too many requests response a status code equal to that given
func (o *GetSummaryReportsTooManyRequests) IsCode(code int) bool {
	return code == 429
}

// Code gets the status code for the get summary reports too many requests response
func (o *GetSummaryReportsTooManyRequests) Code() int {
	return 429
}

func (o *GetSummaryReportsTooManyRequests) Error() string {
	return fmt.Sprintf("[GET /falconx/entities/report-summaries/v1][%d] getSummaryReportsTooManyRequests  %+v", 429, o.Payload)
}

func (o *GetSummaryReportsTooManyRequests) String() string {
	return fmt.Sprintf("[GET /falconx/entities/report-summaries/v1][%d] getSummaryReportsTooManyRequests  %+v", 429, o.Payload)
}

func (o *GetSummaryReportsTooManyRequests) GetPayload() *models.MsaReplyMetaOnly {
	return o.Payload
}

func (o *GetSummaryReportsTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// hydrates response header X-CS-TRACEID
	hdrXCSTRACEID := response.GetHeader("X-CS-TRACEID")

	if hdrXCSTRACEID != "" {
		o.XCSTRACEID = hdrXCSTRACEID
	}

	// hydrates response header X-RateLimit-Limit
	hdrXRateLimitLimit := response.GetHeader("X-RateLimit-Limit")

	if hdrXRateLimitLimit != "" {
		valxRateLimitLimit, err := swag.ConvertInt64(hdrXRateLimitLimit)
		if err != nil {
			return errors.InvalidType("X-RateLimit-Limit", "header", "int64", hdrXRateLimitLimit)
		}
		o.XRateLimitLimit = valxRateLimitLimit
	}

	// hydrates response header X-RateLimit-Remaining
	hdrXRateLimitRemaining := response.GetHeader("X-RateLimit-Remaining")

	if hdrXRateLimitRemaining != "" {
		valxRateLimitRemaining, err := swag.ConvertInt64(hdrXRateLimitRemaining)
		if err != nil {
			return errors.InvalidType("X-RateLimit-Remaining", "header", "int64", hdrXRateLimitRemaining)
		}
		o.XRateLimitRemaining = valxRateLimitRemaining
	}

	// hydrates response header X-RateLimit-RetryAfter
	hdrXRateLimitRetryAfter := response.GetHeader("X-RateLimit-RetryAfter")

	if hdrXRateLimitRetryAfter != "" {
		valxRateLimitRetryAfter, err := swag.ConvertInt64(hdrXRateLimitRetryAfter)
		if err != nil {
			return errors.InvalidType("X-RateLimit-RetryAfter", "header", "int64", hdrXRateLimitRetryAfter)
		}
		o.XRateLimitRetryAfter = valxRateLimitRetryAfter
	}

	o.Payload = new(models.MsaReplyMetaOnly)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewGetSummaryReportsInternalServerError creates a GetSummaryReportsInternalServerError with default headers values
func NewGetSummaryReportsInternalServerError() *GetSummaryReportsInternalServerError {
	return &GetSummaryReportsInternalServerError{}
}

/*
GetSummaryReportsInternalServerError describes a response with status code 500, with default header values.

Internal Server Error
*/
type GetSummaryReportsInternalServerError struct {

	/* Trace-ID: submit to support if resolving an issue
	 */
	XCSTRACEID string

	/* Request limit per minute.
	 */
	XRateLimitLimit int64

	/* The number of requests remaining for the sliding one minute window.
	 */
	XRateLimitRemaining int64

	Payload *models.FalconxSummaryReportV1Response
}

// IsSuccess returns true when this get summary reports internal server error response has a 2xx status code
func (o *GetSummaryReportsInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get summary reports internal server error response has a 3xx status code
func (o *GetSummaryReportsInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get summary reports internal server error response has a 4xx status code
func (o *GetSummaryReportsInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this get summary reports internal server error response has a 5xx status code
func (o *GetSummaryReportsInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this get summary reports internal server error response a status code equal to that given
func (o *GetSummaryReportsInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the get summary reports internal server error response
func (o *GetSummaryReportsInternalServerError) Code() int {
	return 500
}

func (o *GetSummaryReportsInternalServerError) Error() string {
	return fmt.Sprintf("[GET /falconx/entities/report-summaries/v1][%d] getSummaryReportsInternalServerError  %+v", 500, o.Payload)
}

func (o *GetSummaryReportsInternalServerError) String() string {
	return fmt.Sprintf("[GET /falconx/entities/report-summaries/v1][%d] getSummaryReportsInternalServerError  %+v", 500, o.Payload)
}

func (o *GetSummaryReportsInternalServerError) GetPayload() *models.FalconxSummaryReportV1Response {
	return o.Payload
}

func (o *GetSummaryReportsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// hydrates response header X-CS-TRACEID
	hdrXCSTRACEID := response.GetHeader("X-CS-TRACEID")

	if hdrXCSTRACEID != "" {
		o.XCSTRACEID = hdrXCSTRACEID
	}

	// hydrates response header X-RateLimit-Limit
	hdrXRateLimitLimit := response.GetHeader("X-RateLimit-Limit")

	if hdrXRateLimitLimit != "" {
		valxRateLimitLimit, err := swag.ConvertInt64(hdrXRateLimitLimit)
		if err != nil {
			return errors.InvalidType("X-RateLimit-Limit", "header", "int64", hdrXRateLimitLimit)
		}
		o.XRateLimitLimit = valxRateLimitLimit
	}

	// hydrates response header X-RateLimit-Remaining
	hdrXRateLimitRemaining := response.GetHeader("X-RateLimit-Remaining")

	if hdrXRateLimitRemaining != "" {
		valxRateLimitRemaining, err := swag.ConvertInt64(hdrXRateLimitRemaining)
		if err != nil {
			return errors.InvalidType("X-RateLimit-Remaining", "header", "int64", hdrXRateLimitRemaining)
		}
		o.XRateLimitRemaining = valxRateLimitRemaining
	}

	o.Payload = new(models.FalconxSummaryReportV1Response)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

license: MIT

repository: CrowdStrike/gofalcon

license_type: permissive

repo_name: CrowdStrike/gofalcon

branch_name: refs/heads/main

gha_license_id: MIT

gha_language: Go

extension: go


text:
package gos

import (
	"fmt"
	"log"
	"os"
	"path/filepath"
	"runtime"
)

//Level log level
type Level int

var (
	// log file
	f *os.File
	//DefaultPrefix default
	DefaultPrefix = ""
	//DefaultCallerDepth 2
	DefaultCallerDepth = 2

	logger     *log.Logger
	levelFlags = []string{"DEBUG", "INFO", "WARN", "ERROR", "FATAL"}
)

//Level is int
// start 0
const (
	DEBUG Level = iota
	INFO
	WARNING
	ERROR
	FATAL
)

//Log log struct type
type Log struct {
	logger    *log.Logger
	filePath  string
	fileName  string
	logPrefix string
	f         *os.File
}

//Glog default Glog var
var Glog = &Log{
	logger:    log.New(os.Stdout, DefaultPrefix, log.LstdFlags),
	logPrefix: "",
}

//Mlog default log middeware
var Mlog = Middleware{
	Name: "log",
	HandlerFunc: func(c *Context) {
		Glog.Info("Request : ", c.Request.Method, " ", c.Request.RequestURI)
	},
}

//LogSetOutPut set up log output
func (l *Log) LogSetOutPut(logFile string) {
	f, err := os.OpenFile(logFile, os.O_RDWR|os.O_CREATE, 0755)
	if err != nil {
		Glog.Error("fail open logfile: ", logFile, "error: ", err)
		return
	}
	l.f = f
	l.logger.SetOutput(l.f)

}

//Close close the log file
func (l *Log) Close() {
	if l.f != nil {
		l.Close()
	}
}

//Debug Debug
func (l *Log) Debug(v ...interface{}) {
	l.setPrefix(DEBUG)
	l.logger.Println(v...)
}

//Info Info
func (l *Log) Info(v ...interface{}) {
	l.setPrefix(INFO)
	l.logger.Println(v...)
}

//Warn Warn
func (l *Log) Warn(v ...interface{}) {
	l.setPrefix(WARNING)
	l.logger.Println(v...)
}

//Error Error
func (l *Log) Error(v ...interface{}) {
	l.setPrefix(ERROR)
	l.logger.Println(v...)
}

//Fatal Fatal
func (l *Log) Fatal(v ...interface{}) {
	l.setPrefix(FATAL)
	l.logger.Fatalln(v...)
}

//Debug Debug
func Debug(v ...interface{}) {
	Glog.Debug(v...)
}

//Info Info
func Info(v ...interface{}) {
	Glog.Info(v...)
}

//Warn Warn
func Warn(v ...interface{}) {
	Glog.Warn(v...)
}

//Error Error
func Error(v ...interface{}) {
	Glog.Error(v...)
}

//Fatal Fatal
func Fatal(v ...interface{}) {
	Glog.Fatal(v...)
}

func (l *Log) setPrefix(level Level) {
	_, file, line, ok := runtime.Caller(DefaultCallerDepth)
	if ok {
		l.logPrefix = fmt.Sprintf("[%s][%s:%d]", levelFlags[level], filepath.Base(file), line)
	} else {
		l.logPrefix = fmt.Sprintf("[%s]", levelFlags[level])
	}

	l.logger.SetPrefix(l.logPrefix)
}

branch_name: refs/heads/master


text:
package main

import (
	"os"

	"github.com/funkygao/dbus/cmd/dbc/command"
	"github.com/funkygao/gocli"
)

var commands map[string]cli.CommandFactory

func init() {
	ui := &cli.ColoredUi{
		Ui: &cli.BasicUi{
			Writer:      os.Stdout,
			Reader:      os.Stdin,
			ErrorWriter: os.Stderr,
		},
		OutputColor: cli.UiColorNone,
		InfoColor:   cli.UiColorGreen,
		ErrorColor:  cli.UiColorRed,
		WarnColor:   cli.UiColorYellow,
	}
	cmd := os.Args[0]

	commands = map[string]cli.CommandFactory{
		"checkpoint": func() (cli.Command, error) {
			return &command.Checkpoint{
				Ui:  ui,
				Cmd: cmd,
			}, nil
		},

		"rebalance": func() (cli.Command, error) {
			return &command.Rebalance{
				Ui:  ui,
				Cmd: cmd,
			}, nil
		},

		"config": func() (cli.Command, error) {
			return &command.Config{
				Ui:  ui,
				Cmd: cmd,
			}, nil
		},

		"upgrade": func() (cli.Command, error) {
			return &command.Upgrade{
				Ui:  ui,
				Cmd: cmd,
			}, nil
		},

		"plugins": func() (cli.Command, error) {
			return &command.Plugins{
				Ui:  ui,
				Cmd: cmd,
			}, nil
		},

		"pause": func() (cli.Command, error) {
			return &command.Pause{
				Ui:  ui,
				Cmd: cmd,
			}, nil
		},

		"migrate": func() (cli.Command, error) {
			return &command.Migrate{
				Ui:  ui,
				Cmd: cmd,
			}, nil
		},

		"resources": func() (cli.Command, error) {
			return &command.Resources{
				Ui:  ui,
				Cmd: cmd,
			}, nil
		},

		"participants": func() (cli.Command, error) {
			return &command.Participants{
				Ui:  ui,
				Cmd: cmd,
			}, nil
		},
	}

}

repository: ffan/dbus

repo_name: ffan/dbus


text:
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

// Package selector provides functionality for users to select an application, environment, or service name.
package selector

import (
	"errors"
	"fmt"

	"github.com/aws/copilot-cli/internal/pkg/aws/ec2"
)

var (
	// ErrVPCNotFound is returned when no existing VPCs are found.
	ErrVPCNotFound = errors.New("no existing VPCs found")
	// ErrSubnetsNotFound is returned when no existing subnets are found.
	ErrSubnetsNotFound = errors.New("no existing subnets found")
)

// VPCSubnetLister list VPCs and subnets.
type VPCSubnetLister interface {
	ListVPCs() ([]ec2.VPC, error)
	ListVPCSubnets(vpcID string, opts ...ec2.ListVPCSubnetsOpts) ([]string, error)
}

// EC2Select is a selector for Ec2 resources.
type EC2Select struct {
	prompt Prompter
	ec2Svc VPCSubnetLister
}

// NewEC2Select returns a new selector that chooses Ec2 resources.
func NewEC2Select(prompt Prompter, ec2Client VPCSubnetLister) *EC2Select {
	return &EC2Select{
		prompt: prompt,
		ec2Svc: ec2Client,
	}
}

// VPC has the user select an available VPC.
func (s *EC2Select) VPC(prompt, help string) (string, error) {
	vpcs, err := s.ec2Svc.ListVPCs()
	if err != nil {
		return "", fmt.Errorf("list VPC ID: %w", err)
	}
	if len(vpcs) == 0 {
		return "", ErrVPCNotFound
	}
	var options []string
	for _, vpc := range vpcs {
		stringifiedVPC := vpc.String()
		options = append(options, stringifiedVPC)
	}
	vpc, err := s.prompt.SelectOne(
		prompt, help,
		options)
	if err != nil {
		return "", fmt.Errorf("select VPC: %w", err)
	}
	extractedVPC, err := ec2.ExtractVPC(vpc)
	if err != nil {
		return "", fmt.Errorf("extract VPC ID: %w", err)
	}
	return extractedVPC.ID, nil
}

// PublicSubnets has the user multiselect public subnets given the VPC ID.
func (s *EC2Select) PublicSubnets(prompt, help, vpcID string) ([]string, error) {
	return s.subnet(prompt, help, vpcID, ec2.FilterForPublicSubnets())
}

// PrivateSubnets has the user multiselect private subnets given the VPC ID.
func (s *EC2Select) PrivateSubnets(prompt, help, vpcID string) ([]string, error) {
	return s.subnet(prompt, help, vpcID, ec2.FilterForPrivateSubnets())
}

func (s *EC2Select) subnet(prompt, help string, vpcID string, filter ec2.ListVPCSubnetsOpts) ([]string, error) {
	subnets, err := s.ec2Svc.ListVPCSubnets(vpcID, filter)
	if err != nil {
		return nil, fmt.Errorf("list subnets for VPC %s: %w", vpcID, err)
	}
	if len(subnets) == 0 {
		return nil, ErrSubnetsNotFound
	}
	ans, err := s.prompt.MultiSelect(
		prompt, help,
		subnets)
	if err != nil {
		return nil, err
	}
	return ans, nil
}

repository: patnolanireland/copilot-cli

repo_name: patnolanireland/copilot-cli

branch_name: refs/heads/mainline

gha_license_id: NOASSERTION


text:
require recipes-core/images/core-image-base.bb
#include the wifi distro with linux firmware rpidistro bcm43430

IMAGE_INSTALL_append = " \
 i2c-tools \
 libgpiod-tools \
 spitools \
 linux-firmware-rpidistro-bcm43430 \
"
IMAGE_FEATURES_append = " ssh-server-dropbear "

extension: bb


text:
@misc{Geus10,
 author = {de Geus, T.W.J.\},
 year = {2010},
 title = {{goose-thesis: a customized LaTeX thesis class}},
 url = {https://github.com/tdegeus/goose-thesis}
}

@misc{Geus11,
 author = {de Geus, T.W.J.\},
 year = {2011},
 title = {{goose-thesis: a customized LaTeX thesis class}},
 url = {https://github.com/tdegeus/goose-thesis}
}

@misc{Geus12,
 author = {de Geus, T.W.J.\},
 year = {2012},
 title = {{goose-thesis: a customized LaTeX thesis class}},
 url = {https://github.com/tdegeus/goose-thesis}
}

@misc{Geus13,
 author = {de Geus, T.W.J.\},
 year = {2013},
 title = {{goose-thesis: a customized LaTeX thesis class}},
 url = {https://github.com/tdegeus/goose-thesis}
}

@misc{Geus14,
 author = {de Geus, T.W.J.\},
 year = {2014},
 title = {{goose-thesis: a customized LaTeX thesis class}},
 url = {https://github.com/tdegeus/goose-thesis}
}

@misc{Geus15,
 author = {de Geus, T.W.J.\},
 year = {2015},
 title = {{goose-thesis: a customized LaTeX thesis class}},
 url = {https://github.com/tdegeus/goose-thesis}
}

@misc{Geus16,
 author = {de Geus, T.W.J.\},
 year = {2016},
 title = {{goose-thesis: a customized LaTeX thesis class}},
 url = {https://github.com/tdegeus/goose-thesis}
}

@misc{Geus17,
 author = {de Geus, T.W.J.\},
 year = {2017},
 title = {{goose-thesis: a customized LaTeX thesis class}},
 url = {https://github.com/tdegeus/goose-thesis}
}

repository: tdegeus/goose-thesis

repo_name: tdegeus/goose-thesis

gha_language: TeX

extension: bib


text:
@conference {han2017,
	title = {FRAPpuccino: Fault-detection through Runtime Analysis of Provenance},
	booktitle = {Workshop on Hot Topics in Cloud Computing (HotCloud{\textquoteright}17)},
	year = {2017},
	publisher = {USENIX},
	organization = {USENIX},
	author = {Xueyuan Han and Pasquier, Thomas and Tanvi Ranjan and Goldstein, Mark and Margo Seltzer}
}

repository: tfjmp/website

repo_name: tfjmp/website

gha_language: Jupyter Notebook


text:
@article{2015ApJ...811...52A,
 abstract = {The IceCube neutrino observatory pursues a follow-up program selecting
interesting neutrino events in real-time and issuing alerts for
electromagnetic follow-up observations. In 2012 March, the most
significant neutrino alert during the first three years of
operation was issued by IceCube. In the follow-up observations
performed by the Palomar Transient Factory (PTF), a Type IIn
supernova (SN IIn) PTF12csy was found 0.°2 away from
the neutrino alert direction, with an error radius of
0.°54. It has a redshift of z = 0.0684,
corresponding to a luminosity distance of about 300 Mpc and the
Pan-STARRS1 survey shows that its explosion time was at least
158 days (in host galaxy rest frame) before the neutrino alert,
so that a causal connection is unlikely. The a posteriori
significance of the chance detection of both the neutrinos and
the SN at any epoch is 2.2\ensuremathσ within IceCube's
2011/12 data acquisition season. Also, a complementary neutrino
analysis reveals no long-term signal over the course of one
year. Therefore, we consider the SN detection coincidental and
the neutrinos uncorrelated to the SN. However, the SN is unusual
and interesting by itself: it is luminous and energetic, bearing
strong resemblance to the SN IIn 2010jl, and shows signs of
interaction of the SN ejecta with a dense circumstellar medium.
High-energy neutrino emission is expected in models of diffusive
shock acceleration, but at a low, non-detectable level for this
specific SN. In this paper, we describe the SN PTF12csy and
present both the neutrino and electromagnetic data, as well as
their analysis.},
 adsnote = {Provided by the SAO/NASA Astrophysics Data System},
 adsurl = {https://ui.adsabs.harvard.edu/abs/2015ApJ...811...52A},
 archiveprefix = {arXiv},
 author = {Aartsen, M.~G. and Abraham, K. and Ackermann, M. and Adams, J. and
Aguilar, J.~A. and Ahlers, M. and Ahrens, M. and Altmann, D. and
Anderson, T. and Archinger, M. and Arguelles, C. and
Arlen, T.~C. and Auffenberg, J. and Bai, X. and Barwick, S.~W. and
Baum, V. and Bay, R. and Beatty, J.~J. and Becker Tjus, J. and
Becker, K. -H. and Beiser, E. and BenZvi, S. and Berghaus, P. and
Berley, D. and Bernardini, E. and Bernhard, A. and
Besson, D.~Z. and Binder, G. and Bindig, D. and Bissok, M. and
Blaufuss, E. and Blumenthal, J. and Boersma, D.~J. and
Bohm, C. and Börner, M. and Bos, F. and Bose, D. and
Böser, S. and Botner, O. and Braun, J. and Brayeur, L. and
Bretz, H. -P. and Brown, A.~M. and Buzinsky, N. and Casey, J. and
Casier, M. and Cheung, E. and Chirkin, D. and Christov, A. and
Christy, B. and Clark, K. and Classen, L. and Coenders, S. and
Cowen, D.~F. and Cruz Silva, A.~H. and Daughhetee, J. and
Davis, J.~C. and Day, M. and de André, J.~P.~A.~M. and
De Clercq, C. and Dembinski, H. and De Ridder, S. and
Desiati, P. and de Vries, K.~D. and de Wasseige, G. and
de With, M. and DeYoung, T. and Dı́az-Vélez, J.~C. and
Dumm, J.~P. and Dunkman, M. and Eagan, R. and Eberhardt, B. and
Ehrhardt, T. and Eichmann, B. and Euler, S. and Evenson, P.~A. and
Fadiran, O. and Fahey, S. and Fazely, A.~R. and Fedynitch, A. and
Feintzeig, J. and Felde, J. and Filimonov, K. and Finley, C. and
Fischer-Wasels, T. and Flis, S. and Fuchs, T. and Glagla, M. and
Gaisser, T.~K. and Gaior, R. and Gallagher, J. and
Gerhardt, L. and Ghorbani, K. and Gier, D. and Gladstone, L. and
Glüsenkamp, T. and Goldschmidt, A. and Golup, G. and
Gonzalez, J.~G. and Góra, D. and Grant, D. and
Gretskov, P. and Groh, J.~C. and Gross, A. and Ha, C. and
Haack, C. and Haj Ismail, A. and Hallgren, A. and Halzen, F. and
Hansmann, B. and Hanson, K. and Hebecker, D. and Heereman, D. and
Helbing, K. and Hellauer, R. and Hellwig, D. and Hickford, S. and
Hignight, J. and Hill, G.~C. and Hoffman, K.~D. and
Hoffmann, R. and Holzapfe, K. and Homeier, A. and Hoshina, K. and
Huang, F. and Huber, M. and Huelsnitz, W. and Hulth, P.~O. and
Hultqvist, K. and In, S. and Ishihara, A. and Jacobi, E. and
Japaridze, G.~S. and Jero, K. and Jurkovic, M. and
Kaminsky, B. and Kappes, A. and Karg, T. and Karle, A. and
Kauer, M. and Keivani, A. and Kelley, J.~L. and Kemp, J. and
Kheirandish, A. and Kiryluk, J. and Kläs, J. and
Klein, S.~R. and Kohnen, G. and Koirala, R. and Kolanoski, H. and
Konietz, R. and Koob, A. and Köpke, L. and Kopper, C. and
Kopper, S. and Koskinen, D.~J. and Kowalski, M. and Krings, K. and
Kroll, G. and Kroll, M. and Kunnen, J. and Kurahashi, N. and
Kuwabara, T. and Labare, M. and Lanfranchi, J.~L. and
Larson, M.~J. and Lesiak-Bzdak, M. and Leuermann, M. and
Leuner, J. and Lünemann, J. and Madsen, J. and Maggi, G. and
Mahn, K.~B.~M. and Maruyama, R. and Mase, K. and Matis, H.~S. and
Maunu, R. and McNally, F. and Meagher, K. and Medici, M. and
Meli, A. and Menne, T. and Merino, G. and Meures, T. and
Miarecki, S. and Middell, E. and Middlemas, E. and Miller, J. and
Mohrmann, L. and Montaruli, T. and Morse, R. and Nahnhauer, R. and
Naumann, U. and Niederhausen, H. and Nowicki, S.~C. and
Nygren, D.~R. and Obertacke, A. and Olivas, A. and Omairat, A. and
O'Murchadha, A. and Palczewski, T. and Pandya, H. and Paul, L. and
Pepper, J.~A. and Pérez de los Heros, C. and Pfendner, C. and
Pieloth, D. and Pinat, E. and Posselt, J. and Price, P.~B. and
Przybylski, G.~T. and Pütz, J. and Quinnan, M. and
Rädel, L. and Rameez, M. and Rawlins, K. and Redl, P. and
Reimann, R. and Relich, M. and Resconi, E. and Rhode, W. and
Richman, M. and Richter, S. and Riedel, B. and Robertson, S. and
Rongen, M. and Rott, C. and Ruhe, T. and Ryckbosch, D. and
Saba, S.~M. and Sabbatini, L. and Sander, H. -G. and Sand
rock, A. and Sandroos, J. and Sarkar, S. and Schatto, K. and
Scheriau, F. and Schimp, M. and Schmidt, T. and Schmitz, M. and
Schoenen, S. and Schöneberg, S. and Schönwald, A. and
Schukraft, A. and Schulte, L. and Seckel, D. and Seunarine, S. and
Shanidze, R. and Smith, M.~W.~E. and Soldin, D. and
Spiczak, G.~M. and Spiering, C. and Stahlberg, M. and
Stamatikos, M. and Stanev, T. and Stanisha, N.~A. and
Stasik, A. and Stezelberger, T. and Stokstad, R.~G. and
Stössl, A. and Strahler, E.~A. and Ström, R. and
Strotjohann, N.~L. and Sullivan, G.~W. and Sutherland, M. and
Taavola, H. and Taboada, I. and Ter-Antonyan, S. and
Terliuk, A. and Teši\,́ G. and Tilav, S. and
Toale, P.~A. and Tobin, M.~N. and Tosi, D. and Tselengidou, M. and
Turcati, A. and Unger, E. and Usner, M. and Vallecorsa, S. and
van Eijndhoven, N. and Vandenbroucke, J. and van Santen, J. and
Vanheule, S. and Veenkamp, J. and Vehring, M. and Voge, M. and
Vraeghe, M. and Walck, C. and Wallraff, M. and Wandkowsky, N. and
Weaver, Ch. and Wendt, C. and Westerhoff, S. and Whelan, B.~J. and
Whitehorn, N. and Wichary, C. and Wiebe, K. and
Wiebusch, C.~H. and Wille, L. and Williams, D.~R. and
Wissing, H. and Wolf, M. and Wood, T.~R. and Woschnagg, K. and
Xu, D.~L. and Xu, X.~W. and Xu, Y. and Yanez, J.~P. and
Yodh, G. and Yoshida, S. and Zarzhitsky, P. and Zoll, M. and
IceCube Collaboration and Ofek, Eran O. and Kasliwal, Mansi M. and
Nugent, Peter E. and Arcavi, Iair and Bloom, Joshua S. and
Kulkarni, Shrinivas R. and Perley, Daniel A. and Barlow, Tom and
Horesh, Assaf and Gal-Yam, Avishay and Howell, D.~A. and
Dilday, Ben and PTF Collaboration and Evans, Phil A. and
Kennea, Jamie A. and Swift Collaboration and Burgett, W.~S. and
Chambers, K.~C. and Kaiser, N. and Waters, C. and
Flewelling, H. and Tonry, J.~L. and Rest, A. and Smartt, S.~J. and
Pan-STARRS1 Science Consortium},
 doi = {10.1088/0004-637X/811/1/52},
 eid = {52},
 eprint = {1506.03115},
 journal = {\apj},
 keywords = {circumstellar matter, galaxies: dwarf, neutrinos, shock waves, supernovae: individual: PTF12csy, SN 2010jl, Astrophysics - High Energy Astrophysical Phenomena, 85-05},
 month = {Sep},
 number = {1},
 pages = {52},
 primaryclass = {astro-ph.HE},
 title = {The Detection of a Type IIn Supernova in Optical Follow-up Observations of IceCube Neutrino Events},
 volume = {811},
 year = {2015}
}

repository: profjsb/my-content

repo_name: profjsb/my-content


text:
SUMMARY = "Invoke py.test as distutils command with dependency resolution"
HOMEPAGE = "https://pypi.python.org/pypi/pytest-runner/2.11.1"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e38b971c2b4c33b978d1b9c9ece9ae63"

SRC_URI[md5sum] = "bdb73eb18eca2727944a2dcf963c5a81"
SRC_URI[sha256sum] = "983a31eab45e375240e250161a556163bc8d250edaba97960909338c273a89b3"

inherit pypi setuptools3

DEPENDS += "python3-setuptools-scm-native"
BBCLASSEXTEND = "native nativesdk"

repository: maxinbjohn/meta-homeassistant-backup

repo_name: maxinbjohn/meta-homeassistant-backup


text:
@article{Cock2009,
abstract = {SUMMARY: The Biopython project is a mature open source international collaboration of volunteer developers, providing Python libraries for a wide range of bioinformatics problems. Biopython includes modules for reading and writing different sequence file formats and multiple sequence alignments, dealing with 3D macro molecular structures, interacting with common tools such as BLAST, ClustalW and EMBOSS, accessing key online databases, as well as providing numerical methods for statistical learning.$\backslash$n$\backslash$nAVAILABILITY: Biopython is freely available, with documentation and source code at (www.biopython.org) under the Biopython license.},
author = {Cock, Peter J A and Antao, Tiago and Chang, Jeffrey T. and Chapman, Brad A. and Cox, Cymon J. and Dalke, Andrew and Friedberg, Iddo and Hamelryck, Thomas and Kauff, Frank and Wilczynski, Bartek and {De Hoon}, Michiel J L},
doi = {10.1093/bioinformatics/btp163},
file = {:Users/davidmasp/Documents/Mendeley/Cock et al/2009/Cock et al.{\_}2009{\_}Bioinformatics.pdf:pdf},
isbn = {1367-4811 (Electronic)$\backslash$r1367-4803 (Linking)},
issn = {13674803},
journal = {Bioinformatics},
mendeley-groups = {SBI - pyEDA},
number = {11},
pages = {1422--1423},
pmid = {19304878},
title = {{Biopython: Freely available Python tools for computational molecular biology and bioinformatics}},
volume = {25},
year = {2009}
}
@article{Hunter2007,
abstract = {Matplotlib is a 2D graphics package used for Python for application development, interactive scripting, and publication-quality image generation across user interfaces and operating systems.},
author = {Hunter, John D.},
doi = {10.1109/MCSE.2007.55},
file = {:Users/davidmasp/Documents/Mendeley/Hunter/2007/Hunter{\_}2007{\_}Computing in Science and Engineering.pdf:pdf},
isbn = {1521-9615 VO  - 9},
issn = {15219615},
journal = {Computing in Science and Engineering},
mendeley-groups = {SBI - pyEDA},
number = {3},
pages = {99--104},
pmid = {1000044628},
title = {{Matplotlib: A 2D graphics environment}},
volume = {9},
year = {2007}
}
@article{Amadei1993,
abstract = {Analysis of extended molecular dynamics (MD) simulations of lysozyme in vacuo and in aqueous solution reveals that it is possible to separate the configurational space into two subspaces: (1) an "essential" subspace containing only a few degrees of freedom in which anharmonic motion occurs that comprises most of the positional fluctuations; and (2) the remaining space in which the motion has a narrow Gaussian distribution and which can be considered as "physically constrained." If overall translation and rotation are eliminated, the two spaces can be constructed by a simple linear transformation in Cartesian coordinate space, which remains valid over several hundred picoseconds. The transformation follows from the covariance matrix of the positional deviations. The essential degrees of freedom seem to describe motions which are relevant for the function of the protein, while the physically constrained subspace merely describes irrelevant local fluctuations. The near-constraint behavior of the latter subspace allows the separation of equations of motion and promises the possibility of investigating independently the essential space and performing dynamic simulations only in this reduced space.},
author = {Amadei, a and Limddrn, Abm},
file = {:Users/davidmasp/Documents/Mendeley/Amadei, Limddrn/1993/Amadei, Limddrn{\_}1993{\_}Proteins Structure, Function, and Genetics.pdf:pdf},
journal = {Proteins: Structure, Function, and Genetics},
keywords = {constraint dynam-,ics,lysozyme,molecular dynamics,normal modes},
mendeley-groups = {SBI - pyEDA},
number = {4},
pages = {412--425},
title = {{Essential dynamics of Proteins}},
volume = {17},
year = {1993}
}
@article{VanAalten1998,
abstract = {Application of the "essential dynamics" method to the NMR cluster of structures for the R2R3 DNA-binding domain of the mouse c-Myb transcriptional activator is described. Using this method, large concerted fluctuations of atoms are extracted showing a hinge-bending motion between the two (R2 and R3) Myb repeats on the basis of NMR data alone. Molecular dynamics simulation of the same protein allowed quantitative comparison of the large concerted motions calculated from experimental and theoretical data, showing a significant degree of similarity. Detailed inspection of the motions reveals a conserved proline that plays a key role in determining hinge flexibility. The proline-to-alanine mutation at this position, which has previously been characterized biochemically, was subjected to molecular dynamics and subsequent essential dynamics analysis. The hinge-bending motion between the two repeats was found to be enhanced for the mutant. The approach described should have general applications, predicting the effect of mutations on protein dynamic properties of other proteins.},
author = {van Aalten, D M and Grotewold, E and Joshua-Tor, L},
doi = {10.1006/meth.1998.0587},
file = {:Users/davidmasp/Documents/Mendeley/van Aalten, Grotewold, Joshua-Tor/1998/van Aalten, Grotewold, Joshua-Tor{\_}1998{\_}Methods (San Diego, Calif.).pdf:pdf},
isbn = {1046-2023 (Print)$\backslash$r1046-2023 (Linking)},
issn = {1046-2023},
journal = {Methods (San Diego, Calif.)},
keywords = {Binding Sites,DNA,DNA-Binding Proteins,DNA-Binding Proteins: chemistry,DNA-Binding Proteins: metabolism,DNA: metabolism,Magnetic Resonance Spectroscopy,Proto-Oncogene Proteins,Proto-Oncogene Proteins c-myb,Proto-Oncogene Proteins: chemistry,Proto-Oncogene Proteins: metabolism,Trans-Activators,Trans-Activators: chemistry,Trans-Activators: metabolism},
mendeley-groups = {SBI - pyEDA},
number = {3},
pages = {318--28},
pmid = {9571087},
title = {{Essential dynamics from NMR clusters: dynamic properties of the Myb DNA-binding domain and a hinge-bending enhancing variant.}},
volume = {14},
year = {1998}
}
@incollection{Hayward2008,
abstract = {Normal mode analysis and essential dynamics analysis are powerful methods used for the analysis of collective motions in biomolecules. Their application has led to an appreciation of the importance of protein dynamics in function and the relationship between structure and dynamical behavior. In this chapter, the methods and their implementation are introduced and recent developments such as elastic networks and advanced sampling techniques are described.},
author = {Hayward, Steven and {De Groot}, Bert L.},
booktitle = {Methods in Molecular Biology},
doi = {10.1007/978-1-59745-177-2-5},
file = {:Users/davidmasp/Documents/Mendeley/Hayward, De Groot/2008/Hayward, De Groot{\_}2008{\_}Methods in Molecular Biology.pdf:pdf},
isbn = {9781588298645},
issn = {10643745},
keywords = {Collective protein dynamics,Conformational flooding,Conformational sampling,Elastic network,Principal component analysis},
mendeley-groups = {SBI - pyEDA},
pages = {89--106},
pmid = {18446283},
title = {{Normal modes and essential dynamics}},
volume = {443},
year = {2008}
}
@article{Gargallo2003,
abstract = {Molecular dynamics (MD) simulations of the activation domain of porcine procarboxypeptidase B (ADBp) were performed to examine the effect of using the particle-particle particle-mesh (P3M) or the reaction field (RF) method for calculating electrostatic interactions in simulations of highly charged proteins. Several structural, thermodynamic, and dynamic observables were derived from the MD trajectories, including estimated entropies and solvation free energies and essential dynamics (ED). The P3M method leads to slightly higher atomic positional fluctuations and deviations from the crystallographic structure, along with somewhat lower values of the total energy and solvation free energy. However, the ED analysis of the system leads to nearly identical results for both simulations. Because of the strong similarity between the results, both methods appear well suited for the simulation of highly charged globular proteins in explicit solvent. However, the lower computational demand of the RF method in the present implementation represents a clear advantage over the P3M method.},
author = {Gargallo, Raimundo and H{\"{u}}nenberger, Philippe H and Avil{\'{e}}s, Francesc X and Oliva, Baldomero},
doi = {10.1110/ps.03137003.generally},
file = {:Users/davidmasp/Documents/Mendeley/Gargallo et al/2003/Gargallo et al.{\_}2003{\_}Protein science a publication of the Protein Society.pdf:pdf},
isbn = {3493224087},
issn = {0961-8368},
journal = {Protein science : a publication of the Protein Society},
keywords = {electrostatics,entropy,essential dy-,molecular dynamics,procarboxypeptidase b,solvation},
mendeley-groups = {SBI - pyEDA},
number = {10},
pages = {2161--2172},
pmid = {14500874},
title = {{Molecular dynamics simulation of highly charged proteins: comparison of the particle-particle particle-mesh and reaction field methods for the calculation of electrostatic interactions.}},
volume = {12},
year = {2003}
}
@article{VanderWalt2011,
abstract = {In the Python world, NumPy arrays are the standard representation for numerical data and enable efficient implementation of numerical computations in a high-level language. As this effort shows, NumPy performance can be improved through three techniques: vectorizing calculations, avoiding copying data in memory, and minimizing operation counts.},
author = {van der Walt, Stéfan and Colbert, S Chris and Varoquaux, Gaël},
doi = {10.1109/MCSE.2011.37},
issn = {1521-9615},
journal = {Computing in Science {\&} Engineering},
mendeley-groups = {SBI - pyEDA},
month = {mar},
number = {2},
pages = {22--30},
publisher = {AIP Publishing},
title = {{The NumPy Array: A Structure for Efficient Numerical Computation}},
volume = {13},
year = {2011}
}
@article{Tirion1996,
abstract = {Normal mode analysis (NMA) is a leading method for studying long-time dynamics and elasticity of biomolecules. The method proceeds from complex semiempirical potentials characterizing the covalent and noncovalent interactions between atoms. It is widely accepted that such detailed potentials are essential to the success of NMA's. We show that a single-parameter potential is sufficient to reproduce the slow dynamics in good detail. Costly and inaccurate energy minimizations are eliminated, permitting direct analysis of crystal coordinates. The technique can be used for new applications, such as mapping of one crystal form to another by means of slow modes, and studying anomalous dynamics of large proteins and complexes.},
author = {Tirion, Monique M.},
doi = {10.1103/PhysRevLett.77.1905},
file = {:Users/davidmasp/Documents/Mendeley/Tirion/1996/Tirion{\_}1996{\_}Unknown.pdf:pdf},
isbn = {1079-7114 (Electronic)$\backslash$r0031-9007 (Linking)},
issn = {0031-9007},
journal = {Physical Review Letters},
mendeley-groups = {SBI - pyEDA},
number = {9},
pages = {1905--1908},
pmid = {10063201},
title = {{Large Amplitude Elastic Motions in Proteins from a Single-Parameter, Atomic Analysis}},
volume = {77},
year = {1996}
}
@article{Ogata1994,
abstract = {The DNA-binding region of Myb consists of three imperfect tandem repeats (R1, R2, and R3). We have determined the solution structure of a specific DNA complex of the minimum DNA-binding domain (R2R3) by heteronuclear multidimensional NMR. Both R2 and R3 contain three helices, and the third helix in each is found to be a recognition helix. R2 and R3 are closely packed in the major groove, so that the two recognition helices contact each other directly to bind to the specific base sequence, AACNG cooperatively; this is a significant arrangement of recognition helices. The three key base pairs in this sequence are specifically recognized by Asn-183 (R3), Lys-182 (R3), and Lys-128 (R2). In contrast, R1 has no specific interactions with DNA from our NMR study of the DNA complex of the full DNA-binding domain (R1R2R3).},
author = {Ogata, Kazuhiro and Morikawa, Souichi and Nakamura, Haruki and Sekikawa, Ai and Inoue, Taiko and Kanai, Hiroko and Sarai, Akinori and Ishii, Shunsuke and Nishimura, Yoshifumi},
doi = {10.1016/0092-8674(94)90549-5},
issn = {00928674},
journal = {Cell},
keywords = {Amino Acid Sequence,Animals,Base Composition,Binding Sites,DNA,DNA-Binding Proteins,DNA-Binding Proteins: chemistry,DNA-Binding Proteins: metabolism,DNA: chemistry,DNA: metabolism,Drosophila,Drosophila: metabolism,Humans,Magnetic Resonance Spectroscopy,Models, Molecular,Molecular Sequence Data,Nucleic Acid Conformation,Oligodeoxyribonucleotides,Oligodeoxyribonucleotides: chemistry,Oligodeoxyribonucleotides: metabolism,Protein Conformation,Protein Structure, Secondary,Proto-Oncogene Proteins,Proto-Oncogene Proteins c-myb,Proto-Oncogene Proteins: chemistry,Proto-Oncogene Proteins: metabolism,Saccharomyces cerevisiae,Saccharomyces cerevisiae: metabolism,Sequence Homology, Amino Acid,Zea mays,Zea mays: metabolism,Zinc Fingers},
language = {English},
mendeley-groups = {SBI - pyEDA},
month = {nov},
number = {4},
pages = {639--648},
pmid = {7954830},
publisher = {Elsevier},
title = {{Solution structure of a specific DNA complex of the Myb DNA-binding domain with cooperative recognition helices}},
volume = {79},
year = {1994}
}
@unpublished{PyMOL,
	Author = {{Schr\"odinger, LLC}},
	Date-Added = {2010-08-19 17:58:20 -0400},
	Date-Modified = {2015-12-22 18:04:08 -0400},
	Month = {November},
	Title = {The {PyMOL} Molecular Graphics Plugin, Version~1.8},
	Year = {2015}}
}
@article{Tomomori1999,
abstract = {Escherichia coli osmosensor EnvZ is a protein histidine kinase that plays a central role in osmoregulation, a cellular adaptation process involving the His-Asp phosphorelay signal transduction system. Dimerization of the transmembrane protein is essential for its autophosphorylation and phosphorelay signal transduction functions. Here we present the NMR-derived structure of the homodimeric core domain (residues 223-289) of EnvZ that includes His 243, the site of autophosphorylation and phosphate transfer reactions. The structure comprises a four-helix bundle formed by two identical helix-turn-helix subunits, revealing the molecular assembly of two active sites within the dimeric kinase.},
author = {Tomomori, C and Tanaka, T and Dutta, R and Park, H and Saha, S K and Zhu, Y and Ishima, R and Liu, D and Tong, K I and Kurokawa, H and Qian, H and Inouye, M and Ikura, M},
doi = {10.1038/11495},
file = {:Users/davidmasp/Documents/Mendeley/Tomomori et al/1999/Tomomori et al.{\_}1999{\_}Nature structural biology.pdf:pdf},
isbn = {1072-8368 (Print)$\backslash$r1072-8368 (Linking)},
issn = {1072-8368},
journal = {Nature structural biology},
keywords = {Amino Acid,Amino Acid Sequence,Bacterial Outer Membrane Proteins,Bacterial Outer Membrane Proteins: chemistry,Bacterial Outer Membrane Proteins: genetics,Escherichia coli,Escherichia coli Proteins,Escherichia coli: enzymology,Magnetic Resonance Spectroscopy,Models,Molecular,Molecular Sequence Data,Multienzyme Complexes,Mutagenesis,Protein Conformation,Sequence Homology,Site-Directed,Solutions},
mendeley-groups = {SBI - pyEDA},
number = {8},
pages = {729--34},
pmid = {10426948},
title = {{Solution structure of the homodimeric core domain of Escherichia coli histidine kinase EnvZ.}},
volume = {6},
year = {1999}
}
@article{Model,
author={T. Meyer and M. D'Abramo and A. Hospital and M. Rueda and C. Ferrer-Costa and A. Pérez and O. Carrillo and J. Camps and C. Fenollosa and D. Repchevsky and J. Ll. Gelpí and M. Orozco.},
title={MoDEL (Molecular Dynamics Extended Library): A database of atomistic molecular dynamics trajectories},
year={2010},
journal={Structure},
volume={18},
pages={1399--1409}
}


text:
# UCLIBC_BASE should be the latest released revision of uclibc (that way
# the config files will typically be correct!)  uclibc-cvs takes precedence
# over uclibc-${UCLIBC_BASE}, if a config file in uclibc-cvs is out of date
# try removing it
#
# UCLIBC_BASE can be set in a distro file, but whether this works depends
# on whether the base patches apply to the selected (SRCDATE) svn release.
#
UCLIBC_BASE ?= "0.9.29"
PR = "r8"

require uclibc.inc

PROVIDES += "virtual/${TARGET_PREFIX}libc-for-gcc"

SRC_URI += "file://uClibc.machine file://uClibc.distro \
	    file://errno_values.h.patch;patch=1 \
	    file://termios.h.patch;patch=1 \
            file://uClibc-0.9.29-001-fix-mmap.patch;patch=1 \
	    file://uClibc-0.9.29-conditional-sched_affinity.patch;patch=1 \
	    file://uClibc-0.9.29-fix-gethostent_r-failure-retval.patch;patch=1 \
	    file://uClibc-0.9.29-fix-internal_function-definition.patch;patch=1 \
	    file://uClibc-0.9.29-rm-whitespace.patch;patch=1 \
	    "

# mmap-unsigned-shift_bugid1303.patch
# http://uclibc.org/lists/uclibc-cvs/2007-May/011360.html;patch=1"

#recent versions uclibc require real kernel headers
PACKAGE_ARCH = "${MACHINE_ARCH}"

#as stated above, uclibc needs real kernel-headers
#however: we can't depend on virtual/kernel when nptl hits due to depends deadlocking ....
KERNEL_SOURCE = "${CROSS_DIR}/${TARGET_SYS}"

SRC_URI += "http://www.uclibc.org/downloads/uClibc-${PV}.tar.bz2"

S = "${WORKDIR}/uClibc-${UCLIBC_BASE}"

LEAD_SONAME = "libc.so"

repository: jdegges/gumstix-pip-oe

repo_name: jdegges/gumstix-pip-oe


text:
require xorg-driver-video.inc

DESCRIPTION = "X.Org X server -- Glint display driver"

DEPENDS += " xf86dgaproto drm xf86driproto"


text:
@misc{brownlee,
    title = {How to fix the vanishing gradients using the ReLU},
    author = {Jason Brownlee},
    year = {2019},
    url={https://machinelearningmastery.com/how-to-fix-vanishing-gradients-using-the-rectified-linear-activation-function/}
}

@inproceedings{project1,
  title={Focused web crawler: NBA team specific news articles},
  author={Jason Lee},
  year={2020},
  url = {https://github.com/papagorgio23/NBA_News_Spiders/blob/master/Focus\%20Web\%20Crawler\%20Project.pdf}
}

@inproceedings{project1,
  title={Focused web crawler: NBA team specific news articles},
  author={Jason Lee},
  year={2020},
  url = {https://github.com/papagorgio23/NBA_News_Spiders/blob/master/Focus\%20Web\%20Crawler\%20Project.pdf}
}

@MISC{sample-code,
	HOWPUBLISHED = "\url{https://www.machinelearningplus.com/nlp/topic-modeling-visualization-how-to-present-results-lda-models/}",
	AUTHOR = "Thomas Miller",
	TITLE = "Assignment 1 sample code",
	MONTH = "October",
	YEAR = "2019",
	NOTE = "Accessed on 2019-10-15"
}

@MISC{aisports,
	HOWPUBLISHED = "\url{https://aisportsfirm.com/}",
	AUTHOR = {Lee, J.M., AND Shephard, I., AND Wolande, P.},
	TITLE = "{A.I. Sports}",
	MONTH = "January",
	YEAR = "2018"
}

@ARTICLE{gorman,
    author={R. P. {Gorman} and T. J. {Sejnowski}},
    journal={IEEE Transactions on Acoustics, Speech, and Signal Processing},
    title={Learned classification of sonar targets using a massively parallel network},
    year={1988},
    volume={36},
    number={7},
    pages={1135-1140},
}

@book{chollet,
    author = "Francois Chollet",
    year = 2018,
    title = "Deep learning with Python",
    publisher = "Manning Publications Co.",
    address = "Shelter Island, NY"
}

@book{goodfellow,
    author = {Goodfellow, I. AND Bengio, Y. AND Courville, A.},
    year = 2016,
    title = "Deep Learning",
    publisher = "MIT Press",
    address = "Cambridge, MA"
}

@book{mool,
    author = "Jojo Moolayil",
    year = 2019,
    title = "Learn Keras for deep neural networks",
    address = "Vancouver, BC, Canada",
    publisher = "Manning Publications Co.",
}

@book{Python,
    author = "Raschka, S., AND Mirjalili, V.",
    year = 2017,
    title = "Python machine learning: Machine learning and deep learning with Python, scikit-learn, and tensorflow. (2nd ed.)",
    address = "Birmingham, UK",
    publisher = "Packt Publishing Ltd.",
}

@book{handsOn,
    author = "Ankur A. Patel",
    year = 2019,
    title = "Hands-on unsupervised learning using Python: How to build applied machine learning solutions from unlabeled data",
    publisher = "O'Reilly Media, Inc.",
    address = "Sebastopol, CA"
}

@book{multivariate,
    author = "Alan Julian Izenman",
    year = 2008,
    title = "Modern multivariate statistical techniques: Regression, classification, and manifold learning",
    publisher = "Springer",
    address = "New York: NY"
}

@book{mining,
    author = "Sholom M. Weiss AND Nitin Indurkhya AND Tong Zhang",
    year = 2015,
    title = "Fundamentals of predictive text mining. 2nd edition",
    publisher = "Springer",
    address = "New York: NY"
}

@book{Cookbook,
    author = "Chris Albon",
    year = 2018,
    title = "Python machine learning cookbook: Practical solutions from preprocessing to deep learning",
    publisher = "O'Reilly Media, Inc.",
    address = "Sebastopol, CA"
}

@article{market,
author = {Bryan L. Boulier and H.O. Stekler and Sarah Amundson},
title = {Testing the efficiency of the National Football League betting market},
journal = {Applied Economics},
volume = {38},
number = {3},
pages = {279-284},
year  = {2006},
publisher = {Routledge},
doi = {10.1080/00036840500368904},
URL = {https://doi.org/10.1080/00036840500368904},
eprint = {https://doi.org/10.1080/00036840500368904}
}

@inproceedings{metooAlexa,
    title = "{\#}{M}e{T}oo {A}lexa: How Conversational Systems Respond to Sexual Harassment",
    author = "Cercas Curry, Amanda  and
      Rieser, Verena",
    booktitle = "Proceedings of the Second {ACL} Workshop on Ethics in Natural Language Processing",
    month = jun,
    year = "2018",
    address = "New Orleans, Louisiana, USA",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/W18-0802",
    doi = "10.18653/v1/W18-0802",
    pages = "7--14",
    abstract = "Conversational AI systems, such as Amazon{'}s Alexa, are rapidly developing from purely transactional systems to social chatbots, which can respond to a wide variety of user requests. In this article, we establish how current state-of-the-art conversational systems react to inappropriate requests, such as bullying and sexual harassment on the part of the user, by collecting and analysing the novel {\#}MeTooAlexa corpus. Our results show that commercial systems mainly avoid answering, while rule-based chatbots show a variety of behaviours and often deflect. Data-driven systems, on the other hand, are often non-coherent, but also run the risk of being interpreted as flirtatious and sometimes react with counter-aggression. This includes our own system, trained on {``}clean{''} data, which suggests that inappropriate system behaviour is not caused by data bias.",
}

@article{TEDpolicy,
  title={Dialogue Transformers},
  author={Vladimir Vlasov and Johannes E. M. Mosig and Alan Nichol},
  url={https://arxiv.org/abs/1910.00486},
  journal={ArXiv},
  year={2019},
  volume={abs/1910.00486}
}

@article{REDP,
  author    = {Vladimir Vlasov and
               Akela Drissner{-}Schmid and
               Alan Nichol},
  title     = {Few-Shot Generalization Across Dialogue Tasks},
  journal   = {CoRR},
  volume    = {abs/1811.11707},
  year      = {2018},
  url       = {http://arxiv.org/abs/1811.11707},
  archivePrefix = {arXiv},
  eprint    = {1811.11707},
  timestamp = {Fri, 30 Nov 2018 12:44:28 +0100},
  biburl    = {https://dblp.org/rec/journals/corr/abs-1811-11707.bib},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}

@article{lstm,
author = {Hochreiter, Sepp and Schmidhuber, J\"{u}rgen},
title = {Long Short-Term Memory},
year = {1997},
issue_date = {November 15, 1997},
publisher = {MIT Press},
address = {Cambridge, MA, USA},
volume = {9},
number = {8},
issn = {0899-7667},
url = {https://doi.org/10.1162/neco.1997.9.8.1735},
doi = {10.1162/neco.1997.9.8.1735},
journal = {Neural Comput.},
month = nov,
pages = {1735–1780},
numpages = {46}
}

@article{eliza,
author = {Joseph Weizenbaum},
title = {ELIZA--A computer program for the study of natural language communication between man and machine},
year = {1966},
issue_date = {November 15, 1997},
publisher = {MIT Press},
address = {Cambridge, MA, USA},
volume = {9},
number = {1},
url = {http://www.universelle-automation.de/1966_Boston.pdf},
journal = {Commungicatins of the ACM},
month = jan,
}

@misc{ConveRT,
    title={ConveRT: Efficient and Accurate Conversational Representations from Transformers},
    author={Matthew Henderson and Iñigo Casanueva and Nikola Mrkšić and Pei-Hao Su and Tsung-Hsien Wen and Ivan Vulić},
    year={2019},
    eprint={1911.03688},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}

url: https://raw.githubusercontent.com/papagorgio23/Northwestern/043a88b3b3714a91b510a255cda92268eefbbd4a/458 - Deep Learning/Research Assignments/Project 1/Computer Vision - LaTeX/bibliographie.bib


text:
@Article{alcorn2018-strike,
  author          = {Michael A. Alcorn and Qi Li and Zhitao Gong and Chengfei Wang and Long Mai and Wei{-}Shinn Ku and Anh Nguyen},
  title           = {Strike (with) a Pose: Neural Networks Are Easily Fooled By Strange Poses of Familiar Objects},
  journaltitle    = {CoRR},
  year            = 2018,
  volume          = {abs/1811.11553},
  eprint          = {1811.11553},
  url             = {http://arxiv.org/abs/1811.11553},
  journal         = {CoRR},
  archiveprefix   = {arXiv},
  bibsource       = {dblp computer science bibliography, https://dblp.org},
  biburl          = {https://dblp.org/rec/bib/journals/corr/abs-1811-11553},
  timestamp       = {20190111T1321}
}

@Article{alhaija2018-geometric,
  author          = {Alhaija, Hassan Abu and Mustikovela, Siva Karthik and Geiger, Andreas and Rother, Carsten},
  title           = {Geometric Image Synthesis},
  journaltitle    = {arXiv preprint arXiv:1809.04696},
  year            = 2018,
  journal         = {arXiv preprint arXiv:1809.04696},
  timestamp       = {20190130T1728}
}

@InProceedings{anonymous2019-rotation,
  author          = {Anonymous},
  title           = {A Rotation and a Translation Suffice: Fooling CNNs with Simple Transformations},
  year            = 2019,
  booktitle       = {Submitted to International Conference on Learning Representations},
  note            = {under review},
  url             = {https://openreview.net/forum?id=BJfvknCqFQ},
  timestamp       = {20190130T1726}
}

@Article{chandola2009-anomaly,
  author          = {Chandola, Varun and Banerjee, Arindam and Kumar, Vipin},
  title           = {Anomaly Detection: a Survey},
  journaltitle    = {ACM computing surveys (CSUR)},
  year            = 2009,
  volume          = 41,
  number          = 3,
  pages           = 15,
  journal         = {ACM computing surveys (CSUR)},
  publisher       = {ACM},
  timestamp       = {20190130T1710}
}

@InProceedings{chen2015-deepdriving,
  author          = {Chen, Chenyi and Seff, Ari and Kornhauser, Alain and Xiao, Jianxiong},
  title           = {Deepdriving: Learning affordance for direct perception in autonomous driving},
  year            = 2015,
  booktitle       = {Proceedings of the IEEE International Conference on Computer Vision},
  pages           = {2722--2730},
  timestamp       = {20190130T1620}
}

@Article{choi1992-inverse,
  author          = {Choi, Benjamin B and Lawrence, Charles},
  title           = {{Inverse Kinematics Problem in Robotics Using Neural Networks}},
  journaltitle    = {NASA Technical Memorandum},
  year            = 1992,
  volume          = 105869,
  pages           = {1--23},
  url             = {http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.113.1730&rep=rep1&type=pdf},
  journal         = {NASA Technical Memorandum},
  timestamp       = {20190130T1737}
}

@Misc{dombi2019-moderngl,
  author          = {Szabolcs Dombi},
  title           = {ModernGL - ModernGL 5.4.1 documentation},
  year            = 2019,
  howpublished    = {\url{https://moderngl.readthedocs.io/en/stable/index.html}},
  note            = {(Accessed on 11/14/2018)},
  timestamp       = {20190130T1637}
}

@Article{evtimov2017-robust,
  author          = {Evtimov, Ivan and Eykholt, Kevin and Fernandes, Earlence and Kohno, Tadayoshi and Li, Bo and Prakash, Atul and Rahmati,
                  Amir and Song, Dawn},
  title           = {Robust Physical-World Attacks on Machine Learning Models},
  journaltitle    = {arXiv preprint arXiv:1707.08945},
  year            = 2017,
  journal         = {arXiv preprint arXiv:1707.08945},
  timestamp       = {20190130T1722}
}

@InProceedings{gandhi2017-learning,
  author          = {Gandhi, Dhiraj and Pinto, Lerrel and Gupta, Abhinav},
  title           = {Learning to fly by crashing},
  year            = 2017,
  booktitle       = {Intelligent Robots and Systems (IROS), 2017 IEEE/RSJ International Conference on},
  organization    = {IEEE},
  pages           = {3948--3955},
  timestamp       = {20190130T1620}
}

@Article{gong2018-adversarial,
  author          = {{Gong}, Zhitao and {Wang}, Wenlu and {Li}, Bo and {Song}, Dawn and {Ku}, Wei-Shinn},
  title           = {Adversarial Texts With Gradient Methods},
  journaltitle    = {arXiv e-prints},
  year            = 2018,
  eid             = {arXiv:1801.07175},
  month           = Jan,
  pages           = {arXiv:1801.07175},
  eprint          = {1801.07175},
  journal         = {arXiv e-prints},
  adsnote         = {Provided by the SAO/NASA Astrophysics Data System},
  adsurl          = {https://ui.adsabs.harvard.edu/\#abs/2018arXiv180107175G},
  archiveprefix   = {arXiv},
  primaryclass    = {cs.CL},
  timestamp       = {20190111T1251},
  titletitle      = {Adversarial Texts with Gradient Methods}
}

@Misc{grabar2018-uber,
  author          = {Henry Grabar},
  title           = {The self-driving Uber that killed a pedestrian didn't brake. Here's why.},
  year            = 2018,
  howpublished    = {\url{https://slate.com/technology/2018/05/uber-car-in-fatal-arizona-crash-perceived-pedestrian-1-3-seconds-before-impact.html}},
  note            = {(Accessed on 07/13/2018)},
  month           = may,
  date-added      = {2018-07-13 18:36:15 +0000},
  timestamp       = {20190130T1624}
}

@InProceedings{hendrycks2017-baseline,
  author          = {Dan Hendrycks and Kevin Gimpel},
  title           = {A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networks},
  year            = 2017,
  booktitle       = {Proceedings of International Conference on Learning Representations},
  timestamp       = {20190130T1629}
}

@Article{karmon2018-lavan,
  author          = {Karmon, Danny and Zoran, Daniel and Goldberg, Yoav},
  title           = {Lavan: Localized and Visible Adversarial Noise},
  journaltitle    = {arXiv preprint arXiv:1801.02608},
  year            = 2018,
  journal         = {arXiv preprint arXiv:1801.02608},
  timestamp       = {20190130T1722}
}

@Thesis{karparthy2016-connecting,
  author          = {Andrew Karparthy},
  title           = {Connecting Images and Natural Language},
  type            = {{Ph.D.} dissertation},
  institution     = {Stanford University},
  year            = 2016,
  url             = {https://cs.stanford.edu/people/karpathy/main.pdf},
  timestamp       = {20190115T0915}
}

@Article{lambert2016-understanding,
  author          = {Lambert, F},
  title           = {Understanding the Fatal Tesla Accident on Autopilot and the Nhtsa Probe},
  journaltitle    = {Electrek, July},
  year            = 2016,
  journal         = {Electrek, July},
  timestamp       = {20190130T1623}
}

@Article{lu2017-standard,
  author          = {Jiajun Lu and Hussein Sibai and Evan Fabry and David A. Forsyth},
  title           = {Standard Detectors Aren't (currently) Fooled By Physical Adversarial Stop Signs},
  journaltitle    = {CoRR},
  year            = 2017,
  volume          = {abs/1710.03337},
  eprint          = {1710.03337},
  url             = {http://arxiv.org/abs/1710.03337},
  journal         = {CoRR},
  archiveprefix   = {arXiv},
  bibsource       = {dblp computer science bibliography, https://dblp.org},
  biburl          = {https://dblp.org/rec/bib/journals/corr/abs-1710-03337},
  timestamp       = {Mon, 13 Aug 2018 16:45:59 +0200}
}

@Book{marschner2015-fundamentals,
  author          = {Marschner, Steve and Shirley, Peter},
  title           = {Fundamentals of computer graphics},
  year            = 2015,
  publisher       = {CRC Press},
  timestamp       = {20190130T1635}
}

@InProceedings{osadchy2005-synergistic,
  author          = {Osadchy, Margarita and Miller, Matthew L and LeCun, Yann},
  title           = {{Synergistic Face Detection and Pose Estimation with Energy-Based Models}},
  year            = 2005,
  booktitle       = {Advances in Neural Information Processing Systems},
  isbn            = 9783540687948,
  pages           = {1017--1024},
  doi             = {10.1007/11957959},
  url             = {https://doi.org/10.1007/11957959},
  issn            = {1532-4435},
  keywords        = {convolutional networks, energy based models, face detection, object recognition, pose estimation},
  pmid            = 15535169,
  timestamp       = {20190130T1737}
}

@Online{press2018-tesla,
  author          = {Associated Press},
  title           = {Tesla that crashed into truck was on Autopilot},
  year            = 2018,
  url             = {https://nypost.com/2018/05/14/tesla-that-crashed-into-truck-was-on-autopilot},
  urldate         = {2018-01-11},
  timestamp       = {20190111T1233}
}

@Misc{pytorch2018-pytorch,
  author          = {PyTorch},
  title           = {PyTorch Master Documentation},
  year            = 2018,
  howpublished    = {\url{https://pytorch.org/docs/stable/torchvision/models.html}},
  note            = {(Accessed on 11/14/2018)},
  timestamp       = {20190130T1734}
}

@Article{sampedro2018-fully,
  author          = {Sampedro, Carlos and Rodriguez-Ramos, Alejandro and Bavle, Hriday and Carrio, Adrian and de la Puente, Paloma and
                  Campoy, Pascual},
  title           = {A Fully-Autonomous Aerial Robot for Search and Rescue Applications in Indoor Environments Using Learning-Based
                  Techniques},
  journaltitle    = {Journal of Intelligent \& Robotic Systems},
  year            = 2018,
  pages           = {1--27},
  journal         = {Journal of Intelligent \& Robotic Systems},
  publisher       = {Springer},
  timestamp       = {20190130T1621}
}

@Article{scheirer2013-toward,
  author          = {Scheirer, Walter J and de Rezende Rocha, Anderson and Sapkota, Archana and Boult, Terrance E},
  title           = {Toward Open Set Recognition},
  journaltitle    = {IEEE transactions on pattern analysis and machine intelligence},
  year            = 2013,
  volume          = 35,
  number          = 7,
  pages           = {1757--1772},
  journal         = {IEEE transactions on pattern analysis and machine intelligence},
  publisher       = {IEEE},
  timestamp       = {20190130T1631}
}

@Article{such2017-deep,
  author          = {Such, Felipe Petroski and Madhavan, Vashisht and Conti, Edoardo and Lehman, Joel and Stanley, Kenneth O and Clune,
                  Jeff},
  title           = {Deep Neuroevolution: Genetic Algorithms Are a Competitive Alternative for Training Deep Neural Networks for
                  Reinforcement Learning},
  journaltitle    = {arXiv preprint arXiv:1712.06567},
  year            = 2017,
  journal         = {arXiv preprint arXiv:1712.06567},
  timestamp       = {20190130T1738}
}

@Book{sugiyama2017-dataset,
  author          = {Sugiyama, Masashi and Lawrence, Neil D and Schwaighofer, Anton and others},
  title           = {Dataset shift in machine learning},
  year            = 2017,
  publisher       = {The MIT Press},
  timestamp       = {20190130T1621}
}

@InProceedings{tian2018-deeptest,
  author          = {Tian, Yuchi and Pei, Kexin and Jana, Suman and Ray, Baishakhi},
  title           = {Deeptest: Automated testing of deep-neural-network-driven autonomous cars},
  year            = 2018,
  booktitle       = {Proceedings of the 40th International Conference on Software Engineering},
  organization    = {ACM},
  pages           = {303--314},
  timestamp       = {20190130T1624}
}

@Misc{times2016-tesla,
  author          = {New York Times},
  title           = {Tesla car on autopilot crashes, killing driver, United States News \& Top Stories - The Straits Times},
  year            = 2016,
  howpublished    = {\url{https://www.straitstimes.com/world/united-states/tesla-car-on-autopilot-crashes-killing-driver}},
  note            = {(Accessed on 06/14/2018)},
  month           = jul,
  timestamp       = {20190130T1626}
}

@InProceedings{torralba2011-unbiased,
  author          = {Torralba, Antonio and Efros, Alexei A},
  title           = {Unbiased look at dataset bias},
  year            = 2011,
  booktitle       = {Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on},
  organization    = {IEEE},
  pages           = {1521--1528},
  timestamp       = {20190130T1727}
}

@Book{woo1999-opengl,
  author          = {Woo, Mason and Neider, Jackie and Davis, Tom and Shreiner, Dave},
  title           = {OpenGL programming guide: the official guide to learning OpenGL, version 1.2},
  year            = 1999,
  publisher       = {Addison-Wesley Longman Publishing Co., Inc.},
  timestamp       = {20190130T1635}
}

@InProceedings{xiang2016-objectnet3d,
  author          = {Xiang, Yu and Kim, Wonhui and Chen, Wei and Ji, Jingwei and Choy, Christopher and Su, Hao and Mottaghi, Roozbeh and
                  Guibas, Leonidas and Savarese, Silvio},
  title           = {Objectnet3d: A large scale database for 3d object recognition},
  year            = 2016,
  booktitle       = {European Conference on Computer Vision},
  organization    = {Springer},
  pages           = {160--176},
  timestamp       = {20190130T1733}
}

@Article{zhu2016-object,
  author          = {Zhu, Zhuotun and Xie, Lingxi and Yuille, Alan L},
  title           = {Object Recognition With and Without Objects},
  journaltitle    = {arXiv preprint arXiv:1611.06596},
  year            = 2016,
  journal         = {arXiv preprint arXiv:1611.06596},
  timestamp       = {20190130T1646}
}

@Book{goodfellow2016-deep,
  author          = {Goodfellow, Ian and Bengio, Yoshua and Courville, Aaron and Bengio, Yoshua},
  title           = {Deep learning},
  year            = 2016,
  volume          = 1,
  publisher       = {MIT press Cambridge},
  timestamp       = {20190206T1254}
}

@InCollection{more1978-levenberg,
  author          = {Mor{\'e}, Jorge J},
  title           = {The Levenberg-Marquardt algorithm: implementation and theory},
  year            = 1978,
  booktitle       = {Numerical analysis},
  publisher       = {Springer},
  pages           = {105--116},
  timestamp       = {20190206T1650}
}

@Article{xie2018-feature,
  author          = {Cihang Xie and Yuxin Wu and Laurens van der Maaten and Alan L. Yuille and Kaiming He},
  title           = {Feature Denoising for Improving Adversarial Robustness},
  journaltitle    = {CoRR},
  year            = 2018,
  volume          = {abs/1812.03411},
  eprint          = {1812.03411},
  url             = {http://arxiv.org/abs/1812.03411},
  journal         = {CoRR},
  archiveprefix   = {arXiv},
  bibsource       = {dblp computer science bibliography, https://dblp.org},
  biburl          = {https://dblp.org/rec/bib/journals/corr/abs-1812-03411},
  timestamp       = {20190312T1324}
}

@Article{prakash2018-protecting,
  author          = {Aaditya Prakash and Nick Moran and Solomon Garber and Antonella DiLillo and James A. Storer},
  title           = {Protecting {JPEG} Images Against Adversarial Attacks},
  journaltitle    = {CoRR},
  year            = 2018,
  volume          = {abs/1803.00940},
  eprint          = {1803.00940},
  url             = {http://arxiv.org/abs/1803.00940},
  journal         = {CoRR},
  archiveprefix   = {arXiv},
  bibsource       = {dblp computer science bibliography, https://dblp.org},
  biburl          = {https://dblp.org/rec/bib/journals/corr/abs-1803-00940},
  timestamp       = {20190312T1337}
}

repository: gongzhitaao/phd-thesis

repo_name: gongzhitaao/phd-thesis


text:
// Copyright (c) 2018 David Crawshaw <david@zentus.com>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

package sqlite_test

import (
	"bytes"
	"compress/gzip"
	"io"
	"io/ioutil"
	"reflect"
	"sync"
	"testing"
	"time"

	"crawshaw.io/sqlite"
)

func TestBlob(t *testing.T) {
	c, err := sqlite.OpenConn(":memory:", 0)
	if err != nil {
		t.Fatal(err)
	}
	defer func() {
		if err := c.Close(); err != nil {
			t.Error(err)
		}
	}()

	if _, err := c.Prep("DROP TABLE IF EXISTS blobs;").Step(); err != nil {
		t.Fatal(err)
	}
	if _, err := c.Prep("CREATE TABLE blobs (col BLOB);").Step(); err != nil {
		t.Fatal(err)
	}

	stmt := c.Prep("INSERT INTO blobs (col) VALUES ($col);")
	stmt.SetZeroBlob("$col", 5)
	if _, err := stmt.Step(); err != nil {
		t.Fatal(err)
	}
	if err := stmt.Finalize(); err != nil {
		t.Error(err)
	}
	rowid := c.LastInsertRowID()
	t.Logf("blobs rowid: %d", rowid)

	b, err := c.OpenBlob("", "blobs", "col", rowid, true)
	if err != nil {
		t.Fatal(err)
	}
	n, err := b.WriteAt([]byte{1, 2, 3}, 0)
	if err != nil {
		t.Fatal(err)
	}
	if n != 3 {
		t.Fatalf("b.WriteAt n=%d, want 3", n)
	}
	n, err = b.WriteAt([]byte{2, 3, 4, 5}, 1)
	if err != nil {
		t.Fatal(err)
	}
	if n != 4 {
		t.Fatalf("b.WriteAt n=%d, want 4", n)
	}
	if size := b.Size(); size != 5 {
		t.Fatalf("b.Size=%d, want 5", size)
	}
	n, err = b.WriteAt([]byte{2, 3, 4, 5, 6}, 1) // too long
	if err == nil {
		t.Fatalf("WriteAt too long, but no error")
	}
	if err := b.Close(); err != nil {
		t.Error(err)
	}

	b, err = c.OpenBlob("", "blobs", "col", rowid, false)
	if err != nil {
		t.Fatal(err)
	}
	defer b.Close()
	got := make([]byte, 5)
	n, err = b.ReadAt(got, 0)
	if n != len(got) {
		t.Fatalf("b.ReadAt=%d, want len(got)=%d", n, len(got))
	}
	want := []byte{1, 2, 3, 4, 5}
	if !reflect.DeepEqual(got, want) {
		t.Errorf("b.ReadAt got %v, want %v", got, want)
	}
	n, err = b.ReadAt(got[3:], 3)
	if n != len(got)-3 {
		t.Fatalf("b.ReadAt(got, 3)=%d, want len(got)-3=%d", n, len(got)-3)
	}
	if !reflect.DeepEqual(got, want) {
		t.Errorf("b.ReadAt(got, 3) %v, want %v", got, want)
	}
}

func TestConcurrentBlobSpins(t *testing.T) {
	flags := sqlite.SQLITE_OPEN_READWRITE | sqlite.SQLITE_OPEN_CREATE | sqlite.SQLITE_OPEN_URI | sqlite.SQLITE_OPEN_NOMUTEX | sqlite.SQLITE_OPEN_SHAREDCACHE
	c, err := sqlite.OpenConn("file::memory:?mode=memory", flags)
	if err != nil {
		t.Fatal(err)
	}
	c2, err := sqlite.OpenConn("file::memory:?mode=memory", flags)
	if err != nil {
		t.Fatal(err)
	}
	defer c.Close()
	defer c2.Close()

	if _, err := c.Prep("DROP TABLE IF EXISTS blobs;").Step(); err != nil {
		t.Fatal(err)
	}
	if _, err := c.Prep("CREATE TABLE blobs (col BLOB);").Step(); err != nil {
		t.Fatal(err)
	}

	stmt := c.Prep("INSERT INTO blobs (col) VALUES ($col);")
	stmt.SetZeroBlob("$col", 1024)
	if _, err := stmt.Step(); err != nil {
		t.Fatal(err)
	}
	blobRow1 := c.LastInsertRowID()
	if err := stmt.Reset(); err != nil {
		t.Fatal(err)
	}
	if _, err := stmt.Step(); err != nil {
		t.Fatal(err)
	}
	blobRow2 := c.LastInsertRowID()
	if err := stmt.Finalize(); err != nil {
		t.Error(err)
	}

	blob1, err := c.OpenBlob("", "blobs", "col", blobRow1, true)
	if err != nil {
		t.Errorf("OpenBlob: %v", err)
		return
	}
	go func() {
		time.Sleep(50 * time.Millisecond)
		blob1.Close()
	}()

	countBefore := sqlite.ConnCount(c2)
	blob2, err := c2.OpenBlob("", "blobs", "col", blobRow2, true)
	countAfter := sqlite.ConnCount(c2)
	if err != nil {
		t.Errorf("OpenBlob: %v", err)
		return
	}
	blob2.Close()

	if spins := countAfter - countBefore - 1; spins > 1 {
		t.Errorf("expecting no more than 1 spin, got %d", spins)
	}
}

// TestConcurrentBlobWrites looks for unexpected SQLITE_LOCKED errors
// when using the (default) shared cache.
func TestConcurrentBlobWrites(t *testing.T) {
	flags := sqlite.SQLITE_OPEN_READWRITE | sqlite.SQLITE_OPEN_CREATE | sqlite.SQLITE_OPEN_URI | sqlite.SQLITE_OPEN_NOMUTEX | sqlite.SQLITE_OPEN_SHAREDCACHE

	const numBlobs = 5
	c, err := sqlite.OpenConn("file::memory:?mode=memory", flags)
	if err != nil {
		t.Fatal(err)
	}
	defer c.Close()

	if _, err := c.Prep("DROP TABLE IF EXISTS blobs;").Step(); err != nil {
		t.Fatal(err)
	}
	if _, err := c.Prep("CREATE TABLE blobs (col BLOB);").Step(); err != nil {
		t.Fatal(err)
	}

	stmt := c.Prep("INSERT INTO blobs (col) VALUES ($col);")
	stmt.SetZeroBlob("$col", 1024)
	var blobRowIDs []int64
	for i := 0; i < numBlobs; i++ {
		if _, err := stmt.Step(); err != nil {
			t.Fatal(err)
		}
		blobRowIDs = append(blobRowIDs, c.LastInsertRowID())
		if err := stmt.Reset(); err != nil {
			t.Fatal(err)
		}
	}
	if err := stmt.Finalize(); err != nil {
		t.Error(err)
	}

	var wg sync.WaitGroup
	for i := 0; i < numBlobs; i++ {
		wg.Add(1)
		go func(i int) {
			defer wg.Done()
			b := make([]byte, 1024)
			b[0] = byte(i)

			c, err := sqlite.OpenConn("file::memory:?mode=memory", flags)
			if err != nil {
				t.Fatal(err)
			}
			defer c.Close()

			blob, err := c.OpenBlob("", "blobs", "col", blobRowIDs[i], true)
			if err != nil {
				t.Errorf("OpenBlob: %v (i=%d)", err, i)
				return
			}
			defer blob.Close()
			for j := 0; j < 10; j++ {
				b[1] = byte(j)

				n, err := blob.WriteAt(b, 0)
				if err != nil {
					t.Errorf("Blob.WriteAt: %v (i=%d, j=%d)", err, i, j)
					return
				}
				if n != len(b) {
					t.Fatalf("n=%d, want %d (i=%d, j=%d)", n, len(b), i, j)
				}
			}
		}(i)
	}
	wg.Wait()
}

func TestBlobClose(t *testing.T) {
	c, err := sqlite.OpenConn(":memory:", 0)
	if err != nil {
		t.Fatal(err)
	}
	defer func() {
		if err := c.Close(); err != nil {
			t.Error(err)
		}
	}()

	if _, err := c.Prep("DROP TABLE IF EXISTS blobs;").Step(); err != nil {
		t.Fatal(err)
	}
	if _, err := c.Prep("CREATE TABLE blobs (col BLOB);").Step(); err != nil {
		t.Fatal(err)
	}

	stmt := c.Prep("INSERT INTO blobs (col) VALUES ($col);")
	stmt.SetZeroBlob("$col", 5)
	if _, err := stmt.Step(); err != nil {
		t.Fatal(err)
	}
	rowid := c.LastInsertRowID()
	t.Logf("blobs rowid: %d", rowid)

	b, err := c.OpenBlob("", "blobs", "col", rowid, true)
	if err != nil {
		t.Fatal(err)
	}

	if err := b.Close(); err != nil {
		t.Fatal(err)
	}
	if err := b.Close(); err == nil {
		t.Error("no error on second close")
	}
	if _, err := b.WriteAt([]byte{1}, 0); err == nil {
		t.Error("want error on write-after-close")
	}
	if _, err = b.ReadAt(make([]byte, 1), 0); err == nil {
		t.Error("want error on read-after-close")
	}
}

func TestBlobReadWrite(t *testing.T) {
	c, err := sqlite.OpenConn(":memory:", 0)
	if err != nil {
		t.Fatal(err)
	}
	defer func() {
		if err := c.Close(); err != nil {
			t.Error(err)
		}
	}()

	if _, err := c.Prep("DROP TABLE IF EXISTS blobs;").Step(); err != nil {
		t.Fatal(err)
	}
	if _, err := c.Prep("CREATE TABLE blobs (col BLOB);").Step(); err != nil {
		t.Fatal(err)
	}

	stmt := c.Prep("INSERT INTO blobs (col) VALUES ($col);")
	stmt.SetZeroBlob("$col", 5)
	if _, err := stmt.Step(); err != nil {
		t.Fatal(err)
	}
	rowid := c.LastInsertRowID()
	t.Logf("blobs rowid: %d", rowid)

	b, err := c.OpenBlob("", "blobs", "col", rowid, true)
	if err != nil {
		t.Fatal(err)
	}
	defer b.Close()

	if _, err := b.Write([]byte{1, 2, 3}); err != nil {
		t.Fatal(err)
	}
	if _, err := b.Write([]byte{4, 5}); err != nil {
		t.Fatal(err)
	}
	if _, err := b.Write([]byte{6}); err != io.ErrShortWrite {
		t.Errorf("Write past end of blob, want io.ErrShortWrite got: %v", err)
	}
	if _, err := b.Seek(0, 0); err != nil {
		t.Fatal(err)
	}
	if got, err := ioutil.ReadAll(b); err != nil {
		t.Fatal(err)
	} else if want := []byte{1, 2, 3, 4, 5}; !reflect.DeepEqual(got, want) {
		t.Errorf("want %v, got %v", want, got)
	}
}

// See https://github.com/golang/go/issues/28606
func TestBlobPtrs(t *testing.T) {
	c, err := sqlite.OpenConn(":memory:", 0)
	if err != nil {
		t.Fatal(err)
	}
	defer func() {
		if err := c.Close(); err != nil {
			t.Error(err)
		}
	}()

	if _, err := c.Prep("DROP TABLE IF EXISTS blobs;").Step(); err != nil {
		t.Fatal(err)
	}
	if _, err := c.Prep("CREATE TABLE blobs (col BLOB);").Step(); err != nil {
		t.Fatal(err)
	}

	buf := new(bytes.Buffer)
	gzw := gzip.NewWriter(buf)
	gzw.Write([]byte("hello"))
	gzw.Close()
	n := buf.Len()

	stmt := c.Prep("INSERT INTO blobs (col) VALUES ($col);")
	stmt.SetZeroBlob("$col", int64(n))
	if _, err := stmt.Step(); err != nil {
		t.Fatal(err)
	}
	rowid := c.LastInsertRowID()
	t.Logf("blobs rowid: %d", rowid)

	blob, err := c.OpenBlob("", "blobs", "col", rowid, true)
	if err != nil {
		t.Fatal(err)
	}
	defer blob.Close()

	gzw = gzip.NewWriter(blob)
	gzw.Write([]byte("hello"))
	gzw.Close()

	blob.Seek(0, 0)

	gzr, err := gzip.NewReader(blob)
	if err != nil {
		t.Fatal(err)
	}
	b, err := ioutil.ReadAll(gzr)
	if err != nil {
		t.Fatal(err)
	}
	if got := string(b); got != "hello" {
		t.Errorf("read %q, want %q", got, "hello")
	}
	if err := gzr.Close(); err != nil {
		t.Fatal(err)
	}
}

license: ISC

repository: crawshaw/sqlite

repo_name: crawshaw/sqlite

gha_license_id: ISC

gha_language: C


text:
package nut

import (
	"bufio"
	"fmt"
	"net"
	"strings"
)

type UPSClient struct {
	HostIP string
	Name   string

	conn net.Conn
}

type Results map[string]string

func (c *UPSClient) All() (Results, error) {
	fmt.Println("connecting")
	conn, err := c.Connect()
	if err != nil {
		return nil, err
	}

	c.conn = conn

	fmt.Println("listvars")
	err = c.listVars()
	if err != nil {
		return nil, err
	}

	fmt.Println("list vars response")
	data, err := c.listVarsResponse()

	fmt.Println("parse")
	return c.parse(data)
}

func (c *UPSClient) Connect() (net.Conn, error) {
	return net.Dial("tcp", c.HostIP)
}

func (c *UPSClient) listVars() error {
	_, err := fmt.Fprintf(c.conn, "LIST VAR %s\n", c.Name)
	return err
}

func (c *UPSClient) parse(text string) (Results, error) {
	r := Results{}

	// VAR eaton key "value"

	lines := strings.Split(text, "\n")
	for _, s := range lines {
		bits := strings.SplitN(s, " ", 4)
		if len(bits) != 4 {
			continue
		}

		k := bits[2]
		v := bits[3]
		// Strip off the start and end quotes
		v = v[1 : len(v)-1]

		r[k] = v
	}

	return r, nil
}

func (c *UPSClient) listVarsResponse() (string, error) {
	scanner := bufio.NewScanner(c.conn)
	collected := ""
	for scanner.Scan() {
		s := scanner.Text()
		if strings.HasPrefix(s, "END LIST VAR") {
			return collected, nil
		}

		collected += s + "\n"
	}
	if err := scanner.Err(); err != nil {
		return "", err
	}

	return "", nil
}

repository: gak/nut-upsd-exporter

repo_name: gak/nut-upsd-exporter


text:
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package walk

import (
	"syscall"
	"unsafe"
)

import (
	"github.com/Skarm/win"
)

var webViewDWebBrowserEvents2Vtbl *win.DWebBrowserEvents2Vtbl

func init() {
	webViewDWebBrowserEvents2Vtbl = &win.DWebBrowserEvents2Vtbl{
		syscall.NewCallback(webView_DWebBrowserEvents2_QueryInterface),
		syscall.NewCallback(webView_DWebBrowserEvents2_AddRef),
		syscall.NewCallback(webView_DWebBrowserEvents2_Release),
		syscall.NewCallback(webView_DWebBrowserEvents2_GetTypeInfoCount),
		syscall.NewCallback(webView_DWebBrowserEvents2_GetTypeInfo),
		syscall.NewCallback(webView_DWebBrowserEvents2_GetIDsOfNames),
		syscall.NewCallback(webView_DWebBrowserEvents2_Invoke),
	}
}

type webViewDWebBrowserEvents2 struct {
	win.DWebBrowserEvents2
}

func webView_DWebBrowserEvents2_QueryInterface(wbe2 *webViewDWebBrowserEvents2, riid win.REFIID, ppvObject *unsafe.Pointer) uintptr {
	// Just reuse the QueryInterface implementation we have for IOleClientSite.
	// We need to adjust object, which initially points at our
	// webViewDWebBrowserEvents2, so it refers to the containing
	// webViewIOleClientSite for the call.
	var clientSite win.IOleClientSite
	var webViewInPlaceSite webViewIOleInPlaceSite
	var docHostUIHandler webViewIDocHostUIHandler

	ptr := uintptr(unsafe.Pointer(wbe2)) -
		uintptr(unsafe.Sizeof(clientSite)) -
		uintptr(unsafe.Sizeof(webViewInPlaceSite)) -
		uintptr(unsafe.Sizeof(docHostUIHandler))

	return webView_IOleClientSite_QueryInterface((*webViewIOleClientSite)(unsafe.Pointer(ptr)), riid, ppvObject)
}

func webView_DWebBrowserEvents2_AddRef(args *uintptr) uintptr {
	return 1
}

func webView_DWebBrowserEvents2_Release(args *uintptr) uintptr {
	return 1
}

func webView_DWebBrowserEvents2_GetTypeInfoCount(args *uintptr) uintptr {
	/*	p := (*struct {
			wbe2    *webViewDWebBrowserEvents2
			pctinfo *uint
		})(unsafe.Pointer(args))

		*p.pctinfo = 0

		return S_OK*/

	return win.E_NOTIMPL
}

func webView_DWebBrowserEvents2_GetTypeInfo(args *uintptr) uintptr {
	/*	p := (*struct {
				wbe2         *webViewDWebBrowserEvents2
			})(unsafe.Pointer(args))

		    unsigned int  iTInfo,
		    LCID  lcid,
		    ITypeInfo FAR* FAR*  ppTInfo*/

	return win.E_NOTIMPL
}

func webView_DWebBrowserEvents2_GetIDsOfNames(args *uintptr) uintptr {
	/*	p := (*struct {
		wbe2      *webViewDWebBrowserEvents2
		riid      REFIID
		rgszNames **uint16
		cNames    uint32
		lcid      LCID
		rgDispId  *DISPID
	})(unsafe.Pointer(args))*/

	return win.E_NOTIMPL
}

func webView_DWebBrowserEvents2_Invoke(
	wbe2 *webViewDWebBrowserEvents2,
	dispIdMember win.DISPID,
	riid win.REFIID,
	lcid uint32, // LCID
	wFlags uint16,
	pDispParams *win.DISPPARAMS,
	pVarResult *win.VARIANT,
	pExcepInfo unsafe.Pointer, // *EXCEPINFO
	puArgErr *uint32) uintptr {

	var wb WidgetBase
	var wvcs webViewIOleClientSite

	wv := (*WebView)(unsafe.Pointer(uintptr(unsafe.Pointer(wbe2)) +
		uintptr(unsafe.Sizeof(*wbe2)) -
		uintptr(unsafe.Sizeof(wvcs)) -
		uintptr(unsafe.Sizeof(wb))))

	switch dispIdMember {
	case win.DISPID_NAVIGATECOMPLETE2:
		wv.urlChangedPublisher.Publish()
	}

	return win.DISP_E_MEMBERNOTFOUND
}

repository: Skarm/walk

repo_name: Skarm/walk