text stringlengths 3.08k 10.4k |
|---|
package corner
import (
"fmt"
"math"
"strings"
)
type Segment struct {
Start Point
End Point
offsets []float64
rbase float64
rsep float64
}
func (c *Canvas) NewSegment(x0, y0, x1, y1 float64) *Segment {
return &Segment{
Start: Point{x0, y0},
End: Point{x1, y1},
rbase: c.rbase,
rsep: c.... |
/*
Copyright © 2020 <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 writing, software
distri... |
package trading
import (
"encoding/json"
"fmt"
"log"
"sort"
"strconv"
"strings"
"time"
"github.com/shopspring/decimal"
"github.com/yellowred/surfingcat-trading-bot/server/config"
"github.com/yellowred/surfingcat-trading-bot/server/exchange"
"github.com/yellowred/surfingcat-trading-bot/server/message"
"git... |
//
// Author:: <NAME> (<<EMAIL>>)
// Copyright:: Copyright 2020, Lacework Inc.
// License:: Apache License, Version 2.0
//
// 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://ww... |
/*
Copyright (c) 2015 <NAME> (<EMAIL>), All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions
and the following d... |
// Package wavefront is a plugin for go-metrics that provides a Wavefront reporter and tag support at the host and metric level.
package wavefront
import (
"errors"
"log"
"net"
"net/url"
"sort"
"strings"
"time"
"github.com/rcrowley/go-metrics"
)
var (
configError = errors.New("error: invalid wavefront confi... |
package syncer_test
import (
"context"
"testing"
"time"
"github.com/filecoin-project/go-address"
bstore "github.com/ipfs/go-ipfs-blockstore"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/filecoin-project/go-filecoin/internal/pkg/block"
"github.com/filecoin-project/go... |
// Copyright © 2018 NAME HERE <EMAIL>
//
// 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 agree... |
/*
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANT... |
package main
import (
"adventofcode_2015/dinner"
"bufio"
"bytes"
"strings"
)
func main() {
//in := inputTest
in := input
scanner := bufio.NewScanner(bytes.NewBufferString(in))
var rules dinner.Rules
for scanner.Scan() {
l := strings.Trim(scanner.Text(), " \r\n\t")
if l == "" {
continue
}
r, err :=... |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package ecr
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The ECR Image data source allows the details of an i... |
// Copyright (c) 2017 Cisco and/or its affiliates.
//
// 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 applicabl... |
// Copyright 2021 The Cockroach 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 or agreed ... |
/*
Copyright (c) 2015, Alcatel-Lucent Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of condi... |
// 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 tiff
import (
"encoding/binary"
"fmt"
"io"
"sync"
)
// ReadAtReadSeeker is the interface that wraps the Read, ReadAt, and Seek
// methods. Typic... |
package mixer
import "time"
type Sound interface {
// SetPaused starts or stops the sound. Note that the sound position is not
// changed with this function, meaning that if the sound is not playing
// because it was played all the way to the end, calling SetPaused(false)
// will not restart it from the beginning... |
package db
import (
"context"
"fmt"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
mopts "go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/mongo/readconcern"
)
// ApplyOpsResponse represents the response from an 'apply... |
// Package srs transforms FOLIO SRS MARC records in JSON format into a tabular
// form.
package srs
import (
"encoding/json"
"fmt"
)
// Marc is a single "row" of data extracted from part of a MARC record.
type Marc struct {
Line int64
Field string
Ind1 string
Ind2 string
Ord int64
SF strin... |
package version
import (
"fmt"
"runtime"
"strconv"
"strings"
"time"
"github.com/pkg/errors"
"github.com/stackrox/rox/pkg/buildinfo"
"github.com/stackrox/rox/pkg/env"
"github.com/stackrox/rox/pkg/utils"
"github.com/stackrox/rox/pkg/version/internal"
)
// GetMainVersion returns the tag of Rox.
func GetMainVe... |
package middleware
import (
"fmt"
"html"
"log"
"net/http"
"os"
"path"
"sort"
"strings"
fiber "github.com/gofiber/fiber"
)
// Middleware types
type (
// FileSystemConfig defines the config for FileSystem middleware.
FileSystemConfig struct {
// Next defines a function to skip this middleware if returned ... |
package watcher
import (
"os"
"sync"
"time"
"github.com/cloudfoundry-incubator/bbs/db"
"github.com/cloudfoundry-incubator/bbs/events"
"github.com/cloudfoundry-incubator/bbs/models"
"github.com/pivotal-golang/clock"
"github.com/pivotal-golang/lager"
"github.com/tedsuo/ifrit"
)
type Watcher ifrit.Runner
type... |
package parse
import (
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"go.uber.org/zap/zapcore"
)
func TestTimeParsers(t *testing.T) {
testData := []struct {
in interface{}
parser TimeParser
want time.Time
wantErr bool
}{
{int(1), DefaultTimeParser, t... |
package iam
import (
"io"
"net/http"
"testing"
"github.com/go-playground/validator/v10"
"github.com/stretchr/testify/assert"
)
func TestClientCRUD(t *testing.T) {
teardown := setup(t)
defer teardown()
clientName := "TestClient"
clientDescription := "Group description"
applicationID := "f5fe538f-c3b5-4454... |
package chain
import (
"bytes"
"crypto/sha256"
b64 "encoding/base64"
"fmt"
"strconv"
"time"
"../globalvariables"
_ "github.com/go-sql-driver/mysql"
"github.com/jinzhu/gorm"
)
type Chain struct {
ChainID int `gorm:"primary_key"`
Name string `gorm:"unique"`
AccessToken string
Blocks []... |
package main
import (
"context"
"fmt"
"time"
"github.com/DATA-DOG/godog"
"github.com/DATA-DOG/godog/gherkin"
"github.com/alien4cloud/alien4cloud-go-client/v2/alien4cloud"
)
type suiteContext struct {
config Config
a4cClient alien4cloud.Client
applicationID string
environmentID string
ctx ... |
package spatial
import (
"errors"
"math"
"github.com/golang/geo/r1"
"github.com/golang/geo/r2"
)
//RTree representation a tree for spatial indexing which improve the time for searching a location in space
type RTree struct {
Ancestor *RTree
Descendant []*RTree
Items []Item
Rect r2.Rect
MaxItem ... |
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"strings"
"sync"
"time"
"bazil.org/fuse"
"bazil.org/fuse/fs"
"github.com/mholt/caddy/middleware/browse"
"golang.org/x/net/html"
)
type directory struct {
node
de map[string]dirent
mu sync.Mutex
}
type dirent struct {... |
package server
import (
"context"
"fmt"
"log"
"net/http"
"strings"
"testing"
"time"
"github.com/mikeydub/go-gallery/service/opensea"
"github.com/mikeydub/go-gallery/service/persist"
"github.com/stretchr/testify/assert"
)
func TestOpenseaSync_Success(t *testing.T) {
assert := setupTest(t, 1)
ctx := contex... |
package zonecut
import (
"fmt"
"github.com/hashicorp/golang-lru"
"github.com/ANSSI-FR/transdep/messages/nameresolver"
"github.com/ANSSI-FR/transdep/messages/zonecut"
"github.com/ANSSI-FR/transdep/tools"
"github.com/ANSSI-FR/transdep/errors"
errors2 "errors"
)
// REQ_CHAN_CAPACITY is the capacity of the channel... |
// Copyright (c) <NAME> @bwplotka
// Licensed under the Apache License 2.0.
package linktransformer
import (
"bytes"
"encoding/json"
"fmt"
"math"
"net/http"
"regexp"
"strconv"
"time"
"github.com/pkg/errors"
"gopkg.in/yaml.v3"
)
type Config struct {
Version int
Validators []ValidatorConfig `yaml:"valida... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package appsync
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
)
type ListTypesInput struct {
_ struct{} `type:"structure"`
// The API ID... |
package pixeltmx
import (
"image"
"os"
_ "image/png" // This is required for the parsing png resource files
"github.com/elliotmr/tmx"
"github.com/faiface/pixel"
"github.com/pkg/errors"
"path/filepath"
)
type tileSetEntry struct {
data *pixel.TrianglesData
frame pixel.Rect
firstGID uint32
source ... |
package crypto
import (
"encoding/json"
"fmt"
common "github.com/lukaszozimek/alpha-vantage-api-client"
"io/ioutil"
"strings"
)
type AlphaVantageRealTimeCurrencyExchange struct {
ExchangeRateResult ExchangeRateResult
}
type ExchangeRateResult struct {
FromCurrencyCode string `json:"1. From_Currency Code"`
F... |
/*
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... |
package log
import (
"fmt"
"io"
"net/url"
"os"
"strconv"
"strings"
)
// These EnvKeys describe environmental variables used to set Config
// variables.
const (
// LogLevel is the env var representing the log level. Values should
// use our logger's representation: "TRACE", "DEBUG", etc.
LogLevel EnvKey = "LO... |
/**
* Author: <NAME>
* Version: 1.0.0
* Date: 2021/4/9 下午12:55
* Description: etcd 集群存储节点元信息配置
**/
package cluster
import (
"context"
"encoding/json"
"fmt"
"strings"
"sync"
"time"
"github.com/weitrue/Seckill/infrastructure/stores/etcd"
"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/etcdserv... |
package cmd
import (
"fmt"
"io/ioutil"
"net/url"
"os"
"runtime"
"strings"
"github.com/pkg/browser"
)
// LinuxDistribution is of type int
type LinuxDistribution int
const (
// Unknown is the catch-all distro
Unknown LinuxDistribution = iota
// Ubuntu distribution
Ubuntu
// Arch linux distribution
Arch
... |
package module
import (
models "github.com/das08/kuRakutanBot-go/models/rakutan"
"github.com/google/uuid"
"strings"
)
type Command struct {
Keyword string
SendFunction func(c Clients, env *Environments, lb *LINEBot)
}
var Commands = [...]Command{
{Keyword: "help", SendFunction: helpCmd},
{Keyword: "へるぷ",... |
// Multi-room chat app implemented in gotalk
package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"os"
"os/signal"
"sync"
"syscall"
"time"
"github.com/rsms/gotalk"
)
type Room struct {
Name string `json:"name"`
mu sync.RWMutex
messages []*Message... |
// Copyright 2018 <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 writing, sof... |
package main
import (
"fmt"
"log"
"strings"
"github.com/evalphobia/adventofcode/lib"
)
func main() {
lib.ParseFlag()
value := lib.GetValue()
if value == "" {
log.Fatal("cannot get value")
}
switch {
case lib.GetPart() == 2:
runPart2(value)
default:
runPart1(value)
}
}
func runPart1(value string)... |
/*
* WARNING! All changes made in this file will be lost!
* Created from 'scheme.tl' by 'mtprotoc'
*
* Copyright (c) 2021-present, NebulaChat Studio (https://nebula.chat).
* All rights reserved.
*
* Author: Benqi (<EMAIL>)
*/
package chat
import (
"reflect"
"github.com/teamgram/proto/mtproto"
)
var _ *m... |
package app
import (
"fmt"
"net/http"
"net/url"
"strconv"
"time"
"github.com/rs/zerolog/log"
"github.com/haozibi/leetcode-badge/internal/leetcode"
"github.com/haozibi/leetcode-badge/internal/shield"
"github.com/haozibi/leetcode-badge/internal/storage"
"github.com/haozibi/leetcode-badge/internal/tools"
)
c... |
package turnpike
import (
"crypto/tls"
"errors"
"fmt"
"sync"
"time"
"github.com/gorilla/websocket"
)
// errors.
var (
ErrWSSendTimeout = errors.New("ws peer send timeout")
ErrWSIsClosed = errors.New("ws peer is closed")
)
type websocketPeer struct {
conn *websocket.Conn
serializer Serializer
s... |
package iptables
import (
"bytes"
"fmt"
"sort"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func ruleHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["from_port"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["to_port"].(s... |
// +build integration
package controllers
import (
"context"
"os"
"path/filepath"
"github.com/go-logr/logr"
"github.com/go-logr/zapr"
"github.com/stretchr/testify/suite"
"go.uber.org/zap/zaptest"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis... |
/*
NOTE: The file's contents are a fork of
https://github.com/secmask/go-redisproto/blob/37fbcca3f27bb291d6918e4508fe201d4f180c41/parser.go
*/
package proto
import (
"bytes"
"errors"
"io"
)
var (
ExpectNumber = &ProtocolError{msg: "Expect Number"}
ExpectNewLine = &ProtocolError{msg: "Expect Newline"}
ExpectT... |
package main
import (
"bufio"
"bytes"
"compress/gzip"
"encoding/base64"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
)
var (
flagStaticDir = flag.String("i", "static", "Static directory to embed")
flagOuputFile = flag.String("o", "", "Output file to write to")
flagP... |
// Copyright 2017, Square, Inc.
// Package config handles config files, -config, and env vars at startup.
package config
import (
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"os/user"
"path/filepath"
"strings"
"github.com/alexflint/go-arg"
"github.com/square/spincycle/proto"
"github.com/square/spincycle/request... |
package task
import (
"context"
"encoding/json"
"errors"
"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/mvcc/mvccpb"
"github.com/hpcloud/tail"
"github.com/yihongzhi/log-collector/common/etcd"
"github.com/yihongzhi/log-collector/common/logger"
"github.com/yihongzhi/log-collector/common/utils"
"path... |
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2021 Intel Corporation
package main
import (
"context"
"flag"
"os"
"time"
fwddp_manager "github.com/smart-edge-open/intel-ethernet-operator/pkg/fwddp-manager"
"github.com/smart-edge-open/intel-ethernet-operator/pkg/utils/assets"
appsv1 "k8s.io/api/apps/v... |
/*
Copyright 2021 Crunchy Data Solutions, 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 wri... |
// Copyright © 2022 <NAME> <<EMAIL>>
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
package gs
import (
"fmt"
"github.com/dairaga/gs/funcs"
)
// Either is simplified Scala Either. Concept of Ether is either A or B.
// Either has two subclass Right and L... |
package backplane
import (
"bytes"
"encoding/json"
"errors"
"io/ioutil"
"net/http"
"net/url"
"time"
)
const (
backplaneURL = "https://www.backplane.io"
backplaneHost = "www.backplane.io"
)
// Client is the API client that performs actions against the Backplane API server.
type Client struct {
token string... |
package orchestrator
import (
"bufio"
"bytes"
"encoding/hex"
"errors"
"net"
"github.com/sirupsen/logrus"
)
type Client struct {
config *Config
logger logrus.FieldLogger
callbacks Callbacks
connected bool
transport net.Conn
lastMessageID uint8
}
type Callbacks struct {
OnIntro ... |
package app
import (
"fmt"
"github.com/go-ap/errors"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"net/http"
"os"
"path/filepath"
"time"
)
func (h *handler) Routes() func(chi.Router) {
return func(r chi.Router) {
r.Use(middleware.GetHead)
r.Use(ReqLogger(h.logger))
r.Use(h.LoadSession)
... |
package graphqlc
import (
"context"
"encoding/json"
"fmt"
"strings"
"github.com/gofrs/uuid"
"github.com/pkg/errors"
"golang.org/x/net/websocket"
)
type SubscriptionEvent struct {
Data []byte
Err error
}
func (c *Client) Subscribe(ctx context.Context, req *Request, notifications chan SubscriptionEvent) {
... |
package main
import (
"bufio"
"fmt"
"io"
"os"
"strings"
"sync"
"time"
)
func main() {
var mainErr error
var conf *configuration
conf, mainErr = loadConfig()
if mainErr != nil {
fmt.Fprintln(os.Stderr, mainErr.Error())
os.Exit(1)
}
var s3Deleter *S3Deleter
s3Deleter, mainErr = NewS3Deleter(conf.Reg... |
package pdf
import (
"log"
"strings"
"github.com/dgf/flashcards/api"
"github.com/jung-kurt/gofpdf"
)
// PDF implements api.Printer
type PDF struct {
Options
File string
}
// New creates a new PDF Printer
func New(path string, o Options) api.Printer {
return &PDF{
File: path,
Options: o,
}
}
// font ... |
package bring
import (
"image"
"image/draw"
"github.com/tfriedel6/canvas"
"github.com/tfriedel6/canvas/backend/softwarebackend"
)
type layer struct {
width int
height int
image *image.RGBA
gc *canvas.Canvas
visible bool
modified bool
modifiedRect image.Rectangle
pat... |
package net_test
import (
"cf"
"cf/api"
"cf/configuration"
. "cf/net"
"fmt"
"github.com/stretchr/testify/assert"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"runtime"
"strings"
testconfig "testhelpers/configuration"
testnet "testhelpers/net"
"testing"
)
func TestNewRequest(t *testing.T) {
gateway... |
package image
import (
"context"
"fmt"
"io"
"io/ioutil"
"log"
ctrcontent "github.com/containerd/containerd/content"
"github.com/deislabs/oras/pkg/content"
"github.com/opencontainers/go-digest"
)
// DiskImageStore -.
type DiskImageStore struct {
sourceImage string
writer io.Writer
compressed bool
}
... |
package events
import (
"reflect"
"testing"
"time"
)
var appendFormatTests = []struct {
srcFmt string
srcArgs []interface{}
dstFmt string
dstArgs Args
}{
{ // empty format
srcFmt: "",
srcArgs: nil,
dstFmt: "",
dstArgs: nil,
},
{ // simple string
srcFmt: "Hello World!",
srcArgs: nil,
dstFm... |
// Copyright (C) 2017 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 t... |
// Copyright © 2018 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 ... |
// Copyright 2016, RadiantBlue Technologies, 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 ... |
/*
Copyright 2018 The Kubernetes 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 or agreed to in writing, ... |
// Copyright 2014-2015 Apcera Inc. All rights reserved.
package v1
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/http/httptest"
"net/url"
"strconv"
"sync"
"time"
"github.com/gorilla/mux"
)
var (
testVerbose = false // Change to true in order to see HTTP requests in test output.
testHttpServer *... |
/*
* Copyright 2014 <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 writi... |
package gcpsecrets
import (
"context"
"encoding/base64"
"fmt"
"time"
"github.com/hashicorp/errwrap"
"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/logical"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
)
func pathSecretAccessToken(b *backend) *framework.Path {
return &frame... |
/*
MIT License
Copyright (c) 2018 <NAME>
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, distrib... |
/*
* Minio Client (C) 2015 Minio, 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 agr... |
package lexer
import (
"github.com/yourfavoritedev/golang-interpreter/token"
)
// Lexer converts a string input to produce tokens for the Monkey language.
// It always keeps track of the current position, the next readable position and
// the current character under examination. These tokens will be parsed by
// the... |
// Package taskrunner provides a cron-style execution engine for running arbitrary
// function calls at specified intervals
package taskrunner
import (
"net/url"
"sync"
"github.com/grafana/metrictank/stats"
"github.com/raintank/raintank-apps/task-agent-ng/collector-ns1/ns1"
"github.com/raintank/raintank-apps/tas... |
// Copyright 2021 MatrixOrigin.
//
// 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... |
//
// Copyright © 2021 Uncharted Software 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 ap... |
// Copyright 2015 The LUCI 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 or agreed... |
/*
Copyright © 2020 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 writi... |
package linter
import (
"fmt"
"regexp"
"github.com/skeema/tengo"
)
// Percona's keyword list is same as mysql.
var mysqlKeywordToFlavor = map[string]tengo.Flavor{
"GET" : tengo.FlavorMySQL56,
"IO_AFTER_GTIDS": tengo.FlavorMySQL56,
"IO_BEFORE_GTIDS": tengo.FlavorMySQL56,
"MASTER_BIND": tengo.FlavorMySQL56,
"G... |
package containerapi
import (
"time"
"github.com/cpuguy83/go-docker/container/containerapi/mount"
)
// Config contains the configuration data about a container.
// It should hold only portable information about the container.
// Here, "portable" means "independent from the host we are running on".
// Non-portable ... |
package main
import (
"bytes"
"encoding/json"
"errors"
"flag"
"fmt"
"net/http"
"net/http/httputil"
"net/url"
"os"
"strings"
)
type Release struct {
TagName string `json:"tag_name"`
TargetCommitish string `json:"target_commitish"`
Name string `json:"name"`
Body string `json:... |
package main
import "C"
import (
"github.com/cavaliercoder/grab"
xmly "github.com/jing332/xmlydownloader"
"log"
"net/http"
"os"
"regexp"
"strings"
"time"
"unsafe"
)
//#include "cgo.h"
import "C"
func main() {
log.SetFlags(log.Lshortfile | log.Ltime)
}
var uflCallback C.UpdateFileLengthCallback
//export C... |
package elastic
import (
"bytes"
"context"
"log"
"sync/atomic"
"time"
"github.com/cenkalti/backoff/v4"
"github.com/dustin/go-humanize"
"github.com/elastic/go-elasticsearch/v7"
"github.com/elastic/go-elasticsearch/v7/esapi"
"github.com/elastic/go-elasticsearch/v7/esutil"
"github.com/kozgot/go-log-processing... |
/*
Package hub provides primitives for working with the publish-subscribe messaging model.
All the types are Go channels, so the usage is identical to theirs.
The pattern is simple: publish messages to given topics. To do this a series of commands
are sent to the Hub, which is a plain channel, commands that are execut... |
// Copyright (c) 2014, <NAME>
// Copyright (c) 2011, Open Knowledge Foundation Ltd.
package rst
import (
"errors"
"fmt"
"math"
"net/http"
"regexp"
"sort"
"strconv"
"strings"
)
// addVary adds value to the list of values of the "Vary" header if it's not
// already there.
func addVary(header http.Header, value... |
package registry
import (
"encoding/json"
"errors"
"fmt"
"net/http"
"net/url"
"regexp"
"strings"
rhttp "github.com/aviral26/acr-checkhealth/pkg/http"
"github.com/aviral26/acr-checkhealth/pkg/io"
"github.com/rs/zerolog"
)
// authType is an authorization type to use for an HTTP request.
type... |
package main
import (
"context"
"fmt"
"net/http"
"time"
"github.com/go-co-op/gocron"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
messari "github.com/rajendrarusmana/coinspeed-worker/client... |
package main
import (
"bytes"
"context"
"encoding/binary"
"fmt"
"log"
"os"
"os/signal"
"syscall"
"github.com/bendahl/uinput"
"github.com/mafredri/magic4linux/m4p"
)
const (
broadcastPort = 42830
subscriptionPort = 42831
)
func main() {
ctx, cancel := signal.NotifyContext(context.Background(), os.In... |
package cases
import (
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"time"
"github.com/MetaLife-Protocol/SuperNode/cmd/tools/smoketest/models"
"github.com/MetaLife-Protocol/SuperNode/utils"
)
// TokenSwapsPayload :
type TokenSwapsPayload struct {
Role string `json:"role"`
SendingAmount int3... |
package schema
import (
"fmt"
"io/ioutil"
"sort"
"strings"
"github.com/flynn/json5"
"github.com/go-errors/errors"
)
func panicIfErr(err error) {
if err != nil {
panic(err)
}
}
// ParseSchemaFile -
func ParseSchemaFile(schemaFile string) ConvictConfigSchema {
data, err := ioutil.ReadFile(schemaFile)
pani... |
package main
import (
"fmt"
"os"
"strings"
"github.com/codegangsta/cli"
_ "github.com/joho/godotenv/autoload"
)
// build number set at compile-time
var version string
// default docker registry
const defaultRegistry = "https://index.docker.io/v1/"
func main() {
app := cli.NewApp()
app.Name = "docker plugin"... |
package gameutils
import (
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/inpututil"
)
// Funciones de comprobación de acción.
// El struct de acción incluye un identificador para saber qué se está
// haciendo así como un modificador para saber con qué intensidad se hace.
type Action st... |
//Copyright 2016 <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 writing, softwa... |
package googledns
import (
"bytes"
"encoding/json"
googleauth "github.com/cloudlibz/gocloud/googleauth"
"io/ioutil"
"net/http"
"time"
)
const (
UnixDate = "Mon Jan _2 15:04:05 MST 2006"
RFC3339 = "2006-01-02T15:04:05Z07:00"
)
//ListResourceDnsRecordSets list ListResourceDnsRecordSets.
func (googledns *Googl... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: pb/helloworld.proto
package helloworld
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... |
package index
import (
"sort"
"storage-fulltext/common"
"storage-fulltext/stemmer"
"sync"
"github.com/Sirupsen/logrus"
"time"
)
const TOP_RESULTS_RETURNED = 100
type Document string
type Occurence struct {
Doc Document
Pos, Prev int
}
type IndexMeta struct {
WordsUsed, ListedOccurences int
LastRef... |
package server
import (
"fmt"
"net/http"
"net/url"
"strings"
"time"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
"github.com/sp0x/torrentd/indexer"
"github.com/sp0x/torrentd/indexer/cache"
"github.com/sp0x/torrentd/indexer/search"
"github.com/sp0x/torrentd/torrent"
"github.com/sp0x/torrent... |
// Copyright © 2018 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 ... |
package api
import (
"context"
"encoding/json"
"fmt"
"golang.org/x/sync/errgroup"
custom_errors "hihoak/api-service/internal/pkg/custom-errors"
spotify "hihoak/api-service/internal/pkg/spotify-structs"
"hihoak/api-service/internal/pkg/utils/logger"
pb "hihoak/api-service/pkg/pb/hihoak/api-service"
"io"
"net/... |
package ros1msg
import (
"fmt"
"strconv"
"strings"
"github.com/foxglove/mcap/go/ros"
)
type Type struct {
BaseType string
IsArray bool
FixedSize int
IsRecord bool
Items *Type
Fields []Field
}
type Field struct {
Name string
Type Type
}
func resolveDependentFields(
parentPackage string,
dep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.