text
stringlengths
3.08k
10.4k
package examples import ( "encoding/json" "errors" "fmt" "log" "net" "net/http" "net/rpc" go_openrpc_reflect "github.com/etclabscore/go-openrpc-reflect" meta_schema "github.com/open-rpc/meta-schema" ) // Set up a basic service that does some example-application things. type MyCalculator struct { history []...
//go:generate go-bindata -pkg realtime -o realtime_embed.go realtime.js package realtime import ( "fmt" "net/http" "reflect" "strconv" "strings" "sync" "time" "github.com/gorilla/websocket" ) var proto = "v1" type Config struct { Throttle time.Duration CheckOrigin bool } type Handler struct { config...
// Package start combines four common tasks for setting up an // commandline application: // // * Reading settings from a configuration file // * Reading environment variables // * Reading command line flags // * Defining commands and subcommands // // See the file README.md about usage of the start package. // // Copy...
/* 重复插入key相同的value, 不更新该key的deadline */ package timeout import ( "container/heap" "context" "strings" "sync" "time" "github.com/erda-project/erda/pkg/jsonstore/js_util" "github.com/erda-project/erda/pkg/jsonstore/storetypes" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) type elem struct { deadlin...
// // poly1305.go: Poly1305 MAC. // // To the extent possible under law, <NAME> waived all copyright // and related or neighboring rights to poly1305, using the creative // commons "CC0" public domain dedication. See LICENSE or // <http://creativecommons.org/publicdomain/zero/1.0/> for full details. // Package poly130...
package custom import ( "bytes" "encoding/json" "flag" "fmt" "log" "os" "reflect" "github.com/pelletier/go-toml" "github.com/colt3k/mycli" ) // Clients type of which to store client connections type Clients struct { Hosts []Host `json:"clients"` } // Host connection information for a host type Host struc...
package workerpool import ( "context" "errors" "fmt" "runtime" "sync" uuid "github.com/gofrs/uuid" tomb "gopkg.in/tomb.v2" ) const ( // PENDING state when job is queued. PENDING = "pending" // RUNNING state when job is currently executed. RUNNING = "running" // COMPLETED state when job is terminated whit...
/** * Copyright 2015 @ z3q.net. * name : snapshot * author : jarryliu * date : 2016-06-28 23:52 * description : * history : */ package item import ( "fmt" "go2o/core/domain/interface/enum" "go2o/core/domain/interface/item" "time" ) var _ item.ISnapshotService = new(snapshotServiceImpl) type snapshotServic...
package money import ( "encoding/json" "fmt" "strconv" ) const precision = 100 // Money is an amount with precision 2 // // - FromInt(15) -> 15 // - FromFloat(15.07) -> 15.07 // - FromFloat(-15.073) -> -15.07 // - FromFloat(15.078) -> 15.07 // type Money int64 // FromInt converts int64 to Money func From...
// Copyright 2020 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
package client import ( "context" "errors" "fmt" "net/http" "os" "path" "strings" "github.com/go-git/go-git/v5" "github.com/google/go-github/github" "github.com/gosuri/uiprogress" ) func (c *Client) GetRepos(ctx context.Context, name string) ([]*github.Repository, error) { count := 0 orgFound := true c...
package soda import ( "encoding/json" "fmt" "io/ioutil" "net/http" "net/url" "strconv" "strings" "time" ) type metadata struct { baseurl, identifier string } func (m metadata) url() (string, error) { if m.baseurl == "" || len(m.identifier) != 9 || m.identifier[4] != '-' { return "", fmt.Errorf("Cannot ge...
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris package tty import ( "fmt" "os" "os/signal" "sort" "strings" "sync" "syscall" "time" "github.com/ridge/game/task" "golang.org/x/sys/unix" ) // From https://en.wikipedia.org/wiki/ANSI_escape_code#Description const ( ...
package blockchain import ( "encoding/json" "net/http" "sync" "github.com/YushinJung/NomadCoin/db" "github.com/YushinJung/NomadCoin/utils" ) const ( defaultDifficulty int = 2 difficultyInterval int = 5 // change difficulty every 5 block interval blockInterval int = 2 // we want block every two minutes...
// Copyright 2021 The churrodata Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License,...
package evaluator import ( "fmt" "github.com/cszczepaniak/monkey/ast" "github.com/cszczepaniak/monkey/object" ) var ( NULL = &object.Null{} TRUE = &object.Boolean{Value: true} FALSE = &object.Boolean{Value: false} ) func Eval(node ast.Node, env *object.Environment) object.Object { switch n := node.(type) {...
package api import ( "encoding/hex" "fmt" "gitlab.com/accumulatenetwork/accumulate/protocol" "gitlab.com/accumulatenetwork/accumulate/types/api/query" ) func packStateResponse(account protocol.Account, chains []query.ChainState, receipt *query.GeneralReceipt) (*ChainQueryResponse, error) { res := new(ChainQuery...
// Copyright 2019 <NAME> // // 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 w...
// Copyright 2018 Google Inc. // // 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 ...
package llama import ( "context" "golang.org/x/time/rate" "log" "net" "sync" "time" ) // TestRunner repeatedly runs through a list of targets and passes them down // to a PortGroup for processing. type TestRunner struct { pg *PortGroup tosend chan *net.UDPAddr rl *rate.Limiter stop chan bool ...
package e2e // Namespace Description var LitmusChaosnamespaceYaml = []byte(` apiVersion: v1 kind: Namespace metadata: name: test-litmus `) // Litmus Chaos Service Account var ChaosServiceAccountYaml = []byte(` apiVersion: v1 kind: ServiceAccount metadata: name: pod-cpu-hog-sa namespace: test-litmus labels: ...
package cmd import ( "context" "os" "path/filepath" "github.com/marccarre/go-github-release/pkg/gpg" "github.com/marccarre/go-github-release/pkg/validate" "github.com/google/go-github/github" "github.com/marccarre/go-github-release/pkg/logging" "github.com/spf13/cobra" "go.uber.org/zap" "golang.org/x/oauth...
package main import ( "flag" "fmt" "os" "path/filepath" "strings" "github.com/icon-project/rewardcalculator/common/db" "github.com/icon-project/rewardcalculator/core" ) const ( DBType = "goleveldb" ) type CLI struct { DB db.Database } func (cli *CLI) printUsage() { fmt.Printf("Make IISS data DB") fmt.Pr...
// Code generated by go-swagger; DO NOT EDIT. package services // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "context" "net/http" "time" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com...
package generic import ( "fmt" "math/rand" mat "github.com/klahssen/go-mat" "github.com/klahssen/nn" "github.com/klahssen/nn/internal/activation" ) func sum(x []float64) float64 { res := 0.0 for i := range x { res += x[i] } return res } type src struct { inSize int seed int64 max int64 n in...
package service import ( "context" "fmt" "testing" "go-common/app/admin/main/activity/model" xtime "go-common/library/time" "time" . "github.com/smartystreets/goconvey/convey" ) func TestService_SubjectList(t *testing.T) { Convey("service test", t, WithService(func(s *Service) { p := &model.ListSub{ ...
package aws import ( "encoding/json" "fmt" "os" "strings" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/codebuild" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/ssm" "github.com/spf13/viper" ) // Settings is a setting...
package mmap import ( "math" "os" "runtime" "syscall" "unsafe" ) const maxInt = int(^uint(0) >> 1) // Mapping is a mapping of the file into the memory. type Mapping struct { internal hProcess syscall.Handle hFile syscall.Handle hMapping syscall.Handle alignedAddress uintptr alignedLen...
// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "encoding/json" "errors" "fmt" "io/ioutil" "os" "strings" "golang.org/x/vulndb/report" "gopkg.in/yaml.v2" ) // Affects type Aff...
package fetchers import ( "fmt" "io/ioutil" "net/http" "strings" "testing" "golang.org/x/net/html/atom" "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" "golang.org/x/net/html" ) // Disable logger. We don't want noisy logs when running tests func init() { logrus.SetLevel(logrus.PanicLevel...
// Code generated by go-swagger; DO NOT EDIT. package firmware // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "context" "net/http" "time" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com...
/* Command line tool for updating Dockerfiles based on versions.yaml. */ package main import ( "bytes" "flag" "io/ioutil" "log" "os" "path/filepath" "reflect" "strings" "text/template" "github.com/GoogleCloudPlatform/runtimes-common/versioning/versions" ) func renderDockerfile(version versions.Version, tmp...
package main import ( "encoding/binary" "log" "math" "time" "github.com/SMerrony/tello" "golang.org/x/mobile/app" "golang.org/x/mobile/event/lifecycle" "golang.org/x/mobile/event/paint" "golang.org/x/mobile/event/size" "golang.org/x/mobile/event/touch" "golang.org/x/mobile/exp/f32" "golang.org/x/mobile/ex...
package gitlab import ( "fmt" "net/http" "net/url" "os" "path/filepath" "regexp" "strings" "time" "github.com/nikoksr/proji/internal/util" "github.com/nikoksr/proji/pkg/domain" "github.com/pkg/errors" gl "github.com/xanzy/go-gitlab" ) const defaultTimeout = time.Second * 10 // Service struct holds impor...
package application import ( "bytes" "crypto/md5" "fmt" "net/http" "os" "sort" "strconv" "time" "github.com/jinzhu/gorm" newrelic "github.com/newrelic/go-agent" "github.com/server-may-cry/bubble-go/market" "github.com/server-may-cry/bubble-go/models" "github.com/server-may-cry/bubble-go/mynewrelic" "git...
package conio import ( "fmt" "os" "strings" ) type Result int const ( CONTINUE Result = iota ENTER Result = iota ABORT Result = iota ) func (this Result) String() string { switch this { case CONTINUE: return "CONTINUE" case ENTER: return "ENTER" case ABORT: return "ABORT" default: return "E...
package main import ( "fmt" "strings" "io/ioutil" "encoding/json" "net/http" "log" "time" "github.com/gorilla/feeds" ) type DockerHubRepository struct { User string `json:"user"` Name string `json:"name"` Namespace string `json:"namespace"` Description string `json:"description"` Last_updated time.Time `...
package main import ( "bufio" "fmt" "net/http" "os" "strings" "time" "github.com/ansible-semaphore/semaphore/cli/setup" "github.com/ansible-semaphore/semaphore/db" "github.com/ansible-semaphore/semaphore/db/factory" "github.com/gorilla/context" log "github.com/Sirupsen/logrus" "github.com/ansible-semapho...
package controller import ( "flag" "fmt" "net/http" "net/http/pprof" "os" "syscall" "time" "github.com/golang/glog" "github.com/spf13/pflag" "github.com/aledbf/ingress-controller/pkg/ingress" "github.com/aledbf/ingress-controller/pkg/k8s" "github.com/prometheus/client_golang/prometheus" "k8s.io/kuberne...
// package upnp provides a simple and opinionated interface to UPnP-enabled // routers, allowing users to forward ports and discover their external IP // address. Specific quirks: // // - When attempting to discover UPnP-enabled routers on the network, only the // first such router is returned. If you have multiple rou...
package store import ( "github.com/artheus/go-minecraft/core/block" "github.com/artheus/go-minecraft/core/types" . "github.com/artheus/go-minecraft/math/f32" "bytes" "encoding/binary" "errors" "flag" "log" "github.com/boltdb/bolt" ) var ( dbpath = flag.String("db", "gocraft.db", "db file name") ) var ( ...
/* * Copyright (c) <NAME> 2018 * * 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, distri...
package main import ( "encoding/json" "flag" "fmt" "io" "io/ioutil" "log" "math" "net" "net/http" "os" "os/exec" "regexp" "sort" "strconv" "strings" "time" "github.com/prometheus/client_golang/prometheus" ) type interceptor struct { forward i...
package main import ( "context" "errors" "log" "os" "os/signal" "time" "github.com/cschleiden/go-workflows/backend" "github.com/cschleiden/go-workflows/backend/redis" "github.com/cschleiden/go-workflows/client" "github.com/cschleiden/go-workflows/worker" "github.com/cschleiden/go-workflows/workflow" "gith...
package main import ( "bytes" "encoding/binary" "fmt" "io" "log" "net" "os" "syscall" ) func server(client_sync chan struct{}) (chan struct{}, error) { server_done := make(chan struct{}) os.Remove(uds_file_path) l, err := net.Listen("unix", uds_file_path) if err != nil { return nil, fmt.Errorf("error: ...
package _gin import ( "fmt" "github.com/gin-gonic/gin" "net/http" "time" ) // http框架gin的使用 https://github.com/gin-gonic/gin func SampleMainFirst() { // 创建默认的engine:注入了默认的中间件 r := gin.Default() // Set a lower memory limit for multipart forms (default is 32 MiB) r.MaxMultipartMemory = 8 << 20 // 8 MiB //...
package eth import ( "crypto/x509/pkix" "encoding/asn1" "fmt" "math/big" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/kms" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-eth...
// Copyright 2016 <NAME>. All rights reserved. // Use of this source code is governed by a license that can be found in the LICENSE.txt file. // Password store - currently only supports goleveldb and cassandra. package main import ( "encoding/binary" "errors" "github.com/gocql/gocql" "golang.org/x/crypto/bcrypt...
package core import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" "net/url" "strings" "github.com/pborman/uuid" "github.com/shieldproject/shield/db" "github.com/shieldproject/shield/lib/github" "github.com/shieldproject/shield/route" "github.com/shieldproject/shield/util" ) type GithubAuthProvi...
package prog import ( "context" "fmt" "time" "github.com/ambientsound/visp/api" "github.com/ambientsound/visp/clipboard" "github.com/ambientsound/visp/db" "github.com/ambientsound/visp/input/keys" "github.com/ambientsound/visp/list" "github.com/ambientsound/visp/log" "github.com/ambientsound/visp/multibar" ...
// Copyright (c) 2018, CAOHONGJU. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. ...
package handler import ( "errors" "fmt" "github.com/keptn/go-utils/pkg/api/models" keptnv2 "github.com/keptn/go-utils/pkg/lib/v0_2_0" "github.com/keptn/keptn/go-sdk/pkg/sdk" "github.com/keptn/keptn/webhook-service/lib" ) const webhookConfigFileName = "webhook/webhook.yaml" type SecretEnv struct { Env map[stri...
// Code generated by protoc-gen-go. DO NOT EDIT. // source: bcast.proto package crdt_pb import ( fmt "fmt" proto "github.com/golang/protobuf/proto" math "math" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-...
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this f...
package cmd import ( "bytes" "encoding/base64" "encoding/binary" "encoding/json" "fmt" "strings" "github.com/xitongsys/parquet-go/parquet" "github.com/xitongsys/parquet-go/types" ) // MetaCmd is a kong command for meta type MetaCmd struct { CommonOption Base64 bool `name:"base64" short:"b" help:"Encode min...
package database import ( "crypto/rand" "fmt" mathrand "math/rand" "github.com/shopspring/decimal" "gorm.io/driver/mysql" "gorm.io/driver/sqlite" "gorm.io/gorm" "apprit/store/api/v1/database/dtos" "apprit/store/api/v1/utils" ) func CreateDatabase() *gorm.DB { profile := utils.GetEnv("PROFILE", "DEV") dat...
package awskms import ( "context" "crypto" "crypto/rsa" "fmt" "io" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/kms" "github.com/aws/aws-sdk-go/service/kms/kmsiface" ) var _ crypto.Signer = (*Signer)(nil) // Signer is a crypto.Signer that uses a AWS KMS backed key. It should be // init...
package logs import ( "fmt" "strings" ) const ( actionFields = 'w' actionTags = 'x' ) // NewLayout 创建Layout func NewLayout(format string) (*Layout, error) { l := &Layout{} if err := l.Parse(format); err != nil { return nil, err } return l, nil } // https://wiki.jikexueyuan.com/project/log4j/log4j-patte...
/* Copyright 2022 Gravitational, Inc. 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, soft...
package main import ( "context" "fmt" "log" "os" "strings" "github.com/Masterminds/semver/v3" "github.com/WillAbides/semver-next/internal" "github.com/alecthomas/kong" "github.com/google/go-github/v28/github" "golang.org/x/oauth2" ) var version = "unknown" var kongVars = kong.Vars{ "repo_help": `GitHub r...
// Code generated by protoc-gen-go. DO NOT EDIT. // source: payment.proto /* Package schema is a generated protocol buffer package. It is generated from these files: payment.proto It has these top-level messages: Payment PaymentList PaymentEvent */ package schema import proto "github.com/golang/protobuf/proto" ...
package main import ( "fmt" "log" "os" "os/exec" "path/filepath" "time" ) func command(name string, arg ...string) *exec.Cmd { cmd := func() *exec.Cmd { if p, err := exec.LookPath("telegram-notify"); err == nil { _, f1 := os.LookupEnv("TELEGRAM_NOTIFY_TOKEN") _, f2 := os.LookupEnv("TELEGRAM_NOTIFY_CHAT...
// Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "bytes" "io" "io/ioutil" "log" "os" "path/filepath" "strings" "testing" ) const tmplText = "foo" func TestParseExecute(t *t...
package main import ( "fmt" "github.com/ryanuber/columnize" ) func help(args ...string) { if len(args) < 1 { fmt.Printf("List of all %s commands:\n", Prog) help0 := []string{ "? | (\\?) | Synonym for `help'.", "clear | (\\c) | Clear the current input statement.", "exit | (\\q) | Exit cmha-cli. Same...
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** package v1alpha import ( "context" "reflect" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) // Returns the details of a fleet. func LookupFleet(ctx *pulumi.Con...
// Copyright 2019 tree xie // // 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 wri...
/* * Copyright 2019 InfAI (CC SES) * * 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 t...
package models import ( "github.com/jinzhu/gorm" ) type SodexoUser struct { Id int `json:"id" gorm:"type:int(11);primary_key"` Uid int `json:"uid" gorm:"type:int(11);"` Uuid string `json:"uuid" gorm:"type:varchar(64);"` Username string `json:"username" gorm:"type:varchar(64);"` M...
/* Copyright IBM Corp 2016 All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writ...
// Package graphite implements a Graphite backend for package metrics. Metrics // will be emitted to a Graphite server in the plaintext protocol which looks // like: // // "<metric path> <metric value> <metric timestamp>" // // See http://graphite.readthedocs.io/en/latest/feeding-carbon.html#the-plaintext-protocol. /...
package auth import ( "context" "regexp" "strings" "github.com/ThreeDotsLabs/watermill/message" "github.com/golang-tire/auth/internal/pkg/pubsub" zaplogger "github.com/casbin/zap-logger" "github.com/golang-tire/pkg/log" "github.com/casbin/casbin/v2" "github.com/casbin/casbin/v2/model" "github.com/casbin/...
/* Package food provides methods and tools for generating fantasy food styles. */ package food import ( "context" "fmt" "github.com/ironarachne/world/pkg/geography" "github.com/ironarachne/world/pkg/random" "github.com/ironarachne/world/pkg/resource" "github.com/ironarachne/world/pkg/slices" ) const foodStyleE...
package model import ( "container/heap" "fmt" "time" ) const ( checkExpireNum = 10 moveBackNum = 10 ) // Item is key-value pair stored in model type Item struct { key string Row interface{} Expire int64 index int } func newItem(key string, row interface{}, expire int64) *Item { return &Item{key:...
/* Copyright AppsCode Inc. and Contributors 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...
/* Copyright 2021 Intel Coporation. SPDX-License-Identifier: Apache-2.0 */ package k8sutil import ( "context" "crypto/x509" "encoding/base64" "fmt" "io/ioutil" "os" "strings" "github.com/intel/trusted-certificate-issuer/api/v1alpha1" tcsapi "github.com/intel/trusted-certificate-issuer/api/v1alpha1" "github...
package cbnet import ( "errors" "fmt" "os" "path/filepath" "github.com/cloud-barista/cb-larva/poc-cb-net/pkg/file" cblog "github.com/cloud-barista/cb-log" "github.com/sirupsen/logrus" ) // CBLogger represents a logger to show execution processes according to the logging level. var CBLogger *logrus.Logger fun...
package viewLib import ( "encoding/json" "log" "os" "strconv" "sync" "time" "github.com/boltdb/bolt" ) //Counter is an instance of a [pageName]pageView hash map. This is implemented //with a mutex RW lock for concurrent R/W safety var Counter = struct { sync.RWMutex M map[string]int }{M: make(map[string]int...
//Package sse implements a server and client for the HTML5 Server-Sent-Events protocol. //More protocol information available at https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events package sse import ( "bufio" "encoding/json" "errors" "fmt" "io" "net/http" "strings" ) //Sender is ...
/* Copyright 2021 Ciena 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, softw...
package quick import ( "fmt" "math/rand" "reflect" "strings" ) var DefaultConfig = Config{ Sizes: []int{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 99, 100, 101, 127, 128, 129, 255, 256, 257, ...
// Copyright 2020 Anapaya Systems // // 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 i...
package resource import ( "context" "encoding/json" "io/ioutil" "net/http" "path" "strings" ) type ctxKey int const paramsKey ctxKey = ctxKey(0) // RouteParams is a map of param names to values that are matched with a pattern to a path. // Param ID's are expected to be unique. type RouteParams map[string]stri...
package main import ( "crypto/rsa" "fmt" "io/ioutil" "log" "net/http" "strconv" "time" jwt "github.com/dgrijalva/jwt-go" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" "github.com/go-chi/cors" ) const ( privKeyPath = "keys/private.pem" pubKeyPath = "keys/public.pem" readMePath = "RE...
package service import ( "fmt" "net/http" "regexp" "strings" "github.com/companieshouse/chs.go/log" "github.com/companieshouse/insolvency-api/constants" "github.com/companieshouse/insolvency-api/dao" "github.com/companieshouse/insolvency-api/models" "github.com/companieshouse/insolvency-api/utils" ) // Vali...
//go:generate bitfanDoc -codec multiline // The multiline codec will collapse multiline messages and merge them into a single event. // // The original goal of this codec was to allow joining of multiline messages from files into a single event. For example, joining Java exception and stacktrace messages into a single ...
package main import ( "errors" "strings" "testing" ) var defaultsymbolSubsets = map[string]bool{ "alphabetic": true, "digit": true, "special": true, "space": false, } // testing generate function // len(generate(n, X)) = n func TestGenerateLength(t *testing.T) { for i := 0; i < 100; i++ { s, e...
// Code generated by protoc-gen-go. DO NOT EDIT. // source: comm.proto package proto import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import ( context "golang.org/x/net/context" grpc "google.golang.org/grpc" ) // Reference imports to suppress errors if they are not otherwise use...
package v8 /* #include "v8_wrap.h" #include <stdlib.h> */ import "C" import "unsafe" import "runtime" //import "reflect" // A sandboxed execution context with its own set of built-in objects // and functions. type Context struct { embedable self unsafe.Pointer engine *Engine } type ContextScope struct { conte...
package chicken import ( "time" "github.com/lindsaygelle/nook" "github.com/lindsaygelle/nook/animal" "github.com/lindsaygelle/nook/character" "github.com/lindsaygelle/nook/gender" "github.com/lindsaygelle/nook/personality" "golang.org/x/text/language" ) var ( benedictBirthday = nook.Birthday{ Day: 10, ...
// Copyright 2019 The go-ultiledger Authors // // 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 o...
// Package utils contains all utility functions that currently have no better home than here. package utils import ( "context" "fmt" "os" "os/signal" "runtime/debug" "sync" "syscall" "time" "github.com/edaniels/golog" ) // ContextualMain calls a main entry point function with a cancellable // context via SI...
// Code generated by smithy-go-codegen DO NOT EDIT. package lambda import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" smithy "github.com/awslabs/smithy-go" "github.com/awslabs/smithy-go/middleware" smithyhttp "github.com/awslabs/smithy-go/...
package main import ( "bytes" "embed" "encoding/xml" "github.com/pkg/browser" "html/template" "io" "io/ioutil" "log" "mime/multipart" "net/http" "os" "strings" ) // content is our static web server content. //go:embed static var static embed.FS func main() { go browser.OpenURL("http://localhost:8000") ...
package alice import ( "errors" "fmt" "time" "github.com/streadway/amqp" ) // RabbitProducer models a RabbitMQ producer type RabbitProducer struct { channel *amqp.Channel // The channel this producer uses to communicate with the broker exchange *Exchange // The exchange this producer p...
package main import ( "fmt" "image" "math" "os" "path/filepath" "gocv.io/x/gocv" ) const x = math.Pi / 180 func Rad(d float64) float64 { return d * x } func Deg(r float64) float64 { return r / x } func main() { messiPath := filepath.Join("messi.jpg") // read image messi := gocv.IMRead(messiPath, gocv.IMRe...
package gaskv import ( "io" "time" "github.com/cosmos/cosmos-sdk/store/types" "github.com/cosmos/cosmos-sdk/telemetry" ) var _ types.KVStore = &Store{} // Store applies gas tracking to an underlying KVStore. It implements the // KVStore interface. type Store struct { gasMeter types.GasMeter gasConfig types.G...
package server import ( "autoscaler/db" "autoscaler/helpers" "autoscaler/metricscollector/collector" "autoscaler/models" "code.cloudfoundry.org/cfhttp/handlers" "code.cloudfoundry.org/lager" "encoding/json" "fmt" "net/http" "strconv" "strings" ) type MetricHandler struct { nodeIndex int nodeAdds []str...
package aerospike import ( "context" "database/sql" "errors" as "github.com/aerospike/aerospike-client-go" "github.com/magiconair/properties" "github.com/pingcap/go-ycsb/pkg/ycsb" ) const ( asNs = "aerospike.ns" asHost = "aerospike.host" asPort = "aerospike.port" ) type aerospikedb struct { client *as.C...
// +build integration // Copyright (c) 2017 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 u...
package acrostic import ( "errors" "fmt" "strconv" "unicode" "github.com/noyuno/lgo/runes" ) // Phrase : 文節 type Phrase struct { //Options : Options Options *Options //Instance : Instance Instance *Instance Text [][]rune Keywords [][]rune NewLine bool // Destination : 係り先の文節番号 Destination int // ...