text:
package main

import (
	"crypto/rand"
	"encoding/hex"
	"errors"
	"html/template"
	"net/http"
	"net/url"
	"strings"
	"time"

	"golang.org/x/crypto/bcrypt"
)

// Server is the HTTP server for the to-do list app.
type Server struct {
	model        Model
	logger       Logger
	location     *time.Location
	username     string
	passwordHash string
	showLists    bool

	mux      *http.ServeMux
	homeTmpl *template.Template
	listTmpl *template.Template
}

// Model is the database model interface used by the server.
type Model interface {
	GetLists() ([]*List, error)
	CreateList(name string) (string, error)
	DeleteList(id string) error
	GetList(id string) (*List, error)

	AddItem(listID, description string) (string, error)
	UpdateDone(listID, itemID string, done bool) error
	DeleteItem(listID, itemID string) error

	CreateSignIn() (string, error)
	IsSignInValid(id string) (bool, error)
	DeleteSignIn(id string) error
}

// Logger is the logger interface used by the server.
type Logger interface {
	Printf(format string, v ...interface{})
}

// NewServer creates a new server with the specified dependencies.
func NewServer(
	model Model,
	logger Logger,
	timezone string,
	username string,
	passwordHash string,
	showLists bool,
) (*Server, error) {
	location := time.Local // use server's local time if timezone not specified
	if timezone != "" {
		var err error
		location, err = time.LoadLocation(timezone)
		if err != nil {
			return nil, err
		}
	}
	s := &Server{
		model:        model,
		logger:       logger,
		location:     location,
		username:     username,
		passwordHash: passwordHash,
		showLists:    showLists,
		mux:          http.NewServeMux(),
	}
	s.addRoutes()
	s.addTemplates()
	return s, nil
}

func (s *Server) addRoutes() {
	s.mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		if r.URL.Path == "/" { // because "/" pattern matches /*
			s.home(w, r)
		} else {
			http.NotFound(w, r)
		}
	})
	s.mux.HandleFunc("/sign-in", csrf(s.signIn))
	s.mux.HandleFunc("/sign-out", s.signedIn(csrf(s.signOut)))
	s.mux.HandleFunc("/lists/", s.signedIn(s.showList))
	s.mux.HandleFunc("/create-list", s.signedIn(csrf(s.createList)))
	s.mux.HandleFunc("/delete-list", s.signedIn(csrf(s.deleteList)))
	s.mux.HandleFunc("/add-item", s.signedIn(csrf(s.addItem)))
	s.mux.HandleFunc("/update-done", s.signedIn(csrf(s.updateDone)))
	s.mux.HandleFunc("/delete-item", s.signedIn(csrf(s.deleteItem)))
}

func (s *Server) signedIn(h http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		if !s.isSignedIn(r) {
			location := "/?return-url=" + url.QueryEscape(r.URL.Path)
			http.Redirect(w, r, location, http.StatusFound)
			return
		}
		h(w, r)
	}
}

func (s *Server) isSignedIn(r *http.Request) bool {
	if s.username == "" {
		return true
	}
	valid, err := s.model.IsSignInValid(getSignInCookie(r))
	return err == nil && valid
}

func getSignInCookie(r *http.Request) string {
	cookie, err := r.Cookie("sign-in")
	if err != nil {
		return ""
	}
	return cookie.Value
}

func (s *Server) addTemplates() {
	s.homeTmpl = template.Must(template.New("home").Parse(homeTmpl))
	s.listTmpl = template.Must(template.New("list").Parse(listTmpl))
}

// ServeHTTP implements the http.Handler interface.
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	startTime := time.Now()
	w.Header().Set("Cache-Control", "no-cache")
	s.mux.ServeHTTP(w, r)
	s.logger.Printf("%s %s %v", r.Method, r.URL.Path, time.Since(startTime))
}

func (s *Server) home(w http.ResponseWriter, r *http.Request) {
	var lists []*List
	if s.showLists {
		var err error
		lists, err = s.model.GetLists()
		if err != nil {
			s.internalError(w, "fetching lists", err)
			return
		}
		for _, list := range lists {
			// Change UTC timezone to display timezone
			list.TimeCreated = list.TimeCreated.In(s.location)
		}
	}

	isSignedIn := s.isSignedIn(r)
	var data = struct {
		Token       string
		Lists       []*List
		ShowSignIn  bool
		ShowSignOut bool
		ReturnURL   string
		SignInError bool
	}{
		Token:       getCSRFToken(w, r),
		Lists:       lists,
		ShowSignIn:  !isSignedIn,
		ShowSignOut: s.username != "" && isSignedIn,
		ReturnURL:   r.URL.Query().Get("return-url"),
		SignInError: r.URL.Query().Get("error") == "sign-in",
	}
	err := s.homeTmpl.Execute(w, data)
	if err != nil {
		s.internalError(w, "rendering template", err)
		return
	}
}

func (s *Server) signIn(w http.ResponseWriter, r *http.Request) {
	username := strings.TrimSpace(r.FormValue("username"))
	password := r.FormValue("password")
	returnURL := r.FormValue("return-url")
	if returnURL == "" {
		returnURL = "/"
	}
	if username != s.username || bcrypt.CompareHashAndPassword([]byte(s.passwordHash), []byte(password)) != nil {
		location := "/?error=sign-in&return-url=" + url.QueryEscape(returnURL)
		http.Redirect(w, r, location, http.StatusFound)
		return
	}
	id, err := s.model.CreateSignIn()
	if err != nil {
		s.internalError(w, "creating sign in", err)
		return
	}
	cookie := &http.Cookie{
		Name:     "sign-in",
		Value:    id,
		MaxAge:   90 * 24 * 60 * 60,
		Path:     "/",
		Secure:   r.URL.Scheme == "https",
		HttpOnly: true,
		SameSite: http.SameSiteStrictMode,
	}
	http.SetCookie(w, cookie)
	http.Redirect(w, r, returnURL, http.StatusFound)
}

func (s *Server) signOut(w http.ResponseWriter, r *http.Request) {
	cookie := &http.Cookie{
		Name:     "sign-in",
		MaxAge:   -1,
		Path:     "/",
		Secure:   r.URL.Scheme == "https",
		HttpOnly: true,
		SameSite: http.SameSiteStrictMode,
	}
	http.SetCookie(w, cookie)

	err := s.model.DeleteSignIn(getSignInCookie(r))
	if err != nil {
		s.internalError(w, "deleting sign in", err)
		return
	}

	http.Redirect(w, r, "/", http.StatusFound)
}

func (s *Server) showList(w http.ResponseWriter, r *http.Request) {
	id := r.URL.Path[len("/lists/"):]
	list, err := s.model.GetList(id)
	if err != nil {
		s.internalError(w, "fetching list", err)
		return
	}
	if list == nil {
		http.NotFound(w, r)
		return
	}

	var data = struct {
		Token      string
		List       *List
		ShowDelete bool
	}{
		Token:      getCSRFToken(w, r),
		List:       list,
		ShowDelete: r.URL.Query().Get("delete") != "",
	}
	err = s.listTmpl.Execute(w, data)
	if err != nil {
		s.internalError(w, "rendering template", err)
		return
	}
}

func (s *Server) createList(w http.ResponseWriter, r *http.Request) {
	name := strings.TrimSpace(r.FormValue("name"))
	if name == "" {
		// Empty list name, just reload home page
		http.Redirect(w, r, "/", http.StatusFound)
		return
	}
	listID, err := s.model.CreateList(name)
	if err != nil {
		s.internalError(w, "creating list", err)
		return
	}
	http.Redirect(w, r, "/lists/"+listID, http.StatusFound)
}

func (s *Server) deleteList(w http.ResponseWriter, r *http.Request) {
	id := r.FormValue("list-id")
	err := s.model.DeleteList(id)
	if err != nil {
		s.internalError(w, "deleting list", err)
		return
	}
	http.Redirect(w, r, "/", http.StatusFound)
}

func (s *Server) addItem(w http.ResponseWriter, r *http.Request) {
	listID := r.FormValue("list-id")
	list, err := s.model.GetList(listID)
	if err != nil {
		s.internalError(w, "fetching list", err)
		return
	}
	if list == nil {
		http.NotFound(w, r)
		return
	}
	description := strings.TrimSpace(r.FormValue("description"))
	if description == "" {
		// Empty item description, just reload list
		http.Redirect(w, r, "/lists/"+list.ID, http.StatusFound)
		return
	}
	_, err = s.model.AddItem(list.ID, description)
	if err != nil {
		s.internalError(w, "adding item", err)
		return
	}
	http.Redirect(w, r, "/lists/"+list.ID, http.StatusFound)
}

func (s *Server) updateDone(w http.ResponseWriter, r *http.Request) {
	listID := r.FormValue("list-id")
	itemID := r.FormValue("item-id")
	done := r.FormValue("done") == "on"
	err := s.model.UpdateDone(listID, itemID, done)
	if err != nil {
		s.internalError(w, "updating done flag", err)
		return
	}
	http.Redirect(w, r, "/lists/"+listID, http.StatusFound)
}

func (s *Server) deleteItem(w http.ResponseWriter, r *http.Request) {
	listID := r.FormValue("list-id")
	itemID := r.FormValue("item-id")
	err := s.model.DeleteItem(listID, itemID)
	if err != nil {
		s.internalError(w, "deleting item", err)
		return
	}
	http.Redirect(w, r, "/lists/"+listID, http.StatusFound)
}

func (s *Server) internalError(w http.ResponseWriter, msg string, err error) {
	s.logger.Printf("error %s: %v", msg, err)
	http.Error(w, "error "+msg, http.StatusInternalServerError)
}

// GeneratePasswordHash generates a bcrypt hash from the given password.
func GeneratePasswordHash(password string) (string, error) {
	b, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
	return string(b), err
}

// CheckPasswordHash returns a non-nil error if the given password hash is not
// a valid bcrypt hash.
func CheckPasswordHash(passwordHash string) error {
	err := bcrypt.CompareHashAndPassword([]byte(passwordHash), []byte("x"))
	if errors.Is(err, bcrypt.ErrMismatchedHashAndPassword) {
		return nil
	}
	return err
}

// csrf wraps the given handler, ensuring that the HTTP method is POST and
// that the CSRF token in the "csrf-token" cookie matches the token in the
// "csrf-token" form field.
func csrf(h http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		if r.Method != "POST" {
			w.Header().Set("Allow", "POST")
			http.Error(w, "405 method not allowed", http.StatusMethodNotAllowed)
			return
		}
		token := r.FormValue("csrf-token")
		cookie, err := r.Cookie("csrf-token")
		if err != nil || token != cookie.Value {
			http.Error(w, "invalid CSRF token or cookie", http.StatusBadRequest)
			return
		}
		h(w, r)
	}
}

// getCSRFToken returns the current session's CSRF token, generating a new one
// and settings the "csrf-token" cookie if not present.
func getCSRFToken(w http.ResponseWriter, r *http.Request) string {
	cookie, err := r.Cookie("csrf-token")
	if err == nil && cookie.Value != "" {
		return cookie.Value
	}
	token := generateCSRFToken()
	cookie = &http.Cookie{
		Name:     "csrf-token",
		Value:    token,
		Path:     "/",
		Secure:   r.URL.Scheme == "https",
		HttpOnly: true,
		SameSite: http.SameSiteStrictMode,
	}
	http.SetCookie(w, cookie)
	return token
}

func generateCSRFToken() string {
	b := make([]byte, 16)
	_, err := rand.Read(b)
	if err != nil { // should never fail
		panic(err)
	}
	return hex.EncodeToString(b)
}

repository: rishidevkota/simplelists

repo_name: rishidevkota/simplelists


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

#ifndef TENCENTCLOUD_IOTTID_V20190411_MODEL_UPLOADDEVICEUNIQUECODERESPONSE_H_
#define TENCENTCLOUD_IOTTID_V20190411_MODEL_UPLOADDEVICEUNIQUECODERESPONSE_H_

#include <string>
#include <vector>
#include <map>
#include <tencentcloud/core/AbstractModel.h>

namespace TencentCloud
{
    namespace Iottid
    {
        namespace V20190411
        {
            namespace Model
            {
                /**
                * UploadDeviceUniqueCode返回参数结构体
                */
                class UploadDeviceUniqueCodeResponse : public AbstractModel
                {
                public:
                    UploadDeviceUniqueCodeResponse();
                    ~UploadDeviceUniqueCodeResponse() = default;
                    CoreInternalOutcome Deserialize(const std::string &payload);
                    std::string ToJsonString() const;

                    /**
                     * 获取本次已上传数量
                     * @return Count 本次已上传数量
                     *
                     */
                    uint64_t GetCount() const;

                    /**
                     * 判断参数 Count 是否已赋值
                     * @return Count 是否已赋值
                     *
                     */
                    bool CountHasBeenSet() const;

                    /**
                     * 获取重复的硬件唯一标识码
注意：此字段可能返回 null，表示取不到有效值。
                     * @return ExistedCodeSet 重复的硬件唯一标识码
注意：此字段可能返回 null，表示取不到有效值。
                     *
                     */
                    std::vector<std::string> GetExistedCodeSet() const;

                    /**
                     * 判断参数 ExistedCodeSet 是否已赋值
                     * @return ExistedCodeSet 是否已赋值
                     *
                     */
                    bool ExistedCodeSetHasBeenSet() const;

                    /**
                     * 获取剩余可上传数量
                     * @return LeftQuantity 剩余可上传数量
                     *
                     */
                    uint64_t GetLeftQuantity() const;

                    /**
                     * 判断参数 LeftQuantity 是否已赋值
                     * @return LeftQuantity 是否已赋值
                     *
                     */
                    bool LeftQuantityHasBeenSet() const;

                    /**
                     * 获取错误的硬件唯一标识码
注意：此字段可能返回 null，表示取不到有效值。
                     * @return IllegalCodeSet 错误的硬件唯一标识码
注意：此字段可能返回 null，表示取不到有效值。
                     *
                     */
                    std::vector<std::string> GetIllegalCodeSet() const;

                    /**
                     * 判断参数 IllegalCodeSet 是否已赋值
                     * @return IllegalCodeSet 是否已赋值
                     *
                     */
                    bool IllegalCodeSetHasBeenSet() const;

                private:

                    /**
                     * 本次已上传数量
                     */
                    uint64_t m_count;
                    bool m_countHasBeenSet;

                    /**
                     * 重复的硬件唯一标识码
注意：此字段可能返回 null，表示取不到有效值。
                     */
                    std::vector<std::string> m_existedCodeSet;
                    bool m_existedCodeSetHasBeenSet;

                    /**
                     * 剩余可上传数量
                     */
                    uint64_t m_leftQuantity;
                    bool m_leftQuantityHasBeenSet;

                    /**
                     * 错误的硬件唯一标识码
注意：此字段可能返回 null，表示取不到有效值。
                     */
                    std::vector<std::string> m_illegalCodeSet;
                    bool m_illegalCodeSetHasBeenSet;

                };
            }
        }
    }
}

#endif // !TENCENTCLOUD_IOTTID_V20190411_MODEL_UPLOADDEVICEUNIQUECODERESPONSE_H_

repository: TencentCloud/tencentcloud-sdk-cpp

license_type: permissive

repo_name: TencentCloud/tencentcloud-sdk-cpp

branch_name: refs/heads/master

extension: h


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

package gowarc

import (
	"bytes"
	"fmt"
	"io"
)

type revisitBlock struct {
	opts                *warcRecordOptions
	headerBytes         []byte
	blockDigest         *digest
	blockDigestString   string
	payloadDigestString string
}

func (block *revisitBlock) IsCached() bool {
	return true
}

func (block *revisitBlock) Cache() error {
	return nil
}

func (block *revisitBlock) Close() error {
	return nil
}

func (block *revisitBlock) RawBytes() (io.Reader, error) {
	return bytes.NewReader(block.headerBytes), nil
}

// ProtocolHeaderBytes implements ProtocolHeaderBlock
func (block *revisitBlock) ProtocolHeaderBytes() []byte {
	return block.headerBytes
}

func (block *revisitBlock) PayloadBytes() (io.Reader, error) {
	return &bytes.Buffer{}, nil
}

func (block *revisitBlock) BlockDigest() string {
	return block.blockDigestString
}

func (block *revisitBlock) PayloadDigest() string {
	return block.payloadDigestString
}

func (block *revisitBlock) Size() int64 {
	return int64(len(block.headerBytes))
}

func (block *revisitBlock) Write(w io.Writer) (int64, error) {
	p, err := block.RawBytes()
	if err != nil {
		return 0, err
	}
	bytesWritten, err := io.Copy(w, p)
	if err != nil {
		return bytesWritten, err
	}
	return bytesWritten, err
}

// newRevisitBlock creates a revisitBlock from a PayloadBlock
func newRevisitBlock(opts *warcRecordOptions, src Block) (*revisitBlock, error) {
	block := &revisitBlock{
		opts: opts,
	}

	switch v := src.(type) {
	case HttpRequestBlock:
		block.headerBytes = v.ProtocolHeaderBytes()
		block.payloadDigestString = v.PayloadDigest()
	case HttpResponseBlock:
		block.headerBytes = v.ProtocolHeaderBytes()
		block.payloadDigestString = v.PayloadDigest()
	case *genericBlock:
	default:
		return nil, fmt.Errorf("making revisit of %T not supported", v)
	}

	blockDigest, _ := newDigest(block.opts.defaultDigestAlgorithm, block.opts.defaultDigestEncoding)
	if _, err := blockDigest.Write(block.headerBytes); err != nil {
		return nil, err
	}
	block.blockDigestString = blockDigest.format()
	block.blockDigest = blockDigest

	return block, nil
}

// parseRevisitBlock creates a new revisitBlock from a reader
func parseRevisitBlock(opts *warcRecordOptions, r io.Reader, blockDigest *digest, payloadDigest string) (*revisitBlock, error) {
	block := &revisitBlock{
		opts:                opts,
		payloadDigestString: payloadDigest,
	}

	content := &bytes.Buffer{}
	rr := io.TeeReader(r, blockDigest)
	if _, err := io.Copy(content, rr); err != nil {
		return nil, err
	}
	block.headerBytes = content.Bytes()

	block.blockDigestString = blockDigest.format()
	block.blockDigest = blockDigest

	return block, nil
}

repository: nlnwa/gowarc

repo_name: nlnwa/gowarc

gha_language: Go

extension: go


text:
package main

import (
	"flag"
	"fmt"
	"github.com/amimof/huego"
	"github.com/prometheus/client_golang/prometheus"
	"github.com/prometheus/client_golang/prometheus/promhttp"
	"log"
	"net/http"
	"os"
)

var (
	bridgeUrl   string
	username    string
	listenAddr  string
	metricsPath string
	upDesc      prometheus.Desc
	statusDesc  prometheus.Desc
	satDesc     prometheus.Desc
	brightDesc  prometheus.Desc
	hueDesc     prometheus.Desc
	reachDesc   prometheus.Desc
)

type Exporter struct {
	bridge huego.Bridge
}

func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
	ch <- &upDesc
	ch <- &statusDesc
	ch <- &satDesc
	ch <- &brightDesc
	ch <- &hueDesc
	ch <- &reachDesc
}

func statusMetric(light *huego.Light) prometheus.Metric {
	lightID := fmt.Sprint(light.ID)
	lightOn := float64(0)
	if light.State.On {
		lightOn = 1
	}

	return prometheus.MustNewConstMetric(
		&statusDesc,
		prometheus.GaugeValue,
		lightOn,
		light.Name, lightID, light.UniqueID,
	)

}

func brightMetric(light *huego.Light) prometheus.Metric {
	lightID := fmt.Sprint(light.ID)

	return prometheus.MustNewConstMetric(
		&brightDesc,
		prometheus.GaugeValue,
		float64(light.State.Bri),
		light.Name, lightID, light.UniqueID,
	)

}

func hueMetric(light *huego.Light) prometheus.Metric {
	lightID := fmt.Sprint(light.ID)

	return prometheus.MustNewConstMetric(
		&hueDesc,
		prometheus.GaugeValue,
		float64(light.State.Hue),
		light.Name, lightID, light.UniqueID,
	)

}

func satMetric(light *huego.Light) prometheus.Metric {
	lightID := fmt.Sprint(light.ID)

	return prometheus.MustNewConstMetric(
		&satDesc,
		prometheus.GaugeValue,
		float64(light.State.Sat),
		light.Name, lightID, light.UniqueID,
	)

}

func reachMetric(light *huego.Light) prometheus.Metric {
	lightID := fmt.Sprint(light.ID)
	lightReachable := float64(0)
	if light.State.Reachable {
		lightReachable = 1
	}

	return prometheus.MustNewConstMetric(
		&reachDesc,
		prometheus.GaugeValue,
		lightReachable,
		light.Name, lightID, light.UniqueID,
	)

}

func upMetric(up float64) prometheus.Metric {

	return prometheus.MustNewConstMetric(
		&upDesc,
		prometheus.GaugeValue,
		up,
	)
}

func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
	lights, err := e.bridge.GetLights()
	if err != nil {
		log.Printf("Error getting lights: %s", err)
		ch <- upMetric(0)
		return
	}
	log.Printf("Found %d lights", len(lights))
	ch <- upMetric(1)

	for _, light := range lights {
		ch <- statusMetric(&light)
		ch <- satMetric(&light)
		ch <- brightMetric(&light)
		ch <- reachMetric(&light)
		ch <- hueMetric(&light)
	}
}

func NewExporter(bridge *huego.Bridge) (*Exporter, error) {
	// attempt to GetLights() once in case there's an error
	_, err := bridge.GetLights()
	return &Exporter{
		bridge: *bridge,
	}, err
}

func indexHandler(metricsPath string) http.HandlerFunc {
	html := `

		<title>Hue Exporter</title>

Hue Exporter

			metrics

`

	index := []byte(fmt.Sprintf(html, metricsPath))

	return func(w http.ResponseWriter, r *http.Request) {
		w.Write(index)
	}
}

func init() {
	flag.StringVar(&bridgeUrl, "bridge-url", "http://philips-hue", "url of the Hue bridge device")
	flag.StringVar(&username, "username", "", "set authorised API username")
	flag.StringVar(&listenAddr, "listen-address", ":9100", "set HTTP listen address")
	flag.StringVar(&metricsPath, "metrics-path", "/metrics", "set metrics path")

	// Desc
	upDesc = *prometheus.NewDesc("up", "Was the last query successful?", []string{}, prometheus.Labels{})
	statusDesc = *prometheus.NewDesc("light_status", "Status of light (on/off)",
		[]string{"name", "id", "unique_id"},
		prometheus.Labels{})
	brightDesc = *prometheus.NewDesc("light_brightness", "Brightness of light",
		[]string{"name", "id", "unique_id"},
		prometheus.Labels{})
	hueDesc = *prometheus.NewDesc("light_hue", "Hue of light",
		[]string{"name", "id", "unique_id"},
		prometheus.Labels{})
	satDesc = *prometheus.NewDesc("light_saturation", "Saturation of light",
		[]string{"name", "id", "unique_id"},
		prometheus.Labels{})
	reachDesc = *prometheus.NewDesc("light_reachable", "Reachability of light",
		[]string{"name", "id", "unique_id"},
		prometheus.Labels{})
}

// Register with curl command:
// $ curl -X POST -d '{"devicetype":"my app name#my_username"}' http://philips-hue/api
// [{"error":{"type":101,"address":"","description":"link button not pressed"}}]
// Then press hue bridge link button and run curl again:
// $ curl -X POST -d '{"devicetype":"my app name#my_username"}' http://philips-hue/api
// [{"success":{"username":"VBYPKZXBqwcLCSdzj5yLW1gjK2fb9XCOSxQ1dP7B"}}]
// Username is: VBYPKZXBqwcLCSdzj5yLW1gjK2fb9XCOSxQ1dP7B

func main() {
	flag.Parse()

	if username == "" {
		fmt.Println("Please set a username")
		os.Exit(0)
	}

	bridge := huego.New(bridgeUrl, username)
	exporter, err := NewExporter(bridge)
	if err != nil {
		log.Fatal(err)
	}

	prometheus.MustRegister(exporter)

	http.HandleFunc("/", indexHandler(metricsPath))
	http.Handle(metricsPath, promhttp.Handler())
	log.Fatal(http.ListenAndServe(listenAddr, nil))
}

repository: ramaro/hue-lights-exporter

repo_name: ramaro/hue-lights-exporter


text:
package lzma

type treedecoder struct {
	probs []prob
}

func newTree(numBits int) *treedecoder {
	tree := new(treedecoder)
	tree.probs = make([]prob, numBits)
	return tree
}

func (t *treedecoder) decode(rd *rangedecoder) (uint, error) {
	m := uint(1)
	for _, prob := range t.probs {
		bit, err := rd.decodeBit(&prob)
		if err != nil {
			return 0, err
		}
		m = (m << 1) + bit
	}
	return m - uint(1 << uint(len(t.probs))), nil
}

func (t *treedecoder) reverseDecode(rd *rangedecoder) (uint, error) {
	return reverseDecode(t.probs, rd)
}

func reverseDecode(probs []prob, rd *rangedecoder) (uint, error) {
	m := uint(1)
	symbol := uint(0)
	for pos, prob := range probs {
		bit, err := rd.decodeBit(&prob)
		if err != nil {
			return 0, err
		}
		m <<= 1
		m += bit
		symbol |= bit << uint(pos)
	}
	return symbol, nil
}

license: MIT

repository: AlbanSeurat/gonfler

repo_name: AlbanSeurat/gonfler


text:
@inproceedings{NguyenCanh2019,
 abstract = {Detection followed by projection in conventional privacy cameras is vulnerable to software attacks that threaten to expose image sensor data. By multiplexing the incoming light with a coded mask, a FlatCam camera removes the spatial correlation and captures visually protected images. However, FlatCam imaging suffers from poor reconstruction quality and pays no attention to the privacy of visual information. In this paper, we propose a deep learning-based compressive sensing approach to reconstruct and protect sensitive regions from secured FlatCam measurements. We predict sensitive regions via facial segmentation and separate them from the captured measurements. Our deep compressive sensing network was trained with simulated data, and was tested on both simulated and real FlatCam data.},
 author = {Nguyen Canh, Thuong and Nagahara, Hajime},
 booktitle = {Proceedings - 2019 International Conference on Computer Vision Workshop, ICCVW 2019},
 doi = {10.1109/ICCVW.2019.00492},
 isbn = {9781728150239},
 keywords = {Compressive sensing,Deep compressive sensing,Deep learning,Visual privacy protection},
 month = {oct},
 pages = {3978--3986},
 publisher = {Institute of Electrical and Electronics Engineers Inc.},
 title = {Deep compressive sensing for visual privacy protection in flatcam imaging},
 year = {2019}
}

repository: conscienceli/islab-website

repo_name: conscienceli/islab-website

gha_license_id: MIT

extension: bib


text:
package main

func getParadisePackages(_ string) []Package {
	return readPackages()
}

func getParadisePackage(_ string, id int) *Package {
	p := readPackageById(id);
	if (p.Id == nil) {
		return nil;
	}
	return &p;
}

func getParadisePackageByUrl(_ string, url string) *Package {
	packages := readPackages()
	for i := 0; i < len(packages); i++ {
		if (packages[i].Url == url) {
			return &packages[i]
		}
	}
	return nil
}

repository: outermeasure/Paradise

repo_name: outermeasure/Paradise

branch_name: refs/heads/develop

gha_language: JavaScript


text:
COMPATIBLE_MACHINE = "poodle255"
COMPATIBLE_HOST = "arm.*-linux"
require openzaurus-pxa_2.4.18-rmk7-pxa3-embedix20031107.inc

extension: bb


text:
require xorg-lib-common.inc

DESCRIPTION = "A Sample Authorization Protocol for X"
PRIORITY = "optional"

DEPENDS += " xproto"
PROVIDES = "xau"

XORG_PN = "libXau"


text:
PV = "0.0cvs${CVSDATE}"
SECTION = "libs"
PRIORITY = "optional"
MAINTAINER = "Phil Blundell <pb@debian.org>"
DEPENDS = "x11"
DESCRIPTION = "Cairo support library"
LICENSE = "X11"
SRC_URI = "cvs://anoncvs:anoncvs@cvs.cairographics.org/cvs/cairo;module=libpixman"
S = "${WORKDIR}/libpixman"

DEFAULT_PREFERENCE = "-1"

inherit autotools pkgconfig

do_stage () {
	oe_runmake install DESTDIR="" bindir=${STAGING_BINDIR} includedir=${STAGING_INCDIR} libdir=${STAGING_LIBDIR} prefix=${STAGING_DIR}
}

repository: Terentyev/familiar-linux

repo_name: Terentyev/familiar-linux


text:
// Distributed under the MIT License (See
// accompanying file "LICENSE" or the website
// http://www.opensource.org/licenses/mit-license.php)

#pragma once

#include <memory>

namespace Assets
{
    class AssetSetManager;
    class IIntermediateCompilers;
    class IntermediatesStore;

    class Services
    {
    public:
        static AssetSetManager& GetAssetSets();
        static IIntermediateCompilers& GetIntermediateCompilers();
        static IntermediatesStore& GetIntermediatesStore();

        static std::shared_ptr<AssetSetManager> GetAssetSetsPtr();
        static std::shared_ptr<IIntermediateCompilers> GetIntermediateCompilersPtr();
        static std::shared_ptr<IntermediatesStore> GetIntermediatesStorePtr();
    };
}

repository: djewsbury/XLE

repo_name: djewsbury/XLE


text:
package main

import "fmt"

func main() {
    fmt.Println(test())

    y := 1
        <error>y, _</error> := 10, 1
    fmt.Println(y)
}

func f1() int {return 1}
func f2() (int, int) {return 1, 2}

func test() int {
    x := f1()
    y, z := f2()

    <error>x</error> := f1()
    <error>y,   z</error>     := f2()

    fmt.Println(test21313())
    fmt.Println(Test2())

    x, a := f2() // Ok: `x` is reused and `a` is new
    b, x := f2() // Ok: `b` is new and `x` is reused

    return x + y + z + a + b // Just to avoid unused variable error
}

func test21313() (err int) {
    {
        err := 1
        return err
    }
    return 1
}

func bar() error {
    return nil
}

func Test2() (err error) {
    <error>err</error> := bar()
    if err := bar(); err != nil {
        return err
    } else {
        err := bar()
        return err
    }

    switch err := bar(); {  // missing switch expression means "true"
        case err != nil: return -err
        default: return err
    }

    var c chan int
    // todo: fix inspection
    //noinspection GoVarDeclaration
    select {
    case err, ok := (<-c):
        println(err)
        println(ok)
    }

    return err
}

func _(i int) {
    for i := 1; i < 3; i++ {
        _ = i
    }

    if i := 1; i > 0 {
        _ = i
    }

    switch i := 1; {
        case true: _ = i
    }
}

repository: zcwfeng/go-lang-idea-plugin

repo_name: zcwfeng/go-lang-idea-plugin


text:
@article{Wojcik-2019-Land,
    title = "Land cover and landform-based upscaling of soil organic carbon stocks on the Br{\o}gger Peninsula, Svalbard",
    author = "Wojcik, Robin  and
      Palmtag, Juri  and
      Hugelius, Gustaf  and
      Weiss, Niels  and
      Kuhry, Peter",
    journal = "Arctic, Antarctic, and Alpine Research, Volume 51, Issue 1",
    volume = "51",
    number = "1",
    year = "2019",
    publisher = "Informa UK Limited",
    url = "https://aclanthology.org/G19-184001",
    doi = "10.1080/15230430.2019.1570784",
    pages = "40--57",
    abstract = "In this study we assess the total storage, landscape distribution, and vertical partitioning of soil organic carbon (SOC) stocks on the Brogger Peninsula, Svalbard. This type of high Arctic...",
}

repository: gwf-uwaterloo/gwf-publications

repo_name: gwf-uwaterloo/gwf-publications

branch_name: refs/heads/main

gha_language: Python


text:
@inproceedings{EmmerJaens14a,
  address = {Krakow},
  author = {{Emmert}, Thomas and {Jaensch}, Stefan and {Sovardi}, Carlo and {Polifke}, Wolfgang},
  booktitle = {7th {{Forum Acusticum}}},
  keywords = {NonPerRev},
  month = sep,
  note = {\url{http://www.fa2014.agh.edu.pl/fa2014_cd/}},
  timestamp = {2015-02-24 12:14:36 +0100},
  title = {{{taX}} - a {{Flexible Tool}} for {{Low-Order Duct Acoustic Simulation}} in {{Time}} and {{Frequency Domain}}},
  year = {2014}
}

license: Unlicense

url: https://raw.githubusercontent.com/briandk/zotero-better-bibtex/ad0c16fbd5a20df8628294823fe88b1dc1191908/test/fixtures/export/bibtex; url export does not survive underscores #402.bibtex

repository: briandk/zotero-better-bibtex

repo_name: briandk/zotero-better-bibtex

extension: bibtex


text:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7);  // Set the LCD I2C address

void setup()
{
  lcd.begin (16,2); // for 16 x 2 LCD module
  lcd.setBacklightPin(3,POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.home ();  // go home

  Serial.begin(9600);
  Serial.println(F("Initalizing"));
}

void loop()
{
  // Wait a few seconds between measurements.
  lcd.clear();
  lcd.setCursor(0,0); // column,row starts at 0

  Serial.print(F(">>>"));
  String s = Serial.readStringUntil(/r);

  lcd.print("Read: ");
  lcd.setCursor(0,1); // column,row starts at 0
  lcd.print(s);

}

repository: rsteenbu/MyArduinoProject

repo_name: rsteenbu/MyArduinoProject

extension: cpp


text:
@inproceedings{bhaskar2018truthful,
  title={Truthful and near-optimal mechanisms for welfare maximization in multi-winner elections},
  author={Bhaskar, Umang and Dani, Varsha and Ghosh, Abheek},
  booktitle={Thirty-Second AAAI Conference on Artificial Intelligence (AAAI)},
  year={2018},
  url={https://www.aaai.org/ocs/index.php/AAAI/AAAI18/paper/view/17314},
  abstract={Mechanisms for aggregating the preferences of agents in elections need to balance many different considerations, including efficiency, information elicited from agents, and manipulability. We consider the utilitarian social welfare of mechanisms for preference aggregation, measured by the distortion. We show that for a particular input format called threshold approval voting, where each agent is presented with an independently chosen threshold, there is a mechanism with nearly optimal distortion when the number of voters is large. Threshold mechanisms are potentially manipulable, but place a low informational burden on voters. We then consider truthful mechanisms. For the widely-studied class of ordinal mechanisms which elicit the rankings of candidates from each agent, we show that truthfulness essentially imposes no additional loss of welfare. We give truthful mechanisms with distortion O(√m log m) for k-winner elections, and distortion O(√m log m) when candidates have arbitrary costs, in elections with m candidates. These nearly match known lower bounds for ordinal mechanisms that ignore the strategic behavior. We further tighten these lower bounds and show that for truthful mechanisms our first upper bound is tight. Lastly, when agents decide between two candidates, we give tight bounds on the distortion for truthful mechanisms.}
}
@inproceedings{bhaskar2018welfare,
  title={On the Welfare of Cardinal Voting Mechanisms},
  author={Bhaskar, Umang and Ghosh, Abheek},
  booktitle={38th IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science (FSTTCS)},
  year={2018},
  organization={Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik},
  url={https://drops.dagstuhl.de/opus/volltexte/2018/9926/},
  abstract={A voting mechanism is a method for preference aggregation that takes as input preferences over alternatives from voters, and selects an alternative, or a distribution over alternatives. While preferences of voters are generally assumed to be cardinal utility functions that map each alternative to a real value, mechanisms typically studied assume coarser inputs, such as rankings of the alternatives (called ordinal mechanisms). We study cardinal mechanisms, that take as input the cardinal utilities of the voters, with the objective of minimizing the distortion - the worst-case ratio of the best social welfare to that obtained by the mechanism. For truthful cardinal mechanisms with m alternatives and n voters, we show bounds of Theta(mn), Omega(m), and Omega(sqrt{m}) for deterministic, unanimous, and randomized mechanisms respectively. This shows, somewhat surprisingly, that even mechanisms that allow cardinal inputs have large distortion. There exist ordinal (and hence, cardinal) mechanisms with distortion O(sqrt{m log m}), and hence our lower bound for randomized mechanisms is nearly tight. In an effort to close this gap, we give a class of truthful cardinal mechanisms that we call randomized hyperspherical mechanisms that have O(sqrt{m log m}) distortion. These are interesting because they violate two properties - localization and non-perversity - that characterize truthful ordinal mechanisms, demonstrating non-trivial mechanisms that differ significantly from ordinal mechanisms. Given the strong lower bounds for truthful mechanisms, we then consider approximately truthful mechanisms. We give a mechanism that is delta-truthful given delta in (0,1), and has distortion close to 1. Finally, we consider the simple mechanism that selects the alternative that maximizes social welfare. This mechanism is not truthful, and we study the distortion at equilibria for the voters (equivalent to the Price of Anarchy, or PoA). While in general, the PoA is unbounded, we show that for equilibria obtained from natural dynamics, the PoA is close to 1. Thus relaxing the notion of truthfulness in both cases allows us to obtain near-optimal distortion.}
}

repository: AbheekG/academic-kickstart

repo_name: AbheekG/academic-kickstart


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

package types

import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import timestamp "github.com/golang/protobuf/ptypes/timestamp"

import (
	context "golang.org/x/net/context"
	grpc "google.golang.org/grpc"
)

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

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

type Deployment struct {
	ID                   int64    `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Branch               string   `protobuf:"bytes,2,opt,name=Branch,proto3" json:"Branch,omitempty"`
	RepoID               int64    `protobuf:"varint,3,opt,name=RepoID,proto3" json:"RepoID,omitempty"`
	ArtifactID           int64    `protobuf:"varint,4,opt,name=ArtifactID,proto3" json:"ArtifactID,omitempty"`
	K8SName              string   `protobuf:"bytes,5,opt,name=K8SName,proto3" json:"K8SName,omitempty"`
	Manifest             string   `protobuf:"bytes,6,opt,name=Manifest,proto3" json:"Manifest,omitempty"`
	Replicas             int64    `protobuf:"varint,7,opt,name=Replicas,proto3" json:"Replicas,omitempty"`
	IsInitialized        bool     `protobuf:"varint,8,opt,name=IsInitialized,proto3" json:"IsInitialized,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *Deployment) Reset()         { *m = Deployment{} }
func (m *Deployment) String() string { return proto.CompactTextString(m) }
func (*Deployment) ProtoMessage()    {}
func (*Deployment) Descriptor() ([]byte, []int) {
	return fileDescriptor_CD_0224c74fce272072, []int{0}
}
func (m *Deployment) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_Deployment.Unmarshal(m, b)
}
func (m *Deployment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_Deployment.Marshal(b, m, deterministic)
}
func (dst *Deployment) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Deployment.Merge(dst, src)
}
func (m *Deployment) XXX_Size() int {
	return xxx_messageInfo_Deployment.Size(m)
}
func (m *Deployment) XXX_DiscardUnknown() {
	xxx_messageInfo_Deployment.DiscardUnknown(m)
}

var xxx_messageInfo_Deployment proto.InternalMessageInfo

func (m *Deployment) GetID() int64 {
	if m != nil {
		return m.ID
	}
	return 0
}

func (m *Deployment) GetBranch() string {
	if m != nil {
		return m.Branch
	}
	return ""
}

func (m *Deployment) GetRepoID() int64 {
	if m != nil {
		return m.RepoID
	}
	return 0
}

func (m *Deployment) GetArtifactID() int64 {
	if m != nil {
		return m.ArtifactID
	}
	return 0
}

func (m *Deployment) GetK8SName() string {
	if m != nil {
		return m.K8SName
	}
	return ""
}

func (m *Deployment) GetManifest() string {
	if m != nil {
		return m.Manifest
	}
	return ""
}

func (m *Deployment) GetReplicas() int64 {
	if m != nil {
		return m.Replicas
	}
	return 0
}

func (m *Deployment) GetIsInitialized() bool {
	if m != nil {
		return m.IsInitialized
	}
	return false
}

type DeploymentsQuery struct {
	Page                 int64    `protobuf:"varint,1,opt,name=Page,proto3" json:"Page,omitempty"`
	Limit                int64    `protobuf:"varint,2,opt,name=Limit,proto3" json:"Limit,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *DeploymentsQuery) Reset()         { *m = DeploymentsQuery{} }
func (m *DeploymentsQuery) String() string { return proto.CompactTextString(m) }
func (*DeploymentsQuery) ProtoMessage()    {}
func (*DeploymentsQuery) Descriptor() ([]byte, []int) {
	return fileDescriptor_CD_0224c74fce272072, []int{1}
}
func (m *DeploymentsQuery) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_DeploymentsQuery.Unmarshal(m, b)
}
func (m *DeploymentsQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_DeploymentsQuery.Marshal(b, m, deterministic)
}
func (dst *DeploymentsQuery) XXX_Merge(src proto.Message) {
	xxx_messageInfo_DeploymentsQuery.Merge(dst, src)
}
func (m *DeploymentsQuery) XXX_Size() int {
	return xxx_messageInfo_DeploymentsQuery.Size(m)
}
func (m *DeploymentsQuery) XXX_DiscardUnknown() {
	xxx_messageInfo_DeploymentsQuery.DiscardUnknown(m)
}

var xxx_messageInfo_DeploymentsQuery proto.InternalMessageInfo

func (m *DeploymentsQuery) GetPage() int64 {
	if m != nil {
		return m.Page
	}
	return 0
}

func (m *DeploymentsQuery) GetLimit() int64 {
	if m != nil {
		return m.Limit
	}
	return 0
}

type DeploymentsArray struct {
	Total                int64         `protobuf:"varint,1,opt,name=Total,proto3" json:"Total,omitempty"`
	Deployments          []*Deployment `protobuf:"bytes,2,rep,name=deployments,proto3" json:"deployments,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

func (m *DeploymentsArray) Reset()         { *m = DeploymentsArray{} }
func (m *DeploymentsArray) String() string { return proto.CompactTextString(m) }
func (*DeploymentsArray) ProtoMessage()    {}
func (*DeploymentsArray) Descriptor() ([]byte, []int) {
	return fileDescriptor_CD_0224c74fce272072, []int{2}
}
func (m *DeploymentsArray) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_DeploymentsArray.Unmarshal(m, b)
}
func (m *DeploymentsArray) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_DeploymentsArray.Marshal(b, m, deterministic)
}
func (dst *DeploymentsArray) XXX_Merge(src proto.Message) {
	xxx_messageInfo_DeploymentsArray.Merge(dst, src)
}
func (m *DeploymentsArray) XXX_Size() int {
	return xxx_messageInfo_DeploymentsArray.Size(m)
}
func (m *DeploymentsArray) XXX_DiscardUnknown() {
	xxx_messageInfo_DeploymentsArray.DiscardUnknown(m)
}

var xxx_messageInfo_DeploymentsArray proto.InternalMessageInfo

func (m *DeploymentsArray) GetTotal() int64 {
	if m != nil {
		return m.Total
	}
	return 0
}

func (m *DeploymentsArray) GetDeployments() []*Deployment {
	if m != nil {
		return m.Deployments
	}
	return nil
}

type Revision struct {
	ID                   int64                `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	DeploymentID         int64                `protobuf:"varint,2,opt,name=DeploymentID,proto3" json:"DeploymentID,omitempty"`
	ArtifactID           int64                `protobuf:"varint,3,opt,name=ArtifactID,proto3" json:"ArtifactID,omitempty"`
	Date                 *timestamp.Timestamp `protobuf:"bytes,4,opt,name=Date,proto3" json:"Date,omitempty"`
	Stdout               string               `protobuf:"bytes,5,opt,name=Stdout,proto3" json:"Stdout,omitempty"`
	Replicas             int64                `protobuf:"varint,6,opt,name=Replicas,proto3" json:"Replicas,omitempty"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
	XXX_unrecognized     []byte               `json:"-"`
	XXX_sizecache        int32                `json:"-"`
}

func (m *Revision) Reset()         { *m = Revision{} }
func (m *Revision) String() string { return proto.CompactTextString(m) }
func (*Revision) ProtoMessage()    {}
func (*Revision) Descriptor() ([]byte, []int) {
	return fileDescriptor_CD_0224c74fce272072, []int{3}
}
func (m *Revision) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_Revision.Unmarshal(m, b)
}
func (m *Revision) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_Revision.Marshal(b, m, deterministic)
}
func (dst *Revision) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Revision.Merge(dst, src)
}
func (m *Revision) XXX_Size() int {
	return xxx_messageInfo_Revision.Size(m)
}
func (m *Revision) XXX_DiscardUnknown() {
	xxx_messageInfo_Revision.DiscardUnknown(m)
}

var xxx_messageInfo_Revision proto.InternalMessageInfo

func (m *Revision) GetID() int64 {
	if m != nil {
		return m.ID
	}
	return 0
}

func (m *Revision) GetDeploymentID() int64 {
	if m != nil {
		return m.DeploymentID
	}
	return 0
}

func (m *Revision) GetArtifactID() int64 {
	if m != nil {
		return m.ArtifactID
	}
	return 0
}

func (m *Revision) GetDate() *timestamp.Timestamp {
	if m != nil {
		return m.Date
	}
	return nil
}

func (m *Revision) GetStdout() string {
	if m != nil {
		return m.Stdout
	}
	return ""
}

func (m *Revision) GetReplicas() int64 {
	if m != nil {
		return m.Replicas
	}
	return 0
}

type RevisionsQuery struct {
	DeploymentID         int64    `protobuf:"varint,1,opt,name=DeploymentID,proto3" json:"DeploymentID,omitempty"`
	Page                 int64    `protobuf:"varint,2,opt,name=Page,proto3" json:"Page,omitempty"`
	Limit                int64    `protobuf:"varint,3,opt,name=Limit,proto3" json:"Limit,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *RevisionsQuery) Reset()         { *m = RevisionsQuery{} }
func (m *RevisionsQuery) String() string { return proto.CompactTextString(m) }
func (*RevisionsQuery) ProtoMessage()    {}
func (*RevisionsQuery) Descriptor() ([]byte, []int) {
	return fileDescriptor_CD_0224c74fce272072, []int{4}
}
func (m *RevisionsQuery) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_RevisionsQuery.Unmarshal(m, b)
}
func (m *RevisionsQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_RevisionsQuery.Marshal(b, m, deterministic)
}
func (dst *RevisionsQuery) XXX_Merge(src proto.Message) {
	xxx_messageInfo_RevisionsQuery.Merge(dst, src)
}
func (m *RevisionsQuery) XXX_Size() int {
	return xxx_messageInfo_RevisionsQuery.Size(m)
}
func (m *RevisionsQuery) XXX_DiscardUnknown() {
	xxx_messageInfo_RevisionsQuery.DiscardUnknown(m)
}

var xxx_messageInfo_RevisionsQuery proto.InternalMessageInfo

func (m *RevisionsQuery) GetDeploymentID() int64 {
	if m != nil {
		return m.DeploymentID
	}
	return 0
}

func (m *RevisionsQuery) GetPage() int64 {
	if m != nil {
		return m.Page
	}
	return 0
}

func (m *RevisionsQuery) GetLimit() int64 {
	if m != nil {
		return m.Limit
	}
	return 0
}

type RevisionsArray struct {
	Total                int64       `protobuf:"varint,1,opt,name=Total,proto3" json:"Total,omitempty"`
	Revisions            []*Revision `protobuf:"bytes,2,rep,name=revisions,proto3" json:"revisions,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

func (m *RevisionsArray) Reset()         { *m = RevisionsArray{} }
func (m *RevisionsArray) String() string { return proto.CompactTextString(m) }
func (*RevisionsArray) ProtoMessage()    {}
func (*RevisionsArray) Descriptor() ([]byte, []int) {
	return fileDescriptor_CD_0224c74fce272072, []int{5}
}
func (m *RevisionsArray) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_RevisionsArray.Unmarshal(m, b)
}
func (m *RevisionsArray) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_RevisionsArray.Marshal(b, m, deterministic)
}
func (dst *RevisionsArray) XXX_Merge(src proto.Message) {
	xxx_messageInfo_RevisionsArray.Merge(dst, src)
}
func (m *RevisionsArray) XXX_Size() int {
	return xxx_messageInfo_RevisionsArray.Size(m)
}
func (m *RevisionsArray) XXX_DiscardUnknown() {
	xxx_messageInfo_RevisionsArray.DiscardUnknown(m)
}

var xxx_messageInfo_RevisionsArray proto.InternalMessageInfo

func (m *RevisionsArray) GetTotal() int64 {
	if m != nil {
		return m.Total
	}
	return 0
}

func (m *RevisionsArray) GetRevisions() []*Revision {
	if m != nil {
		return m.Revisions
	}
	return nil
}

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

func (m *Empty) Reset()         { *m = Empty{} }
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage()    {}
func (*Empty) Descriptor() ([]byte, []int) {
	return fileDescriptor_CD_0224c74fce272072, []int{6}
}
func (m *Empty) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_Empty.Unmarshal(m, b)
}
func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_Empty.Marshal(b, m, deterministic)
}
func (dst *Empty) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Empty.Merge(dst, src)
}
func (m *Empty) XXX_Size() int {
	return xxx_messageInfo_Empty.Size(m)
}
func (m *Empty) XXX_DiscardUnknown() {
	xxx_messageInfo_Empty.DiscardUnknown(m)
}

var xxx_messageInfo_Empty proto.InternalMessageInfo

func init() {
	proto.RegisterType((*Deployment)(nil), "types.Deployment")
	proto.RegisterType((*DeploymentsQuery)(nil), "types.DeploymentsQuery")
	proto.RegisterType((*DeploymentsArray)(nil), "types.DeploymentsArray")
	proto.RegisterType((*Revision)(nil), "types.Revision")
	proto.RegisterType((*RevisionsQuery)(nil), "types.RevisionsQuery")
	proto.RegisterType((*RevisionsArray)(nil), "types.RevisionsArray")
	proto.RegisterType((*Empty)(nil), "types.Empty")
}

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

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

// CDAPIClient is the client API for CDAPI service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type CDAPIClient interface {
	GetRevision(ctx context.Context, in *Revision, opts ...grpc.CallOption) (*Revision, error)
	GetRevisions(ctx context.Context, in *RevisionsQuery, opts ...grpc.CallOption) (*RevisionsArray, error)
	GetAllDeployments(ctx context.Context, in *DeploymentsQuery, opts ...grpc.CallOption) (*DeploymentsArray, error)
	GetDeployment(ctx context.Context, in *Deployment, opts ...grpc.CallOption) (*Deployment, error)
	CreateDeployment(ctx context.Context, in *Deployment, opts ...grpc.CallOption) (*Empty, error)
	ChangeImage(ctx context.Context, in *Deployment, opts ...grpc.CallOption) (*Empty, error)
	ScaleDeployment(ctx context.Context, in *Deployment, opts ...grpc.CallOption) (*Empty, error)
	UpdateManifest(ctx context.Context, in *Deployment, opts ...grpc.CallOption) (*Empty, error)
	DeleteDeployment(ctx context.Context, in *Deployment, opts ...grpc.CallOption) (*Empty, error)
}

type cDAPIClient struct {
	cc *grpc.ClientConn
}

func NewCDAPIClient(cc *grpc.ClientConn) CDAPIClient {
	return &cDAPIClient{cc}
}

func (c *cDAPIClient) GetRevision(ctx context.Context, in *Revision, opts ...grpc.CallOption) (*Revision, error) {
	out := new(Revision)
	err := c.cc.Invoke(ctx, "/types.CDAPI/GetRevision", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cDAPIClient) GetRevisions(ctx context.Context, in *RevisionsQuery, opts ...grpc.CallOption) (*RevisionsArray, error) {
	out := new(RevisionsArray)
	err := c.cc.Invoke(ctx, "/types.CDAPI/GetRevisions", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cDAPIClient) GetAllDeployments(ctx context.Context, in *DeploymentsQuery, opts ...grpc.CallOption) (*DeploymentsArray, error) {
	out := new(DeploymentsArray)
	err := c.cc.Invoke(ctx, "/types.CDAPI/GetAllDeployments", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cDAPIClient) GetDeployment(ctx context.Context, in *Deployment, opts ...grpc.CallOption) (*Deployment, error) {
	out := new(Deployment)
	err := c.cc.Invoke(ctx, "/types.CDAPI/GetDeployment", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cDAPIClient) CreateDeployment(ctx context.Context, in *Deployment, opts ...grpc.CallOption) (*Empty, error) {
	out := new(Empty)
	err := c.cc.Invoke(ctx, "/types.CDAPI/CreateDeployment", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cDAPIClient) ChangeImage(ctx context.Context, in *Deployment, opts ...grpc.CallOption) (*Empty, error) {
	out := new(Empty)
	err := c.cc.Invoke(ctx, "/types.CDAPI/ChangeImage", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cDAPIClient) ScaleDeployment(ctx context.Context, in *Deployment, opts ...grpc.CallOption) (*Empty, error) {
	out := new(Empty)
	err := c.cc.Invoke(ctx, "/types.CDAPI/ScaleDeployment", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cDAPIClient) UpdateManifest(ctx context.Context, in *Deployment, opts ...grpc.CallOption) (*Empty, error) {
	out := new(Empty)
	err := c.cc.Invoke(ctx, "/types.CDAPI/UpdateManifest", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cDAPIClient) DeleteDeployment(ctx context.Context, in *Deployment, opts ...grpc.CallOption) (*Empty, error) {
	out := new(Empty)
	err := c.cc.Invoke(ctx, "/types.CDAPI/DeleteDeployment", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// CDAPIServer is the server API for CDAPI service.
type CDAPIServer interface {
	GetRevision(context.Context, *Revision) (*Revision, error)
	GetRevisions(context.Context, *RevisionsQuery) (*RevisionsArray, error)
	GetAllDeployments(context.Context, *DeploymentsQuery) (*DeploymentsArray, error)
	GetDeployment(context.Context, *Deployment) (*Deployment, error)
	CreateDeployment(context.Context, *Deployment) (*Empty, error)
	ChangeImage(context.Context, *Deployment) (*Empty, error)
	ScaleDeployment(context.Context, *Deployment) (*Empty, error)
	UpdateManifest(context.Context, *Deployment) (*Empty, error)
	DeleteDeployment(context.Context, *Deployment) (*Empty, error)
}

func RegisterCDAPIServer(s *grpc.Server, srv CDAPIServer) {
	s.RegisterService(&_CDAPI_serviceDesc, srv)
}

func _CDAPI_GetRevision_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Revision)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CDAPIServer).GetRevision(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/types.CDAPI/GetRevision",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CDAPIServer).GetRevision(ctx, req.(*Revision))
	}
	return interceptor(ctx, in, info, handler)
}

func _CDAPI_GetRevisions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(RevisionsQuery)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CDAPIServer).GetRevisions(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/types.CDAPI/GetRevisions",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CDAPIServer).GetRevisions(ctx, req.(*RevisionsQuery))
	}
	return interceptor(ctx, in, info, handler)
}

func _CDAPI_GetAllDeployments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(DeploymentsQuery)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CDAPIServer).GetAllDeployments(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/types.CDAPI/GetAllDeployments",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CDAPIServer).GetAllDeployments(ctx, req.(*DeploymentsQuery))
	}
	return interceptor(ctx, in, info, handler)
}

func _CDAPI_GetDeployment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Deployment)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CDAPIServer).GetDeployment(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/types.CDAPI/GetDeployment",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CDAPIServer).GetDeployment(ctx, req.(*Deployment))
	}
	return interceptor(ctx, in, info, handler)
}

func _CDAPI_CreateDeployment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Deployment)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CDAPIServer).CreateDeployment(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/types.CDAPI/CreateDeployment",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CDAPIServer).CreateDeployment(ctx, req.(*Deployment))
	}
	return interceptor(ctx, in, info, handler)
}

func _CDAPI_ChangeImage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Deployment)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CDAPIServer).ChangeImage(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/types.CDAPI/ChangeImage",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CDAPIServer).ChangeImage(ctx, req.(*Deployment))
	}
	return interceptor(ctx, in, info, handler)
}

func _CDAPI_ScaleDeployment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Deployment)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CDAPIServer).ScaleDeployment(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/types.CDAPI/ScaleDeployment",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CDAPIServer).ScaleDeployment(ctx, req.(*Deployment))
	}
	return interceptor(ctx, in, info, handler)
}

func _CDAPI_UpdateManifest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Deployment)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CDAPIServer).UpdateManifest(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/types.CDAPI/UpdateManifest",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CDAPIServer).UpdateManifest(ctx, req.(*Deployment))
	}
	return interceptor(ctx, in, info, handler)
}

func _CDAPI_DeleteDeployment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Deployment)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CDAPIServer).DeleteDeployment(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/types.CDAPI/DeleteDeployment",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CDAPIServer).DeleteDeployment(ctx, req.(*Deployment))
	}
	return interceptor(ctx, in, info, handler)
}

var _CDAPI_serviceDesc = grpc.ServiceDesc{
	ServiceName: "types.CDAPI",
	HandlerType: (*CDAPIServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetRevision",
			Handler:    _CDAPI_GetRevision_Handler,
		},
		{
			MethodName: "GetRevisions",
			Handler:    _CDAPI_GetRevisions_Handler,
		},
		{
			MethodName: "GetAllDeployments",
			Handler:    _CDAPI_GetAllDeployments_Handler,
		},
		{
			MethodName: "GetDeployment",
			Handler:    _CDAPI_GetDeployment_Handler,
		},
		{
			MethodName: "CreateDeployment",
			Handler:    _CDAPI_CreateDeployment_Handler,
		},
		{
			MethodName: "ChangeImage",
			Handler:    _CDAPI_ChangeImage_Handler,
		},
		{
			MethodName: "ScaleDeployment",
			Handler:    _CDAPI_ScaleDeployment_Handler,
		},
		{
			MethodName: "UpdateManifest",
			Handler:    _CDAPI_UpdateManifest_Handler,
		},
		{
			MethodName: "DeleteDeployment",
			Handler:    _CDAPI_DeleteDeployment_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "CD.proto",
}

func init() { proto.RegisterFile("CD.proto", fileDescriptor_CD_0224c74fce272072) }

var fileDescriptor_CD_0224c74fce272072 = []byte{
	// 558 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcb, 0x6e, 0xda, 0x40,
	0x14, 0xc5, 0x98, 0x57, 0x2e, 0x84, 0x24, 0xa3, 0x3e, 0x2c, 0x2f, 0x5a, 0x34, 0xea, 0x82, 0x4d,
	0x9d, 0x16, 0x1a, 0xb5, 0x8b, 0xaa, 0x12, 0xc5, 0x15, 0xb2, 0xfa, 0x50, 0x6a, 0x92, 0x65, 0x2b,
	0x4d, 0xe0, 0x42, 0x46, 0xf2, 0x4b, 0xf6, 0x50, 0x89, 0xfe, 0x40, 0xff, 0xab, 0xdf, 0xd2, 0x0f,
	0xa9, 0x3c, 0x8c, 0xc1, 0xd8, 0x28, 0x4a, 0x76, 0x9c, 0x33, 0xe7, 0x5c, 0xe6, 0xde, 0x73, 0xc7,
	0xd0, 0x1a, 0xdb, 0x56, 0x14, 0x87, 0x22, 0x24, 0x75, 0xb1, 0x8e, 0x30, 0x31, 0x9f, 0x2f, 0xc3,
	0x70, 0xe9, 0xe1, 0xb9, 0x24, 0x6f, 0x56, 0x8b, 0x73, 0xc1, 0x7d, 0x4c, 0x04, 0xf3, 0xa3, 0x8d,
	0x8e, 0xfe, 0xd3, 0x00, 0x6c, 0x8c, 0xbc, 0x70, 0xed, 0x63, 0x20, 0x48, 0x17, 0xaa, 0x8e, 0x6d,
	0x68, 0x3d, 0xad, 0xaf, 0xbb, 0x55, 0xc7, 0x26, 0x4f, 0xa0, 0xf1, 0x31, 0x66, 0xc1, 0xec, 0xd6,
	0xa8, 0xf6, 0xb4, 0xfe, 0x91, 0xab, 0x50, 0xca, 0xbb, 0x18, 0x85, 0x8e, 0x6d, 0xe8, 0x52, 0xab,
	0x10, 0x79, 0x06, 0x30, 0x8a, 0x05, 0x5f, 0xb0, 0x99, 0x70, 0x6c, 0xa3, 0x26, 0xcf, 0x72, 0x0c,
	0x31, 0xa0, 0xf9, 0xf9, 0xdd, 0xf4, 0x1b, 0xf3, 0xd1, 0xa8, 0xcb, 0x82, 0x19, 0x24, 0x26, 0xb4,
	0xbe, 0xb2, 0x80, 0x2f, 0x30, 0x11, 0x46, 0x43, 0x1e, 0x6d, 0x71, 0x7a, 0xe6, 0x62, 0xe4, 0xf1,
	0x19, 0x4b, 0x8c, 0xa6, 0xac, 0xb9, 0xc5, 0xe4, 0x05, 0x1c, 0x3b, 0x89, 0x13, 0x70, 0xc1, 0x99,
	0xc7, 0x7f, 0xe3, 0xdc, 0x68, 0xf5, 0xb4, 0x7e, 0xcb, 0xdd, 0x27, 0xe9, 0x7b, 0x38, 0xdd, 0x75,
	0x99, 0x7c, 0x5f, 0x61, 0xbc, 0x26, 0x04, 0x6a, 0x97, 0x6c, 0x89, 0xaa, 0x5b, 0xf9, 0x9b, 0x3c,
	0x82, 0xfa, 0x17, 0xee, 0x73, 0x21, 0xdb, 0xd5, 0xdd, 0x0d, 0xa0, 0x3f, 0xf6, 0xdc, 0xa3, 0x38,
	0x66, 0xeb, 0x54, 0x79, 0x15, 0x0a, 0xe6, 0x29, 0xfb, 0x06, 0x90, 0x21, 0xb4, 0xe7, 0x3b, 0xa5,
	0x51, 0xed, 0xe9, 0xfd, 0xf6, 0xe0, 0xcc, 0x92, 0x61, 0x58, 0xbb, 0x1a, 0x6e, 0x5e, 0x45, 0xff,
	0x6a, 0x69, 0x7f, 0xbf, 0x78, 0xc2, 0xc3, 0xa0, 0x94, 0x00, 0x85, 0xce, 0xce, 0xe7, 0xd8, 0xea,
	0x62, 0x7b, 0x5c, 0x61, 0xea, 0x7a, 0x69, 0xea, 0x16, 0xd4, 0x6c, 0x26, 0x50, 0xe6, 0xd1, 0x1e,
	0x98, 0xd6, 0x66, 0x29, 0xac, 0x6c, 0x29, 0xac, 0xab, 0x6c, 0x29, 0x5c, 0xa9, 0x4b, 0xd3, 0x9d,
	0x8a, 0x79, 0xb8, 0x12, 0x2a, 0x24, 0x85, 0xf6, 0x72, 0x68, 0xec, 0xe7, 0x40, 0x7f, 0x42, 0x37,
	0xeb, 0x41, 0xcd, 0xb7, 0x78, 0x73, 0xed, 0xc0, 0xcd, 0xb3, 0x0c, 0xaa, 0x87, 0x32, 0xd0, 0xf3,
	0x19, 0x5c, 0xe7, 0xea, 0xdf, 0x95, 0xc0, 0x4b, 0x38, 0x8a, 0x33, 0x9d, 0x9a, 0xff, 0x89, 0x9a,
	0x7f, 0xe6, 0x77, 0x77, 0x0a, 0xda, 0x84, 0xfa, 0x27, 0x3f, 0x12, 0xeb, 0xc1, 0x9f, 0x1a, 0xd4,
	0xc7, 0xf6, 0xe8, 0xd2, 0x21, 0xaf, 0xa1, 0x3d, 0x41, 0xb1, 0x0d, 0xa4, 0xe8, 0x36, 0x8b, 0x04,
	0xad, 0x90, 0x0f, 0xd0, 0xc9, 0x59, 0x12, 0xf2, 0xb8, 0x20, 0xd9, 0x4c, 0xc4, 0x2c, 0xd1, 0xb2,
	0x11, 0x5a, 0x21, 0x13, 0x38, 0x9b, 0xa0, 0x18, 0x79, 0x5e, 0x6e, 0xcd, 0xc8, 0xd3, 0xd2, 0xda,
	0xa8, 0x32, 0x07, 0x0e, 0xb2, 0x42, 0x6f, 0xe1, 0x78, 0x82, 0x22, 0xf7, 0xa0, 0xcb, 0xbb, 0x67,
	0x96, 0x29, 0x5a, 0x21, 0x17, 0x70, 0x3a, 0x8e, 0x91, 0x09, 0xbc, 0xdb, 0xdb, 0x51, 0x94, 0x9c,
	0x19, 0xad, 0x90, 0x57, 0xd0, 0x1e, 0xdf, 0xb2, 0x60, 0x89, 0x8e, 0x9f, 0x46, 0x77, 0x0f, 0xc7,
	0x1b, 0x38, 0x99, 0xce, 0x98, 0xf7, 0xc0, 0xff, 0x19, 0x42, 0xf7, 0x3a, 0x9a, 0x33, 0x81, 0xdb,
	0x6f, 0xc2, 0x3d, 0x4c, 0x17, 0xe9, 0xb3, 0xf5, 0xf0, 0x81, 0x3d, 0xdd, 0x34, 0xe4, 0xbb, 0x18,
	0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x53, 0xf2, 0x9d, 0xfe, 0x4d, 0x05, 0x00, 0x00,
}


text:
@article{nathan_academic_2002,
	title = {Academic Freedom in Clinical Research},
	volume = {347},
	url = {http://content.nejm.org/cgi/content/extract/347/17/1368},
	abstract = {Description: This article summarizes the Nancy Oliveri case. Dr. Olivieri was a researcher who was determined to present information about safety problems with a drug she was studying, in violation of a confidentiality agreement with the drug company that sponsored the research. This case illustrates the need to avoid agreements with drug companies that allow those companies to completely bar publication of unfavorable results.},
	pages = {1368--1371},
	journaltitle = {New England Journal of Medicine},
	author = {Nathan, {DG} and Weatheral, {DJ}},
	urldate = {2009-03-09},
	date = {2002-10-24},
	keywords = {Conflict of interest}
}

@article{steinbrook_controlling_2009,
	title = {Controlling Conflict of Interest -- Proposals from the Institute of Medicine},
	url = {http://content.nejm.org/cgi/content/full/360/21/2160},
	doi = {10.1056/NEJMp0810200},
	pages = {NEJMp0810200},
	journaltitle = {N Engl J Med},
	author = {Steinbrook, Robert},
	urldate = {2009-05-01},
	date = {2009-04-29},
	keywords = {Conflict of interest}
}

@article{jefferson_relation_2009,
	title = {Relation of study quality, concordance, take home message, funding, and impact in studies of influenza vaccines: systematic review},
	volume = {338},
	url = {http://www.bmj.com/cgi/content/abstract/338/feb12_2/b354},
	doi = {10.1136/bmj.b354},
	shorttitle = {Relation of study quality, concordance, take home message, funding, and impact in studies of influenza vaccines},
	abstract = {Objective To explore the relation between study concordance, take home message, funding, and dissemination of comparative studies assessing the effects of influenza vaccines. Design Systematic review without meta-analysis. Data extraction Search of the Cochrane Library, {PubMed}, Embase, and the web, without language restriction, for any studies comparing the effects of influenza vaccines against placebo or no intervention. Abstraction and assessment of quality of methods were carried out. Data synthesis We identified 259 primary studies (274 datasets). Higher quality studies were significantly more likely to show concordance between data presented and conclusions (odds ratio 16.35, 95\% confidence interval 4.24 to 63.04) and less likely to favour effectiveness of vaccines (0.04, 0.02 to 0.09). Government funded studies were less likely to have conclusions favouring the vaccines (0.45, 0.26 to 0.90). A higher mean journal impact factor was associated with complete or partial industry funding compared with government or private funding and no funding (differences between means 5.04). Study size was not associated with concordance, content of take home message, funding, and study quality. Higher citation index factor was associated with partial or complete industry funding. This was sensitive to the exclusion from the analysis of studies with undeclared funding. Conclusion Publication in prestigious journals is associated with partial or total industry funding, and this association is not explained by study quality or size.},
	pages = {b354},
	issue = {feb12\_2},
	journaltitle = {{BMJ}},
	author = {Jefferson, T and Di Pietrantonj, C and Debalini, M G and Rivetti, A and Demicheli, V},
	urldate = {2009-03-31},
	date = {2009-02-12},
	keywords = {Conflict of interest}
}

@article{krimsky_academic-corporate_1991,
	title = {Academic-corporate ties in biotechnology: a quantitative study},
	volume = {16},
	issn = {0162-2439},
	url = {http://www.ncbi.nlm.nih.gov/pubmed/11652031},
	shorttitle = {Academic-corporate ties in biotechnology},
	pages = {275--87},
	number = {3},
	journaltitle = {Science, Technology \& Human Values},
	shortjournal = {Sci Technol Human Values},
	author = {Krimsky, Sheldon and Ennis, James G and Weissman, Robert},
	urldate = {2009-03-09},
	date = {1991},
	pmid = {11652031},
	keywords = {Conflict of interest}
}

@article{hundley_companies_2007,
	title = {Companies run trials of drugs they invest in},
	url = {http://www.sptimes.com/2007/07/01/Worldandnation/Companies_run_trials_.shtml},
	journaltitle = {St. Petersburg Times},
	author = {Hundley, Kris},
	urldate = {2009-03-09},
	date = {2007-07-01},
	keywords = {Conflict of interest}
}

@online{goozner_gooznews:_nodate,
	title = {{GoozNews}: States Say Medscape {CME} Part of Off-Label Promotion Scheme},
	url = {http://www.gooznews.com/archives/001345.html},
	author = {Goozner, Merrill},
	urldate = {2009-03-09},
	keywords = {Conflict of interest}
}

repository: pmean/build-website

repo_name: pmean/build-website


text:
//**********************************************************************//
//
//  Interface example for the Bendvelope panel, 16 button/led bar w/ knob
//  and scanned matrix 7 segment display.
//
//  This file defines the human interaction of the panel parts
//
//  Written by:  Marshall Taylor
//  Changelog (YYYY/MM/DD):
//    2016/2/24: Created
//    2016/2/29: Moved seven segment stuff to voltage monitor
//
//**********************************************************************//
#ifndef P8INTERFACE_H
#define P8INTERFACE_H

#include "stdint.h"
#include "timeKeeper.h"
#include "P8PanelComponents.h"
#include "P8Panel.h"
#include "flagMessaging.h"

enum PStates
{
	PInit,
	PIdle,

};

class P8Interface : public P8Panel
{
public:
	P8Interface( void );
	void reset( void );
	//State machine stuff
	void processMachine( void );
	void tickStateMachine( void );

	void timersMIncrement( uint8_t );
	void setPointer( uint8_t, int16_t * );

	//Flags coming in from the system
	//  ..and data.

	//Internal - and going out to the system - Flags
	uint8_t lastAttack;
	uint8_t lastAttackBend;
	uint8_t lastAttackHold;
	uint8_t lastDecay;
	uint8_t lastDecayBend;
	uint8_t lastSustain;
	uint8_t lastRelease;
	uint8_t lastReleaseBend;

	//Data going out to the system
	float dcAmpOffset[4]; //osc A thru D

private:
	//Internal Flags
	//MessagingFlag quantizeHoldOffFlag;
	MessagingFlag changeVolume;
	//  ..and data
	int8_t waveformShape1 = 1;
	int8_t waveformShape2 = 1;
	int8_t waveformShape3 = 1;
	int8_t waveformShape4 = 1;
	int8_t group1Store = 0;
	int8_t group2Store = 0;
	int8_t group3Store = 0;

	int8_t oscASelect = 0;
	int8_t oscBSelect = 0;

	int16_t * waveFormPointerA;
	int16_t * waveFormPointerB;

	uint8_t waveShapeParams[2][4];
	//State machine stuff
	PStates state;
	uint8_t debugTemp = 0;

};

#endif


text:
package cliaws

import (
	"context"
	"encoding/json"
	"fmt"
	"strings"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/s3"

	"github.com/alexflint/go-arg"
	"github.com/nathants/cli-aws/lib"
)

func init() {
	lib.Commands["s3-head"] = s3Head
	lib.Args["s3-head"] = s3HeadArgs{}
}

type s3HeadArgs struct {
	Path string `arg:"positional"`
}

func (s3HeadArgs) Description() string {
	return "\nhead an object\n"
}

func s3Head() {
	var args s3HeadArgs
	arg.MustParse(&args)
	ctx := context.Background()

	path := lib.Last(strings.Split(args.Path, "s3://"))
	parts := strings.Split(path, "/")
	bucket := parts[0]
	var key string
	if len(parts) > 1 {
		key = strings.Join(parts[1:], "/")
	}

	s3Client, err := lib.S3ClientBucketRegion(bucket)
	if err != nil {
		lib.Logger.Fatal("error: ", err)
	}

	out, err := s3Client.HeadObjectWithContext(ctx, &s3.HeadObjectInput{
		Bucket: aws.String(bucket),
		Key:    aws.String(key),
	})
	if err != nil {
		lib.Logger.Fatal("error: ", err)
	}

	data, err := json.Marshal(out)
	if err != nil {
		lib.Logger.Fatal("error: ", err)
	}
	var outMap map[string]interface{}
	err = json.Unmarshal(data, &outMap)
	if err != nil {
		lib.Logger.Fatal("error: ", err)
	}

	val := map[string]interface{}{}
	for k, v := range outMap {
		if v != nil {
			val[k] = v
		}
	}
	fmt.Println(lib.Pformat(val))
}

repository: nathants/cli-aws

repo_name: nathants/cli-aws


text:
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

include("${CMAKE_CURRENT_LIST_DIR}/AmiciTargets.cmake")

check_required_components(Amici)

repository: ICB-DCM/parPE

repo_name: ICB-DCM/parPE

extension: cmake


text:
SUMMARY = "Phosphor OpenBMC pre-init scripts for static-norootfs layout"
DESCRIPTION = "Phosphor OpenBMC filesystem mount implementation for static-norootfs"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
PR = "r1"

SOURCE_FILES = "\
    init \
    10-early-mounts \
    20-udev \
    21-factory-reset \
    30-ubiattach-or-format \
    50-mount-persistent \
    "
SRC_URI += "\
    ${@' '.join(\
        [ 'file://' + x for x in d.getVar('SOURCE_FILES', True).split()])} \
    "

S = "${WORKDIR}"

inherit allarch
inherit update-alternatives

PKG_INSTALL_DIR="${libexecdir}/${BPN}"
FILES:${PN} += "${PKG_INSTALL_DIR}"

do_install() {
    install -d ${D}${PKG_INSTALL_DIR}

    for f in ${SOURCE_FILES} ; do
        install -m 0755 ${S}/$f ${D}${PKG_INSTALL_DIR}/$f
    done
}

RDEPENDS:${PN} += " \
    ${@d.getVar('PREFERRED_PROVIDER_u-boot-fw-utils', True) or \
        'u-boot-fw-utils'} \
    ${VIRTUAL-RUNTIME_base-utils} \
    mtd-utils-ubifs \
    udev \
"

ALTERNATIVE_LINK_NAME[init] = "${base_sbindir}/init"
# Use a number higher than the systemd init alternative so that
# ours is enabled instead.
ALTERNATIVE_PRIORITY[init] ?= "400"

ALTERNATIVE:${PN} = "init"
ALTERNATIVE_TARGET[init] = "${PKG_INSTALL_DIR}/init"

repository: openbmc/openbmc

repo_name: openbmc/openbmc

gha_license_id: NOASSERTION