text
stringlengths
3.08k
10.4k
package main import ( "fmt" "github.com/derat/advent-of-code/lib" ) func main() { grid := lib.InputLinesBytes("2019/20") labels := make(map[string][][2]int) // label e.g. "AZ" to r,c for r := 0; r < len(grid)-1; r++ { for c := 0; c < len(grid[0])-1; c++ { if ch := grid[r][c]; ch >= 'A' && ch <= 'Z' { ...
// // Author:: <NAME> (<<EMAIL>>) // Copyright:: Copyright 2021, 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...
package core import ( "encoding/json" "github.com/streadway/amqp" log "github.com/sirupsen/logrus" proc "github.com/LaCumbancha/yelp-review-ha/cmd/common/processing" props "github.com/LaCumbancha/yelp-review-ha/cmd/common/properties" comms "github.com/LaCumbancha/yelp-review-ha/cmd/common/communication" rabbit...
// +build stm32,stm32f407 package machine // Peripheral abstraction layer for the stm32f4(07) import ( "device/stm32" "runtime/interrupt" "unsafe" ) func CPUFrequency() uint32 { return 168000000 } func (p Pin) getPort() *stm32.GPIO_Type { switch p / 16 { case 0: return stm32.GPIOA case 1: return stm32.G...
package main import ( "bufio" "fmt" "io" "log" "os" "os/exec" "path/filepath" "sync" "time" ) func pip(args []string) { config := readConfig() localPip := config.Local.Pip // _ = _execCommand(localPip, args) proc := NewProcess(localPip, args...) out := proc.StreamOutput() logFile := filepath.Join(getLo...
package tfl import ( "encoding/json" "errors" "fmt" "io/ioutil" "net/http" "net/url" "strings" "time" ) const ( apiURL string = "https://api.tfl.gov.uk" journeyResultsPath string = "Journey/JourneyResults" toPath string = "to" stopPointPath string = "StopPoint" searchPath ...
/* 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 fi...
package gui import ( "fmt" "io" "time" screen "github.com/tweekmonster/nmux/screen" "github.com/tweekmonster/nmux/util" "github.com/gorilla/websocket" ) type Client struct { Addr string Conn *websocket.Conn firstRun bool palette map[int]screen.CellAttrs ClearBG screen.Color curStyle ...
// Command logfmt is an opinionated log formatter package main import ( "bufio" "encoding/json" "fmt" "io" "os" "strconv" "strings" "time" humanize "github.com/dustin/go-humanize" "github.com/wayneashleyberry/truecolor/pkg/color" ) // HTTPPayload does things type HTTPPayload struct { RequestMethod ...
package urlvalues import ( "fmt" "reflect" "strings" "sync" "github.com/go-playground/form" ) // decoderOpts contain options for form.Decoder. type decoderOpts struct { maxArraySize uint mode form.Mode tagName string } // newDecoderOpts return decoderOpts with default values. func newDecoderOpt...
package sentences import ( "strings" ) /* AnnotateTokens is an interface used for the sentence tokenizer to add properties to any given token during tokenization. */ type AnnotateTokens interface { Annotate([]*Token) []*Token } /* TypeBasedAnnotation performs the first pass of annotation, which makes decisions bas...
// Copyright Chaos Mesh 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 w...
// Copyright 2021-present Open Networking Foundation. // // 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 applica...
package mp4 import ( "encoding/binary" "sort" ) func (f *File) Optimize() error { sort.Stable(topLevelBoxSort(f.Child)) moov := f.Box.Find("moov") if moov == nil { // no offsets to adjust return nil } // collect old mdat offsets var oo []int64 for _, b := range f.Child { if b.Type == "mdat" { oo =...
// Copyright (c) 2018 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package main import ( "fmt" "github.com/kaspanet/kaspad/config" "github.com/kaspanet/kaspad/domainmessage" "github.com/kaspanet/kaspad/netadapter/standalone" "github.com/...
package aws import ( "fmt" "sync" "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" "github.com/gruntwork-io/go-commons/errors" "github.com/gruntwork-io/go-commons/retry" multierror "github.com/hashicorp/go-multierror" "github.com/gruntwo...
package net import ( "fmt" gonet "net" "strings" "time" "github.com/pivotal-golang/clock" boshsettings "github.com/cloudfoundry/bosh-agent/settings" bosherr "github.com/cloudfoundry/bosh-utils/errors" boshlog "github.com/cloudfoundry/bosh-utils/logger" boshsys "github.com/cloudfoundry/bosh-utils/system" ) ...
// Copyright 2012-present <NAME>. All rights reserved. // Use of this source code is governed by a MIT-license. // See http://olivere.mit-license.org/license.txt for details. package elastic import ( "context" "fmt" "net/url" "net/http" "strings" ) // CatHealthService returns a terse representation of the same ...
package wappa import ( "context" "net/http" ) const rideEndpoint endpoint = `ride` // Ride statuses. const ( RideStatusSearchingForDriver = "searching-for-driver" RideStatusDriverNotFound = "driver-not-found" RideStatusCancelled = "ride-cancelled" RideStatusDriverFound = "driver-found" Rid...
// Copyright 2020 The Moov Authors // Use of this source code is governed by an Apache License // license that can be found in the LICENSE file. package wire import ( "encoding/json" "strings" "unicode/utf8" ) // InstitutionAccount is the institution account type InstitutionAccount struct { // tag tag string /...
// Code generated by transpiler. DO NOT EDIT. /** * Go Video Downloader * * Copyright 2019 Tenta, 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 * * http://www.apache.or...
package realtime import ( "context" "encoding/json" "fmt" "log" "net/http" "os" "time" "github.com/buger/jsonparser" "github.com/go-numb/go-dydx/private" "github.com/go-numb/go-dydx/public" "github.com/gorilla/websocket" ) const ( PRODUCTION = "wss://api.dydx.exchange/v3/ws" STAGING...
// Copyright (c) 2019 - for information on the respective copyright owner // see the NOTICE file and/or the repository at // https://github.com/direct-state-transfer/dst-go/NOTICE // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License...
package ewasm import ( "bytes" "encoding/hex" "flag" "fmt" "io/ioutil" "os" "path" "reflect" "strings" "testing" "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" ) const testsPath = "tests" type testCase struct { Description string Script []byte PreState [32]byte Block []byte PostState...
// Package mpd implements parsing and generating of MPEG-DASH Media Presentation Description (MPD) files. package mpd import ( "bytes" "encoding/xml" "fmt" "io" "regexp" "strconv" ) // http://mpeg.chiariglione.org/standards/mpeg-dash // https://www.brendanlong.com/the-structure-of-an-mpeg-dash-mpd.html // http:...
// Copyright (c) 2018-2019 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package pow import ( "context" "database/sql" "fmt" "net/http" "strconv" "time" "github.com/raedahgroup/dcrextdata/app" "github.com/raedahgroup/dcrextdata/app/he...
// Copyright 2016 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...
package main import ( "bytes" cr "crypto/rand" "crypto/sha256" "encoding/hex" "errors" "flag" "fmt" oh "github.com/ossrs/go-oryx-lib/http" ol "github.com/ossrs/go-oryx-lib/logger" "github.com/satori/go.uuid" "net/http" "os" "time" ) func CreateUserID(channelID, user string) string { var b bytes.Buffer ...
package bootstrap import ( "fmt" "net" "os" "os/signal" "syscall" "time" "github.com/cloudflare/tableflip" log "github.com/sirupsen/logrus" "golang.org/x/sys/unix" ) const ( // EnvPidFile is the name of the environment variable containing the pid file path EnvPidFile = "GITALY_PID_FILE" // EnvUpgradesEna...
// Copyright 2018 jsonnet-bundler 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 a...
package releaseresolver import ( "fmt" "net/url" "os" "path/filepath" "sync" "code.cloudfoundry.org/fissile/model" "code.cloudfoundry.org/fissile/util" multierror "github.com/hashicorp/go-multierror" "github.com/mholt/archiver" "github.com/vbauerster/mpb" "github.com/vbauerster/mpb/decor" ) //LoadReleases...
package nitro import ( "errors" //"fmt" "image" "image/color" "io" //"os" ) // An NCGR (nitro character graphic resource) stores pixel data. type NCGR struct { header Header char _CHAR Data []byte pix []byte // unpacked pixel cache } type _CHAR struct { Height, Width uint16 // Pixel format BitDept...
package handlers import ( "database/sql" "encoding/json" "io" "net/http" "strconv" "github.com/mattgen88/pindish/pinterest" "github.com/AreaHQ/jsonhal" "github.com/gorilla/mux" "github.com/mattgen88/pindish/models" log "github.com/sirupsen/logrus" ) // RecipesResponse describes boards for user type Recipe...
// Code generated by protoc-gen-go. DO NOT EDIT. // source: envoy/extensions/filters/listener/original_dst/v3/original_dst.proto package envoy_extensions_filters_listener_original_dst_v3 import ( fmt "fmt" _ "github.com/cncf/udpa/go/udpa/annotations" proto "github.com/golang/protobuf/proto" math "math" ) // Refe...
// Copyright (c) 2018 // Author: <NAME> <jaw @ <EMAIL>> // Created: 2018-Dec-22 10:18 (EST) // Function: monitor other systems package monitor import ( "expvar" "fmt" "net" "time" "github.com/jaw0/acgo/diag" "github.com/jaw0/kibitz" "github.com/jaw0/kibitz/myinfo" "github.com/jaw0/yentablue/config" "github...
package mutationParser import ( "errors" "hcc/clarinet/data" "hcc/clarinet/http" "strconv" ) func checkServerArgsEach(args map[string]interface{}) bool { _, subnetUUIDOk := args["subnet_uuid"].(string) _, osOk := args["os"].(string) _, serverNameOk := args["server_name"].(string) _, serverDescOk := args["serv...
/* Version 1.0 */ /*Games usually work with an EVENT LOOP. for { recieve input(mouse/keyboard etc) update everything (physics, ai) draw } */ /* THINGS TO IMPROVE: FRAME RATE INDEPENDENCE. SCOREBOARD IMPLEMENTATION. IMPROVE AI. */ package main import ( "fmt" "github.com/veandco/go-sdl2/sdl" ) co...
package convert import ( "reflect" "strings" "runtime" "github.com/hetian9288/json2dart/app/fields" "fmt" "os" "github.com/sirupsen/logrus" "encoding/json" ) type Convert struct { ModelName string Data interface{} Path string Fields []fields.Fields FieldsSort []string PackagePath s...
package forwarding import ( "context" "errors" "fmt" "io" "log" "net" "time" "github.com/cretz/bine/tor" "golang.org/x/crypto/ed25519" "github.com/cmars/oniongrok/config" ) // Service implements a forwarding service. It sets up and operates forwarding // as defined by configuration. type Service struct { ...
package downloader import ( "errors" "fmt" "github.com/shettyh/threadpool" "io" "log" "net/http" "net/pansx/fileInfo" "net/pansx/utils" "os" "os/exec" "path" "path/filepath" "strings" ) type Downloader struct { workerNum int destDir string host string results []*threadpool.Future pool ...
//(C) Copyright [2020] Hewlett Packard Enterprise Development LP // //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 a...
package scaling import ( "reflect" "sync" "time" "github.com/golang/glog" scalingpolicy "github.com/justinsb/scaler/pkg/apis/scalingpolicy/v1alpha1" "github.com/justinsb/scaler/pkg/factors" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/util/clock" ) // resourceScalingRuleEvaluator holds the...
package radolan import ( "bufio" "strings" "testing" "time" ) type headerTestcase struct { // head of file test string // expected expBinary string expProduct string expCaptureTime time.Time expForecastTime time.Time expInterval time.Duration expDx int expDy int exp...
// Taken from https://github.com/containers/image // Modifications Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. package tarfile import ( "archive/tar" "encoding/json" "io" "os" "path" "cdk-ecr-deployment-handler/internal/iolimits" "github.com/containers/image/v5/docker/reference" "gith...
// Copyright 2020, 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 cmpopts_test import ( "fmt" "net" "time" "github.com/Boklazhenko/go-cmp/cmp" "github.com/Boklazhenko/go-cmp/cmp/cmpopts" "github.com/Boklazhenk...
/* Copyright @ 2021 bocloud <<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 agreed ...
package util //GLPATH=/usr/lib make import ( // "sort" "image/color" "os" "fmt" "math/rand" "gonum.org/v1/plot" "gonum.org/v1/plot/plotter" "gonum.org/v1/plot/plotutil" "gonum.org/v1/plot/vg" "io/ioutil" "math" "gonum.org/v1/gonum/floats" "gonum.org/v1/gonum/stat" ) func CheckError(e error) { if e != ni...
package inventory import ( "context" "crypto/tls" "crypto/x509" "strconv" "strings" "github.com/pkg/errors" "go.etcd.io/etcd/api/v3/mvccpb" etcdv3 "go.etcd.io/etcd/client/v3" etcdns "go.etcd.io/etcd/client/v3/namespace" ) type ( // EtcdDatasource implements an etcd datasource. EtcdDatasource struct { //...
// Copyright 2018 <NAME>. Atos Technologies - Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois, France. // // 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.apa...
// Copyright 2015 Keybase, Inc. All rights reserved. Use of // this source code is governed by the included BSD license. package systests import ( "bytes" "strings" "testing" "time" "github.com/keybase/client/go/client" "github.com/keybase/client/go/gregor" "github.com/keybase/client/go/libkb" gregor1 "githu...
package main import ( "bufio" "fmt" "math/rand" "os" "sort" ) func main() { reader := bufio.NewReader(os.Stdin) n, m, k := readThreeNums(reader) E := make([][]int, m) for i := 0; i < m; i++ { E[i] = readNNums(reader, 3) } fmt.Println(solve(n, m, k, E)) } func readInt(bytes []byte, from int, val *int) i...
/* Copyright 2020 The Kubernetes Authors 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 ag...
// 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 writing...
package main import ( "boot/util" "fmt" "github.com/urfave/cli" "log" "os" "strings" ) func initFIle(name, path, opath, v string) { //pom createFile(util.Pom(name, v, opath)) //application createFile(util.ApplicationApp(name, path, opath)) //test createFile(util.TestFile(name, path, opath)) //resources ...
/* * Copyright 2018- The Pixie 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 ag...
package main import ( "io" "io/fs" "log" "os" "path/filepath" ) const ( modeDir os.FileMode = 0755 modeNormal os.FileMode = 0644 modePrivate os.FileMode = 0700 ) // NewFilePath creates a new FilePath object with the given // filename and options. // // The FilePath object encapsulates common functionali...
// Copyright Turing Corp. 2018 All Rights Reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package broadcast import ( "encoding/hex" "runtime" "time" "github.com/turingchain2020/turingchain/p2p/utils" net "github.com/turingchain2020/turingchain/sy...
package tikv import ( "strings" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/store/tikv" "github.com/pingcap/tidb/util/codec" ) // Codec encode bytes to be sortable type Codec interface { EncodeBytes(b []byte, data []byte) []byte DecodeBytes(b []byte, buf []byte) ([]byte, []byte, error) } // RawT...
package main import ( "testing" ) func validateMoveTo(t *testing.T, mo *MoveOptimizer, to []int, escore int) { moves := mo.perfectMove[0] score := moves[0].score if score != escore { t.Errorf("Wrong score! score=%v escore=%v moves=%v emove=%v", score, escore, moves, to) return } if len(moves) != len(to)...
package measurement import ( "github.com/tarent/gomulocity/generic" "io/ioutil" "net/http" "net/http/httptest" "reflect" "testing" "time" ) func buildMeasurementApi(url string) MeasurementApi { httpClient := http.DefaultClient client := generic.Client{ HTTPClient: httpClient, BaseURL: url, Username:...
// +build functional package proxy_test import ( "context" "io/ioutil" "log" "net" "net/http" "os" "testing" "time" "gotest.tools/assert" "github.com/schnoddelbotz/uds-proxy/proxy" "github.com/schnoddelbotz/uds-proxy/proxy_test_server" ) var testProxy *proxy.Instance const ( fakeServerPort = ":2577...
package main import ( "errors" "fmt" "github.com/codegangsta/cli" "github.com/shirou/gopsutil/disk" "github.com/stvp/pager" "net" "net/http" "os" "strings" ) type DiskUsageReport struct { Mountpoint string `json:"mountpoint"` Usage *disk.DiskUsageStat `json: "usage"` } type ServiceComman...
package main import ( "bytes" "errors" "io" "io/ioutil" "net" "os" "strings" "github.com/AlecAivazis/survey/v2" "github.com/peterh/liner" ) const ( Sender = "send" Receiver = "receive" BackSelect = ".." FileConfig = "file config" ) var ErrBackSelect = errors.New("go back") type app struct { opt...
package main import ( "context" "errors" "fmt" "math/rand" "os" "path/filepath" "sync" "time" "github.com/iand/logfmtr" "github.com/urfave/cli/v2" "github.com/iand/gonudb" ) func main() { app := &cli.App{ Name: "gonudbsample", HelpName: "gonudbsample", Usage: "Sample application for Gonu...
package internal import ( "fmt" ) var ( fieldDigitToLetterLat map[int]string fieldDigitToLetterLon map[int]string fieldLetterToDigitLat map[string]float64 fieldLetterToDigitLon map[string]float64 fieldDegLatitudes = [...]float64{ -90, -80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20, ...
package network import ( "path/filepath" "strconv" "testing" . "github.com/smartystreets/goconvey/convey" ) // docker container's process ID points to its tcp stats in /proc/{pid}/net/tcp var mockPids = []int{1234, 5678, 91011} //mockTcpContent := []byte(`ivnalidsl local_address rem_address st tx_queue rx_qu...
// +build CargoEntities package CargoEntities import( "encoding/xml" "code.myceliUs.com/Utility" ) type Notification struct{ /** The entity UUID **/ UUID string /** The entity TypeName **/ TYPENAME string /** The parent uuid if there is some. **/ ParentUuid string /** The relation name with the parent. **/...
// Package peer implements an object used to represent peers in the libp2p network. package peer import ( "encoding/hex" "errors" "fmt" ic "github.com/libp2p/go-libp2p-core/crypto" b58 "github.com/mr-tron/base58/base58" mh "github.com/multiformats/go-multihash" ) var ( // ErrEmptyPeerID is an error for empty ...
package nodes import ( "context" "fmt" "github.com/doddle/lander/pkg/chart" v1 "k8s.io/api/core/v1" "math" "strings" "time" "github.com/patrickmn/go-cache" "github.com/withmandala/go-log" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" ) var ( // hard limit cache for 15sec, ex...
// *** 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 solidserver import ( "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/go/pulumi" ) type IPSubnet struct { s *pulumi.ResourceState ...
package v1 import ( rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // +genclient // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ClusterPolicy ... type ClusterPolicy Policy // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/ru...
package crypto import ( "crypto/aes" "crypto/cipher" "crypto/rand" "encoding/base64" "fmt" "io" "os" "regexp" "strings" ) // Here we provide some tools to deal with encryption. All the methods here can // and should be improved to provide more security, here are just the simplest // and secure methods // En...
package main import ( "os" "os/exec" "strings" "strconv" "encoding/json" "io/ioutil" "errors" "github.com/jawher/mow.cli" log "github.com/Sirupsen/logrus" ) var version string var commit string type configuration struct { Periscope periscope `json:"periscope"` Video video `json:"video"` } type...
/* * Copyright 2021 Comcast Cable Communications Management, 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by...
package main import ( "flag" "fmt" "io/ioutil" "os" "path/filepath" "strings" "github.com/richardjkendall/tf-auto-document/parser" "github.com/richardjkendall/tf-auto-document/scangit" "github.com/richardjkendall/tf-auto-document/writer" ) // CombinedModuleDetails holds the combined module details type Comb...
// Copyright 2013 <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...
package sweetiebot import ( "time" "github.com/erikmcclure/discordgo" ) // Module monitors all incoming requests depending on what module interfaces they implement type Module interface { Name() string Commands() []Command Description(*GuildInfo) string //Config() interface{} } // Giving each possible hook fu...
// Copyright 2016-2019 DutchSec (https://dutchsec.com/) // // 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...
package gorethink import ( "fmt" "strconv" "strings" p "github.com/dancannon/gorethink/ql2" ) type OptArgs interface { toMap() map[string]interface{} } type termsList []Term type termsObj map[string]Term type Term struct { name string rootTerm bool termType p.Term_TermType data interface{} args ...
package memmetrics import ( "runtime" "sync" "time" "github.com/mailgun/timetools" . "gopkg.in/check.v1" ) type RRSuite struct { tm *timetools.FreezedTime } var _ = Suite(&RRSuite{}) func (s *RRSuite) SetUpSuite(c *C) { s.tm = &timetools.FreezedTime{ CurrentTime: time.Date(2012, 3, 4, 5, 6, 7, 0, time.UTC...
// Copyright © 2017 yukimemi // // 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...
package parse import ( "github.com/divyesh19/sqlgen2/parse/exit" "go/ast" "go/types" "fmt" ) type LType struct { PkgName string // package name (short name) Name string // name of source code type. } func (t LType) String() string { if t.PkgName == "" { return t.Name } return fmt.Sprintf("%s.%s", t.Pkg...
package main import ( "errors" "fmt" "net" "sync" "time" ) /** Default settings 1. Time can be up to 2^38 2. Support machines up to 2^16 3. Rate is 1ms -> 2^10 ids 4. Time unit of genertor: 1ms **/ const ( TIMEBIT = 38 MACHINEBIT = 16 SEQUENCEBIT = 10 TIMEUNIT = time.Millisecond ) // IDConfig - Conf...
package main import ( "bufio" "bytes" "fmt" "os" ) func readInt(bytes []byte, from int, val *int) int { i := from sign := 1 if bytes[i] == '-' { sign = -1 i++ } tmp := 0 for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' { tmp = tmp*10 + int(bytes[i]-'0') i++ } *val = tmp * sign return i } ...
// Copyright 2017, OpenCensus 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 agree...
package v1beta1 type Argocd struct { Deploy bool `json:"deploy,omitempty"` CustomImage *ArgocdCustomImage `json:"customImage,omitempty" yaml:"customImage,omitempty"` Network *Network `json:"network,omitempty" yaml:"network,omitempty"` Auth *ArgocdAuth `json:"a...
package chia import ( "bufio" "bytes" "crypto/tls" "crypto/x509" "encoding/json" "io/ioutil" "log" "net/http" "os" "time" "github.com/dustin/go-humanize" "github.com/minio/minio/pkg/disk" ) func NewClient(CertificateFile string, PrivateKey string, CACertificatePath string) *ChiaClient { //load client ce...
package main import ( "flag" "fmt" "math" "math/rand" "github.com/faiface/pixel" "github.com/faiface/pixel/imdraw" "github.com/faiface/pixel/pixelgl" "github.com/faiface/pixel/text" "github.com/fengttt/gosim" "golang.org/x/image/colornames" "golang.org/x/image/font/basicfont" ) const ( // Universe size N...
package log import ( "context" "encoding/json" "fmt" "time" "github.com/ditointernet/go-dito/lib/errors" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" ) // Level indicates the severity of the data being logged type Level int const ( // LevelCritical ...
package commands //go:generate esc -o assets_gen.go -pkg commands -ignore ".go" assets/ //go:generate easyjson commands.go import ( "github.com/jonas747/dcmd" "github.com/jonas747/discordgo" "github.com/jonas747/yagpdb/common" "github.com/jonas747/yagpdb/docs" "github.com/mediocregopher/radix.v2/redis" log "gi...
package util import ( "bytes" "context" "fmt" "log" "regexp" "github.com/l1ghthouse/northstar-bootstrap/src/mod" "github.com/l1ghthouse/northstar-bootstrap/src/nsserver" "github.com/lucasepe/codename" ) // CreateFunnyName generates a docker like name. func CreateFunnyName() string { rng, err := codename.Def...
package client import ( "encoding/json" "fmt" "log" "net/url" "sync" "github.com/hichtakk/nsxctl/structs" ) func (c *NsxtClient) GetGateway(tier int16, gwId string) structs.Tier0Gateways { var path string if tier == 0 { path = "/policy/api/v1/infra/tier-0s" } else { path = "/policy/api/v1/infra/tier-1s"...
// Package sumhash implements the subset-sum hash function. package sumhash import ( "encoding/binary" "fmt" "hash" ) // digest implementation is based on https://cs.opensource.google/go/go/+/refs/tags/go1.16.6:src/crypto/sha256/sha256.go type digest struct { c Compressor size int // number of bytes...
package upcloud import ( "encoding/json" "time" ) // Constants const ( StorageTypeBackup = "backup" StorageTypeCDROM = "cdrom" StorageTypeDisk = "disk" StorageTypeNormal = "normal" StorageTypeTemplate = "template" StorageTierHDD = "hdd" StorageTierMaxIOPS = "maxiops" StorageAccessPublic = ...
package controllers import ( "context" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.i...
/* Copyright SecureKey Technologies Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package cas import ( "errors" "fmt" "github.com/bluele/gcache" ariesstorage "github.com/hyperledger/aries-framework-go/spi/storage" gocid "github.com/ipfs/go-cid" "github.com/ipfs/go-merkledag" "github.com/ip...
package asset import ( "fmt" "path/filepath" "regexp" "strings" "unicode" "github.com/WhoBrokeTheBuild/TelcomSim/data" "github.com/WhoBrokeTheBuild/TelcomSim/log" gl "github.com/go-gl/gl/v4.1-core/gl" ) // Shader represents an OpenGL Shader Program type Shader struct { ID uint32 Uniforms map[string]i...
package parse_test import ( "encoding/hex" "github.com/jchavannes/jgo/jerr" "github.com/jchavannes/jgo/jlog" "github.com/memocash/index/ref/bitcoin/memo" "github.com/memocash/index/ref/bitcoin/tx/parse" "github.com/memocash/index/ref/bitcoin/tx/script" "github.com/memocash/index/ref/bitcoin/util/testing/test_tx...
/* Package autopool provides a collection of sync.Pool(s) that holds values that are collected when they go out of scope vs. a standard sync.Pool that requires a .Put(). This is useful when the value goes out of scope in a package you do not control, like gRPC. If the value is under your control, a standard sync.Pool i...
package failover import ( "context" "fmt" "strings" "time" kitlog "github.com/go-kit/kit/log" "github.com/gocardless/stolon-pgbouncer/pkg/pgbouncer" "github.com/golang/protobuf/ptypes" tspb "github.com/golang/protobuf/ptypes/timestamp" uuid "github.com/satori/go.uuid" grpc "google.golang.org/grpc" "google....