text:
@inproceedings{pimentel+al.emnlp22,
 abstract = {In this paper, we seek to measure how much information a component in a neural network could extract from the representations fed into it. Our work stands in contrast to prior probing work, most of which investigates how much information a model's representations contain. This shift in perspective leads us to propose a new principle for probing, the architectural bottleneck principle: In order to estimate how much information a given component could extract, a probe should look exactly like the component. Relying on this principle, we estimate how much syntactic information is available to transformers through our attentional probe, a probe that exactly resembles a transformer's self-attention head. Experimentally, we find that, in three models (BERT, ALBERT, and RoBERTa), a sentence's syntax tree is mostly extractable by our probe, suggesting these models have access to syntactic information while composing their contextual representations. Whether this information is actually used by these models, however, remains an open question.},
 address = {Abu Dhabi, United Arab Emirates},
 arxiv = {https://arxiv.org/abs/2211.06420},
 author = {Pimentel*, Tiago and
Valvoda*, Josef and
Stoehr, Niklas and
Cotterell, Ryan},
 booktitle = {Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing},
 code = {https://github.com/rycolab/attentional-probe},
 month = {December},
 publisher = {Association for Computational Linguistics},
 title = {The Architectural Bottleneck Principle},
 url = {https://arxiv.org/abs/2211.06420},
 venue = {EMNLP},
 year = {2022}
}

repository: rycolab/website

repo_name: rycolab/website


text:
# Specify location of the corresponding NON-HLOS.bin file by adding
# NHLOS_URI:pn-firmware-qcom-dragonboard-apq8074 = "..."  to local.conf. Use
# "file://" if the file is provided locally.

DESCRIPTION = "QCOM Firmware for Dragonboard APQ8074 board"

LICENSE = "CLOSED"

# dragonboard8074 firmware is unsigned, so install into generic location
FW_QCOM_NAME = "apq8074"

FW_QCOM_LIST = "adsp.mbn mba.mbn modem.mbn wcnss.mbn"

require recipes-bsp/firmware/firmware-qcom.inc
require recipes-bsp/firmware/firmware-qcom-nhlos.inc

SPLIT_FIRMWARE_PACKAGES = " \
    linux-firmware-qcom-${FW_QCOM_NAME}-audio \
    linux-firmware-qcom-${FW_QCOM_NAME}-modem \
    linux-firmware-qcom-${FW_QCOM_NAME}-wifi \
"

license: MIT

license_type: permissive

branch_name: refs/heads/master

extension: bb


text:
DESCRIPTION = "Units to initialize CAN buffer pins"

inherit systemd

LICENSE = ""
COMPATIBLE_MACHINE = "(beaglebone)"
PACKAGE_ARCH = "${MACHINE_ARCH}"

SRC_URI = "file://set-can-pins.service \
           file://set-can-pins.sh \
          "

do_install() {
	install -d ${D}${base_libdir}/systemd/system
	install -m 0644 ${WORKDIR}/*.service ${D}${base_libdir}/systemd/system

	install -d ${D}${bindir}
	install -m 0755 ${WORKDIR}/*.sh ${D}${bindir}

	install -d ${D}${sysconfdir}/systemd/system/network.target.wants
	( cd ${D}${sysconfdir}/systemd/system/network.target.wants &&
	ln -s ${D}${base_libdir}/systemd/system/set-can-pins.service set-can-pins.service
	)
}

ALLOW_EMPTY_${PN} = "1"

FILES_${PN} = "${base_libdir}/systemd/system/set-can-pins.service \
               ${bindir}/set-can-pins.sh \
               ${sysconfdir}/systemd/ \
              "

NATIVE_SYSTEMD_SUPPORT = "1"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE_${PN} = "set-can-pins.service"

repository: JackDoan/meta-beagleboard

repo_name: JackDoan/meta-beagleboard

gha_license_id: MIT


text:
/**
 * Copyright 2015 Batis Degryll Ludo
 * @file ZBNoidResourceLoader.h
 * @since 2017-08-26
 * @date 2017-08-26
 * @author Degryll Ludo Batis
 * @brief Daemon that load all ZBNoid resources.
 */

#ifndef ZBE_MAIN_ZOMBIENOID_DAEMONS_ZBNOIDRESOURCELOADER_H
#define ZBE_MAIN_ZOMBIENOID_DAEMONS_ZBNOIDRESOURCELOADER_H

#include <memory>
#include <cstdint>

#include "ZBE/core/daemons/Daemon.h"

#include "ZBNoid.h"

#include "graphics/RsrcIDDictionary.h"

#include "ZBE/SDL/system/SDLWindow.h"

namespace zombienoid {
  /** \brief Defines a daemon that ends the game if the number of lifes reaches 0 in zombienoid game.
   */
  class ZBNoidResourceLoader : public zbe::Daemon {
    public:

      ZBNoidResourceLoader(const ZBNoidResourceLoader&) = delete;
      void operator=(const ZBNoidResourceLoader&) = delete;

      ZBNoidResourceLoader(std::shared_ptr<RsrcIDDictionary> rsrcIDDic, std::shared_ptr<zbe::SDLImageStore> imgStore, std::shared_ptr<zbe::SDLTextFontStore> textFontStore) : rsrcIDDic(rsrcIDDic), imgStore(imgStore), textFontStore(textFontStore)  {}

      ~ZBNoidResourceLoader() {}

      void run();

    private:
      std::shared_ptr<RsrcIDDictionary> rsrcIDDic;
      std::shared_ptr<zbe::SDLImageStore> imgStore;
      std::shared_ptr<zbe::SDLTextFontStore> textFontStore;
  };

}  // namespace zombienoid

#endif // ZBE_MAIN_ZOMBIENOID_DAEMONS_ZBNOIDRESOURCELOADER_H

repository: Degryll/ZBE

repo_name: Degryll/ZBE

gha_language: C

extension: h


text:
/**
 * @file main.cpp
 * @author James Scott, Jr.  aka(Skoona) (skoona@gmail.com)
 * @brief HomieNode featuring an SHT31 Temperature sensor.
 * @version 1.0.0
 * @date 2021-01-29
 *
 * @copyright Copyright (c) 2021
 *
 */

#include <Arduino.h>
#include "Sht31Node.hpp"
#include "RCWLNode.hpp"
#include "MetricsNode.hpp"

#ifdef ESP8266
extern "C"
{
#include "user_interface.h" // to set CPU Freq for Non-Huzzah's
}
#endif

/*
 * SKN_NODE_ID becomes the base name when ranges are used
 * ex: sknSensors/deviceName/SHT31_0/temperature -> 72.3 degress
 * Note: HomieNode(...range,lower,upper) manages this array suffix change; i.e no more name fixups
*/
#define SKN_MOD_NAME "Monitor-SHT31-RCWL-Metrics"
#define SKN_MOD_VERSION "2.0.0"
#define SKN_MOD_BRAND "SknSensors"

#define SKN_TNODE_TITLE "Temperature and Humidity Sensor"
#define SKN_MNODE_TITLE "Motion Sensor"

#define SKN_TNODE_TYPE "sensor"
#define SKN_MNODE_TYPE "sensor"

#define SKN_TNODE_ID "Ambient"
#define SKN_MNODE_ID "Presence"

#define SKN_DNODE_TITLE "Device Info"
#define SKN_DNODE_TYPE "sensor"
#define SKN_DNODE_ID "hardware"

// Select SDA and SCL pins for I2C communication and Motion
#define PIN_RCWL D5 // 14
#define PIN_SCL  D6 // 12
#define PIN_SDA  D7 // 13
#define SENSOR_READ_INTERVAL 300

ADC_MODE(ADC_VCC); //vcc read in MetricsNode

HomieSetting<long> sensorsIntervalSetting("sensorInterval", "The interval in seconds to wait between sending commands.");
HomieSetting<long> motionIntervalSetting("motionHoldInterval", "The interval in seconds to hold motion detection.");

Sht31Node temperatureMonitor(PIN_SDA, PIN_SCL, SKN_TNODE_ID, SKN_TNODE_TITLE, SKN_TNODE_TYPE, SENSOR_READ_INTERVAL);
RCWLNode  motionMonitor(PIN_RCWL, SKN_MNODE_ID, SKN_MNODE_TITLE, SKN_MNODE_TYPE, SENSOR_READ_INTERVAL);
MetricsNode metricsNode(SKN_DNODE_ID, SKN_DNODE_TITLE, SKN_DNODE_TYPE);

bool broadcastHandler(const String &level, const String &value)
{
  Homie.getLogger() << "Received broadcast level " << level << ": " << value << endl;
  return true;
}

void setup()
{
  delay(50);
  Serial.begin(115200);
  while( !Serial)
    delay(100); // wait for external monitor to ready

  Serial << endl << "Starting..." << endl;

  sensorsIntervalSetting.setDefaultValue(900).setValidator([](long candidate) {
    return (candidate >= 100) && (candidate <= 3000);
  });
  motionIntervalSetting.setDefaultValue(60).setValidator([](long candidate) {
    return (candidate >= 10) && (candidate <= 300);
  });

  temperatureMonitor.setMeasurementInterval(sensorsIntervalSetting.get());
  motionMonitor.setMotionHoldInterval(motionIntervalSetting.get());
  metricsNode.setMeasurementInterval(60);

  Homie_setFirmware(SKN_MOD_NAME, SKN_MOD_VERSION);
  Homie_setBrand(SKN_MOD_BRAND);

  Homie.setBroadcastHandler(broadcastHandler)
      .setup();
}

void loop()
{
  Homie.loop();
}

extension: cpp


text:
package dyplsapi

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// OperateAxgGroup invokes the dyplsapi.OperateAxgGroup API synchronously
func (client *Client) OperateAxgGroup(request *OperateAxgGroupRequest) (response *OperateAxgGroupResponse, err error) {
	response = CreateOperateAxgGroupResponse()
	err = client.DoAction(request, response)
	return
}

// OperateAxgGroupWithChan invokes the dyplsapi.OperateAxgGroup API asynchronously
func (client *Client) OperateAxgGroupWithChan(request *OperateAxgGroupRequest) (<-chan *OperateAxgGroupResponse, <-chan error) {
	responseChan := make(chan *OperateAxgGroupResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.OperateAxgGroup(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// OperateAxgGroupWithCallback invokes the dyplsapi.OperateAxgGroup API asynchronously
func (client *Client) OperateAxgGroupWithCallback(request *OperateAxgGroupRequest, callback func(response *OperateAxgGroupResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *OperateAxgGroupResponse
		var err error
		defer close(result)
		response, err = client.OperateAxgGroup(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// OperateAxgGroupRequest is the request struct for api OperateAxgGroup
type OperateAxgGroupRequest struct {
	*requests.RpcRequest
	ResourceOwnerId      requests.Integer `position:"Query" name:"ResourceOwnerId"`
	Numbers              string           `position:"Query" name:"Numbers"`
	ResourceOwnerAccount string           `position:"Query" name:"ResourceOwnerAccount"`
	GroupId              requests.Integer `position:"Query" name:"GroupId"`
	OwnerId              requests.Integer `position:"Query" name:"OwnerId"`
	PoolKey              string           `position:"Query" name:"PoolKey"`
	OperateType          string           `position:"Query" name:"OperateType"`
}

// OperateAxgGroupResponse is the response struct for api OperateAxgGroup
type OperateAxgGroupResponse struct {
	*responses.BaseResponse
	Code      string `json:"Code" xml:"Code"`
	Message   string `json:"Message" xml:"Message"`
	RequestId string `json:"RequestId" xml:"RequestId"`
}

// CreateOperateAxgGroupRequest creates a request to invoke OperateAxgGroup API
func CreateOperateAxgGroupRequest() (request *OperateAxgGroupRequest) {
	request = &OperateAxgGroupRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("Dyplsapi", "2017-05-25", "OperateAxgGroup", "", "")
	request.Method = requests.POST
	return
}

// CreateOperateAxgGroupResponse creates a response to parse from OperateAxgGroup response
func CreateOperateAxgGroupResponse() (response *OperateAxgGroupResponse) {
	response = &OperateAxgGroupResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}

repository: aliyun/alibaba-cloud-sdk-go

repo_name: aliyun/alibaba-cloud-sdk-go

gha_language: Go

extension: go


text:
PR = "r1"
DESCRIPTION = "The GNU Compiler Collection - MinGW port"
HOMEPAGE = "http://www.mingw.org/"

DEFAULT_PREFERENCE = "-1"
DEFAULT_PREFERENCE_mingw32 = "1"

inherit autotools gettext

require gcc-common.inc
require gcc-package-sdk.inc

SRC_URI = "${SOURCEFORGE_MIRROR}/mingw/gcc-core-${PV}-src.tar.gz;name=core \
	   ${SOURCEFORGE_MIRROR}/mingw/gcc-g++-${PV}-src.tar.gz;name=g++ \
	   ${SOURCEFORGE_MIRROR}/mingw/gcc-g77-${PV}-src.tar.gz;name=g77 \
	   ${SOURCEFORGE_MIRROR}/mingw/gcc-java-${PV}-src.tar.gz;name=java \
	   ${SOURCEFORGE_MIRROR}/mingw/gcc-objc-${PV}-src.tar.gz;name=objc \
	   ${SOURCEFORGE_MIRROR}/mingw/gcc-ada-${PV}-src.tar.gz;name=ada \
	   file://includedir.patch \
"

require mingw-gcc-build.inc

SRC_URI[core.md5sum] = "d0dc9d57d493889bc1ca88b127290b9d"
SRC_URI[core.sha256sum] = "a21c2f48bb48d62935ee955ac8fa318658861f6316f30feb3cdec5337abf7f05"
SRC_URI[g++.md5sum] = "ca81c8420ab9d1d05ff9c73a9d4f7d63"
SRC_URI[g++.sha256sum] = "d54078fdccaa3776927b3931c15b880c43e76cb6a0fb59594d1b85cfc89356e9"
SRC_URI[g77.md5sum] = "57d489658743f0d9048e440b312740c8"
SRC_URI[g77.sha256sum] = "3ea32832e07571be317cdb1f9b9dc678a51ad2c2f066f91e155c449d0cf7d796"
SRC_URI[java.md5sum] = "96b039f4e11bff4d3d8a4e7da6e3998d"
SRC_URI[java.sha256sum] = "ec7a963c0dfd986697350be26e53577b0a39c86970b4e9485d85ca99b0cb2197"
SRC_URI[objc.md5sum] = "2bffc1e314f2efb1034b3d3ea1ce2f7d"
SRC_URI[objc.sha256sum] = "a8a3c0f0a38f819b87ff9282f1e40536f5050153f0f60db5c869509a70497c2c"
SRC_URI[ada.md5sum] = "30154205636c12c6abcc462ce07550cf"
SRC_URI[ada.sha256sum] = "404358fe19326679f602de6f7d6a2db180e27af83813150f58ab28eec197b646"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD


text:
#include "Eris.h"

#include <SPI.h>

namespace ADS131{

  //------------- Configuration
  uint8_t regs[] = {CONFIG1_ID, CONFIG2_ID, CONFIG3_ID, FAULT_ID,
                    CH0_ID, CH1_ID, CH2_ID, CH3_ID, CH4_ID, CH5_ID,
                    CH6_ID, CH7_ID};
  uint8_t sets[] = {CONFIG1_1K, CONFIG2, CONFIG3_BI, FAULT, CH0_1,
                    CH0_1, CH0_1, CH0_1, CH0_1, CH0_1,
                    CH0_1, CH0_1};
  uint8_t vref = 2.4;
  uint8_t gain = 1;

  //------------- GPIO pins
  int ss0 = PIN_ADC0_SS;
  int drdy0 = PIN_ADC0_DRDY;
  int start0 = PIN_ADC0_START;
  int reset0 = PIN_ADC0_RESET;
  int pwdn0 = PIN_ADC0_PWDN;

  //------------- SPI setup
  SPISettings SPIconfig(16000000, MSBFIRST, SPI_MODE1);

  //---------------- Collection vars ----------------------
  uint8_t byteCount = 0;
  uint8_t SPIbuffer[32];

  static binary_semaphore_t xConvertBytesSemaphore;
  thread_t *convertBytes;

  long data_temp; //uint32_t
  bool configStatus = false;
  long startTime = 0;

  ErisBuffer<EMGSample_t> buffer;

//------------- Internal helper functions
  void transferBytes(int numBytes)
  {
    //helper function to transfer data in SPIbuffer over SPI
    /*
    for(int i = 0; i < numBytes; i++)
    {
      Serial.println("Byte " + String(i) + " sent (HEX, BIN): " + String(SPIbuffer[i], HEX) + ", " + String(SPIbuffer[i], BIN));
    }
    */
    digitalWrite(ss0, LOW);
    delayMicroseconds(2);
    for(int i = 0; i < numBytes; i++)
    {
      SPIbuffer[i] = SPI.transfer(SPIbuffer[i]);
      delayMicroseconds(2);
    }
    delayMicroseconds(2);
    digitalWrite(ss0, HIGH);

    /*
    for(int i = 0; i < numBytes; i++)
    {
      Serial.println("Byte " + String(i) + " returned (BIN): " + String(SPIbuffer[i], BIN));
    }
    */
  }

  void startup()
  {
    //startup sequence
    digitalWrite(pwdn0, HIGH);
    digitalWrite(start0, HIGH);

    //CLKSEL pin tied high
    delayMicroseconds(100);

    digitalWrite(reset0, HIGH);
    delayMicroseconds(100);
    digitalWrite(start0, LOW);

    delay(3);//delay(ms)
    SPIbuffer[0] = SDATAC;
    transferBytes(1);

    configStatus = reset_config();
  }

  void collectData()
  {
    chSysLockFromISR();

    memset(SPIbuffer,0,sizeof(SPIbuffer));
    digitalWrite(ss0, LOW);
    SPI.transfer(SPIbuffer, 27);
    digitalWrite(ss0, HIGH);

    chBSemSignalI(&xConvertBytesSemaphore);
    chSysUnlockFromISR();
  }

  static THD_WORKING_AREA(waConvertBytes_T, 256);
  static THD_FUNCTION(ConvertBytes_T, arg) {
    //take it initially
    chBSemWait(&xConvertBytesSemaphore);

    while(1) {

      chBSemWait(&xConvertBytesSemaphore);

      chSysLockFromISR();

      EMGSample_t sample;
      sample.timestamp=(float)(micros() - t0)/1000.0 ;

      for(int chan = 0; chan < EMG_NUMCHANNELS; chan++)
      {
        //convert bytes to voltage readings
        data_temp = (((long)(signed char)(SPIbuffer[3*chan + 3])) << 16) | (((long)(SPIbuffer[3*chan + 4])) << 8) | ((long)(SPIbuffer[3*chan + 5]));
        sample.ch[chan]=2*(vref)*(data_temp)/(pow(2, 24)-1);
      }
      buffer.append(sample);
      chSysUnlockFromISR();
    }
  }

//-------------- Externally callable functions
  bool reset_config()
  {
    //--------- reset sequence
    digitalWrite(reset0, LOW);
    delay(500);
    digitalWrite(reset0, HIGH);
    delay(500);
    //start/stop collecting
    SPIbuffer[0] = RDATAC;
    transferBytes(1);//enable read data continuous mode
    delay(2);
    digitalWrite(start0, HIGH);
    delay(10);
    digitalWrite(start0, LOW);
    delay(2);
    SPIbuffer[0] = SDATAC;
    transferBytes(1);//disable read data continuous mode

    //-------- configure ADC
    for(uint8_t i = 0; i < (sizeof(regs)/sizeof(regs[0])); i++)
    {
      //write
      SPIbuffer[0] = WREG << 4 | regs[i];
      SPIbuffer[1] = 0;
      SPIbuffer[2] = sets[i];
      transferBytes(3);

      //verify
      SPIbuffer[0] = RREG << 4 | regs[i];
      SPIbuffer[1] = 0;
      SPIbuffer[2] = 0;
      transferBytes(3);

      int8_t diff = SPIbuffer[2] - sets[i];//last bit on CONFIG3 register can return either 0 or 1
      if(abs(diff) > 2)//DONT DO MATH INSIDE ABS() -- incorrect
      {
         return false;
      }
    }
    return true;
  }

  void startCollecting()
  {
    if (configStatus) {
      SPIbuffer[0] = RDATAC;
      transferBytes(1);//enable read data continuous mode
      attachInterrupt(digitalPinToInterrupt(drdy0), collectData, FALLING);
      digitalWrite(start0, HIGH);
      startTime = micros();
    } else {
      eriscommon::printText("ADC configuration failed");
    }
  }

  void stopCollecting()
  {
    digitalWrite(start0, LOW);
    detachInterrupt(drdy0);
    SPIbuffer[0] = SDATAC;
    transferBytes(1);//disable read data continuous mode
  }

  void start()
  {
    SPI.beginTransaction(SPIconfig);

    //Set up pins
    pinMode(ss0, OUTPUT);
    pinMode(drdy0, INPUT);
    pinMode(start0, OUTPUT);
    pinMode(pwdn0, OUTPUT);
    pinMode(reset0, OUTPUT);

    digitalWrite(ss0, HIGH);
    digitalWrite(reset0, LOW);
    digitalWrite(pwdn0, LOW);
    digitalWrite(start0, LOW);

    //Initialize buffers
    buffer.init();

    startup();

    chBSemObjectInit(&xConvertBytesSemaphore, true);
    convertBytes = chThdCreateStatic(waConvertBytes_T, sizeof(waConvertBytes_T),
                                        NORMALPRIO, ConvertBytes_T, NULL);
  }
}

repository: JonathanCamargo/Eris

repo_name: JonathanCamargo/Eris


text:
package lade

import "strconv"

var _ AppService = new(AppClient)

type AppClient struct {
	client *Client
}

type AppCreateOpts struct {
	Name     string `json:"name"`
	RegionID string `json:"region_id"`
}

type AppService interface {
	Create(opts *AppCreateOpts) (*App, error)
	Delete(app *App) error
	Get(id string) (*App, error)
	Head(id string) error
	List() ([]*App, error)
}

func (a *AppClient) Create(opts *AppCreateOpts) (app *App, err error) {
	app = new(App)
	err = a.client.doCreate("apps", opts, app)
	return
}

func (a *AppClient) Delete(app *App) error {
	return a.client.doDelete("apps/"+strconv.Itoa(app.ID), nil)
}

func (a *AppClient) Get(id string) (app *App, err error) {
	app = new(App)
	err = a.client.doByID("apps", id, nil, app)
	return
}

func (a *AppClient) Head(id string) error {
	return a.client.doByID("apps", id, nil, nil)
}

func (a *AppClient) List() (apps []*App, err error) {
	err = a.client.doList("apps", nil, &apps)
	return
}

repository: lade-io/go-lade

repo_name: lade-io/go-lade


text:
SECTION = "devel/chicken"
DESCRIPTION = "Client interface to the Memcached protocol."
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://memcached.meta;md5=bfe1c09a5b91a2d9869d535bcfc063e4"
DEPENDS_append_class-cross = " chicken-egg-s11n-cross"
DEPENDS_append_class-crosssdk = " chicken-egg-s11n-crosssdk"
DEPENDS_append_class-nativesdk = " nativesdk-chicken-egg-s11n chicken-egg-s11n-crosssdk"
DEPENDS = " chicken-egg-s11n chicken-egg-s11n-cross"
RDEPENDS_${PN} = " chicken-egg-s11n"

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

SRC_URI[md5sum] = "ad85d452059346e3d1c86ff448f2ed7b"
SRC_URI[sha256sum] = "1b45da189fb156ed26a6008f16f615c8636a69bb680f376b9b116a8eee109404"

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

inherit chicken_install

BBCLASSEXTEND = "cross crosssdk nativesdk"

repository: OSSystems/meta-chicken

repo_name: OSSystems/meta-chicken


text:
SUMMARY = "Python evdev lib"
HOMEPAGE = "https://github.com/gvalkov/python-evdev"
SECTION = "devel/python"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://LICENSE;md5=18debddbb3f52c661a129724a883a8e2"

SRC_URI = "https://github.com/gvalkov/python-evdev/archive/v${PV}.zip"

SRC_URI[md5sum] = "24e4ffa98e338b535eae44d91d609005"
SRC_URI[sha256sum] = "61f6893d80da87a995e5781c74d22a39448b1b32004ffac2f31817017709be04"

inherit setuptools

repository: reMarkable/meta-openembedded

repo_name: reMarkable/meta-openembedded

branch_name: refs/heads/zero-gravitas

gha_language: BitBake


text:
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2020-02-05 16:58:20.873302 +0700 WIB m=+0.064884327

package docs

import (
	"bytes"
	"encoding/json"
	"strings"

	"github.com/alecthomas/template"
	"github.com/swaggo/swag"
)

var doc = `{
    "schemes": {{ marshal .Schemes }},
    "swagger": "2.0",
    "info": {
        "description": "{{.Description}}",
        "title": "{{.Title}}",
        "termsOfService": "http://swagger.io/terms/",
        "contact": {
            "name": "API Support",
            "url": "-",
            "email": "bismobaruno@gmail.com"
        },
        "license": {
            "name": "Apache 2.0",
            "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
        },
        "version": "{{.Version}}"
    },
    "host": "{{.Host}}",
    "basePath": "{{.BasePath}}",
    "paths": {
        "/user": {
            "get": {
                "description": "get list of user data",
                "produces": [
                    "application/json"
                ],
                "summary": "User List",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Language message response",
                        "name": "Accept-Language",
                        "in": "header"
                    },
                    {
                        "type": "integer",
                        "description": "Limit per page",
                        "name": "per_page",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "Page number",
                        "name": "page",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Select field",
                        "name": "select_field",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Sort by",
                        "name": "order_by",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/model.UsersResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/model.GenericResponse"
                        }
                    }
                }
            },
            "post": {
                "description": "create user data",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "summary": "User Create",
                "parameters": [
                    {
                        "type": "string",
                        "description": "language message response",
                        "name": "Accept-Language",
                        "in": "header"
                    },
                    {
                        "description": "Request Payload",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/form.UserForm"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/model.UserResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/model.GenericResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/model.GenericResponse"
                        }
                    }
                }
            }
        },
        "/user/{id}": {
            "get": {
                "description": "get user data by ID",
                "produces": [
                    "application/json"
                ],
                "summary": "User Detail",
                "parameters": [
                    {
                        "type": "string",
                        "description": "language message response",
                        "name": "Accept-Language",
                        "in": "header"
                    },
                    {
                        "type": "string",
                        "description": "User ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/model.UserResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/model.GenericResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/model.GenericResponse"
                        }
                    }
                }
            },
            "put": {
                "description": "update user data",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "summary": "User Update",
                "parameters": [
                    {
                        "type": "string",
                        "description": "language message response",
                        "name": "Accept-Language",
                        "in": "header"
                    },
                    {
                        "type": "string",
                        "description": "User ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Request Payload",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/form.UserForm"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/model.UserResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/model.GenericResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/model.GenericResponse"
                        }
                    }
                }
            },
            "delete": {
                "description": "delete user data by ID",
                "produces": [
                    "application/json"
                ],
                "summary": "User Delete",
                "parameters": [
                    {
                        "type": "string",
                        "description": "User ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "language message response",
                        "name": "Accept-Language",
                        "in": "header"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/model.GenericResponse"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/model.GenericResponse"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/model.GenericResponse"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "form.UserForm": {
            "type": "object",
            "properties": {
                "address": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "phone": {
                    "type": "string"
                }
            }
        },
        "model.GenericResponse": {
            "type": "object",
            "properties": {
                "messages": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "status": {
                    "type": "integer"
                },
                "success": {
                    "type": "boolean"
                }
            }
        },
        "model.UserModel": {
            "type": "object",
            "properties": {
                "address": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "phone": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                }
            }
        },
        "model.UserPaginationResponse": {
            "type": "object",
            "properties": {
                "list": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.UserModel"
                    }
                },
                "page": {
                    "type": "integer"
                },
                "per_page": {
                    "type": "integer"
                },
                "total_data": {
                    "type": "integer"
                },
                "total_page": {
                    "type": "integer"
                }
            }
        },
        "model.UserResponse": {
            "type": "object",
            "properties": {
                "data": {
                    "type": "object",
                    "$ref": "#/definitions/model.UserModel"
                },
                "messages": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "status": {
                    "type": "integer"
                },
                "success": {
                    "type": "boolean"
                }
            }
        },
        "model.UsersResponse": {
            "type": "object",
            "properties": {
                "data": {
                    "type": "object",
                    "$ref": "#/definitions/model.UserPaginationResponse"
                },
                "messages": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "status": {
                    "type": "integer"
                },
                "success": {
                    "type": "boolean"
                }
            }
        }
    }
}`

type swaggerInfo struct {
	Version     string
	Host        string
	BasePath    string
	Schemes     []string
	Title       string
	Description string
}

// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{
	Version:     "1.0.0",
	Host:        "",
	BasePath:    "/api/v1",
	Schemes:     []string{},
	Title:       "Simple REST API",
	Description: "This is a documentation of Simple REST API.",
}

type s struct{}

func (s *s) ReadDoc() string {
	sInfo := SwaggerInfo
	sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)

	t, err := template.New("swagger_info").Funcs(template.FuncMap{
		"marshal": func(v interface{}) string {
			a, _ := json.Marshal(v)
			return string(a)
		},
	}).Parse(doc)
	if err != nil {
		return doc
	}

	var tpl bytes.Buffer
	if err := t.Execute(&tpl, sInfo); err != nil {
		return doc
	}

	return tpl.String()
}

func init() {
	swag.Register(swag.Name, &s{})
}


text:
#ifndef GMOD_GAMERULES_H
#define GMOD_GAMERULES_H
#include "../hl2mp/hl2mp_gamerules.h"
#include "../../Garry's Mod/GLUA/LuaObject/CLuaObject.h"

/*

	members in inherited by classes are mostlikely incorrect judging by how much space
	this takes up in memory.

*/
class CGMODRules : public CHL2MPRules
{
public:
	/*163 - 652*/virtual void CleanUpMap(GarrysMod::Lua::CLuaObject&);
};

#endif


text:
# Copyright 2021 NXP

require recipes-bsp/u-boot/u-boot.inc
require real-time-edge-baremetal-env.inc
inherit fsl-u-boot-localversion

SUMMARY = "U-boot-baremetal provided by NXP"
LICENSE = "GPLv2 & BSD-3-Clause & BSD-2-Clause & LGPL-2.0 & LGPL-2.1"
LIC_FILES_CHKSUM = " \
    file://Licenses/gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
    file://Licenses/bsd-2-clause.txt;md5=6a31f076f5773aabd8ff86191ad6fdd5 \
    file://Licenses/bsd-3-clause.txt;md5=4a1190eac56a9db675d58ebe86eaf50c \
    file://Licenses/lgpl-2.0.txt;md5=5f30f0716dfdd0d91eb439ebec522ec2 \
    file://Licenses/lgpl-2.1.txt;md5=4fbd65380cdd255951079008b364516c \
"

PROVIDES = "real-time-edge-baremetal"

DEPENDS_append = " libgcc dtc-native bison-native bc-native"

UBOOT_BAREMETAL_BRANCH ?= "baremetal-uboot_v2020.04"
UBOOT_BAREMETAL_SRC ?= "git://github.com/real-time-edge-sw/real-time-edge-uboot.git;protocol=https"
SRC_URI = "${UBOOT_BAREMETAL_SRC};branch=${UBOOT_BAREMETAL_BRANCH}"

SRCREV = "fecd3b0ee3ad1148c86841bb2b2b0f45445d9bfd"

S = "${WORKDIR}/git"
B = "${S}"

UBOOT_BAREMETAL_DEFCONFIG ?= ""
DELTA_UBOOT_BAREMETAL_DEFCONFIG ?= ""
UBOOT_BAREMETAL_MAKE_TARGET ?= "all"
UBOOT_BAREMETAL_BINARY ?= "u-boot.bin"
UBOOT_BAREMETAL_RENAME ?= "bm-${UBOOT_BAREMETAL_BINARY}"
PACKAGE_ARCH = "${MACHINE_ARCH}"

do_configure () {
    if [ -n "${UBOOT_BAREMETAL_DEFCONFIG}" ]; then
        cp ${S}/configs/${UBOOT_BAREMETAL_DEFCONFIG} ${B}/.config
        for deltacfg in ${DELTA_UBOOT_BAREMETAL_DEFCONFIG}; do
            ${S}/scripts/kconfig/merge_config.sh -m .config ${deltacfg}
        done
        cp ${B}/.config ${S}/configs/${UBOOT_BAREMETAL_DEFCONFIG}

        oe_runmake -C ${S} O=${B} ${UBOOT_BAREMETAL_DEFCONFIG}
    fi
    DEVTOOL_DISABLE_MENUCONFIG=true
}

do_compile () {
    if [ -n "${UBOOT_BAREMETAL_DEFCONFIG}" ]; then
        oe_runmake -C ${S} ${UBOOT_MAKE_TARGET}
        cp ${B}/${UBOOT_BINARY} ${B}/${UBOOT_BAREMETAL_RENAME}
    fi
}

do_install () {
    if [ -n "${UBOOT_BAREMETAL_DEFCONFIG}" ]; then
        install -D -m 644 ${B}/${UBOOT_BAREMETAL_RENAME} ${D}/boot/${UBOOT_BAREMETAL_RENAME}
    fi
}

do_deploy () {
    if [ -n "${UBOOT_BAREMETAL_DEFCONFIG}" ]; then
        install -D -m 644 ${B}/${UBOOT_BAREMETAL_RENAME} ${DEPLOYDIR}/${UBOOT_BAREMETAL_RENAME}
    fi
}

COMPATIBLE_MACHINE = "qoriq|imx"


text:
/*
 * Copyright 2019 Rockchip Electronics Co. LTD
 *
 * 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.
 *
 * Author: martin.cheng@rock-chips.com
 *   Date: 2019/03/10
 *   Task: build player streamline with node bus.
 */

#include <string.h>           // NOLINT
#include "rt_header.h"        // NOLINT
#include "RTNDKNodePlayer.h"  // NOLINT
#include "RTNDKMediaDef.h"    // NOLINT

UINT32 RTMediaDirector::mLogLevel = RT_LOG_LEVEL_FULL;

typedef struct _rt_media_state {
    UINT32      state;
    const char *name;
} rt_media_state;

#define RT_STATE_MAX  9
static const rt_media_state gStateNames[] = {
    { RT_STATE_ERROR,           "STATE_ERROR" },
    { RT_STATE_IDLE,            "STATE_IDLE" },
    { RT_STATE_INITIALIZED,     "STATE_INITIALIZED" },
    { RT_STATE_PREPARING,       "STATE_PREPARING" },
    { RT_STATE_PREPARED,        "STATE_PREPARED" },
    { RT_STATE_STARTED,         "STATE_STARTED" },
    { RT_STATE_PAUSED,          "STATE_PAUSED" },
    { RT_STATE_STOPPED,         "STATE_STOPPED" },
    { RT_STATE_COMPLETE,        "STATE_COMPLETE" },
};

const char* RTMediaUtil::getStateName(UINT32 state) {
    for (UINT32 idx = 0; idx < RT_STATE_MAX; idx++) {
        if (gStateNames[idx].state == state) {
            return gStateNames[idx].name;
        }
    }
    return "STATE_UNKOWN";
}

void RTMediaUtil::dumpStateError(UINT32 state, const char* caller) {
    switch (RTMediaDirector::getLogLevel()) {
      case RT_LOG_LEVEL_WARRING:
      case RT_LOG_LEVEL_ERROR:
      case RT_LOG_LEVEL_FETAL:
        RT_LOGE("fail to %s, invalid state(%d)", caller, state);
        break;
      case RT_LOG_LEVEL_FULL:
        RT_LOGE("fail to %s, invalid state(%s)", caller, getStateName(state));
        break;
      default:
        break;
    }
}

RTProtocolType RTMediaUtil::getMediaProtocol(const char* uri) {
    RTProtocolType protocol = RT_PROTOCOL_NONE;
    if ((RT_NULL == uri) || (strlen(uri) < 4)) {
        return protocol;
    }

    if (!strncasecmp("http://", uri, 7) || !strncasecmp("https://", uri, 8)) {
        RT_LOGD("uri is with https or http protocol");
        protocol = RT_PROTOCOL_HTTP;
    } else if (!strncasecmp("rtsp://", uri, 7) || !strncasecmp("rtmp://", uri, 7)) {
        RT_LOGD("uri is with rtsp or rtmp protocol");
        protocol = RT_PROTOCOL_RTSP;
    } else if (!strncasecmp("/data/smb/", uri, 10)) {
        RT_LOGD("uri is with /data/smb protocol");
        protocol = RT_PROTOCOL_SAMBA;
    } else if (!strncasecmp("/data/nfs/", uri, 10)) {
        RT_LOGD("uri is with /data/nfs protocol (signed as samba)");
        protocol = RT_PROTOCOL_SAMBA;
    } else if (strstr(uri, "m3u8")) {
        RT_LOGD("uri is with m3u8 protocol");
        protocol = RT_PROTOCOL_HLS;
    } else if (!strncasecmp("rtp:", uri, 4)) {
        RT_LOGD("uri is with rtp protocol");
        protocol = RT_PROTOCOL_RTP;
    } else if (!strncasecmp("udp:", uri, 4)) {
        RT_LOGD("uri is with udp protocol");
        protocol = RT_PROTOCOL_UDP;
    } else if (!strncasecmp("mms://", uri, 6)) {
        RT_LOGD("uri is with mms protocol");
        protocol = RT_PROTOCOL_MMS;
    } else if (!strncasecmp("mmsh://", uri, 7)) {
        RT_LOGD("uri is with mmsh protocol");
        protocol = RT_PROTOCOL_MMSH;
    } else if (!strncasecmp("mmst://", uri, 7)) {
        RT_LOGD("uri is with mmst protocol");
        protocol = RT_PROTOCOL_MMST;
    } else if (strstr(uri, "app_tts-cache")) {
        RT_LOGD("uri is with tts protocol");
        protocol = RT_PROTOCOL_TTS;
    }
    return protocol;
}

RTMediaDirector::RTMediaDirector() {
    rt_memset(&mParmasLast, 0, sizeof(RTMediaParams));
    rt_memset(&mParmasCurr, 0, sizeof(RTMediaParams));
}

RTMediaDirector::~RTMediaDirector() {
    rt_memset(&mParmasLast, 0, sizeof(RTMediaParams));
    rt_memset(&mParmasCurr, 0, sizeof(RTMediaParams));
}

void RTMediaDirector::snapshot() {
    if (mParmasCurr.mCountPacket == mParmasLast.mCountPacket) {
        RT_LOGE("fail, no media packet");
    }
    if (mParmasCurr.mCountFrame == mParmasLast.mCountFrame) {
        RT_LOGE("fail, no media frame");
    }
    if (mParmasCurr.mCountDisplay == mParmasLast.mCountDisplay) {
        RT_LOGE("fail, no frame displayed");
    }
    if (mParmasCurr.mCountDeliver == mParmasLast.mCountDeliver) {
        RT_LOGE("fail, no data delivered");
    }
    rt_memcpy(&mParmasLast, &mParmasCurr, sizeof(RTMediaParams));
}

void RTMediaDirector::updatePacket(UINT32 delta /* = 1*/) {
    mParmasCurr.mCountPacket += 1;
}

void RTMediaDirector::updateFrame(UINT32 delta /* = 1*/) {
    mParmasCurr.mCountFrame += 1;
}

void RTMediaDirector::updateDisplay(UINT32 delta /* = 1*/) {
    mParmasCurr.mCountDisplay += 1;
}

void RTMediaDirector::updateDelivery(UINT32 delta /* = 1*/) {
    mParmasCurr.mCountDeliver += 1;
}

repository: nvisa/Rockit

repo_name: nvisa/Rockit


text:
package trade

import (
    "github.com/bububa/opentaobao/core"
    "github.com/bububa/opentaobao/model/trade"
)

/*
查询卖家已卖出的交易数据（根据创建时间）
taobao.trades.sold.get

搜索当前会话用户作为卖家已卖出的交易数据（只能获取到三个月以内的交易信息）

1. 返回的数据结果是以订单的创建时间倒序排列的。

2. 返回的数据结果只包含了订单的部分数据，可通过taobao.trade.fullinfo.get获取订单详情。

注意：type字段的说明，如果该字段不传，接口默认只查4种类型订单，非默认查询的订单是不返回。遇到订单查不到的情况的，解决办法就是type加上订单类型就可正常返回了。

点击查看更多交易API说明
*/
func TaobaoTradesSoldGet(clt *core.SDKClient, req *trade.TaobaoTradesSoldGetRequest, session string) (*trade.TaobaoTradesSoldGetAPIResponse, error) {
    var resp trade.TaobaoTradesSoldGetAPIResponse
    err := clt.Post(req, &resp, session)
    if err != nil {
        return nil, err
    }
    return &resp, nil
}

repository: phpyandong/opentaobao

repo_name: phpyandong/opentaobao

branch_name: refs/heads/main


text:
package restclient

import (
	"bytes"
	"crypto/tls"
	"errors"
	"io/ioutil"
	"log"
	"mime/multipart"
	"net/http"
	"os"
	"strconv"
	"time"
)

type Endpoint struct {
	Host   string
	Path   string
	Method string
	Body   string
	Token  string
	File   string
	Form   string
}

type Response struct {
	TimeTaken  string
	Endpoint   Endpoint
	Result     string
	StatusCode string
}

// Latency returns the endpoint latency number
func (endpoint Endpoint) Do() (R Response, err error) {

	var statusCode int
	var res string

	url := endpoint.Host + endpoint.Path
	start := time.Now()

	if endpoint.File == "" {
		res, statusCode = httpClient(url,
			[]byte(endpoint.Body),
			endpoint.Method,
			endpoint.Token)
	} else {

		file, err := os.Open(endpoint.File)
		if err != nil {
			return R, err
		}
		defer file.Close()

		fileContents, err := ioutil.ReadAll(file)
		if err != nil {
			return R, err
		}

		fi, err := file.Stat()
		if err != nil {
			return R, err
		}
		file.Close()

		body := new(bytes.Buffer)
		writer := multipart.NewWriter(body)

		part, err := writer.CreateFormFile(endpoint.Form, fi.Name())
		if err != nil {
			return R, err
		}

		part.Write(fileContents)

		err = writer.Close()
		if err != nil {
			return R, err
		}

		tr := &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		}

		client := &http.Client{
			Transport: tr,
		}

		req, _ := http.NewRequest(endpoint.Method, endpoint.Host+endpoint.Path, body)
		req.Header.Add("Content-Type", writer.FormDataContentType())
		req.Header.Set("Authorization", endpoint.Token)

		resp, err := client.Do(req)
		if err != nil {
			return R, err
		}
		defer resp.Body.Close()

		r, err := ioutil.ReadAll(resp.Body)
		if err != nil {
			return R, err
		}

		res = string(r)
	}

	elapsed := time.Since(start)

	// error on the following status codes
	switch statusCode {
	case 400:
		return R, errors.New("status : bad request")
	case 500:
		return R, errors.New("status : internal server error")
	case 403:
		return R, errors.New("status : forbidden")
	case 401:
		return R, errors.New("status : unauthorized")
	}

	R.Endpoint = endpoint
	R.TimeTaken = elapsed.String()
	R.Result = res
	R.StatusCode = strconv.Itoa(statusCode)

	return R, nil
}

func httpClient(url string, jsonData []byte, httpMethod string, authToken string) (apiResponse string, statusCode int) {

	var jsonStr = jsonData
	req, err := http.NewRequest(httpMethod, url, bytes.NewBuffer(jsonStr))
	// Disable keep-alive
	req.Close = true

	// If we got a auth token set it.
	if authToken != "" {
		req.Header.Set("Authorization", authToken)
		// e.Customer.Username, _ = auth.Token(authToken)
	}
	req.Header.Set("Content-Type", "application/json")

	// Build the client and do the request with a 1 minute timeout
	timeout := time.Duration(60 * time.Second)

	tr := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}

	client := &http.Client{
		Timeout:   timeout,
		Transport: tr,
	}

	resp, err := client.Do(req)

	if err != nil {
		log.Println("[ util/ClientRest ] " + url + " unreachable")
		return "", 500
	}
	defer resp.Body.Close()

	body, _ := ioutil.ReadAll(resp.Body)

	return string(body), resp.StatusCode
}

repository: pcittadini/gotick

repo_name: pcittadini/gotick


text:
DESCRIPTION = "Knowledge of GHC's installation directories"
SECTION = "devel"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM ?= "file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9"

SRCREV = "7ec445424f169841ddb5316b7437675d8881f486"
SRC_URI = "git://github.com/simonmar/ghc-paths.git;protocol=https;branch=master"

S = "${WORKDIR}/git"

inherit haskell haskell-package

BBCLASSEXTEND = "native nativesdk"

repository: miketsukerman/meta-haskell

repo_name: miketsukerman/meta-haskell


text:
// Explorer.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "Explorer.h"
//#include <vld.h> //Debug kiểm tra leak bộ nhớ sử dụng: Visual Leak Detector for Visual C++ 2008 - 2015

int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
	_In_opt_ HINSTANCE hPrevInstance,
	_In_ LPWSTR    lpCmdLine,
	_In_ int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	// TODO: Place code here.

	// Initialize global strings
	LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadStringW(hInstance, IDC_EXPLORER, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	// Perform application initialization:
	if (!InitInstance(hInstance, nCmdShow))
	{
		return FALSE;
	}

	HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_EXPLORER));

	MSG msg;

	// Main message loop:
	while (GetMessage(&msg, nullptr, 0, 0))
	{
		if (!TranslateAccelerator(hwndMain, hAccelTable, &msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}

	return (int)msg.wParam;
}

//
//  FUNCTION: MyRegisterClass()
//
//  PURPOSE: Registers the window class.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
	WNDCLASSEXW wcex;

	wcex.cbSize = sizeof(WNDCLASSEX);

	wcex.style = CS_HREDRAW | CS_VREDRAW;
	wcex.lpfnWndProc = WndProc;
	wcex.cbClsExtra = 0;
	wcex.cbWndExtra = 0;
	wcex.hInstance = hInstance;
	wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_EXPLORER));
	wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
	wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
	wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_EXPLORER);
	wcex.lpszClassName = szWindowClass;
	wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

	return RegisterClassExW(&wcex);
}

//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
	hInst = hInstance; // Store instance handle in our global variable
	const int BUFFERSIZE = 260;
	WCHAR buffer[BUFFERSIZE];
	GetCurrentDirectory(BUFFERSIZE, buffer);

	std::wstring configPath = buffer;
	configPath += L"\\";
	/*int strlen = configPath.length();

	while (configPath[strlen - 1] != _T('\\'))
	{
		strlen--;
	}
	configPath = configPath.substr(0, strlen);*/
	configPath += CONFIG_FILE;

	GetPrivateProfileString(L"Screen Resolution", L"Width", L"-2147483648", buffer, BUFFERSIZE, const_cast<LPWSTR>(configPath.c_str()));
	int width = std::stoi(buffer);

	GetPrivateProfileString(L"Screen Resolution", L"Height", L"0", buffer, BUFFERSIZE, const_cast<LPWSTR>(configPath.c_str()));
	int height = std::stoi(buffer);

	HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT, 0, width, height, nullptr, nullptr, hInstance, nullptr);

	hwndMain = hWnd;

	if (!hWnd)
	{
		return FALSE;
	}

	ShowWindow(hWnd, nCmdShow);
	UpdateWindow(hWnd);

	return TRUE;
}

//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND  - process the application menu
//  WM_PAINT    - Paint the main window
//  WM_DESTROY  - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
		HANDLE_MSG(hWnd, WM_CREATE, OnCreate);
		HANDLE_MSG(hWnd, WM_NOTIFY, OnNotify);
		HANDLE_MSG(hWnd, WM_COMMAND, OnCommand);
		HANDLE_MSG(hWnd, WM_PAINT, OnPaint);
		HANDLE_MSG(hWnd, WM_DESTROY, OnDestroy);
		HANDLE_MSG(hWnd, WM_SIZE, OnSize);
		HANDLE_MSG(hWnd, WM_MOUSEMOVE, OnMouseMove);
		HANDLE_MSG(hWnd, WM_LBUTTONDOWN, OnLButtonDown);
		HANDLE_MSG(hWnd, WM_LBUTTONUP, OnLButtonUp);
		HANDLE_MSG(hWnd, WM_CLOSE, OnClose);

	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}

// Message handler for about box.
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	UNREFERENCED_PARAMETER(lParam);
	switch (message)
	{
	case WM_INITDIALOG:
		return (INT_PTR)TRUE;

	case WM_COMMAND:
		if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
		{
			EndDialog(hDlg, LOWORD(wParam));
			return (INT_PTR)TRUE;
		}
		break;
	}
	return (INT_PTR)FALSE;
}

BOOL OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct)
{
	RECT mainWin;
	GetWindowRect(hwnd, &mainWin);

	g_StatusBar = new MyExplorer::StatusBar;
	g_StatusBar->Create(hwnd, IDC_STATUSBAR, hInst);

	g_TreeView = new MyExplorer::TreeView;
	g_TreeView->Create(hwnd, IDC_TREEVIEW, hInst, (mainWin.right - mainWin.left) * 2 / 7, mainWin.bottom - mainWin.top - 10);
	g_TreeView->LoadRoot();
	g_TreeView->SetFocus_();

	g_ListView = new MyExplorer::ListView;
	g_ListView->Create(hwnd, IDC_LISTVIEW, hInst, 0, mainWin.bottom - mainWin.top - 10);
	g_ListView->LoadRoot();

	g_InitComplete = TRUE;

	RECT treeView;
	GetWindowRect(g_TreeView->GetThisHandle(), &treeView);
	nleftWnd_width = treeView.right - treeView.left;

	return TRUE;
}

void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
	switch (id)
	{
	case IDM_ABOUT:
		DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hwnd, About);
		break;

	case IDM_EXIT:
		DestroyWindow(hwnd);
		break;
	}
}

LRESULT OnNotify(HWND hwnd, int idFrom, NMHDR *pnm)
{
	LPNMTOOLBAR lpnmToolBar = (LPNMTOOLBAR)pnm;
	int nCurSelIndex;

	if (g_InitComplete) //Để tránh vòng lặp
	{
		LPNMTREEVIEW lpnmTree = (LPNMTREEVIEW)pnm;

		switch (pnm->code)
		{
		case TVN_ITEMEXPANDING:
			g_TreeView->Expanding(lpnmTree->itemOld.hItem, lpnmTree->itemNew.hItem);

			break;
			//------------------------------------------------------------------------------
		case TVN_SELCHANGED:
			TerminateThread(g_thread_1, 0); // Tránh trường hợp đang load cái cũ giữa chừng load cái mới chồng lên
			CreateThread(NULL, 0, LoadTreeViewExpand, g_TreeView, 0, 0);
			g_thread_1 = CreateThread(NULL, 0, LoadListView, g_ListView, 0, 0);

			break;
		case NM_CLICK:
			if (pnm->hwndFrom == g_ListView->GetThisHandle())
			{
				nCurSelIndex = ListView_GetNextItem(g_ListView->GetThisHandle(), -1, LVNI_FOCUSED);
				if (nCurSelIndex != -1)
					g_ListView->DisplayInfoCurSel();

			}
			break;
		case NM_DBLCLK:
			if (pnm->hwndFrom == g_ListView->GetThisHandle())
			{
				TerminateThread(g_thread_1, 0); // Tránh trường hợp đang load cái cũ giữa chừng load cái mới chồng lên
				TerminateThread(g_thread_2, 0); // Tránh trường hợp đang load cái cũ giữa chừng load cái mới chồng lên
				g_thread_2 = CreateThread(NULL, 0, LoadListViewDBClick, g_ListView, 0, 0);
			}
			break;
		case NM_CUSTOMDRAW: // Khi người dùng kéo thay đổi kích thước TreeView
			if (pnm->hwndFrom == g_TreeView->GetThisHandle())
			{
				g_ListView->Resize();
			}
			break;
		}

	}

	return 0;
}

void OnSize(HWND hwnd, UINT state, int cx, int cy)
{
	g_ListView->Resize();
	g_TreeView->Resize();
	g_StatusBar->Resize();
}

void OnPaint(HWND hwnd)
{
	PAINTSTRUCT ps;
	HDC hdc;
	hdc = BeginPaint(hwnd, &ps);
	EndPaint(hwnd, &ps);
}

void OnClose(HWND hwnd)
{
	const int BUFFERSIZE = 260;
	WCHAR buffer[BUFFERSIZE];
	GetCurrentDirectory(BUFFERSIZE, buffer);

	std::wstring configPath = buffer;
	configPath += L"\\";
	/*int strlen = configPath.length();
	while (configPath[strlen - 1] != _T('\\'))
	{
		strlen--;
	}
	configPath = configPath.substr(0, strlen);*/
	configPath += CONFIG_FILE;

	RECT mainRect;
	GetWindowRect(hwnd, &mainRect);

	std::wstring width = std::to_wstring(mainRect.right - mainRect.left);
	WritePrivateProfileString(L"Screen Resolution", L"Width", const_cast<LPWSTR>(width.c_str()), const_cast<LPWSTR>(configPath.c_str()));

	std::wstring height = std::to_wstring(mainRect.bottom - mainRect.top);
	WritePrivateProfileString(L"Screen Resolution", L"Height", const_cast<LPWSTR>(height.c_str()), const_cast<LPWSTR>(configPath.c_str()));

	DestroyWindow(hwnd);
}

void OnDestroy(HWND hwnd)
{
	PostQuitMessage(0);

	// Giải phóng vùng nhớ đã cấp phát
	delete g_ListView;
	delete g_TreeView;
}

DWORD WINAPI LoadListViewDBClick(LPVOID lpParameter)
{
	MyExplorer::ListView* p = (MyExplorer::ListView*)lpParameter;
	p->LoadCurSel();

	return 0;
}

DWORD WINAPI LoadTreeViewExpand(LPVOID lpParameter)
{
	MyExplorer::TreeView* p = (MyExplorer::TreeView*)lpParameter;
	p->Expand(p->GetCurSel());

	return 0;
}

DWORD WINAPI LoadListView(LPVOID lpParameter)
{
	MyExplorer::ListView* p = (MyExplorer::ListView*)lpParameter;
	p->ClearAll(); //Xóa sạch List View để nạp cái mới
	p->LoadChild(g_TreeView->GetCurPIDL());

	return 0;
}

void OnMouseMove(HWND hwnd, int x, int y, UINT keyFlags)
{
	RECT treeView;
	GetWindowRect(g_TreeView->GetThisHandle(), &treeView);

	RECT listView;
	GetWindowRect(g_ListView->GetThisHandle(), &listView);
	if (keyFlags == MK_LBUTTON)
	{
		if (xSizing)
		{
			if (xSizing)
			{
				nleftWnd_width = x;

				RECT rect;
				GetClientRect(hwnd, &rect);

				MoveWindow(g_TreeView->GetThisHandle(), rect.left,
					rect.top + 0, rect.left + (nleftWnd_width - 2),
					(rect.bottom - (0 + 22)), TRUE);

				MoveWindow(g_ListView->GetThisHandle(), rect.left + nleftWnd_width + 2,
					rect.top + 0, rect.right - (nleftWnd_width + 2),
					rect.bottom - (0 + 22), TRUE);
			}
		}
	}

	if (x >= (treeView.right - treeView.left) && x <= (listView.left - treeView.left))
	{
		SetCursor(LoadCursor(hInst, IDC_SIZEWE));
		ShowCursor(TRUE);
	}
}

void OnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags)
{
	RECT treeView;
	GetWindowRect(g_TreeView->GetThisHandle(), &treeView);

	RECT listView;
	GetWindowRect(g_ListView->GetThisHandle(), &listView);

	xSizing = x >= (treeView.right - treeView.left) && x <= (listView.left - treeView.left);

	if (xSizing)
	{
		SetCapture(hwnd);
		if (xSizing)
		{
			SetCursor(LoadCursor(hInst, IDC_SIZEWE));
			ShowCursor(TRUE);
		}
	}
}

void OnLButtonUp(HWND hwnd, int x, int y, UINT keyFlags)
{
	ReleaseCapture();
	if (xSizing)
	{
		xSizing = FALSE;
	}
}

path: /Source code/Explorer/Explorer.cpp


text:
package controllers

import (
	"log"

	"github.com/aws/aws-sdk-go/service/cognitoidentityprovider"
	"github.com/gin-gonic/gin"
)

type CognitoAPI interface {
	InitiateAuth(input *cognitoidentityprovider.InitiateAuthInput) (*cognitoidentityprovider.InitiateAuthOutput, error)
	RespondToAuthChallenge(input *cognitoidentityprovider.RespondToAuthChallengeInput) (*cognitoidentityprovider.RespondToAuthChallengeOutput, error)
	AssociateSoftwareToken(input *cognitoidentityprovider.AssociateSoftwareTokenInput) (*cognitoidentityprovider.AssociateSoftwareTokenOutput, error)
	SetUserMFAPreference(input *cognitoidentityprovider.SetUserMFAPreferenceInput) (*cognitoidentityprovider.SetUserMFAPreferenceOutput, error)
	VerifySoftwareToken(input *cognitoidentityprovider.VerifySoftwareTokenInput) (*cognitoidentityprovider.VerifySoftwareTokenOutput, error)
}

type App struct {
	cognitoAPI  CognitoAPI
	userPoolID  string
	appClientID string
	Router      *gin.Engine
}

func corsMiddleware() gin.HandlerFunc {
	return func(c *gin.Context) {
		c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
		c.Writer.Header().Set("Access-Control-Max-Age", "86400")
		c.Writer.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, UPDATE, OPTIONS")
		c.Writer.Header().Set("Access-Control-Allow-Headers", "Origin, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization")
		c.Writer.Header().Set("Access-Control-Expose-Headers", "Content-Length")
		c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")

		if c.Request.Method == "OPTIONS" {
			c.AbortWithStatus(200)
		} else {
			c.Next()
		}
	}
}

func NewApp(userPoolID, appClientID string, cognitoAPI CognitoAPI) *App {

	app := &App{
		cognitoAPI:  cognitoAPI,
		userPoolID:  userPoolID,
		appClientID: appClientID,
		Router:      gin.Default(),
	}
	app.Router.Use(corsMiddleware())

	log.Printf("Cold start")
	app.addPingRoutes()
	app.addTokenRoutes()
	app.addMFARoutes()

	return app
}

repository: paujim/cognito-MFA-flow

repo_name: paujim/cognito-MFA-flow


text:
// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package lint

import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"unicode"

	"github.com/emicklei/proto"
	"github.com/uber/prototool/internal/file"
	"github.com/uber/prototool/internal/settings"
	"github.com/uber/prototool/internal/text"
	"go.uber.org/zap"
)

var (
	// AllLinters is the slice of all known Linters.
	AllLinters = []Linter{
		commentsNoCStyleLinter,
		commentsNoInlineLinter,
		enumFieldNamesUppercaseLinter,
		enumFieldNamesUpperSnakeCaseLinter,
		enumFieldPrefixesLinter,
		enumFieldPrefixesExceptMessageLinter,
		enumFieldsHaveCommentsLinter,
		enumFieldsHaveSentenceCommentsLinter,
		enumNamesCamelCaseLinter,
		enumNamesCapitalizedLinter,
		enumZeroValuesInvalidLinter,
		enumZeroValuesInvalidExceptMessageLinter,
		enumsHaveCommentsLinter,
		enumsHaveSentenceCommentsLinter,
		enumsNoAllowAliasLinter,
		fieldsNotReservedLinter,
		fileHeaderLinter,
		fileNamesLowerSnakeCaseLinter,
		fileOptionsCSharpNamespaceSameInDirLinter,
		fileOptionsEqualCSharpNamespaceCapitalizedLinter,
		fileOptionsEqualGoPackageV2SuffixLinter,
		fileOptionsEqualGoPackagePbSuffixLinter,
		fileOptionsEqualJavaMultipleFilesTrueLinter,
		fileOptionsEqualJavaOuterClassnameProtoSuffixLinter,
		fileOptionsEqualJavaPackageComPrefixLinter,
		fileOptionsEqualJavaPackagePrefixLinter,
		fileOptionsEqualOBJCClassPrefixAbbrLinter,
		fileOptionsEqualPHPNamespaceCapitalizedLinter,
		fileOptionsGoPackageNotLongFormLinter,
		fileOptionsGoPackageSameInDirLinter,
		fileOptionsJavaMultipleFilesSameInDirLinter,
		fileOptionsJavaPackageSameInDirLinter,
		fileOptionsOBJCClassPrefixSameInDirLinter,
		fileOptionsPHPNamespaceSameInDirLinter,
		fileOptionsRequireCSharpNamespaceLinter,
		fileOptionsRequireGoPackageLinter,
		fileOptionsRequireJavaMultipleFilesLinter,
		fileOptionsRequireJavaOuterClassnameLinter,
		fileOptionsRequireJavaPackageLinter,
		fileOptionsRequireOBJCClassPrefixLinter,
		fileOptionsRequirePHPNamespaceLinter,
		fileOptionsRequireRubyPackageLinter,
		fileOptionsUnsetJavaMultipleFilesLinter,
		fileOptionsUnsetJavaOuterClassnameLinter,
		gogoNotImportedLinter,
		importsNotPublicLinter,
		importsNotWeakLinter,
		messageFieldsDurationLinter,
		messageFieldsHaveCommentsLinter,
		messageFieldsHaveSentenceCommentsLinter,
		messageFieldsNotFloatsLinter,
		messageFieldsNoJSONNameLinter,
		messageFieldsTimeLinter,
		messageFieldNamesFilenameLinter,
		messageFieldNamesFilepathLinter,
		messageFieldNamesLowerSnakeCaseLinter,
		messageFieldNamesLowercaseLinter,
		messageFieldNamesNoDescriptorLinter,
		messageNamesCamelCaseLinter,
		messageNamesCapitalizedLinter,
		messagesHaveCommentsLinter,
		messagesHaveCommentsExceptRequestResponseTypesLinter,
		messagesHaveSentenceCommentsExceptRequestResponseTypesLinter,
		messagesNotEmptyExceptRequestResponseTypesLinter,
		namesNoCommonLinter,
		namesNoDataLinter,
		namesNoUUIDLinter,
		oneofNamesLowerSnakeCaseLinter,
		packageIsDeclaredLinter,
		packageLowerCaseLinter,
		packageLowerSnakeCaseLinter,
		packageMajorBetaVersionedLinter,
		packageNoKeywordsLinter,
		packagesSameInDirLinter,
		rpcsHaveCommentsLinter,
		rpcsHaveSentenceCommentsLinter,
		rpcsNoStreamingLinter,
		rpcNamesCamelCaseLinter,
		rpcNamesCapitalizedLinter,
		rpcOptionsNoGoogleAPIHTTPLinter,
		requestResponseTypesAfterServiceLinter,
		requestResponseTypesInSameFileLinter,
		requestResponseTypesOnlyInFileLinter,
		requestResponseTypesUniqueLinter,
		requestResponseNamesMatchRPCLinter,
		servicesHaveCommentsLinter,
		servicesHaveSentenceCommentsLinter,
		serviceNamesAPISuffixLinter,
		serviceNamesCamelCaseLinter,
		serviceNamesCapitalizedLinter,
		serviceNamesMatchFileNameLinter,
		serviceNamesNoPluralsLinter,
		syntaxProto3Linter,
		wktDirectlyImportedLinter,
		wktDurationSuffixLinter,
		wktTimestampSuffixLinter,
	}

	// DefaultLinters is the slice of default Linters.
	DefaultLinters = Uber1Linters

	// GoogleLinters is the slice of linters for the google lint group.
	GoogleLinters = []Linter{
		enumFieldNamesUpperSnakeCaseLinter,
		enumNamesCamelCaseLinter,
		enumNamesCapitalizedLinter,
		fileHeaderLinter,
		messageFieldNamesLowerSnakeCaseLinter,
		messageNamesCamelCaseLinter,
		messageNamesCapitalizedLinter,
		rpcNamesCamelCaseLinter,
		rpcNamesCapitalizedLinter,
		serviceNamesCamelCaseLinter,
		serviceNamesCapitalizedLinter,
	}

	// Uber1Linters is the slice of linters for the uber1 lint group.
	Uber1Linters = []Linter{
		commentsNoCStyleLinter,
		enumFieldNamesUpperSnakeCaseLinter,
		enumFieldPrefixesLinter,
		enumNamesCamelCaseLinter,
		enumNamesCapitalizedLinter,
		enumZeroValuesInvalidLinter,
		enumsNoAllowAliasLinter,
		fileHeaderLinter,
		fileOptionsEqualGoPackagePbSuffixLinter,
		fileOptionsEqualJavaMultipleFilesTrueLinter,
		fileOptionsEqualJavaOuterClassnameProtoSuffixLinter,
		fileOptionsEqualJavaPackageComPrefixLinter,
		fileOptionsGoPackageNotLongFormLinter,
		fileOptionsGoPackageSameInDirLinter,
		fileOptionsJavaMultipleFilesSameInDirLinter,
		fileOptionsJavaPackageSameInDirLinter,
		fileOptionsRequireGoPackageLinter,
		fileOptionsRequireJavaMultipleFilesLinter,
		fileOptionsRequireJavaOuterClassnameLinter,
		fileOptionsRequireJavaPackageLinter,
		messageFieldNamesLowerSnakeCaseLinter,
		messageNamesCamelCaseLinter,
		messageNamesCapitalizedLinter,
		oneofNamesLowerSnakeCaseLinter,
		packageIsDeclaredLinter,
		packageLowerSnakeCaseLinter,
		packagesSameInDirLinter,
		rpcNamesCamelCaseLinter,
		rpcNamesCapitalizedLinter,
		requestResponseTypesInSameFileLinter,
		requestResponseTypesUniqueLinter,
		serviceNamesCamelCaseLinter,
		serviceNamesCapitalizedLinter,
		syntaxProto3Linter,
		wktDirectlyImportedLinter,
	}

	// Uber2Linters is the slice of linters for the uber2 lint group.
	Uber2Linters = []Linter{
		commentsNoCStyleLinter,
		commentsNoInlineLinter,
		enumFieldNamesUpperSnakeCaseLinter,
		enumFieldPrefixesExceptMessageLinter,
		enumNamesCamelCaseLinter,
		enumNamesCapitalizedLinter,
		enumZeroValuesInvalidExceptMessageLinter,
		enumsHaveSentenceCommentsLinter,
		enumsNoAllowAliasLinter,
		fieldsNotReservedLinter,
		fileHeaderLinter,
		fileNamesLowerSnakeCaseLinter,
		fileOptionsCSharpNamespaceSameInDirLinter,
		fileOptionsEqualCSharpNamespaceCapitalizedLinter,
		fileOptionsEqualGoPackageV2SuffixLinter,
		fileOptionsEqualJavaMultipleFilesTrueLinter,
		fileOptionsEqualJavaOuterClassnameProtoSuffixLinter,
		fileOptionsEqualJavaPackagePrefixLinter,
		fileOptionsEqualOBJCClassPrefixAbbrLinter,
		fileOptionsEqualPHPNamespaceCapitalizedLinter,
		fileOptionsGoPackageNotLongFormLinter,
		fileOptionsGoPackageSameInDirLinter,
		fileOptionsJavaMultipleFilesSameInDirLinter,
		fileOptionsJavaPackageSameInDirLinter,
		fileOptionsOBJCClassPrefixSameInDirLinter,
		fileOptionsPHPNamespaceSameInDirLinter,
		fileOptionsRequireCSharpNamespaceLinter,
		fileOptionsRequireGoPackageLinter,
		fileOptionsRequireJavaMultipleFilesLinter,
		fileOptionsRequireJavaOuterClassnameLinter,
		fileOptionsRequireJavaPackageLinter,
		fileOptionsRequireOBJCClassPrefixLinter,
		fileOptionsRequirePHPNamespaceLinter,
		importsNotPublicLinter,
		importsNotWeakLinter,
		messagesHaveSentenceCommentsExceptRequestResponseTypesLinter,
		messageFieldNamesFilenameLinter,
		messageFieldNamesFilepathLinter,
		messageFieldNamesLowerSnakeCaseLinter,
		messageFieldNamesNoDescriptorLinter,
		messageFieldsNoJSONNameLinter,
		messageNamesCamelCaseLinter,
		messageNamesCapitalizedLinter,
		namesNoCommonLinter,
		namesNoDataLinter,
		namesNoUUIDLinter,
		oneofNamesLowerSnakeCaseLinter,
		packageIsDeclaredLinter,
		packageLowerCaseLinter,
		packageMajorBetaVersionedLinter,
		packageNoKeywordsLinter,
		packagesSameInDirLinter,
		rpcsHaveSentenceCommentsLinter,
		rpcNamesCamelCaseLinter,
		rpcNamesCapitalizedLinter,
		requestResponseNamesMatchRPCLinter,
		requestResponseTypesAfterServiceLinter,
		requestResponseTypesInSameFileLinter,
		requestResponseTypesOnlyInFileLinter,
		requestResponseTypesUniqueLinter,
		servicesHaveSentenceCommentsLinter,
		serviceNamesAPISuffixLinter,
		serviceNamesCamelCaseLinter,
		serviceNamesCapitalizedLinter,
		serviceNamesMatchFileNameLinter,
		syntaxProto3Linter,
		wktDirectlyImportedLinter,
		wktDurationSuffixLinter,
		wktTimestampSuffixLinter,
	}

	// EmptyLinters is the slice of linters for the empty lint group.
	EmptyLinters = []Linter{}

	// GroupToLinters is the map from linter group to the corresponding slice of linters.
	GroupToLinters = map[string][]Linter{
		"google": GoogleLinters,
		"uber1":  Uber1Linters,
		"uber2":  Uber2Linters,
		"empty":  EmptyLinters,
	}

	allLintIDs = make(map[string]struct{})
)

func init() {
	for _, linter := range AllLinters {
		if _, ok := allLintIDs[linter.ID()]; ok {
			panic(fmt.Sprintf("duplicate linter id %s", linter.ID()))
		}
		allLintIDs[linter.ID()] = struct{}{}
	}
}

// Runner runs a lint job.
type Runner interface {
	Run(protoSet *file.ProtoSet, absolutePaths bool) ([]*text.Failure, error)
}

// RunnerOption is an option for a new Runner.
type RunnerOption func(*runner)

// RunnerWithLogger returns a RunnerOption that uses the given logger.
//
// The default is to use zap.NewNop().
func RunnerWithLogger(logger *zap.Logger) RunnerOption {
	return func(runner *runner) {
		runner.logger = logger
	}
}

// NewRunner returns a new Runner.
func NewRunner(options ...RunnerOption) Runner {
	return newRunner(options...)
}

// FileDescriptor is a wrapper for proto.Proto.
type FileDescriptor struct {
	*proto.Proto

	ProtoSet *file.ProtoSet
	FileData string
}

// The below should not be needed in the CLI
// TODO make private

// Linter is a linter for Protobuf files.
type Linter interface {
	// Return the ID of this Linter. This should be all UPPER_SNAKE_CASE.
	ID() string
	// Return the purpose of this Linter. This should be a human-readable string.
	Purpose(config settings.LintConfig) string
	// Check the file data for the descriptors in a common directory.
	// If there is a lint failure, this returns it in the
	// slice and does not return an error. An error is returned if something
	// unexpected happens. Callers should verify the files are compilable
	// before running this.
	Check(dirPath string, descriptors []*FileDescriptor) ([]*text.Failure, error)
}

// NewLinter is a convenience function that returns a new Linter for the
// given parameters, using a function to record failures.
//
// The ID will be upper-cased.
//
// Failures returned from check do not need to set the ID, this will be overwritten.
func NewLinter(id string, purpose string, addCheck func(func(*text.Failure), string, []*FileDescriptor) error) Linter {
	return newBaseLinter(id, purpose, addCheck)
}

// NewSuppressableLinter is a convenience function that returns a new Linter for the
// given parameters, using a function to record failures. This linter can be
// suppressed given the annotation.
//
// The ID will be upper-cased.
//
// Failures returned from check do not need to set the ID, this will be overwritten.
func NewSuppressableLinter(id string, purpose string, suppressableAnnotation string, addCheck func(func(*file.ProtoSet, *proto.Comment, *text.Failure), string, []*FileDescriptor) error) Linter {
	return newBaseSuppressableLinter(id, purpose, suppressableAnnotation, addCheck)
}

// GetLinters returns the Linters for the LintConfig.
//
// The group, if set, is expected to be lower-case.
//
// The configuration is expected to be valid, deduplicated, and all upper-case.
// IncludeIDs and ExcludeIDs MUST NOT have an intersection.
//
// If the config came from the settings package, this is already validated.
func GetLinters(config settings.LintConfig) ([]Linter, error) {
	var linters []Linter
	var ok bool
	if config.Group != "" {
		linters, ok = GroupToLinters[config.Group]
		if !ok {
			return nil, fmt.Errorf("unknown lint group: %s", config.Group)
		}
	} else if !config.NoDefault {
		// we ignore NoDefault if Group is set
		linters = DefaultLinters
	}
	for _, id := range config.IncludeIDs {
		if err := checkLintID(id); err != nil {
			return nil, err
		}
	}
	for _, excludeID := range config.ExcludeIDs {
		if err := checkLintID(excludeID); err != nil {
			return nil, err
		}
	}
	for ignoreID := range config.IgnoreIDToFilePaths {
		if err := checkLintID(ignoreID); err != nil {
			return nil, err
		}
	}
	if len(config.IncludeIDs) == 0 && len(config.ExcludeIDs) == 0 {
		return linters, nil
	}

	// Apply the configured linters to the default group.
	linterMap := make(map[string]Linter, len(linters)+len(config.IncludeIDs)-len(config.ExcludeIDs))
	for _, l := range linters {
		linterMap[l.ID()] = l
	}
	if len(config.IncludeIDs) > 0 {
		for _, l := range AllLinters {
			for _, id := range config.IncludeIDs {
				if l.ID() == id {
					linterMap[id] = l
				}
			}
		}
	}
	for _, excludeID := range config.ExcludeIDs {
		delete(linterMap, excludeID)
	}

	result := make([]Linter, 0, len(linterMap))
	for _, l := range linterMap {
		result = append(result, l)
	}
	return result, nil
}

// GetDirPathToDescriptors is a convenience function that gets the
// descriptors for the given ProtoSet.
//
// Absolute paths are printed for failures if absolutePaths is true.
func GetDirPathToDescriptors(protoSet *file.ProtoSet, absolutePaths bool) (map[string][]*FileDescriptor, error) {
	dirPathToDescriptors := make(map[string][]*FileDescriptor, len(protoSet.DirPathToFiles))
	for dirPath, protoFiles := range protoSet.DirPathToFiles {
		// skip those files not under the directory
		if !strings.HasPrefix(dirPath, protoSet.DirPath) {
			continue
		}
		descriptors := make([]*FileDescriptor, len(protoFiles))
		for i, protoFile := range protoFiles {
			file, err := os.Open(protoFile.Path)
			if err != nil {
				return nil, err
			}
			parser := proto.NewParser(file)
			if absolutePaths {
				parser.Filename(protoFile.Path)
			} else {
				parser.Filename(protoFile.DisplayPath)
			}
			descriptor, err := parser.Parse()
			if err != nil {
				_ = file.Close()
				return nil, err
			}
			if _, err := file.Seek(0, 0); err != nil {
				_ = file.Close()
				return nil, err
			}
			fileData, err := ioutil.ReadAll(file)
			if err != nil {
				_ = file.Close()
				return nil, err
			}
			_ = file.Close()
			descriptors[i] = &FileDescriptor{
				Proto:    descriptor,
				ProtoSet: protoSet,
				FileData: string(fileData),
			}
		}
		dirPathToDescriptors[dirPath] = descriptors
	}
	return dirPathToDescriptors, nil
}

// CheckMultiple is a convenience function that checks multiple linters and multiple descriptors.
func CheckMultiple(linters []Linter, dirPathToDescriptors map[string][]*FileDescriptor, ignoreIDToFilePaths map[string][]string) ([]*text.Failure, error) {
	var allFailures []*text.Failure
	for dirPath, descriptors := range dirPathToDescriptors {
		for _, linter := range linters {
			failures, err := checkOne(linter, dirPath, descriptors, ignoreIDToFilePaths)
			if err != nil {
				return nil, err
			}
			allFailures = append(allFailures, failures...)
		}
	}
	text.SortFailures(allFailures)
	return allFailures, nil
}

func checkOne(linter Linter, dirPath string, descriptors []*FileDescriptor, ignoreIDToFilePaths map[string][]string) ([]*text.Failure, error) {
	filteredDescriptors, err := filterIgnores(linter, descriptors, ignoreIDToFilePaths)
	if err != nil {
		return nil, err
	}
	return linter.Check(dirPath, filteredDescriptors)
}

func filterIgnores(linter Linter, descriptors []*FileDescriptor, ignoreIDToFilePaths map[string][]string) ([]*FileDescriptor, error) {
	var filteredDescriptors []*FileDescriptor
	for _, descriptor := range descriptors {
		ignore, err := shouldIgnore(linter, descriptor, ignoreIDToFilePaths)
		if err != nil {
			return nil, err
		}
		if !ignore {
			filteredDescriptors = append(filteredDescriptors, descriptor)
		}
	}
	return filteredDescriptors, nil
}

func shouldIgnore(linter Linter, descriptor *FileDescriptor, ignoreIDToFilePaths map[string][]string) (bool, error) {
	filePath := descriptor.Filename
	var err error
	if !filepath.IsAbs(filePath) {
		filePath, err = filepath.Abs(filePath)
		if err != nil {
			return false, err
		}
	}
	ignoreFilePaths, ok := ignoreIDToFilePaths[linter.ID()]
	if !ok {
		return false, nil
	}
	return file.IsExcluded(filePath, descriptor.ProtoSet.Config.DirPath, ignoreFilePaths...), nil
}

func checkLintID(lintID string) error {
	if _, ok := allLintIDs[lintID]; !ok {
		return fmt.Errorf("unknown lint id in configuration file: %s", lintID)
	}
	return nil
}

func hasGolangStyleComment(comment *proto.Comment, name string) bool {
	return comment != nil && len(comment.Lines) > 0 && strings.HasPrefix(comment.Lines[0], fmt.Sprintf(" %s ", name))
}

func hasCompleteSentenceComment(comment *proto.Comment) bool {
	return commentStartsWithUppercaseLetter(comment) && commentContainsPeriod(comment)
}

func commentStartsWithUppercaseLetter(comment *proto.Comment) bool {
	if comment == nil || len(comment.Lines) == 0 {
		return false
	}
	firstLine := strings.TrimSpace(comment.Lines[0])
	if firstLine == "" {
		return false
	}
	return unicode.IsUpper(rune(firstLine[0])) || unicode.IsDigit(rune(firstLine[0]))
}

func commentContainsPeriod(comment *proto.Comment) bool {
	if comment == nil || len(comment.Lines) == 0 {
		return false
	}
	// very primitive check, could make better with NLP but this is hard with comments
	// since comments can contain code examples, links, etc.
	for _, line := range comment.Lines {
		if strings.Contains(line, ".") {
			return true
		}
	}
	return false
}

repository: uber/prototool

repo_name: uber/prototool

branch_name: refs/heads/dev


text:
DESCRIPTION = "The Crypt::RIPEMD160 module allows you to use the RIPEMD160 Message \
Digest algorithm from within Perl programs. The module is based on the \
implementation from Antoon Bosselaers from Katholieke Universiteit \
Leuven. A new RIPEMD160 context object is created with the new \
operation. Multiple simultaneous digest contexts can be maintained, if \
desired. The context is updated with the add operation which adds the \
strings contained in the *LIST* parameter. Note, however, that \
\"add('foo', 'bar')\", \"add('foo')\" followed by \"add('bar')\" and \
\"add('foobar')\" should all give the same result. The final message \
digest value is returned by the digest operation as a 20-byte binary \
string. This operation delivers the result of add operations since the \
last new or reset operation. Note that the digest operation is \
effectively a destructive, read-once operation. Once it has been \
performed, the context must be reset before being used to calculate \
another digest value. Several convenience functions are also provided. \
The addfile operation takes an open file-handle and reads it until \
end-of file in 8192 byte blocks adding the contents to the context. The \
file-handle can either be specified by name or passed as a type-glob \
reference, as shown in the examples below. The hexdigest operation \
calls digest and returns the result as a printable string of hexdecimal \
digits. This is exactly the same operation as performed by the unpack \
operation in the examples below. The hash operation can act as either a \
static member function (ie you invoke it on the RIPEMD160 class as in \
the synopsis above) or as a normal virtual function. In both cases it \
performs the complete RIPEMD160 cycle (reset, add, digest) on the \
supplied scalar value. This is convenient for handling small quantities \
of data. When invoked on the class a temporary context is created. When \
invoked through an already created context object, this context is \
used. The latter form is slightly more efficient. The hexhash operation \
is analogous to hexdigest."

SECTION = "libs"
LICENSE = "Artistic-1.0 | GPL-2.0"
PR = "r0"

MAINTAINER=	"Poky <poky@yoctoproject.org>"
HOMEPAGE=	"https://metacpan.org/release/Crypt-RIPEMD160"

LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Artistic-1.0;md5=cda03bbdc3c1951996392b872397b798 \
file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"

SRC_URI = "http://cpan.metacpan.org/authors/id/T/TO/TODDR/Crypt-RIPEMD160-0.06.tar.gz"

SRC_URI[md5sum] = "f37eae17af81b230104f9d0aca1b2327"
SRC_URI[sha256sum] = "ea64a1e9eb42f3d79855a392e7cca6b86e8e0bcc9aabcc5efa5fa32415b67dba"

S = "${WORKDIR}/Crypt-RIPEMD160-${PV}"

inherit cpan

do_compile() {
	export LIBC="$(find ${STAGING_DIR_TARGET}/${base_libdir}/ -name 'libc-*.so')"
	cpan_do_compile
}

BBCLASSEXTEND = "native"

repository: CELLINKAB/meta-cpan

repo_name: CELLINKAB/meta-cpan


text:
package simplecache

import (
	"github.com/stretchr/testify/assert"
	"testing"
	"time"
)

func TestSimpleCache(t *testing.T) {
	cache := New(10)
	value := cache.Get("test")
	assert.Nil(t, value)
	cache.Put("test", "val")
	assert.NotNil(t, cache.Get("test"))
}

func TestSimpleCacheTime(t *testing.T) {
	cache := New(10)
	value := cache.Get("test")
	assert.Nil(t, value)
	cache.Put("test", "val")
	assert.NotNil(t, cache.Get("test"))
	time.Sleep(time.Second * 12)
	assert.Nil(t, cache.Get("test"))
}

repository: linnaname/gdiamond

repo_name: linnaname/gdiamond


text:
SUMMARY = "GxSlowGear.lv2."
SECTION = "multimedia"

LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://LICENSE;md5=84dcc94da3adb52b53ae4fa38fe49e5d"

DEPENDS = "lv2"

SRCREV = "a523522ca44717fff93ad1b421d52a8d2cfc59a6"
SRC_URI = "git://github.com/moddevices/GxSlowGear.lv2.git"

S = "${WORKDIR}/git"

FILES_${PN} = "${libdir}/lv2/"

do_compile() {
	${CXX} ${LDFLAGS} ${CXXFLAGS} -I. -ffast-math -fPIC -shared -Wl,--no-undefined -o gx_slowgear.so gx_slowgear.cpp
}

do_install() {
	install -d ${D}${libdir}/lv2/gx_slowgear.lv2
	install -m 0644 *.ttl ${D}${libdir}/lv2/gx_slowgear.lv2/
	install -m 0755 gx_slowgear.so ${D}${libdir}/lv2/gx_slowgear.lv2/
	cp -R modgui ${D}${libdir}/lv2/gx_slowgear.lv2/
}