text stringlengths 11 4.05M |
|---|
package ansi
import (
"fmt"
"strconv"
)
const (
numStaticBytes = 3
numStaticInts = 3
)
// Seq represents an escape sequence, led either by ESC or CSI control
// sequence for writing to some output. May only be constructed by any of the
// Escape.With family of methods.
type Seq struct {
id Escape
numBytes in... |
package db
import "database/sql"
// QueryDb 查询记录
func QueryDb(id int) (interface{}, error) {
return nil, sql.ErrNoRows
}
|
/*
* EVE Swagger Interface
*
* An OpenAPI for EVE Online
*
* OpenAPI spec version: 0.4.1.dev1
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
package swagger
// 200 ok object
type GetFleetsFleetIdOk struct {
// Is free-move enabled
IsFreeMove bool `json:"is_free_move,omitempty"`
... |
package logger
import (
"nighthawk/rabbitmq"
"time"
"github.com/streadway/amqp"
)
type Logger struct {
Timestamp time.Time `json:"timestamp"`
LogLevel string `json:"log_level"`
Worker string `json:"worker"`
Body interface{} `json:"body"`
}
type LoggerFactory interface {
InitMQLogger()
... |
package main
import (
"database/sql"
"encoding/json"
"fmt"
_ "github.com/lib/pq"
"io/ioutil"
"log"
"net/http"
"strconv"
)
type post struct {
UserId int `json:"user_id"`
Id int `json:"id"`
Title string `json:"title"`
Body string `json:"body"`
}
type comment struct {
Name string `json:"name"... |
package main
import (
"fmt"
)
func main() {
x := 423
if x == 41 {
fmt.Println("This is 41")
} else if x == 42 {
fmt.Println("This is 42")
} else if x == 43 {
fmt.Println("This is 43")
} else {
fmt.Println("The value was not 40,41,42 or 43")
}
}
|
package gluatemplate
import (
"bytes"
"fmt"
"github.com/yuin/gopher-lua"
"text/template"
)
func Loader(L *lua.LState) int {
tb := L.NewTable()
L.SetFuncs(tb, map[string]lua.LGFunction{
"dostring": doString,
"dofile": doFile,
})
L.Push(tb)
return 1
}
// render
func doString(L *lua.LState) int {
tmplc... |
package http
// -> session-token string
// <- recurring-payments []RecurringPayment
import (
"github.com/gin-gonic/gin"
"github.com/hokora/bank/util"
"net/http"
)
type RecurringPayment struct {
ID uint64
Start int64
Stop int64
Next int64
Amt float64
From string
To string
Interval uint16
}
func... |
// DRUNKWATER TEMPLATE(add description and prototypes)
// Question Title and Description on leetcode.com
// Function Declaration and Function Prototypes on leetcode.com
//775. Global and Local Inversions
//We have some permutation A of [0, 1, ..., N - 1], where N is the length of A.
//The number of (global) inversions ... |
package email
func SendVerificationEmail(email, name, url string) error {
// @TODO: Implement Email Service Of Choice
return nil
}
func SendResetPassword(email, name, url string) error {
// @TODO: Implement Email Service Of Choice
return nil
}
func SendWelcomeEmail(email, name string) {
// @TODO: Implement Em... |
package apperror
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"path"
"runtime"
"strconv"
)
const (
ErrFailedToDecodeConfigurationFile = "Failed to decode configuration file: %v\n"
)
type V1Error struct {
ErrorCode string `json:"error_code"`
PublicMessage string `json:"public_message"`
DebugMessage st... |
package intercom
import (
"encoding/json"
"fmt"
)
// Admin represents an Admin in Intercom.
type Admin struct {
ID json.Number `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
Email string `json:"email"`
}
// AdminList represents an object holding list of Admins
type AdminLis... |
package main
import "fmt"
func soma(a int, b int) int {
return a + b
}
func main() {
res := soma(5, 5)
fmt.Println("5+5 =", res)
}
|
package parcels
/*
import (
"crypto/md5"
"encoding/binary"
"encoding/hex"
"encoding/json"
"hash"
"math"
"sort"
"spWebFront/FrontKeeper/infrastructure/core"
"spWebFront/FrontKeeper/infrastructure/log"
"spWebFront/FrontKeeper/server/app/domain/model"
)
type Parcel = model.Parcel
/*struct {
model.Parcel
Relev... |
/*
You are given an integer n.
Each number from 1 to n is grouped according to the sum of its digits.
Return the number of groups that have the largest size.
Example 1:
Input: n = 13
Output: 4
Explanation: There are 9 groups in total, they are grouped according sum of its digits of numbers from 1 to 13:
[1,10], [2... |
package common
import (
"bufio"
"container/list"
"encoding/json"
log "github.com/cihub/seelog"
"os"
"sync"
)
/* Interface Comment
* for push and fetch, msg deal function is diffrent
* implement it at rocketxclean and rocketxfetch
*/
type taskDealMsg interface {
DealMsg(msgStruct InputMsg, msgDealCount int) i... |
// Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0.
package export
import (
"context"
"database/sql"
"slices"
"strings"
"time"
"github.com/pingcap/errors"
"github.com/pingcap/tidb/br/pkg/version"
tcontext "github.com/pingcap/tidb/dumpling/context"
clientv3 "go.etcd.io/etcd/client/v3"
)
const tidbSer... |
package observability_test
import (
"context"
"testing"
"time"
"github.com/syncromatics/kafmesh/internal/observability"
watchv1 "github.com/syncromatics/kafmesh/internal/protos/kafmesh/watch/v1"
"gotest.tools/assert"
)
func Test_Watcher(t *testing.T) {
watcher := &observability.Watcher{}
ctx, cancel := con... |
package utils
import (
"fmt"
"os"
"strings"
"github.com/go-sql-driver/mysql"
"github.com/go-xorm/core"
"github.com/go-xorm/xorm"
)
// LoadMySQLConfigEnv initializes MySQL config using Environment Variables.
func LoadMySQLConfigEnv() *mysql.Config {
conf := &mysql.Config{
Net: "tcp",
Addr:... |
package main
import (
"fmt"
"github.com/spf13/viper"
"github.com/takeru56/cnos/cinii"
"log"
"net/url"
"os"
"strconv"
"github.com/spf13/cobra"
)
type booksFlags struct {
keyword string
title string
author string
publisher string
yearfrom int
yearto int
count int
sort int
lang int
}
v... |
package backend
//go:generate mockgen -source=$GOFILE -destination=mock/mock_$GOFILE -package=mock
import (
"errors"
"fmt"
"sort"
"github.com/goropikari/psqlittle/core"
)
// DB is interface of DBMS
type DB interface {
GetTable(string) (Table, error)
CreateTable(string, core.Cols) error
DropTable(string) erro... |
package structNovedad
import (
"time"
"github.com/xubiosueldos/conexionBD/Concepto/structConcepto"
"github.com/xubiosueldos/conexionBD/Legajo/structLegajo"
"github.com/xubiosueldos/conexionBD/structGormModel"
)
type Novedad struct {
structGormModel.GormModel
Nombre string `json:"nombre"`... |
package main
import (
"encoding/json"
"github.com/gorilla/mux"
"log"
"net/http"
)
type Provider struct {
ID string `json:"providerID,omitempty"`
Name string `json:"name,omitempty"`
Tier string `json:"tier,omitempty"`
Links *Links `json:"links,omitempty"`
}
type Links struct {
Href string `json:"href,om... |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
package armhelpers
import (
"context"
"testing"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-03-30/compute"
azcompute "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"git... |
package main
import (
"fmt"
"os"
"github.com/gyepisam/redux"
)
var cmdInit = &Command{
Run: runInit,
LinkName: "redo-init",
UsageLine: "redux init [OPTIONS] [DIRECTORY ...]",
Short: "Creates or reinitializes one or more redo root directories.",
}
func init() {
text := `
If one or more DIRECTORY a... |
package mock
import "github.com/10gen/realm-cli/internal/cloud/atlas"
// AtlasClient is a mocked Atlas client
type AtlasClient struct {
atlas.Client
GroupsFn func() ([]atlas.Group, error)
ClustersFn func(groupID string) ([]atlas.Cluster, error)
DatalakesFn func(groupID string) ([]atlas.Datalake, error)
}
// ... |
package dates_utils
import "time"
const format = "01-02-2006 15:04:05Z"
func GetNow() time.Time {
return time.Now().UTC()
}
func GetNowString() string {
return GetNow().Format(format)
}
|
package main
import (
"fmt"
"github.com/cosmos/ethermint/version"
"github.com/spf13/cobra"
)
// var (
// VERSION string
// BUILD_TIME string
// GO_VERSION string
// GIT_BRANCH string
// COMMIT_SHA1 string
// )
var versionCmd = &cobra.Command{
Use: "v",
Short: "Print the version number of ethermin... |
// Copyright 2020 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
package testcore
import (
"github.com/iotaledger/wasp/packages/vm/core/testcore/sandbox_tests/test_sandbox_sc"
"testing"
"github.com/iotaledger/wasp/packages/coretypes"
"github.com/iotaledger/wasp/packages/solo"
"github.com/iotaledger/wasp/p... |
package checker
import (
"context"
"crypto/tls"
"crypto/x509"
"fmt"
"log"
"os"
"time"
"github.com/cybertec-postgresql/vip-manager/vipconfig"
client "go.etcd.io/etcd/client/v3"
)
// EtcdLeaderChecker is used to check state of the leader key in Etcd
type EtcdLeaderChecker struct {
key string
nodename s... |
package main
import (
"errors"
"strings"
"time"
)
func main() {
t := NewThing("blep")
time.Sleep(time.Second)
t.ChangeMessage("bork")
time.Sleep(time.Second)
t.EmphasizeMessage(1)
time.Sleep(time.Second)
t.EmphasizeMessage(3)
time.Sleep(time.Second)
t.Stop()
}
type Thing struct {
msg string
action c... |
package RPC
import (
"bytes"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"time"
)
const RPCUSER = "user"
const RPCPASSWORD = "pwd"
const RPCURL = "http://127.0.0.1:8332"
type Rpc_Requst struct {
Requst *http.Request
Ahead Rpc_Ahead
}
type Rpc_Ahead struct {
Id int ... |
package main
import "fmt"
func main() {
var a [3]int
fmt.Println(a[0])
fmt.Println(a[len(a)-1])
for i, v := range a {
fmt.Println("%d %d \n", i, v)
}
//var tet , bb int = 1, 2
var (
tet int;
bb string
)
print(tet, bb)
months := [...]string{1: "January", 12: "December"}
Q2 := months[4:7]
fmt.Printl... |
package generate
import (
"github.com/spf13/cobra"
"opendev.org/airship/airshipctl/pkg/environment"
)
// NewGenerateCommand creates a new command for generating secret information
func NewGenerateCommand(rootSettings *environment.AirshipCTLSettings) *cobra.Command {
generateRootCmd := &cobra.Command{
Use: "gene... |
package skylark
import (
"fmt"
"bldy.build/build/label"
"github.com/google/skylark"
"github.com/pkg/errors"
)
// newAttributor returns a new bazel build context.
func attributors() bldyDict {
attributors := make(bldyDict)
for _, actionName := range []string{
"bool",
"int",
"int_list",
"label",
"label... |
package main
import (
"fmt"
"github.com/mebiusashan/gcms/internal/config"
)
func main() {
cfx, err := config.Read("E:\\git\\gcms\\configs\\gcms.toml")
fmt.Println(cfx.Server.Port)
fmt.Println(err)
}
|
package hiragana
// Hiragana returns a map between hiragana characters and their pronunciation
func Hiragana() map[string]string {
Hira := make(map[string]string)
Hira["a"] = "あ"
Hira["i"] = "い"
Hira["u"] = "う"
Hira["e"] = "え"
Hira["o"] = "お"
Hira["ka"] = "か"
Hira["ki"] = "き"
Hira["ku"] = "く"
Hira["ke"] =... |
package main
import (
"os"
"fmt"
"io"
"strings"
"bufio"
)
var _ = fmt.Println
const Separator = " "
type Reader struct {
*bufio.Reader
}
func NewReader(r io.Reader) *Reader {
return &Reader{bufio.NewReader(r)}
}
func (r *Reader) ReadEntry() (entry *Entry, err error) {
bytes, _, err := r.ReadLine()
if err... |
package Solution
/**
* Definition for a binary tree node.
* type TreeNode struct {
* Val int
* Left *TreeNode
* Right *TreeNode
* }
*/
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func maxDepth(root *TreeNode) int {
return getDepth(root, 0)
}
func getDepth(node *TreeNode... |
// SchnorrSignatureSample project main.go
package main
import (
"crypto/hmac"
"crypto/rand"
"crypto/sha256"
"fmt"
"math/big"
"reflect"
"github.com/btcsuite/btcd/btcec"
)
func main() {
// a is private key
a, _ := rand.Int(rand.Reader, btcec.S256().N)
m := []byte("message")
// Schnorr Signature > sign
R, ... |
package render
import "forum/pkg/model"
//CreateAllForum create forum list response
func CreateAllForum(in []*model.Forum) []*model.ForumResponse {
if len(in) < 1 {
return []*model.ForumResponse{}
}
out := make([]*model.ForumResponse, len(in))
for i, forum := range in {
out[i] = &model.ForumResponse{
Foru... |
package main
import (
"bufio"
"encoding/json"
"flag"
"fmt"
"os"
"sort"
"strings"
)
var (
fileName = flag.String("f", "examples/production.json", "Файл с правилами")
)
func main() {
rules, backRules, err := loadRules(*fileName)
if err != nil {
fmt.Println(err)
return
}
fmt.Println("Правила в Базе знан... |
package main
import "fmt"
func main() {
foo(2020) // usual function
b1 := bar("Print")
fmt.Println(b1)
}
//usual function
func foo(x int) {
fmt.Println(x)
}
//Returning
func bar(b string) string {
return b
}
|
// GENERATED CODE - DO NOT EDIT!
//
// Generated by:
//
// go run gen_trace.go -o cache.pb.go -pkg testpb -files sourcegraph.com/sqs/grpccache/testpb@test.pb.go
//
// Called via:
//
// go generate
//
package testpb
import (
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
... |
package main
import (
"github.com/mndrix/tap-go"
"github.com/opencontainers/runtime-tools/cgroups"
"github.com/opencontainers/runtime-tools/validation/util"
)
func main() {
var weight uint16 = 500
var leafWeight uint16 = 300
var major, minor int64 = 8, 0
var rate uint64 = 102400
t := tap.New()
t.Header(0)
... |
// Package handler registers "/table-of-contents.{js,css}" routes
// on http.DefaultServeMux on init.
package handler
import (
"go/build"
"log"
"net/http"
"path/filepath"
"github.com/shurcooL/go/gopherjs_http"
"github.com/shurcooL/httpfs/httputil"
"github.com/shurcooL/httpfs/vfsutil"
)
func init() {
// HACK:... |
package main
import "fmt"
func main() {
show(23, "abc", 98, 89, 34)
}
func show(i int, s1 string, s ...int) {
fmt.Printf("%#v\n", i)
fmt.Printf("%#v\n", s1)
fmt.Printf("%#v\n", s)
}
func disp(i []int) {
fmt.Printf("%#v", i)
}
|
package concurrent
import (
"errors"
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestDo(t *testing.T) {
t.Run("empty", func(t *testing.T) {
require.NoError(t, Do())
})
t.Run("with nil", func(t *testing.T) {
require.NoError(t, Do(nil))
})
t.Run("one", func(t *testing.T) {
slice := []i... |
package http
import (
"github.com/wcong/ants-go/ants/node"
)
// welcome struct
type WelcomeInfo struct {
Message string
Greeting string
Time string
}
// result of start spider
type StartSpiderResult struct {
Success bool
Message string
Spider string
Time string
MasterNode *node.NodeInfo... |
package postal_test
import (
"github.com/cloudfoundry-incubator/notifications/config"
"github.com/cloudfoundry-incubator/notifications/postal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
const FixtureFile = "/postal/fixtures/test.text"
var _ = Describe("FileSystem", func() {
var fs p... |
/*
* Copyright (c) 2020. Ant Group. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
package main
var (
Version = "development"
)
|
package userroute
type insertRequest []params
func insertRequestConvert(r insertRequest) []params {
return r
}
type listRequest struct {
UserId int `json:"userId" validate:"required"`
BelongToUser bool `json:"belongToUser"`
}
type listResponse []RouteWithGroups
func newListResponse(routes []RouteWithGrou... |
package orm
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestColumn_New(t *testing.T) {
t.Run("NewColumn", func(t *testing.T) {
column, err := NewColumn("test", "integer", "int32", true)
assert.NoError(t, err)
assert.NotEmpty(t, column.Type)
assert.NotEmpty(t, column.String())
assert.C... |
package opentrace
import (
"github.com/opentracing/opentracing-go"
"net/http"
)
type (
// Injector knows how to propagate a trace
// http.Request agrument should be immutable
// For any modifications, use a copy of the http.Request and replace the pointer
Injector interface {
Inject(tracer opentracing.Tracer,... |
// Copyright 2021 PingCAP, 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 i... |
/*
Package fork sets up process to run in the background.
*/
package fork
import (
"log"
"os"
"os/signal"
"syscall"
"time"
)
func spawnChild() (*os.Process, error) {
daemonState := os.Getenv("_DAEMON_STATE")
switch daemonState {
case "":
syscall.Umask(0022)
syscall.Setsid()
os.Setenv("_DAEMON_STATE", "... |
package main
import (
"encoding/json"
"fmt"
"inmemorydb/model"
"net"
)
var db = map[string]string{}
func main() {
listener, err := net.Listen("tcp", ":9091")
if err != nil {
panic(err)
}
for {
conn, err := listener.Accept()
if err != nil {
panic(err)
}
go handleConnection(conn)
}
}
func handle... |
// Copyright 2020 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
package test
import (
"github.com/iotaledger/wasp/packages/coretypes"
)
const ScName = "erc20"
const ScDescription = "ERC-20 PoC for IOTA Smart Contracts"
const ScHname = coretypes.Hname(0x200e3733)
const ParamAccount = "ac"
const ParamAmount =... |
package web
import (
"fmt"
"html"
"net/http"
"sync"
"github.com/criteo/graphite-remote-adapter/client"
"github.com/criteo/graphite-remote-adapter/client/graphite"
"github.com/criteo/graphite-remote-adapter/config"
"github.com/criteo/graphite-remote-adapter/ui"
"github.com/criteo/graphite-remote-adapter/utils... |
package api
import (
"bufio"
"bytes"
"encoding/json"
"errors"
"fmt"
"net/http"
"github.com/DigitalOnUs/inotx/config"
)
//////// models //////////
var (
ErrEmptyInputFile = errors.New("Empty file to consulize")
ErrorUnsupportedFormat = errors.New("Not supported extension")
)
//File struct
type File st... |
package main
import (
"fmt"
)
func addBinary(a string, b string) string {
i := len(a) - 1
j := len(b) - 1
s := ""
var plus byte
for i >= 0 || j >= 0 {
t := plus
if i >= 0 {
t = t + a[i] - byte(48)
}
if j >= 0 {
t = t + b[j] - byte(48)
}
r := t % 2
plus = t / 2
s = fmt.Sprintf("%d%s", r, s)... |
package base
import (
"backend/base/ws"
"backend/user/models"
"backend/utils/common"
"backend/utils/gredis"
"backend/utils/logging"
"backend/utils/response"
"encoding/json"
"github.com/astaxie/beego/core/validation"
"github.com/gin-gonic/gin"
"net/http"
)
func UserLogin(c *gin.Context) {
type User struct {... |
package compoundsplitting
import (
"bufio"
"os"
"strconv"
"strings"
)
// Dictionary filter for the splitting algorithm
// based on the words in the contextionary
type ContextionaryDict struct {
dict map[string]int // storing the word and its occurrence
}
// NewContextionaryDict
// uses a dictionary file that w... |
package main
import (
"log"
"os"
)
const maxConnRetries = 5
func reqEnv(name string) string {
val := os.Getenv(name)
if len(val) == 0 {
log.Fatalf("please set the %s environment variable", name)
}
return val
}
func main() {
}
|
package model
import (
"ginTest/dao"
"github.com/pkg/errors"
"time"
)
//订单:Order
//Id
//订单编码 OrderCode
//商品名称 GoodsName
//商品单位 GoodsUnit
//商品数量 GoodsNumbers
//总金额 TotalAmount
//供应商 SupplierName
//支付状态 PayStatus 0:未支付 1:已支付
type Orders struct {
Id int `json:"_" `
OrderCode ... |
package main
import "fmt"
var a int
func main() {
for {
fmt.Println("Введите чило")
_, err := fmt.Scan(&a)
if err != nil {
fmt.Printf("error => %s", err)
}
fmt.Println(fib(a))
}
}
func fib(n int) int {
numberFib := make(map[int]int)
numberFib[0] = 0
numberFib[1] = 1
if val, ok := numberFib[n]; o... |
package fishy
import (
"fmt"
"github.com/getcouragenow/core-bs/sdk/pkg/common/gitutil"
"github.com/getcouragenow/core-bs/sdk/pkg/common/osutil"
"github.com/getcouragenow/core-bs/sdk/pkg/oses"
log "github.com/sirupsen/logrus"
"os"
)
const (
bsFishes = "github.com/getcouragenow/core-fish"
)
type GoFishInstallat... |
// Package handlers provides http handlers for HPKE.
package handlers
import (
"bytes"
"fmt"
"hash/fnv"
"net/http"
"strconv"
"time"
"github.com/rs/cors"
"github.com/pomerium/pomerium/internal/httputil"
"github.com/pomerium/pomerium/internal/urlutil"
"github.com/pomerium/pomerium/pkg/hpke"
)
// HPKEPublicK... |
package cookiestore
import (
"crypto/rand"
"fmt"
"net/http"
"time"
"github.com/byuoitav/auth/session"
"github.com/golang-jwt/jwt/v4"
)
type Store struct {
ttl int
maxAge int
key []byte
}
func NewStore(opts ...Option) *Store {
signingKey := make([]byte, 64)
_, err := rand.Read(signingKey)
if err !=... |
package skeleton
import (
"bytes"
"crypto/md5"
//"encoding/base64"
"encoding/binary"
"errors"
"io"
"io/ioutil"
"log"
"net/http"
"strconv"
"github.com/golang/protobuf/proto"
pbd "yunjing.me/phoenix/pbd/go"
oaccount "webapi/account"
osession "webapi/session"
)
const (
kMinPacketSize = 2 + 4 + 2 + md5.... |
package service_test
import (
"context"
"crypto/tls"
"fmt"
"io"
"io/ioutil"
"net/http"
"reflect"
"testing"
"time"
"github.com/go-ocf/cloud/resource-aggregate/cqrs"
"github.com/go-ocf/kit/codec/cbor"
"github.com/go-ocf/kit/codec/json"
"github.com/go-ocf/cloud/authorization/provider"
c2cTest "github.com... |
package commands
import (
"fmt"
"github.com/dghubble/go-twitter/twitter"
"github.com/dora1998/snail-bot/repository"
"regexp"
"time"
)
type Command struct {
Name string
HandleFunc func(body string, username string, statusId int64, repo Repository)
}
type CommandHandler struct {
repository Repository
... |
package main
import (
adventutilities "AdventOfCode/utils"
"log"
)
func solvePuzzleN(lines []string, right int, down int)(numTrees int){
lenY := len(lines)
log.Println("numrows = ", lenY)
s := lines[0]
lenX := len(s)
log.Println("numcols = ", lenX)
numTrees = 0
xPos := 0
log.Println("right =", right)... |
// Copyright 2023 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 (
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
)
// statusHandler is an http.Handler that writes an empty response using... |
package main
import (
"fmt"
"math/rand"
"net"
"os"
"time"
)
// Standard Channels
// VERSION_ROLLING_BITS = 16
// NONCE_BITS = 32
type MessageFrame struct {
ExtensionType uint16
MsgType uint8
// MsgLength uint24
Payload []byte
}
type SignatureNoiseMessage struct {
Version uint16
ValidFrom ... |
package chatroom
import ("testing")
/*
// Acceptance test
func Test_our_chatroom_is_live(t *testing.T) {
var chatroom *Chatroom = new (Chatroom)
bigJim := ClientMock{"Big Jim", chatroom, noMsg}
barbie:= ClientMock{"Barbie", chatroom, noMsg}
bigJim.enter()
barbie.enter()
if (bigJim.popLastMessa... |
package main
import "strings"
func encrypt(text string, key string) string {
result := []rune(strings.ToLower(text))
for i := 0; i < len(result); i++ {
if strings.ContainsRune(En, result[i]) {
result[i] = (((result[i] - a) + (rune(key[i%len(key)]) - a)) % Alphabet) + a
}
}
return string(result)
}
|
/*****************************************************************
* Copyright©,2020-2022, email: 279197148@qq.com
* Version: 1.0.0
* @Author: yangtxiang
* @Date: 2020-08-26 17:00
* Description:
*****************************************************************/
package regcenter
import (
"fmt"
"github.com/go-xe2/x/... |
package remove
import (
"errors"
"github.com/devspace-cloud/devspace/cmd/flags"
"github.com/devspace-cloud/devspace/pkg/util/factory"
"github.com/devspace-cloud/devspace/pkg/util/message"
"github.com/spf13/cobra"
)
type imageCmd struct {
*flags.GlobalFlags
RemoveAll bool
}
func newImageCmd(f factory.Factory... |
package routes
import (
"aplicacoes/projeto-zumbie/config"
"aplicacoes/projeto-zumbie/controller"
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
)
var portaAplicacao string
// HandleFunc ...
func HandleFunc() {
rotas := mux.NewRouter()
config.TryConn()
portaAplicacao = ":3000"
fmt.Prin... |
package main
import "fmt"
type st1 struct {
Id int
Name string
}
type st2 struct {
Id int
Name string
}
func main(){
s1:= st1{12,"abc2"}
s2 := st2(s1)
fmt.Println("", s1, s2)
}
|
package pov
import (
"os"
"path/filepath"
"testing"
"time"
"github.com/google/uuid"
"github.com/qlcchain/go-qlc/common"
"github.com/qlcchain/go-qlc/common/event"
"github.com/qlcchain/go-qlc/common/types"
"github.com/qlcchain/go-qlc/config"
"github.com/qlcchain/go-qlc/ledger"
"github.com/qlcchain/go-qlc/moc... |
package main
import (
"fmt"
"github.com/nsf/termbox-go"
)
type Scene interface {
React(g *Game, e termbox.Event) error
SetView()
}
type Game struct {
noCircleWin int
noCrossWin int
running bool
scene Scene
firstTurn Cell
}
func NewGame() *Game {
return &Game{
scene: NewMenu(),
running:... |
package main
import (
"flag"
"fmt"
"log"
"os"
"time"
)
func main() {
filename := flag.String("file", "", "log file (default: stdout)")
flag.Parse()
outFile := os.Stdout
if *filename != "" {
file, err := os.OpenFile(*filename, os.O_RDWR|os.O_CREATE, os.ModePerm)
if err != nil {
log.Fatal(err)
}
... |
// Copyright 2017 VMware, Inc. 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... |
// @Description jwt
// @Author jiangyang
// @Created 2020/11/17 4:12 下午
package jwt
import (
"time"
jwtgo "github.com/dgrijalva/jwt-go"
"github.com/pkg/errors"
)
const DefaultExpireDuration = time.Hour * 24 * 30
var (
ErrTokenExpired = errors.New("Token is expired")
ErrTokenNotValidYet = errors.New(... |
package core
import (
"errors"
"flag"
"fmt"
)
func MakeInputData() (iData *InputData, err error) {
//var iData InputData
arguments := makeRawArgumentString()
fmt.Printf("%+v\n", *arguments)
if passed, err := arguments.validate(); !passed {
fmt.Println("raw input data validation did not passed")
return nil... |
// Copyright (c) 2019 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package main
import (
"fmt"
"github.com/vladimirvivien/gexe"
ci "github.com/vmware-tanzu/crash-diagnostics/.ci/common"
)
func main() {
arches := []string{"amd64"}
oses := []string{"darwin", "linux"}
e := gexe.New()... |
package leetcode
import (
"fmt"
"math"
)
type calculator struct {
values map[string]int
}
func (c *calculator) sum(nums []int, i, j int) int {
sum := 0
key := fmt.Sprintf("%d-%d", i, j-1)
if value, ok := c.values[key]; ok {
sum = value + nums[j]
} else {
for x := i; x <= j; x++ {
sum += nums[x]
}
}
... |
package main
import (
"fmt"
"os/exec"
)
func main(){
var conn string
conn = "binario_test@tunnel.us-2.checkpoint.security" //CHANGE connection information
var port string
port = "7777" //CHANGE port to be redirected (localhost)
c := exec.Command("ssh", "-i", "cp.pem", "-NL", port+":tunnel:1", conn)
if err :=... |
package containersnapshot
import (
"context"
"testing"
"time"
atomv1alpha1 "github.com/supremind/container-snapshot/pkg/apis/atom/v1alpha1"
"github.com/supremind/container-snapshot/pkg/constants"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
apimeta "k8s.io/apimachinery/p... |
package main
import (
"test"
"fmt"
)
func main() {
fmt.Printf("This is main!\n")
testapp.Test()
} |
package main
import (
//"fmt"
"funbird-dataReport/compress"
"funbird-dataReport/execl"
db "funbird-dataReport/models"
mail "funbird-dataReport/sendmail"
"log"
"os"
"github.com/WangJiemin/gocomm"
)
func PathExists(path string) (bool, error) {
_, err := os.Stat(path)
if err == nil {
return true, nil
}
if... |
package arriba
import (
"encoding/xml"
"fmt"
)
//Node holds the function name taken from the data-lift attribute and
// the NodeSeq is the raw inner html that we will pass to the function on the data-lift attribute
type Node struct {
FunctionName string `xml:"data-lift,attr"`
NodeSeq string `xml:",innerxml"`... |
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"otherside/api/seatgeekLayer"
"otherside/api/spotifyLayer"
"reflect"
"strings"
"time"
"otherside/api/redisLayer"
"github.com/gorilla/mux"
"github.com/zmb3/spotify"
)
type TopTrackResponse struct {
Track spotify.FullTrack
ArtistE... |
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
package todolist
import (
"crypto/rand"
"fmt"
"io"
"math"
"strings"
"time"
)
func AddIfNotThere(arr []string, items []string) []string {
for _, item := range items {
there := false
for _, arrItem := range arr {
if item == arrItem {
there = true
}
}
if !there {
arr = append(arr, item)
}
... |
package data
import (
"github.com/bububa/oppo-omni/model"
)
type QQuickAppGameListResponse struct {
model.BaseResponse
Data *QQuickAppGameListResult `json:"data,omitemtpy"`
}
type QQuickAppGameListResult struct {
ItemCount int64 `json:"itemCount,omitempty"`
TotalCount int64 ... |
package models
// OperateChan is operation channel
var OperateChan chan OperateModel
// OperateModel is struct for set
type OperateModel struct {
Operate string
Key string
Value []byte
}
|
package inject
import (
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"testing"
)
func Test_datadogMutator_mutate(t *testing.T) {
cpuLimits, _ := resource.ParseQuantity("100m")
cpuRequests, _ := resource.ParseQuantity("10m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.