text:
package main

import (
	"fmt"
	"strconv"
	"sync"
	"time"
)

func main() {
	var waitGroup sync.WaitGroup

	waitGroup.Add(5)

	for i := 0; i < 5; i++ {
		go func(i int) {
			fmt.Println("work " + strconv.Itoa(i) + " is done at " + time.Now().String())
			// 等待 1 s 后减少等待数
			time.Sleep(time.Second)
			waitGroup.Done()
		}(i)
	}

	waitGroup.Wait()
	fmt.Println("all works are done at " + time.Now().String())
}

repository: yanming-zhang/micro-go-book

repo_name: yanming-zhang/micro-go-book


text:
@InProceedings{guo15,
  supplementary = {Supplementary:guo15-supp.pdf},
  title = {{The Bayesian Echo Chamber: Modeling Social Influence via Linguistic Accommodation}},
  author = {Guo, Fangjian and Blundell, Charles and Wallach, Hanna and Heller, Katherine},
  pages = {315-323},
  abstract = {We present the Bayesian Echo Chamber, a new Bayesian generative model for social interaction data. By modeling the evolution of people's language usage over time, this model discovers latent influence relationships between them. Unlike previous work on inferring influence, which has primarily focused on simple temporal dynamics evidenced via turn-taking behavior, our model captures more nuanced influence relationships, evidenced via linguistic accommodation patterns in interaction content. The model, which is based on a discrete analog of the multivariate Hawkes process, permits a fully Bayesian inference algorithm. We validate our model's ability to discover latent influence patterns using transcripts of arguments heard by the US Supreme Court and the movie "12 Angry Men." We showcase our model's capabilities by using it to infer latent influence patterns from Federal Open Market Committee meeting transcripts, demonstrating state-of-the-art performance at uncovering social dynamics in group discussions.},
}

license: MIT

repository: mreid/papersite

license_type: permissive

repo_name: mreid/papersite

branch_name: refs/heads/master

gha_license_id: MIT

gha_language: TeX

extension: bib


text:
// document variables
var caption = document.getElementById("caption");
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");

canvas.width = math.round(window.innerWidth * .99);
canvas.height = math.round(window.innerHeight * .87);

caption.width = math.round(window.innerWidth * .99);
caption.height = math.round(window.innerHeight * .5);

// globals
var boxDrag = false;
var mouseX;
var mouseY;
var preMouseX; // previous mouseX
var preMouseY; // previous mouseY
var drawTime = 1;
var drawProportion = (0.6 + drawTime / 24) * .5;//drawTime / 1.75;

// objects
var box = {
  x    : 10,
  y    : 10,
  difX : 0, // difference between mouseX and box.x
  difY : 0, // difference between mouseY and box.y
  size : 75,
  grav : 1.5,
  velX : 0, // x velocity
  velY : 0, // Y velocity
  color: "#ffffff", // color
};

// event listeners
addEventListener("mousemove", mouseMoveHandler);
addEventListener("mousedown", mouseDownHandler);
addEventListener("mouseup", mouseUpHandler);

// event handlers
function mouseMoveHandler() {
  preMouseX = mouseX;
  preMouseY = mouseY;
  mouseX = event.clientX;
  mouseY = event.clientY;
}

function mouseDownHandler() {
  if ((box.x < mouseX && mouseX < box.x + box.size) && (box.y < mouseY && mouseY < box.y + box.size)) {
    box.difX = mouseX - box.x;
    box.difY = mouseY - box.y;
    boxDrag = true;
  }
}

function mouseUpHandler() {
  if (boxDrag) {
    box.velX = mouseX - preMouseX;
    box.velY = mouseY - preMouseY;
  }
  boxDrag = false;

  if (box.y + box.size >= canvas.height) {
    box.y = 0 - box.size;//canvas.height - box.size;
  }
}

// draw functions
function drawRect() {
  ctx.beginPath();
  ctx.rect(box.x, box.y, box.size, box.size);
  ctx.fillStyle = box.color;
  ctx.fill();
}

function draw() {
  // clear and redraw objects onto canvas
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  drawRect();
  caption.innerHTML = math.round(box.x) + ", " + math.round(box.y);

  // if the box is not being dragged
  if (!boxDrag) {

    // gravity
    box.velY += box.grav * drawProportion;
    box.x += box.velX * drawProportion;
    box.y += box.velY * drawProportion;

    if (box.y + box.size >= canvas.height) {
      box.y = canvas.height - box.size;
      box.velY = box.velY * -1 * 0.75;
      box.velX *= .9;
    }

    // wraparound
    if (box.x >= canvas.width) {
      box.x = 0 - box.size;
    }
    else if (box.x <= 0 - box.size) {
      box.x = canvas.width;
    }

  }

  // if the box is being dragged
  if (boxDrag) {
    box.x = mouseX - box.difX;
    box.y = mouseY - box.difY;
  }
}

var drawInterval = setInterval(draw, drawTime);

repository: Emeree/drag-box

repo_name: Emeree/drag-box

gha_language: JavaScript

extension: js


text:
package configcommands

import (
	"errors"
	"fmt"

	"github.com/pivotalservices/cf-mgmt/config"
)

type UpdateSpaceConfigurationCommand struct {
	ConfigManager config.Manager
	BaseConfigCommand
	OrgName               string   `long:"org" description:"Org name" required:"true"`
	SpaceName             string   `long:"space" description:"Space name" required:"true"`
	AllowSSH              string   `long:"allow-ssh" description:"Enable the Space Quota in the config" choice:"true" choice:"false"`
	EnableRemoveUsers     string   `long:"enable-remove-users" description:"Enable removing users from the space" choice:"true" choice:"false"`
	IsoSegment            string   `long:"isolation-segment" description:"Isolation segment assigned to space"`
	ClearIsolationSegment bool     `long:"clear-isolation-segment" description:"Sets the isolation segment to blank"`
	ASGs                  []string `long:"named-asg" description:"Named asg(s) to assign to space, specify muliple times"`
	ASGsToRemove          []string `long:"named-asg-to-remove" description:"Named asg(s) to remove, specify muliple times"`
	Quota                 struct {
		EnableSpaceQuota        string `long:"enable-space-quota" description:"Enable the Space Quota in the config" choice:"true" choice:"false"`
		MemoryLimit             string `long:"memory-limit" description:"An Space's memory limit in Megabytes"`
		InstanceMemoryLimit     string `long:"instance-memory-limit" description:"Space Application instance memory limit in Megabytes"`
		TotalRoutes             string `long:"total-routes" description:"Total Routes capacity for an Space"`
		TotalServices           string `long:"total-services" description:"Total Services capacity for an Space"`
		PaidServicesAllowed     string `long:"paid-service-plans-allowed" description:"Allow paid services to appear in an Space" choice:"true" choice:"false"`
		TotalPrivateDomains     string `long:"total-private-domains" description:"Total Private Domain capacity for an Space"`
		TotalReservedRoutePorts string `long:"total-reserved-route-ports" description:"Total Reserved Route Ports capacity for an Space"`
		TotalServiceKeys        string `long:"total-service-keys" description:"Total Service Keys capacity for an Space"`
		AppInstanceLimit        string `long:"app-instance-limit" description:"Total Service Keys capacity for an Space"`
	} `group:"quota"`
	Developer UserRole `group:"developer" namespace:"developer"`
	Manager   UserRole `group:"manager" namespace:"manager"`
	Auditor   UserRole `group:"auditor" namespace:"auditor"`
}

//Execute - updates space configuration`
func (c *UpdateSpaceConfigurationCommand) Execute(args []string) error {
	c.initConfig()
	spaceConfig, err := c.ConfigManager.GetSpaceConfig(c.OrgName, c.SpaceName)
	if err != nil {
		return err
	}
	errorString := ""

	convertToBool("allow-ssh", &spaceConfig.AllowSSH, c.AllowSSH, &errorString)
	convertToBool("enable-remove-users", &spaceConfig.RemoveUsers, c.EnableRemoveUsers, &errorString)
	if c.IsoSegment != "" {
		spaceConfig.IsoSegment = c.IsoSegment
	}
	if c.ClearIsolationSegment {
		spaceConfig.IsoSegment = ""
	}

	spaceConfig.ASGs = removeFromSlice(append(spaceConfig.ASGs, c.ASGs...), c.ASGsToRemove)

	c.updateQuotaConfig(spaceConfig, &errorString)
	c.updateUsers(spaceConfig, &errorString)

	if errorString != "" {
		return errors.New(errorString)
	}

	if err := c.ConfigManager.SaveSpaceConfig(spaceConfig); err != nil {
		return err
	}
	fmt.Println(fmt.Sprintf("The org/space [%s/%s] has been updated", c.OrgName, c.SpaceName))
	return nil
}

func (c *UpdateSpaceConfigurationCommand) updateUsers(spaceConfig *config.SpaceConfig, errorString *string) {
	updateUsersBasedOnRole(&spaceConfig.Developer, spaceConfig.GetDeveloperGroups(), &c.Developer)
	updateUsersBasedOnRole(&spaceConfig.Auditor, spaceConfig.GetAuditorGroups(), &c.Auditor)
	updateUsersBasedOnRole(&spaceConfig.Manager, spaceConfig.GetManagerGroups(), &c.Manager)

	spaceConfig.DeveloperGroup = ""
	spaceConfig.ManagerGroup = ""
	spaceConfig.AuditorGroup = ""
}

func (c *UpdateSpaceConfigurationCommand) updateQuotaConfig(spaceConfig *config.SpaceConfig, errorString *string) {
	convertToBool("enable-space-quota", &spaceConfig.EnableSpaceQuota, c.Quota.EnableSpaceQuota, errorString)
	convertToInt("memory-limit", &spaceConfig.MemoryLimit, c.Quota.MemoryLimit, errorString)
	convertToInt("instance-memory-limit", &spaceConfig.InstanceMemoryLimit, c.Quota.InstanceMemoryLimit, errorString)
	convertToInt("total-routes", &spaceConfig.TotalRoutes, c.Quota.TotalRoutes, errorString)
	convertToInt("total-services", &spaceConfig.TotalServices, c.Quota.TotalServices, errorString)
	convertToBool("paid-service-plans-allowed", &spaceConfig.PaidServicePlansAllowed, c.Quota.PaidServicesAllowed, errorString)
	convertToInt("total-private-domains", &spaceConfig.TotalPrivateDomains, c.Quota.TotalPrivateDomains, errorString)
	convertToInt("total-reserved-route-ports", &spaceConfig.TotalReservedRoutePorts, c.Quota.TotalReservedRoutePorts, errorString)
	convertToInt("total-service-keys", &spaceConfig.TotalServiceKeys, c.Quota.TotalServiceKeys, errorString)
	convertToInt("app-instance-limit", &spaceConfig.AppInstanceLimit, c.Quota.AppInstanceLimit, errorString)
}

func (c *UpdateSpaceConfigurationCommand) initConfig() {
	if c.ConfigManager == nil {
		c.ConfigManager = config.NewManager(c.ConfigDirectory)
	}
}

repository: arunroula/cf-mgmt

repo_name: arunroula/cf-mgmt

extension: go


text:
# Auto-Generated by cargo-bitbake 0.3.8
#
inherit cargo

# If this is git based prefer versioned ones if they exist
# DEFAULT_PREFERENCE = "-1"

# how to get cargo could be as easy as but default to a git checkout:
# SRC_URI += "crate://crates.io/cargo/0.21.0"
SRC_URI += "git://git@github.com/rust-lang/cargo.git;protocol=ssh;branch=rust-1.20.0"
SRCREV = "5b4b8b2ae3f6a884099544ce66dbb41626110ece"
S = "${WORKDIR}/git"
CARGO_SRC_DIR=""

# please note if you have entries that do not begin with crate://
# you must change them to how that package can be fetched
SRC_URI += " \
crate://crates.io/advapi32-sys/0.2.0 \
crate://crates.io/aho-corasick/0.5.3 \
crate://crates.io/aho-corasick/0.6.3 \
crate://crates.io/atty/0.2.2 \
crate://crates.io/backtrace-sys/0.1.11 \
crate://crates.io/backtrace/0.3.2 \
crate://crates.io/bitflags/0.9.1 \
crate://crates.io/bufstream/0.1.3 \
crate://crates.io/cfg-if/0.1.2 \
crate://crates.io/cmake/0.1.24 \
crate://crates.io/crossbeam/0.2.10 \
crate://crates.io/curl-sys/0.3.14 \
crate://crates.io/curl/0.4.7 \
crate://crates.io/dbghelp-sys/0.2.0 \
crate://crates.io/docopt/0.8.1 \
crate://crates.io/dtoa/0.4.1 \
crate://crates.io/env_logger/0.4.3 \
crate://crates.io/error-chain/0.11.0-rc.2 \
crate://crates.io/filetime/0.1.10 \
crate://crates.io/flate2/0.2.19 \
crate://crates.io/foreign-types/0.2.0 \
crate://crates.io/fs2/0.4.2 \
crate://crates.io/gcc/0.3.51 \
crate://crates.io/git2-curl/0.7.0 \
crate://crates.io/git2/0.6.6 \
crate://crates.io/glob/0.2.11 \
crate://crates.io/hamcrest/0.1.1 \
crate://crates.io/hex/0.2.0 \
crate://crates.io/idna/0.1.2 \
crate://crates.io/itoa/0.3.1 \
crate://crates.io/jobserver/0.1.6 \
crate://crates.io/kernel32-sys/0.2.2 \
crate://crates.io/lazy_static/0.2.8 \
crate://crates.io/libc/0.2.25 \
crate://crates.io/libgit2-sys/0.6.12 \
crate://crates.io/libssh2-sys/0.2.6 \
crate://crates.io/libz-sys/1.0.16 \
crate://crates.io/log/0.3.8 \
crate://crates.io/matches/0.1.6 \
crate://crates.io/memchr/0.1.11 \
crate://crates.io/memchr/1.0.1 \
crate://crates.io/miniz-sys/0.1.9 \
crate://crates.io/miow/0.2.1 \
crate://crates.io/net2/0.2.29 \
crate://crates.io/num-bigint/0.1.39 \
crate://crates.io/num-complex/0.1.38 \
crate://crates.io/num-integer/0.1.34 \
crate://crates.io/num-iter/0.1.33 \
crate://crates.io/num-rational/0.1.38 \
crate://crates.io/num-traits/0.1.39 \
crate://crates.io/num/0.1.39 \
crate://crates.io/num_cpus/1.6.2 \
crate://crates.io/openssl-probe/0.1.1 \
crate://crates.io/openssl-sys/0.9.14 \
crate://crates.io/openssl/0.9.14 \
crate://crates.io/percent-encoding/1.0.0 \
crate://crates.io/pkg-config/0.3.9 \
crate://crates.io/psapi-sys/0.1.0 \
crate://crates.io/quote/0.3.15 \
crate://crates.io/rand/0.3.15 \
crate://crates.io/regex-syntax/0.3.9 \
crate://crates.io/regex-syntax/0.4.1 \
crate://crates.io/regex/0.1.80 \
crate://crates.io/regex/0.2.2 \
crate://crates.io/rustc-demangle/0.1.4 \
crate://crates.io/rustc-serialize/0.3.24 \
crate://crates.io/scoped-tls/0.1.0 \
crate://crates.io/semver-parser/0.7.0 \
crate://crates.io/semver/0.7.0 \
crate://crates.io/serde/1.0.9 \
crate://crates.io/serde_derive/1.0.9 \
crate://crates.io/serde_derive_internals/0.15.1 \
crate://crates.io/serde_ignored/0.0.3 \
crate://crates.io/serde_json/1.0.2 \
crate://crates.io/shell-escape/0.1.3 \
crate://crates.io/socket2/0.2.1 \
crate://crates.io/strsim/0.6.0 \
crate://crates.io/syn/0.11.11 \
crate://crates.io/synom/0.11.3 \
crate://crates.io/tar/0.4.13 \
crate://crates.io/tempdir/0.3.5 \
crate://crates.io/termcolor/0.3.2 \
crate://crates.io/thread-id/2.0.0 \
crate://crates.io/thread_local/0.2.7 \
crate://crates.io/thread_local/0.3.4 \
crate://crates.io/toml/0.4.2 \
crate://crates.io/unicode-bidi/0.3.4 \
crate://crates.io/unicode-normalization/0.1.5 \
crate://crates.io/unicode-xid/0.0.4 \
crate://crates.io/unreachable/1.0.0 \
crate://crates.io/url/1.5.1 \
crate://crates.io/utf8-ranges/0.1.3 \
crate://crates.io/utf8-ranges/1.0.0 \
crate://crates.io/vcpkg/0.2.2 \
crate://crates.io/void/1.0.2 \
crate://crates.io/winapi-build/0.1.1 \
crate://crates.io/winapi/0.2.8 \
crate://crates.io/wincolor/0.1.4 \
crate://crates.io/ws2_32-sys/0.2.1 \
"

# FIXME: update generateme with the real MD5 of the license file
LIC_FILES_CHKSUM=" \
file://LICENSE-MIT;md5=362255802eb5aa87810d12ddf3cfedb4 \
file://LICENSE-APACHE;md5=1836efb2eb779966696f473ee8540542 \
"

SUMMARY = "Cargo, a package manager for Rust."
HOMEPAGE = "https://crates.io"
LICENSE = "MIT | Apache-2.0"

# includes this file if it exists but does not fail
# this is useful for anything you may want to override from
# what cargo-bitbake generates.
include cargo-${PV}.inc
include cargo.inc

repository: agherzan/meta-rust

repo_name: agherzan/meta-rust

extension: bb


text:
// Package auth is an interface for authentication and authorization.
package auth

import (
	"errors"
	"time"

	"github.com/micro/go-micro/client"
	"github.com/micro/go-micro/server"

	"golang.org/x/net/context"
)

//https://github.com/beego/social-auth
// Auth handles client side validation of authentication
// The client does not actually handle authentication itself.
// This could be an oauth2 provider, openid, basic auth, etc.
type Auth interface {
	// Check if authorised
	Authorized(ctx context.Context, req Request) (*Token, error)
	// Retrieve token from context
	Introspect(ctx context.Context) (*Token, error)
	// Revoke a token
	Revoke(t *Token) error
	// Retrieve client token
	Token() (*Token, error)
	String() string
}

////https://github.com/beego/social-auth;TODO..

type Option func(*Options)

// Client or server request
type Request interface {
	Service() string
	Method() string
}

// Basically identical to oauth token
type Token struct {
	AccessToken  string
	RefreshToken string
	TokenType    string
	ExpiresAt    time.Time
	Scopes       []string
	Metadata     map[string]string
}

var (
	ErrInvalidToken = errors.New("invalid token")
)

func ClientWrapper(a Auth) client.Wrapper {
	return func(c client.Client) client.Client {
		return &clientWrapper{c, a}
	}
}

func HandlerWrapper(a Auth) server.HandlerWrapper {
	return func(h server.HandlerFunc) server.HandlerFunc {
		return handlerWrapper(h, a)
	}
}

func NewAuth(opts ...Option) Auth {
	return newOS(opts...)
}


text:
package main

import (
	"context"
	"fmt"
	"io"
	"log"
	"net/http"
	"os"
	"strconv"
	"time"

	"go.opentelemetry.io/contrib/detectors/aws/ec2"
	"go.opentelemetry.io/contrib/detectors/aws/eks"
	"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
	"go.opentelemetry.io/contrib/propagators/aws/xray"
	"go.opentelemetry.io/otel"
	"go.opentelemetry.io/otel/attribute"
	"go.opentelemetry.io/otel/codes"
	"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
	"go.opentelemetry.io/otel/sdk/resource"
	sdktrace "go.opentelemetry.io/otel/sdk/trace"
	semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
	"go.opentelemetry.io/otel/trace"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
)

const (
	_name      = "fib"
	_paramName = "n"
	_port      = 8831
)

var (
	_app                   *App
	_otlpCollectorHostPort string
)

type App struct {
	r io.Reader
	l *log.Logger
}

func NewApp(r io.Reader, l *log.Logger) *App {
	return &App{r: r, l: l}
}

func (a *App) CheckN(ctx context.Context, s string) (uint, error) {
	_, span := otel.Tracer(_name).Start(ctx, "CheckN")
	defer span.End()

	var n uint
	_, err := fmt.Sscanf(s, "%d\n", &n)
	if err != nil {
		span.RecordError(err)
		span.SetStatus(codes.Error, err.Error())
		return 0, err
	}

	// Store n as a string to not overflow an int64
	nStr := strconv.FormatUint(uint64(n), 10)
	span.SetAttributes(attribute.String("request.n", nStr))
	return n, err
}

func (a *App) Compute(ctx context.Context, n uint) (uint64, error) {
	var span trace.Span
	ctx, span = otel.Tracer(_name).Start(ctx, "Compute")
	defer span.End()

	f, err := func(ctx context.Context) (uint64, error) {
		_, span := otel.Tracer(_name).Start(ctx, "Fibonacci")
		defer span.End()
		f, err := Fibonacci(n)
		if err != nil {
			span.RecordError(err)
			span.SetStatus(codes.Error, err.Error())
		}
		return f, err
	}(ctx)
	return f, err
}

func newExporter(ctx context.Context) (sdktrace.SpanExporter, error) {
	traceExporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithInsecure(), otlptracegrpc.WithEndpoint(_otlpCollectorHostPort), otlptracegrpc.WithDialOption(grpc.WithBlock()))
	if err != nil {
		return nil, fmt.Errorf("failed to create trace exporter: %+v", err)
	}
	return traceExporter, err
}

func newResource() *resource.Resource {
	ctx := context.Background()
	r, _ := resource.Merge(
		resource.Default(),
		resource.NewWithAttributes(
			semconv.SchemaURL,
			semconv.ServiceNameKey.String("xrayfib"),
			semconv.ServiceVersionKey.String("v0.2.12"),
			attribute.String("environment", "demo"),
		),
	)
	eksResourceDetector := eks.NewResourceDetector()
	eksResource, _ := eksResourceDetector.Detect(ctx)
	r, _ = resource.Merge(r, eksResource)
	ec2ResourceDetector := ec2.NewResourceDetector()
	ec2Resource, _ := ec2ResourceDetector.Detect(ctx)
	r, _ = resource.Merge(r, ec2Resource)
	return r
}

func initTracerProvider(l *log.Logger) (func(context.Context) error, error) {
	ctx := context.Background()
	dialCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
	defer cancel()
	conn, err := grpc.DialContext(dialCtx, _otlpCollectorHostPort, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
	if err != nil {
		return nil, fmt.Errorf("failed to create gRPC connection to collector at %s: %+v", _otlpCollectorHostPort, err)
	}
	defer conn.Close()
	l.Printf("Connected to gRPC server %q\n", _otlpCollectorHostPort)
	exp, err := newExporter(ctx)
	if err != nil {
		l.Fatal(err)
	}
	l.Printf("Created new gRPC trace exporter: %+v\n", exp)
	idg := xray.NewIDGenerator()
	tp := sdktrace.NewTracerProvider(
		sdktrace.WithBatcher(exp),
		sdktrace.WithSampler(sdktrace.AlwaysSample()),
		sdktrace.WithIDGenerator(idg),
		sdktrace.WithResource(newResource()),
	)
	otel.SetTracerProvider(tp)
	otel.SetTextMapPropagator(xray.Propagator{})
	return tp.Shutdown, nil
}

func Fibonacci(n uint) (uint64, error) {
	if n <= 1 {
		return uint64(n), nil
	}

	if n > 93 {
		return 0, fmt.Errorf("unsupported fibonacci number %d: too large", n)
	}

	var n2, n1 uint64 = 0, 1
	for i := uint(2); i < n; i++ {
		n2, n1 = n1, n1+n2
	}
	return n2 + n1, nil
}

func healthCheckHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintln(w, "OK")
}

func fibHandler(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()
	newCtx, span := otel.Tracer(_name).Start(ctx, "fibHandler")
	defer span.End()
	query := r.URL.Query()
	values, ok := query[_paramName]
	if !ok || len(values) == 0 {
		w.WriteHeader(http.StatusBadRequest)
		fmt.Fprintf(w, "Query parameter '%s' is missing", _paramName)
		return
	}
	n, err := _app.CheckN(newCtx, values[0])
	if err != nil {
		w.WriteHeader(http.StatusBadRequest)
		_app.l.Printf("_app.Poll(newCtx, %d): %+v\n", n, err)
		fmt.Fprintf(w, "Bad request, please try with valid input")
		return
	}
	result, err := _app.Compute(newCtx, n)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		_app.l.Printf("_app.Compute(newCtx, %d): %+v\n", n, err)
		fmt.Fprintf(w, "Internal Server Error")
		return
	}
	w.WriteHeader(http.StatusOK)
	response := fmt.Sprintf("Fib(%d) = %d", n, result)
	_app.l.Println(response)
	fmt.Fprint(w, response)
}

func main() {
	l := log.New(os.Stdout, "", 0)
	ctx := context.Background()

	_otlpCollectorHostPort = os.Getenv("OTLP_COLLECTOR_HOST_PORT")
	if len(_otlpCollectorHostPort) <= 0 {
		l.Fatal("Environment variable OTLP_COLLECTOR_HOST_PORT is empty")
	}
	l.Printf("Setting _otlpCollectorHostPort to %q\n", _otlpCollectorHostPort)

	shutdown, err := initTracerProvider(l)
	if err != nil {
		l.Fatal(err)
	}
	defer func() {
		if err := shutdown(ctx); err != nil {
			l.Fatal("failed to shutdown TracerProvider: %w", err)
		}
	}()

	_app = NewApp(os.Stdin, l)
	http.HandleFunc("/healthz", healthCheckHandler)
	// We need to wrap our handlers with otelhttp.NewHandler to get the
	// URL, Method, Response code, Client IP, etc to show up on AWS XRay.
	// The value of the string argument does not seem to matter
	fibH := otelhttp.NewHandler(http.HandlerFunc(fibHandler), "fib")
	http.Handle("/fib", fibH)
	l.Printf("Listening at port %d\n", _port)
	l.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", _port), nil))
}

repository: yanhan/sysadmin-library

repo_name: yanhan/sysadmin-library

gha_language: Go


text:
DESCRIPTION = "Dedicated /sbin/init for pivot root images"
SECTION = "base"
PRIORITY = "required"
LICENSE = "MIT"
PR = "r0"

COMPATIBLE_MACHINE = "(spitz)"
SRC_URI = "file://init"

do_install () {
	install -m 0755 -D ${WORKDIR}/init ${D}/sbin/init
}

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD


text:
@inproceedings{Yu-ECCV-BiSeNet-2018,
	title={BiSeNet: Bilateral Segmentation Network for Real-time Semantic Segmentation},
	author={Yu, Changqian and Wang, Jingbo and Peng, Chao and Gao, Changxin and Yu, Gang and Sang, Nong},
	booktitle={European Conference on Computer Vision},
	year={2018},
}


text:
@InProceedings{dillon09a,
  title = {Statistical and Computational Tradeoffs in Stochastic Composite Likelihood},
  author = {Joshua Dillon and Guy Lebanon},
  pages = {129--136},
  abstract = {Maximum likelihood estimators are often of limited practical use due to the intensive computation they require. We propose a family of alternative estimators that maximize a stochastic variation of the composite likelihood function. We prove the consistency of the estimators, provide formulas for their asymptotic variance and computational complexity, and discuss experimental results in the context of Boltzmann machines and conditional random fields. The theoretical and experimental studies demonstrate the effectiveness of the estimators in achieving a predefined balance between computational complexity and statistical accuracy.},
  pdf = {http://jmlr.org/proceedings/papers/v5/dillon09a/dillon09a.pdf},
}


text:
DESCRIPTION = "openMips bootlogo"
SECTION = "base"
PRIORITY = "required"
LICENSE = "proprietary"
MAINTAINER = "openMips"

RDEPENDS_${PN} += "virtual/showiframe"

PV = "1.0"
PR = "r4"

S = "${WORKDIR}/"

INITSCRIPT_NAME = "bootlogo"
INITSCRIPT_PARAMS = "start 21 S ."

inherit update-rc.d

SRC_URI = " \
		file://bootlogo.sh \
		 "

SRC_URI_append_gb800se = " \
					file://bootlogo.mvi \
					file://splash.bin \
					"
SRC_URI_append_gb800solo = " \
					file://bootlogo.mvi \
					file://splash.bin \
					"
SRC_URI_append_gb800ue = " \
					file://bootlogo.mvi \
					file://splash.bin \
					file://lcdsplash.bin \
					"
SRC_URI_append_gbquad = " \
					file://bootlogo.mvi \
					file://splash.bin \
					file://lcdsplash.bin \
					"

BINARY_VERSION = "1"
BINARY_VERSION_mipsel = "8"

IMAGES_VERSION = "1"

MVISYMLINKS = "bootlogo_wait backdrop switchoff.mvi"

do_install() {
	install -d ${D}/boot
	install -d ${D}/usr/share
	install -m 0755 bootlogo.mvi ${D}/usr/share/bootlogo.mvi
	ln -sf /usr/share/bootlogo.mvi ${D}/boot/bootlogo.mvi
	for i in ${MVISYMLINKS}; do
		ln -sf /boot/bootlogo.mvi ${D}/boot/$i.mvi
		ln -sf /usr/share/bootlogo.mvi ${D}/usr/share/$i.mvi;
	done;
	install -d ${D}/${sysconfdir}/init.d
	install -m 0755 ${S}/bootlogo.sh ${D}/${sysconfdir}/init.d/bootlogo
}

do_install_append_gb800se() {
    install -d ${DEPLOY_DIR_IMAGE}
	install -m 0755 ${S}/splash.bin ${DEPLOY_DIR_IMAGE}/splash.bin
}
do_install_append_gb800solo() {
    install -d ${DEPLOY_DIR_IMAGE}
	install -m 0755 ${S}/splash.bin ${DEPLOY_DIR_IMAGE}/splash.bin
}
do_install_append_gb800ue() {
    install -d ${DEPLOY_DIR_IMAGE}
	install -m 0755 ${S}/splash.bin ${DEPLOY_DIR_IMAGE}/splash.bin
	install -m 0755 ${S}/lcdsplash.bin ${DEPLOY_DIR_IMAGE}/lcdsplash.bin
}
do_install_append_gbquad() {
    install -d ${DEPLOY_DIR_IMAGE}
	install -m 0755 ${S}/splash.bin ${DEPLOY_DIR_IMAGE}/splash.bin
	install -m 0755 ${S}/lcdsplash.bin ${DEPLOY_DIR_IMAGE}/lcdsplash.bin
}

pkg_preinst() {
	[ -d /proc/stb ] && mount -t jffs2 mtd:'boot partition' /boot
	true
}

pkg_postinst() {
	[ -d /proc/stb ] && umount /boot
	true
}

pkg_prerm() {
	[ -d /proc/stb ] && mount -t jffs2 mtd:'boot partition' /boot
	true
}

pkg_postrm() {
	[ -d /proc/stb ] && umount /boot
	true
}

PACKAGE_ARCH := "${MACHINE_ARCH}"
FILES_${PN} = "/boot /usr/share /etc/init.d"

repository: edwarekuo/openembedded

repo_name: edwarekuo/openembedded


text:
// Copyright © 2017 NAME HERE <EMAIL ADDRESS>
//
// 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 cmd

import (
	"log"
	"net/url"

	"github.com/spf13/cobra"
	"github.com/spf13/viper"

	"go_scoring/scoring"
	"go_scoring/validate"
)

var hostURL *url.URL

// standaloneCmd represents the standalone command
var standaloneCmd = &cobra.Command{
	Use:   "standalone",
	Short: "Scoring over standalone prediction instances",
	Long:  `Use: go_scoring standalone [flags] <import_id> <dataset path>`,
	PreRun: func(cmd *cobra.Command, args []string) {
		hostURL = validate.ValidateHost(
			viper.GetString("host"))
		validate.ValidateFile(viper.GetString("out"))
	},
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) != 2 {
			log.Fatal("Not all necessary arguments provided")
		}
		importId := args[0]
		dataset := args[1]
		// TODO: Work your own magic here
		scoring.RunBatch(
			hostURL, importId, dataset,
			viper.GetString("encoding"),
			viper.GetString("delimiter"),
			0, 2, false, false)
	},
}

func init() {
	RootCmd.AddCommand(standaloneCmd)
	// Here you will define your flags and configuration settings.

	// Cobra supports Persistent Flags which will work for this command
	// and all subcommands, e.g.:
	// standaloneCmd.PersistentFlags().String("foo", "", "A help for foo")

	// Cobra supports local flags which will only run when this command
	// is called directly, e.g.:
	// standaloneCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")

}


text:
SUMMARY = "Simple C++ program using Boost"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

inherit cmake

DEPENDS = "boost"
SRCREV = "${AUTOREV}"
SRC_URI = "git://github.com/loic-yvonnet/boost-program-options-example-dev.git"

S = "${WORKDIR}/git"

BBCLASSEXTEND = "native"


text:
@proceedings{ws-2017-brazilian,
    title = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    editor = "Paetzold, Gustavo Henrique  and
      Pinheiro, Vl{\'a}dia",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6600",
}
@inproceedings{nau-etal-2017-uma,
    title = "Uma Ferramenta para Identificar Desvios de Linguagem na L{\'\i}ngua Portuguesa (A tool to identify the linguistic deviations in the {P}ortuguese Language)[In {P}ortuguese]",
    author = "Nau, Jonathan  and
      Filho, Aluizio Haendchen  and
      Passero, Guilherme  and
      Cavaco, Vinicius",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6601",
    pages = "12--16",
}
@inproceedings{rodrigues-etal-2017-estudo,
    title = "Estudo explorat{\'o}rio de categorias gramaticais com potencial de indicadores para a An{\'a}lise de Sentimentos (An Exploratory study of grammatical categories as potential indicators for Sentiment Analysis)[In {P}ortuguese]",
    author = "Rodrigues, J{\'u}lia  and
      Pagano, Adriana  and
      Paraiso, Emerson",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6602",
    pages = "17--21",
}
@inproceedings{martins-martins-2017-geracao,
    title = "Gera{\c{c}}{\~a}o de perguntas e respostas para a base de conhecimento de um chatterbot educacional (Application to generate questions and answers for an educational chatterbot)[In {P}ortuguese]",
    author = "Martins, Joyce  and
      Martins, Camila",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6603",
    pages = "22--26",
}
@inproceedings{moraes-etal-2017-study,
    title = "A study on irony within the context of 7x1-{PT} corpus",
    author = "Moraes, Silvia  and
      Machado, Rackel  and
      Redecker, Matheus  and
      Cadaval, Rafael  and
      Meneguzzi, Felipe",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6604",
    pages = "27--31",
}
@inproceedings{anchieta-etal-2017-improving,
    title = "Improving Opinion Summarization by Assessing Sentence Importance in On-line Reviews",
    author = "Anchi{\^e}ta, Rafael  and
      Sousa, Rogerio Figueredo  and
      Moura, Raimundo  and
      Pardo, Thiago",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6605",
    pages = "32--36",
}
@inproceedings{santos-etal-2017-wheel,
    title = "Wheel of Life: an initial investigation. Topic-Related Polarity Visualization in Personal Stories",
    author = "Santos, Henrique  and
      Vieira, Renata  and
      Pinho, Greice  and
      Pinheiro, Jackson",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6606",
    pages = "37--41",
}
@inproceedings{vitorio-etal-2017-investigating,
    title = "Investigating Opinion Mining through Language Varieties: a Case Study of {B}razilian and {E}uropean {P}ortuguese tweets",
    author = "Vit{\'o}rio, Douglas  and
      Souza, Ellen Polliana Ramos  and
      Pereira, Ingryd  and
      Oliveira, Adriano",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6607",
    pages = "43--52",
}
@inproceedings{andrade-etal-2017-rule,
    title = "A Rule-based Semantic Annotator: Adding top-level ontology Tags",
    author = "Andrade, Guidson Coelho  and
      Oliveira, Alcione  and
      Moreira, Alexandra",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6608",
    pages = "53--62",
}
@inproceedings{amaral-etal-2017-processo,
    title = "Processo de constru{\c{c}}{\~a}o de um corpus anotado com Entidades Geol{\'o}gicas visando {REN} (Building an annotated corpus with geological entities for {NER})[In {P}ortuguese]",
    author = "Amaral, Daniela  and
      Collovini, Sandra  and
      Figueira, Anny  and
      Vieira, Renata  and
      Vieira, Renata  and
      Gonzalez, Marco",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6609",
    pages = "63--72",
}
@inproceedings{antunes-etal-2017-formacao,
    title = "Forma{\c{c}}{\~a}o de gent{\'\i}licos a partir de top{\^o}nimos: descri{\c{c}}{\~a}o lingu{\'\i}stica e aprendizado autom{\'a}tico (Formation of Demonyms from Toponyms: Linguistic Description and Machine Learning)[In {P}ortuguese]",
    author = "Antunes, Roger Alfredo Marci Rodrigues  and
      Pardo, Thiago  and
      Almeida, Gladis Maria Barcelos",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6610",
    pages = "73--82",
}
@inproceedings{vaz-etal-2017-visualizacao,
    title = "Visualiza{\c{c}}{\~a}o de gloss{\'a}rio em sistemas de recupera{\c{c}}{\~a}o de informa{\c{c}}{\~a}o (Glossary visualization in information retrieval systems)[In {P}ortuguese]",
    author = "Vaz, Glauber  and
      Oliveira, Leandro Mendon{\c{c}}a  and
      Pierozzi, Jr., Ivo",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6611",
    pages = "83--92",
}
@inproceedings{silva-etal-2017-avaliando,
    title = "Avaliando a similaridade sem{\^a}ntica entre frases curtas atrav{\'e}s de uma abordagem h{\'\i}brida (A hybrid approach to measure Semantic Textual Similarity between short sentences in {B}razilian {P}ortuguese)[In {P}ortuguese]",
    author = "Silva, Allan  and
      Rigo, Sandro  and
      Alves, Isa Mara  and
      Barbosa, Jorge",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6612",
    pages = "93--102",
}
@inproceedings{carvalho-etal-2017-comparative,
    title = "A Comparative Study for Sentiment Analysis on Election {B}razilian News",
    author = "Carvalho, Caio Magno Aguiar  and
      Nagano, Hitoshi  and
      Barros, Allan Kardec",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6613",
    pages = "103--111",
}
@inproceedings{lima-etal-2017-influencia,
    title = "Influ{\^e}ncia de T{\'e}cnicas N{\~a}o-supervisionadas de Redu{\c{c}}{\~a}o de Dimensionalidade para Organiza{\c{c}}{\~a}o Flex{\'\i}vel de Documentos (The Unsupervised Dimensionality Reduction Weight on Flexible Document Organization)[In {P}ortuguese]",
    author = "Lima, Beatriz  and
      Eust{\'a}quio, Fernanda  and
      Nogueira, Tatiane",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6614",
    pages = "112--121",
}
@inproceedings{hartmann-etal-2017-portuguese,
    title = "{P}ortuguese Word Embeddings: Evaluating on Word Analogies and Natural Language Tasks",
    author = "Hartmann, Nathan  and
      Fonseca, Erick  and
      Shulby, Christopher  and
      Treviso, Marcos  and
      Silva, J{\'e}ssica  and
      Alu{\'\i}sio, Sandra",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6615",
    pages = "122--131",
}
@inproceedings{barbosa-claro-2017-utilizando,
    title = "Utilizando Features Lingu{\'\i}sticas Gen{\'e}ricas para Classifica{\c{c}}{\~a}o de Triplas Relacionais em Portugu{\^e}s (Generic Linguistic Features for Relational Triples Classification in {P}ortuguese)[In {P}ortuguese]",
    author = "Barbosa, George  and
      Claro, Daniela Barreiro",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6616",
    pages = "132--141",
}
@inproceedings{bard-etal-2017-normalizador,
    title = "Normalizador de Texto para Lingua Portuguesa baseado em Modelo de Linguagem (A Normalizer based on Language Model for Texts in {P}ortuguese)[In {P}ortuguese]",
    author = "Bard, Patrick  and
      Luis, Renan Lopes  and
      Moraes, Silvia",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6617",
    pages = "142--150",
}
@inproceedings{treviso-etal-2017-evaluating,
    title = "Evaluating Word Embeddings for Sentence Boundary Detection in Speech Transcripts",
    author = "Treviso, Marcos  and
      Shulby, Christopher  and
      Alu{\'\i}sio, Sandra",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6618",
    pages = "151--160",
}
@inproceedings{feitosa-pinheiro-2017-analise,
    title = "An{\'a}lise de Medidas de Similaridade Sem{\^a}ntica na Tarefa de Reconhecimento de Implica{\c{c}}{\~a}o Textual (Analysis of Semantic Similarity Measures in the Recognition of Textual Entailment Task)[In {P}ortuguese]",
    author = "Feitosa, David  and
      Pinheiro, Vl{\'a}dia",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6619",
    pages = "161--170",
}
@inproceedings{barreira-etal-2017-framefor,
    title = "{F}rame{FOR} {--} Uma Base de Conhecimento de Frames Sem{\^a}nticos para Per{\'\i}cias de Inform{\'a}tica ({F}rame{FOR} - a Knowledge Base of Semantic Frames for Digital Forensics)[In {P}ortuguese]",
    author = "Barreira, Ravi  and
      Pinheiro, Vl{\'a}dia  and
      Furtado, Vasco",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6620",
    pages = "171--180",
}
@inproceedings{soares-etal-2017-implementacao,
    title = "A Implementa{\c{c}}{\~a}o de uma Minigram{\'a}tica do Portugu{\^e}s Brasileiro sob a Perspectiva da {LFG} (Implementation of a grammar fragment of {B}razilian {P}ortuguese in the {L}exical-{F}unctional {G}rammar formalism)[In {P}ortuguese]",
    author = "Soares, Daniel  and
      Nogueira, Francisco  and
      Alencar, Leonel Figueiredo",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6621",
    pages = "185--192",
}
@inproceedings{peron-correa-torrent-2017-constituicao,
    title = "Constitui{\c{c}}{\~a}o de Um Dicion{\'a}rio Eletr{\^o}nico Tril{\'\i}ngue Fundado em Frames a partir da Extra{\c{c}}{\~a}o Autom{\'a}tica de Candidatos a Termos do Dom{\'\i}nio do Turismo (The Constitution of a Trilingual Eletronic Dictionary Based on Frames from the Automatic Extraction of Candidate Terms of the Tourism Domain)[In {P}ortuguese]",
    author = "Peron-Corr{\^e}a, Simone Rodrigues  and
      Torrent, Tiago Timponi",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6622",
    pages = "193--200",
}
@inproceedings{costa-torrent-2017-modelagem,
    title = "A Modelagem Computacional do Dom{\'\i}nio dos Esportes na {F}rame{N}et Brasil (The Computational Modeling of the Sports Domain in {F}rame{N}et Brasil)[In {P}ortuguese]",
    author = "Costa, Alexandre Diniz  and
      Torrent, Tiago Timponi",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6623",
    pages = "201--208",
}
@inproceedings{marcao-etal-2017-descricao,
    title = "Descri{\c{c}}{\~a}o e modelagem de constru{\c{c}}{\~o}es interrogativas {QU}- em Portugu{\^e}s Brasileiro para o desenvolvimento de um chatbot (Description and modeling of interrogative constructs {QU}- in {B}razilian {P}ortuguese for the development of a chatbot)[In {P}ortuguese]",
    author = "Mar{\c{c}}{\~a}o, Nat{\'a}lia Duarte  and
      Torrent, Tiago Timponi  and
      Matos, Ely Edison Silva",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6624",
    pages = "209--216",
}
@inproceedings{almeida-torrent-2017-construcoes,
    title = "Constru{\c{c}}{\~o}es de Estrutura Argumental no {\^a}mbito do Constructicon da {F}rame{N}et Brasil: proposta de uma modelagem lingu{\'\i}stico-computacional (Structural Constructs of Arguments in the Context of the Construction of {F}rame{N}et Brasil: a proposal for a computational-linguistic modeling)[In {P}ortuguese]",
    author = "Almeida, V{\^a}nia Gomes  and
      Torrent, Tiago Timponi",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6625",
    pages = "217--223",
}
@inproceedings{ramos-2017-investigacao,
    title = "Investiga{\c{c}}{\~a}o Preliminar Sobre a Pros{\'o}dia Sem{\^a}ntica de Verbos de Elocu{\c{c}}{\~a}o: o Caso do Verbo {``}Confessar{''} (A Preliminar Investigation About the Semantic Prosody of Elocution Verbs: the Case for the Verb {``}Confess{''})[In {P}ortuguese]",
    author = "Ramos, Barbara C.",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6626",
    pages = "224--231",
}
@inproceedings{paiva-torrent-2017-uma,
    title = "Uma Proposta Metodol{\'o}gica para a Categoriza{\c{c}}{\~a}o Automatizada de Atra{\c{c}}{\~o}es Tur{\'\i}sticas a partir de Coment{\'a}rios de Usu{\'a}rios em Plataformas Online (A Methodological Proposition for the Automatic Categorization of Touristic Attractions from User Comments in Online Platforms)[In {P}ortuguese]",
    author = "Paiva, Vanessa Maria Ramos Lopes  and
      Torrent, Tiago Timponi",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6627",
    pages = "232--239",
}
@inproceedings{barros-etal-2017-sofrer,
    title = "Sofrer uma ofensa, Receber uma advert{\^e}ncia: Verbos-suporte Conversos de {`}Fazer{'} no Portugu{\^e}s do Brasil (Suffering an offense, Receiving a citation: Supporting Vectors Converted from {`}To do{'} in {B}razilian {P}ortuguese)[In {P}ortuguese]",
    author = "Barros, Cla{\'u}dia D.  and
      Calcia, Nathalia P.  and
      Vale, Oto A.",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6628",
    pages = "240--246",
}
@inproceedings{reis-baptista-2017-os,
    title = "Os Prov{\'e}rbios em manuais de ensino de Portugu{\^e}s L{\'\i}ngua N{\~a}o Materna (The Proverbs of teaching manuals in Non-Native {P}ortuguese)[In {P}ortuguese]",
    author = "Reis, S{\'o}nia  and
      Baptista, Jorge",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6629",
    pages = "247--255",
}
@inproceedings{bossaglia-etal-2017-prosody,
    title = "Prosody, syntax, and pragmatics: insubordination in spoken {B}razilian {P}ortuguese",
    author = "Bossaglia, Giulia  and
      Mello, Heliana  and
      Raso, Tommaso",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6630",
    pages = "256--265",
}
@inproceedings{rodrigues-etal-2017-bases,
    title = "As bases de dados verbais {ADESSE} e {V}i{PE}r: uma an{\'a}lise constrastiva das constru{\c{c}}{\~o}es locativas em espanhol e em portugu{\^e}s (The verbal databases {ADESSE} and {V}i{PE}r: a contrastive analysis of locative constructs in {S}panish and {P}ortuguese)[In {P}ortuguese]",
    author = "Rodrigues, Roana  and
      Vale, Oto  and
      Alonso Alemany, Laura",
    booktitle = "Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology",
    month = oct,
    year = "2017",
    address = "Uberl{\^a}ndia, Brazil",
    publisher = "Sociedade Brasileira de Computa{\c{c}}{\~a}o",
    url = "https://www.aclweb.org/anthology/W17-6631",
    pages = "266--273",
}

repository: emorynlp/nlprankings

repo_name: emorynlp/nlprankings

gha_license_id: NOASSERTION


text:
/*
 * Copyright 2017-2018 IBM Corporation
 *
 * 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 common

import (
	"context"
	"errors"
	"fmt"
	"net/url"
	"strings"

	v1 "k8s.io/api/core/v1"

	"github.com/apache/openwhisk-client-go/whisk"

	"github.com/ibm/cloud-functions-operator/pkg/resources"
)

// --- Authentication

// WskConfig struct
type WskConfig struct {
	WskCliAuthKey   string   `json:"WskCliAuthKey"`
	WskCliNamespace string   `json:"WskCliNamespace"`
	WskCliAPIHost   string   `json:"WskCliApiHost"`
	WskCliInsecure  bool     `json:"WskCliInsecure"`
	WskCliCert      string   `json:"WskCliCert"`
	WskCliBaseURL   *url.URL `json:"WskBaseURL"`
}

// NewWskClient creates a new whisk.Client
func NewWskClient(ctx context.Context, owctx *v1.SecretEnvSource) (*whisk.Client, error) {
	secretName := "seed-defaults-owprops"
	if owctx != nil && owctx.Name != "" {
		secretName = owctx.Name
	}

	config, err := GetWskPropertiesFromSecret(ctx, secretName)
	if err != nil {
		return nil, err
	}

	configInput := &whisk.Config{
		AuthToken: string(config.WskCliAuthKey),
		Namespace: "_",
		Host:      string(config.WskCliAPIHost),
		Version:   "v1",
		BaseURL:   config.WskCliBaseURL,
		Cert:      config.WskCliCert,
		// Key:       key.Value,

		Insecure: config.WskCliInsecure, // true if you want to ignore certificate signing
	}
	return whisk.NewClient(nil, configInput)
}

// GetWskPropertiesFromSecret returns WskConfig from secret
func GetWskPropertiesFromSecret(ctx context.Context, secretName string) (*WskConfig, error) {
	var config WskConfig

	secret, err := resources.GetSecret(ctx, secretName, true)
	if err != nil {
		return nil, err
	}

	apihostb, ok := secret.Data["apihost"]
	if !ok || string(apihostb) == "" {
		return nil, fmt.Errorf("missing 'apihost' key in seed-defaults-owprops secret")
	}
	authb, ok := secret.Data["auth"]
	if !ok || string(authb) == "" {
		return nil, fmt.Errorf("missing 'auth' key in seed-defaults-owprops secret")
	}
	config.WskCliInsecure = false
	if insecureb, ok := secret.Data["insecure"]; ok {
		config.WskCliInsecure = string(insecureb) == "true"
	}
	config.WskCliCert = ""
	if certb, ok := secret.Data["cert"]; ok {
		config.WskCliCert = string(certb)
	}

	config.WskCliAuthKey = string(authb)
	config.WskCliAPIHost = string(apihostb)

	baseURL, err := whisk.GetURLBase(config.WskCliAPIHost, "/api")
	if err != nil {
		return nil, err
	}
	config.WskCliBaseURL = baseURL

	return &config, nil
}

// ResolveFunctionName returns the full name of a function
func ResolveFunctionName(objname string, pkg *string, name *string) string {
	actualName := objname
	if name != nil {
		actualName = *name
	}

	if pkg != nil && *pkg != "default" {
		return strings.Join([]string{*pkg, actualName}, "/")
	}
	return actualName
}

// QualifiedName is a namespace-qualified name
type QualifiedName struct {
	Namespace  string
	EntityName string
}

// from go whisk cli

/*
 Parse a (possibly fully qualified) resource name into namespace and name components. If the given qualified name isNone,
 then this is a default qualified name and it is resolved from properties. If the namespace is missing from the qualified
 name, the namespace is also resolved from the property file.

 Return a qualifiedName struct

 Examples:
	   foo => qName {namespace: "_", entityName: foo}
	   pkg/foo => qName {namespace: "_", entityName: pkg/foo}
	   /ns/foo => qName {namespace: ns, entityName: foo}
	   /ns/pkg/foo => qName {namespace: ns, entityName: pkg/foo}
*/

// ParseQualifiedName returns a qualified name
func ParseQualifiedName(name string, defaultNamespace string) (QualifiedName, error) {
	var qualifiedName QualifiedName

	// If name has a preceding delimiter (/), it contains a namespace. Otherwise the name does not specify a namespace,
	// so default the namespace to the namespace value set in the properties file; if that is not set, use "_"
	if strings.HasPrefix(name, "/") {
		parts := strings.Split(name, "/")
		qualifiedName.Namespace = parts[1]

		if len(parts) < 2 || len(parts) > 4 {
			err := errors.New("A valid qualified name was not detected")
			return qualifiedName, err
		}

		for i := 1; i < len(parts); i++ {
			if len(parts[i]) == 0 || parts[i] == "." {
				err := errors.New("A valid qualified name was not detected")
				return qualifiedName, err
			}
		}

		qualifiedName.EntityName = strings.Join(parts[2:], "/")
	} else {
		if len(name) == 0 || name == "." {
			err := errors.New("A valid qualified name was not detected")
			return qualifiedName, err
		}

		qualifiedName.EntityName = name
		if defaultNamespace == "" {
			defaultNamespace = "_"
		}
		qualifiedName.Namespace = defaultNamespace
	}

	return qualifiedName, nil
}

// JoinQualifiedName returns a fully qualified entity name
func JoinQualifiedName(qname QualifiedName) string {
	return fmt.Sprintf("/%s/%s", qname.Namespace, qname.EntityName)
}

// --- Web annotation helpers

const webExportAnnot = "web-export"
const rawHTTPAnnot = "raw-http"

// const finalAnnot = "final"

// WebAction adds web annotations
func WebAction(webMode string, annotations whisk.KeyValueArr, fetch bool) (whisk.KeyValueArr, error) {
	switch strings.ToLower(webMode) {
	case "yes":
		fallthrough
	case "true":
		return webActionAnnotations(fetch, annotations, addWebAnnotations)
	case "no":
		fallthrough
	case "false":
		return webActionAnnotations(fetch, annotations, deleteWebAnnotations)
	case "raw":
		return webActionAnnotations(fetch, annotations, addRawAnnotations)
	default:
		return nil, errors.New(webMode)
	}
}

type webActionAnnotationMethod func(annotations whisk.KeyValueArr) whisk.KeyValueArr

func webActionAnnotations(
	fetchAnnotations bool,
	annotations whisk.KeyValueArr,
	webActionAnnotationMethod webActionAnnotationMethod) (whisk.KeyValueArr, error) {
	if annotations != nil || !fetchAnnotations {
		annotations = webActionAnnotationMethod(annotations)
	}

	return annotations, nil
}

func addWebAnnotations(annotations whisk.KeyValueArr) whisk.KeyValueArr {
	annotations = deleteWebAnnotationKeys(annotations)
	annotations = AddKeyValue(webExportAnnot, true, annotations)
	annotations = AddKeyValue(rawHTTPAnnot, false, annotations)
	//	annotations = AddKeyValue(finalAnnot, true, annotations)

	return annotations
}

func deleteWebAnnotations(annotations whisk.KeyValueArr) whisk.KeyValueArr {
	annotations = deleteWebAnnotationKeys(annotations)
	annotations = AddKeyValue(webExportAnnot, false, annotations)
	annotations = AddKeyValue(rawHTTPAnnot, false, annotations)
	//	annotations = AddKeyValue(finalAnnot, false, annotations)

	return annotations
}

func addRawAnnotations(annotations whisk.KeyValueArr) whisk.KeyValueArr {
	annotations = deleteWebAnnotationKeys(annotations)
	annotations = AddKeyValue(webExportAnnot, true, annotations)
	annotations = AddKeyValue(rawHTTPAnnot, true, annotations)
	//	annotations = AddKeyValue(finalAnnot, true, annotations)

	return annotations
}

func deleteWebAnnotationKeys(annotations whisk.KeyValueArr) whisk.KeyValueArr {
	annotations = deleteKey(webExportAnnot, annotations)
	annotations = deleteKey(rawHTTPAnnot, annotations)
	//	annotations = deleteKey(finalAnnot, annotations)

	return annotations
}

// AddKeyValue adds a key-value pair to the given array
func AddKeyValue(key string, value interface{}, keyValueArr whisk.KeyValueArr) whisk.KeyValueArr {
	keyValue := whisk.KeyValue{
		Key:   key,
		Value: value,
	}

	return append(keyValueArr, keyValue)
}

func deleteKey(key string, keyValueArr whisk.KeyValueArr) whisk.KeyValueArr {
	for i := 0; i < len(keyValueArr); i++ {
		if keyValueArr[i].Key == key {
			keyValueArr = append(keyValueArr[:i], keyValueArr[i+1:]...)
			break
		}
	}

	return keyValueArr
}


text:
@article{Beamesderfer-2020-The,
    title = "The Impact of Seasonal and Annual Climate Variations on the Carbon Uptake Capacity of a Deciduous Forest Within the Great Lakes Region of Canada",
    author = "Beamesderfer, Eric R.  and
      Arain, M. Altaf  and
      Khomik, Myroslava  and
      Brodeur, Jason J.",
    journal = "Journal of Geophysical Research: Biogeosciences, Volume 125, Issue 9",
    volume = "125",
    number = "9",
    year = "2020",
    publisher = "American Geophysical Union (AGU)",
    url = "https://aclanthology.org/G20-40001",
    doi = "10.1029/2019jg005389",
    abstract = "In eastern North America, many deciduous forest ecosystems grow at the northernmost extent of their geographical ranges, where climate change could aid or impede their growth. This region experiences frequent extreme weather conditions, allowing us to study the response of these forests to environmental conditions, reflective of future climates. Here we determined the impact of seasonal and annual climate variations and extreme weather events on the carbon (C) uptake capacity of an oak-dominated forest in southern Ontario, Canada, from 2012 to 2016. We found that changes in meteorology during late May to mid-July were key in determining the C sink strength of the forest, impacting the seasonal and annual variability of net ecosystem productivity (NEP). Overall, higher temperatures and dry conditions reduced ecosystem respiration (RE) much more than gross ecosystem productivity (GEP), leading to higher NEP. Variability in NEP was primarily driven by changes in RE, rather than GEP. The mean annual GEP, RE, and NEP values at our site during the study were 1,343 {\mbox{$\pm$}} 85, 1,171 {\mbox{$\pm$}} 139, and 206 {\mbox{$\pm$}} 92 g C m-2 yr-1, respectively. The forest was a C sink even in years that experienced heat and water stresses. Mean annual NEP at our site was within the range of NEP (69-459 g C m-2 yr-1) observed in similar North American forests from 2012 to 2016. The growth and C sequestration capabilities of our oak-dominated forest were not adversely impacted by changes in environmental conditions and extreme weather events experienced over the study period.",
}

repository: gwf-uwaterloo/gwf-publications

repo_name: gwf-uwaterloo/gwf-publications

branch_name: refs/heads/main

gha_language: Python