text
stringlengths
11
4.05M
package main import "fmt" func main() { data := []float64{43, 56, 87, 12, 45, 57} // ja tem uma slice, passar a slice n := average(data...) //data é um iten, e mesmo assim que seja so um, //existe um monte de coisa la dentro e estao listados, assim pega esse 1 iten e adiciona ... no final fmt....
package raycaster import ( "image" "image/color" "math" ) const ( //--move speed--// moveSpeed = 0.06 //--rotate speed--// rotSpeed = 0.03 ) // Camera Class that represents a camera in terms of raycasting. // Contains methods to move the camera, and handles projection to, // set the rectangle slice position ...
package main // Leetcode 237. (easy) func deleteNode(node *ListNode) { node.Val = node.Next.Val node.Next = node.Next.Next }
package model import ( "context" "gamesvr/manager" "math" "shared/common" "shared/csv/entry" "shared/csv/static" "shared/global" "shared/protobuf/pb" "shared/statistic/logreason" "shared/utility/coordinate" "shared/utility/errors" "shared/utility/servertime" ) var ( objectHandles = map[int32]objectHandle...
package controller import ( "godson/controller/api" "godson/controller/test" "net/http" "github.com/gin-gonic/gin" swagger "github.com/swaggo/gin-swagger" "github.com/swaggo/gin-swagger/swaggerFiles" ) // Route 总路由 func Route(r *gin.Engine) { r.GET("/", func(c *gin.Context) { c.Redirect(http.StatusMovedPerm...
package store import ( "bytes" "encoding/json" "testing" "github.com/stretchr/testify/assert" "github.com/tilt-dev/tilt/internal/k8s/testyaml" "github.com/tilt-dev/tilt/internal/store/k8sconv" "github.com/tilt-dev/tilt/internal/testutils/manifestbuilder" "github.com/tilt-dev/tilt/internal/testutils/tempdir" ...
package engine type Color struct { R, G, B, A uint8 }
package udwCryptoEncryptV3 import ( "bytes" "crypto/cipher" "crypto/rand" "errors" "github.com/tachyon-protocol/udw/AesCtr" "github.com/tachyon-protocol/udw/udwBytes" "github.com/tachyon-protocol/udw/udwNet" "io" "sync" ) const ErrMsgDecryptKey = "decrypt key error magic buf not match" var gMagicBuf = []byt...
package docker import ( "github.com/docker/docker/api/types" "github.com/docker/docker/client" "golang.org/x/net/context" ) type Docker struct { Containers []types.Container } func (d *Docker) Get() Docker { return Docker{ Containers: d.List(), } } func (d *Docker) List() []types.Container { cli, err := ...
package emm import ( "encoding/xml" "io/ioutil" "strings" "testing" "github.com/certeu/emmchan/rss" ) const ( cd = `<directory> <channel id="P_malekalssite"> <dc:format>rss</dc:format> <dc:type>webnews</dc:type> <dc:subject>eucert</dc:subject> <dc:description>malekals site</dc:description> <...
package dbtoapi import "github.com/spf13/viper" type Config struct { DBType string DBServerIP string DBServerPort string DBName string DBUsername string DBPassword string HttpServerPort string } var conf *Config /*func init() { loadConfig() }*/ func loadConfig() { //viper读取配置...
// Copyright 2018 Authors of Cilium // // 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 models import "testing" func TestConektaError_Error(t *testing.T) { type fields struct { Object string Type string LogId string Details []Detail } tests := []struct { name string fields fields want string }{ { name: "OK", fields: fields{ Object: "Some Object", Type...
// SPDX-License-Identifier: ISC // Copyright (c) 2014-2020 Bitmark Inc. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package currency import ( "github.com/bitmark-inc/bitmarkd/fault" ) // GetFee - returns the fee for a specific currency func (currency Currency) ...
package main import ( "encoding/json" "fmt" "html/template" "net/http" ) type P struct { Name string Age int } func table(wr http.ResponseWriter, re *http.Request) { t, _ := template.ParseFiles("view/table.html") t.Execute(wr, nil) } func getUsers(wr http.ResponseWriter, re *http.Request) { users := make([]...
/* {{{ Copyright (c) 2017, Paul R. Tagliamonte <paultag@gmail.com> * * 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...
package game import ( "encoding/json" "fmt" ) //实现从客户端的请求中ClientMessage中提取data(string map[string]interface{}) //name 为 NetWork.Request("webcenter",data)中的第一个参数,包括请求的模块和方法,data为本次请求所带的数据 func (cm ClientMessage) getMsg() (string, map[string]interface{}) { var name string var data map[string]interface{} //声明变量,不分配内存...
// Copyright (C) 2015-Present Pivotal Software, Inc. All rights reserved. // This program and the accompanying materials are made available under // the terms of the 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 th...
package main import ( "fmt" ) func repeatedSubstringPattern(s string) bool { f := make([]int, len(s)) f[0] = -1 for i, j := 1, -1; i < len(s); i++ { for j >= 0 && s[j+1] != s[i] { j = f[j] } if s[j+1] == s[i] { j++ } f[i] = j } return f[len(s)-1] != -1 && len(s)%(len(s)-f[len(s...
package main import ( "github.com/bitwurx/jrpc2" ) func main() { InitDatabase() s := jrpc2.NewServer(":8080", "/rpc", nil) NewApiV1(&PriorityQueueModel{}, s) s.Start() }
package utils type Column struct { name string typeData string constraint string } type columnBuilder struct { name string typeData string constraint string } type ColumnBuilder interface { Name(string) ColumnBuilder Primary() ColumnBuilder TypeData(string) ColumnBuilder NotNull() ColumnBui...
package bauxebotdiscord import ( "log" "os" "os/signal" "strings" "github.com/Chris-SG/BauxeBot_Go/discord/commands" "github.com/bwmarrin/discordgo" ) // Session for discord bot var ( discord *discordgo.Session err error prefix string cmdList *cmd.Commands bot *discordgo.User ) func onMessageCre...
package compute_test import ( "errors" "github.com/genevieve/leftovers/gcp/compute" "github.com/genevieve/leftovers/gcp/compute/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" gcpcompute "google.golang.org/api/compute/v1" ) var _ = Describe("Instances", func() { var ( client *fakes.InstancesCli...
// Copyright 2020 Insolar Network Ltd. // All rights reserved. // This material is licensed under the Insolar License version 1.0, // available at https://github.com/insolar/block-explorer/blob/master/LICENSE.md. // +build heavy_mock_integration package api import ( "fmt" "math" "strings" "testing" "github.com...
package ListOffsets type Response struct { ThrottleTimeMs int32 Responses []TopicResponse } type TopicResponse struct { Topic string Partitions []PartitionResponse } type PartitionResponse struct { Partition int32 ErrorCode int16 Timestamp int64 Offset int64 } func (r *Response) Offset(topic st...
package main import ( "fmt" "runtime/debug" "sync" "time" ) func init() { debug.SetGCPercent(-1) } const count = 10000000 func dispatchBenchmark(c, buf, sender, receiver int) { start := time.Now() balanceNum := 5 chpool := make([]chan bool, 0, balanceNum) for i := 0; i < balanceNum; i++ { q := make(chan...
//+build wireinject package server import ( "io" "github.com/google/wire" "github.com/spf13/pflag" "github.com/suse/carrier/shim/app" "github.com/suse/carrier/shim/app/configuration" ) func BuildApp(log io.Writer, flags *pflag.FlagSet) (*app.App, func(), error) { wire.Build( wire.Struct(new(app.App), "*"), ...
/* * Copyright 2021 American Express * * 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...
package models type Author struct { Firstname string `json:"firstname"` Lastname string `json:"lastname"` }
package print import ( "bytes" "context" "fmt" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tilt-dev/tilt/internal/tiltfile/starkit" "github.com/tilt-dev/tilt/pkg/logger" ) func TestWarn(t *testing.T) { f := newFixture(t) f.File("Tiltfile", "warn('probl...
package viewmodel // JourneyPlanVM ... type JourneyPlanVM struct { ID uint ` json:"id"` Code string ` json:"code"` JourneyName string ` json:"journeyName"` AssignedAuditor string ` json:"assignedAuditor"` Auditors []string ` json:"auditors"` DepartmentKey string `...
package timekey import ( "os" "testing" "time" ) var ( testFile = []string{"mime_data.go", "fid.go"} ) func TestKey(t *testing.T) { now := time.Now() t.Log("now:", now) fid, err := NewFid("2", testFile[1]) if err != nil { t.Fatal(err) } t.Log("fid.Time()", fid.Time()) if now.Sub(fid....
package retry import ( "fmt" "sync" "sync/atomic" "testing" ) var count int64 func get() int64 { return count } func incCAS() { atomic.AddInt64(&count, 1) } func TestDo(t *testing.T) { var limit int64 var errCnt int64 limit = 5 var wg sync.WaitGroup worker := func() { err := Do(func() error { if ge...
package format import ( "regexp" "strings" "github.com/Karitham/handlergen/gen" ) type Oapi struct { Paths map[string]map[string]Route `yaml:"paths"` } type Route struct { operationID string `yaml:"operationId"` Parameters []Parameter `yaml:"parameters"` } type Parameter struct { Schema Schema `yaml:"...
package main /* struct CredentialSpec{ char *Name; char *Get; char *From; }; */ import "C" import ( "fmt" "reflect" "unsafe" "github.com/cyberark/secretless-broker/internal/plugin" "github.com/cyberark/secretless-broker/internal/plugin/connectors/tcp/mysql/protocol" pluginv1 "github.com/cyberark/sec...
package utils type Object interface{}
package client import ( "fmt" "strings" "time" ) func (c *Handler) handleSYST() { c.WriteMessage(StatusSystemType, "UNIX Type: L8") } func (c *Handler) handleSTAT() { if c.param == "" { // Without a file, it's the server stat. c.handleSTATServer() } else { // With a file/dir it's the file or the dir's files ...
package wire import ( "errors" "strings" "testing" "github.com/stretchr/testify/require" ) // mockFIBeneficiary creates a FIBeneficiary func mockFIBeneficiary() *FIBeneficiary { fib := NewFIBeneficiary() fib.FIToFI.LineOne = "Line One" fib.FIToFI.LineTwo = "Line Two" fib.FIToFI.LineThree = "Line Three" fib....
package routing_rules import ( "go_chaos/http_util" "go_chaos/util" "testing" ) type MockHttpRequest struct { path string headers map[string]string } func NewMockHttpRequest(path string, headers map[string]string) http_util.HttpRequest { return &MockHttpRequest{ path: path, headers: headers, } } fu...
package main import ( "net/http" "net/http/httptest" "strings" "testing" ) func TestHandler(t *testing.T) { body := strings.NewReader(`{"name":"Jesús","age":26}`) req := httptest.NewRequest( http.MethodPost, "http://localhost:8080/", body, ) rec := httptest.NewRecorder() Handler(rec, req) if rec.Co...
package main import ( "fmt" "os" ) func main() { fmt.Println("Error Handling: To check a file exists or not\n") f, err := os.Open("/test.txt") if err != nil { fmt.Println("Error: File not found") return } fmt.Println(f.Name(), "Opened Successfully") } // - Sumeet Ranjan Parida (Batch - 9A) //Output: //E...
package excel import ( "errors" "fmt" "path/filepath" "strings" "github.com/360EntSecGroup-Skylar/excelize" "github.com/alexizzarevalo/grades_management/src/msg" ) type Cells struct { Grade string Carne string } type ExcelOptions struct { File string Cells Cells } func getNameWithExt(fileName, ext strin...
package e4 import ( "fmt" ) type ( any = interface{} ) var ( pt = fmt.Printf )
package cryptoballot import ( "bytes" "crypto" "crypto/rand" "crypto/rsa" "crypto/sha512" "encoding/hex" "errors" ) type SignatureRequest struct { ElectionID string RequestID []byte // SHA512 (hex) of base64 encoded public-key PublicKey // base64 encoded PEM formatted public-key BallotHash []byte ...
package logic import ( "jkt/gateway/global" "jkt/gateway/hotel" "jkt/gateway/lanuage" "jkt/gateway/websocket" "jkt/jktgo/log" "jkt/jktgo/message" "jkt/jktgo/redis" ) // UnknownCodeCallBack 当发生未知码的时候需要调用的函数 func UnknownCodeCallBack(session *websocket.Session, m map[string]interface{}) { log.Debug("客户端 发送了未知的消息...
package models type Link struct { RealURL string `json:"real_url"` Shortcut string `json:"shortcut,omitempty"` }
package core import ( "encoding/json" "strings" ) func (this *Int32) MarshalJSON() ([]byte, error) { if this.Valid == false { return []byte("null"), nil } return json.Marshal(this.int32) } // UnmarshalJSON implements json.Unmarshaler. // It supports string and null input. Blank string input does not produce a...
// Copyright 2022 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package cellular import ( "context" "time" "chromiumos/tast/common/testexec" "chromiumos/tast/errors" "chromiumos/tast/local/cellular" "chromiumos/tast/local/modemman...
package health import ( "encoding/json" "fmt" "net/http" "net/http/httptest" "testing" "time" ) func TestRegisterDependency(t *testing.T) { tests := []struct { dependency Dependency expectedErr error expectedHealth bool }{ // Passing - healthy { dependency: Dependency{ Name: "healthy ser...
// Copyright © 2020. All rights reserved. // Author: Ilya Stroy. // Contacts: qioalice@gmail.com, https://github.com/qioalice // License: https://opensource.org/licenses/MIT package ekatime import ( "time" ) // TillNext returns how much ns (as time.Duration) must be passed until next time // 'range_' will end for t...
package main import ( "github.com/cw35/eventsource" "log" "net/http" "time" ) func getSubscribeKey(req *http.Request) string { return req.Header.Get("Authorization") } func getSessionKey(req *http.Request) string { return req.Header.Get("Authorization") } func consumerStatusListener(subscribeKey, sessionKey s...
// SPDX-License-Identifier: ISC // Copyright (c) 2014-2020 Bitmark Inc. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package blockheader import ( "encoding/binary" "sync" "github.com/bitmark-inc/bitmarkd/blockdigest" "github.com/bitmark-inc/bitmarkd/blockreco...
// Copyright 2021 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package wmp import ( "context" "time" "chromiumos/tast/ctxutil" "chromiumos/tast/local/bundles/cros/wmp/wmputils" "chromiumos/tast/local/chrome" "chromiumos/tast/loca...
// Copyright (c) 2020 - for information on the respective copyright owner // see the NOTICE file and/or the repository at // https://github.com/hyperledger-labs/perun-node // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may...
package handlers import ( "net/http" "github.com/dgrijalva/jwt-go" "github.com/wu-xing/wood-serve/domain" "github.com/labstack/echo" ) func PostArticleBox() echo.HandlerFunc { return func(c echo.Context) error { user := c.Get("user").(*jwt.Token) claims := user.Claims.(jwt.MapClaims) userId := claims["id...
package controllers import ( // "fmt" "github.com/astaxie/beego" "openvpn/models" ) type UserController struct { beego.Controller } func (this *UserController) Post() { //输入内容 //this.Ctx.WriteString(fmt.Sprint(this.Input())) //检测登录 if !checkAccount(this.Ctx) { this.Redirect("/login", 302) return } var ...
package main import ( "sync" "time" "github.com/nsf/termbox-go" ) var mu sync.Mutex type environ struct { sizeX int sizeY int field [][]bool cursorX int cursorY int pause bool duration int } func drawLine(x, y int, str string) { runes := []rune(str) for i := 0; i < len(runes); i++ { ter...
package main import ( "fmt" "log" "net/http" "os" "strings" "time" ) var port string var host string var redirectPath bool func createRedirectURL(r *http.Request) string { var redirectURL = "https://" if host == "" { host = r.Host } redirectURL = redirectURL + host if redirectPath { redirectURL = r...
package logic type Platform int
package benchmark import "bytes" import "strings" /* ベンチマークの機能がテスト用パッケージに標準で入っている - 実行方法 go test -bench . - 出力結果例 testing: warning: no tests to run BenchmarkCat3-4 10000000 192 ns/op 54 B/op 3 allocs/op BenchmarkBuf3-4 10000000 231 ns/op 163 B/op 3 allocs/op Benc...
package random import ( "regexp" "testing" "github.com/stretchr/testify/assert" ) func TestNumeric(t *testing.T) { assert.Len(t, String(32), 32) r := New() assert.Regexp(t, regexp.MustCompile("[0-9]+$"), r.String(8, Numeric)) } func TestLowercaseString(t *testing.T) { assert.Len(t, String(32), 32) r := New(...
package main import "fmt" import "strings" // fungsi variadic // func main() { // var avg = calculate(2,3,4,5,6,2,4,6,3,5) // var msg = fmt.Sprintf("Rata-rata : %.2f", avg) // fmt.Println(msg) // } // func calculate(numbers ...int) float64 { // var total int = 0 // for _, number := range numbers { // total +=...
package server import "time" type ServerConfig struct { Addr string ReadTimeout time.Duration WriteTimeout time.Duration Cert string Key string Memory int64 Timeout time.Duration Group string Websocket bool WebsocketGroup string WebsocketPath string...
package main type ListNode struct { Val int Next *ListNode } type TreeNode struct { Val int Left *TreeNode Right *TreeNode } func build(a []int) *TreeNode { if len(a) == 0 { return nil } mid := len(a) / 2 return &TreeNode{Val: a[mid], Left: build(a[:mid]), Right: build(a[mid+1:])} } func sortedListToB...
package skyobject import ( "errors" "fmt" ) // Ref, Refs or Dynamic in updateStack type commiter interface { commit() (err error) } // track changes type updateStack struct { stack []commiter contains map[commiter]struct{} } func (u *updateStack) init() { u.contains = make(map[commiter]struct{}) } func (u...
package sortedSet_test import ( "math/rand" "testing" "github.com/lleo/go-functional-collections/key" "github.com/lleo/go-functional-collections/sortedSet" ) func buildKeys(numKeys, numKeysXtra int) ([]key.Sort, []key.Sort) { var keys = make([]key.Sort, numKeys+numKeysXtra) for i := 0; i < numKeys+numKeysXtra...
package faker // Hackier Interface type Hackier interface { Abbreviation() string Adjective() string Noun() string Verb() string Ingverb() string Phrase() string } // Hacker struct type Hacker struct { *Fake } // Abbreviation Returns an abbreviation func (h *Hacker) Abbreviation() string { return h.pick(hack...
package presigner import ( "context" "sync" "time" "github.com/Cloud-Foundations/golib/pkg/log" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/aws/arn" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/sts" ) const ( RefreshOnDemand = iota RefreshAutomati...
package repo import ( "errors" "fmt" "os" "path" "strings" "github.com/ghodss/yaml" "github.com/Clever/catapult/gen-go/models" ) // DiscoverApplications finds any launch config files in the specified // directory and returns a map with the application name as the key and // the corresponding launch config fi...
// Copyright 2019 The Cockroach 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 os import ( "fmt" "os" ) //CreateDirectory creates dir with target name //If you want to full access dir,pass os.ModePerm as FileMode parameter func CreateDirectory(name string, permissionBits os.FileMode) error { if _, err := os.Stat(name); os.IsNotExist(err) { return os.Mkdir(name, permissionBits) } ...
/* * Wodby API Client * * Wodby Developer Documentation https://wodby.com/docs/dev * * API version: 3.0.18 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package client type Stack struct { Created int32 `json:"created"` Id string `json:"id"` NewVersion string `jso...
// 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 unde...
package model // NOTE: Just use *time.Time in a struct... // type NullableTime struct { // time.Time `json:",omitempty"` // } // // func (n NullableTime) MarshalJSON() ([]byte, error) { // if n.Time.IsZero() { // // Optional: return []byte("null"), but it will not be omitted // ...
func (client *client) request(url string) (*http.Response, error) { //fmt.Printf("[INFO]: %s\n", "Request to "+url) request, err := http.NewRequest("GET", url, nil) if err != nil { return &http.Response{}, fmt.Errorf("[ERR] :%s", err) } request.Header.Set("Authorization", "Bearer "+client.t...
package license // cactl.go file from license-ca team import ( "bytes" "crypto/tls" "crypto/x509" "encoding/json" "errors" "fmt" "io/ioutil" "net/http" "strconv" "time" ) const defaultMasterCAUrl = "https://private.ca.sensetime.com:8443" const defaultSlaveCAUrl = "https://slave.private.ca.sensetime.com:844...
package functions import ( "fmt" "strings" "github.com/miekg/dns" ) // Reads a CoreDNS resource record and returns its string representation. // From: coredns/plugin/test/helpers.go func ReadRR(val dns.RR) string { var res string switch x := val.(type) { case *dns.SRV: res = fmt.Sprintf("%d|%d|%d|%s", x.Pri...
package tchart import ( "errors" "github.com/nsf/termbox-go" ui "github.com/s-westphal/termui/v3" ) func GetDefaultChartColors() []ui.Color { return []ui.Color{ui.ColorRed, ui.ColorGreen, ui.ColorYellow, ui.ColorBlue, ui.ColorCyan} } type App struct { *vContainer panels []panel widgets []Widget } func NewA...
package csv import ( "encoding/csv" "io" "reflect" "fmt" //"log" ) type Writer struct { *csv.Writer } func NewWriter(w io.Writer) *Writer { return &Writer{ csv.NewWriter(w), } } func (w *Writer) WriteAllCsv(data interface{}) (err error) { refl := reflect.ValueOf(data) err ...
package controllers import ( "errors" "regexp" "strings" "crypto-telegram-notifyer/coingecko" "github.com/astaxie/beego" ) type CoinController struct { beego.Controller } // Definition of a response with data type CoinResponse struct { Name string `json:"symbol"` UsdPrice string `json:"usd_price"` Btc...
package validpalendrome func isPalindrome(s string) bool { if s == "" { return true } // build a lowercase/numeric slice from the string // Over allocate storage if needed to save re-allocation later ln := make([]rune, 0, len(s)) for _, r := range s { rok, ok := fix(r) if !ok { continue } ln = ap...
// Copyright 2018 The gVisor 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...
// Copyright 2020 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package cryptohome import ( "context" "os" "time" "chromiumos/tast/local/bundles/cros/cryptohome/cleanup" "chromiumos/tast/local/chrome" "chromiumos/tast/local/chrome...
package loads import ( "jean/instructions/base" "jean/instructions/factory" "jean/rtda/jvmstack" ) type ILOAD struct { base.Index8Instruction } func (i *ILOAD) Execute(frame *jvmstack.Frame) { _iload(frame, i.Index) } func _iload(frame *jvmstack.Frame, index uint) { val := frame.LocalVars().GetInt(index) fra...
package fixture import ( "bytes" "encoding/base64" "fmt" "log" "net/smtp" "net/mail" "os" "os/exec" "runtime" "strconv" "time" ) type EmailUser struct { Username string Password string EmailServer string Port int } func sendEmail(send_to string, subj string, content string) { emailUser ...
package controller // TODO(huangsz): re-enable / re-write the tests //import ( // "reflect" // "testing" // // "github.com/multivactech/MultiVAC/configs/config" // "github.com/multivactech/MultiVAC/model/shard" // "github.com/multivactech/MultiVAC/processor/shared/message" // "github.com/multivactech/MultiVAC/rpc/btcj...
// Copyright 2019 - 2022 The Samply Community // // 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 main import ( "bufio" "fmt" "net" "github.com/cyberark/secretless-broker/pkg/secretless/log" "github.com/cyberark/secretless-broker/pkg/secretless/plugin/connector" ) // SingleUseConnector creates an authenticated connection to a target TCP service. type SingleUseConnector struct { logger log.Logger } ...
package main import ( "bufio" "encoding/csv" "flag" "fmt" "io" "os" "strings" "time" ) /** Problem: Have to close the goroutines from the previous questions, not just leave them hanging! - Pretty sure the done goroutine is not firing */ func main(){ fileName := flag.String("test-file", "problems.csv", "Th...
package k8pool import ( "context" "fmt" "reflect" api_v1 "k8s.io/api/core/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" ) type PeerInfo struct { // (O...
package cluster import ( "bytes" "context" "encoding/base64" "errors" "fmt" "io/ioutil" "os" "path/filepath" "sort" "strconv" "strings" "sync" "time" "github.com/cnrancher/autok3s/pkg/common" "github.com/cnrancher/autok3s/pkg/hosts" "github.com/cnrancher/autok3s/pkg/providers" "github.com/cnrancher/a...
package main import ( "flag" "net" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" "fmt" "github.com/lintflow/core/inspector" pb "github.com/lintflow/core/proto" "net/http" _ "net/http/pprof" ) var ( addr = flag.String(`addr`, `localhost:4568`, `address for listen service`) lookupd = flag.St...
package main import ( "fmt" "log" "os" "os/signal" "syscall" "time" "github.com/CharlesHolbrow/gm" "github.com/CharlesHolbrow/m" "github.com/rakyll/portmidi" ) func main() { if err := portmidi.Initialize(); err != nil { panic("Error initializing portmidi: " + err.Error()) } out, err := portmidi.NewOut...
package main import ( "net/http" "github.com/gin-gonic/gin" "github.com/niwek/niwek-swagger/controller" "github.com/niwek/niwek-swagger/env" ) func main() { router := gin.Default() // Ping function router.GET("/ping", func(c *gin.Context) { c.JSON(http.StatusOK, gin.H{ "message": "pong", }) }) v1 :...
package bytes func ToUint16(h byte,l byte) uint16 { return uint16(h)<<8 | uint16(l) }
package main import ( "fmt" "math" ) // A Unit is a measure or weight unit including a slice of // equivalent labels (the first member is the default label), // the type of measure ('volume' or 'mass') // and the type equivalency for the unit. Type equivalency // is the amount of reference units in this unit. Refer...
// Copyright 2018 The Cockroach 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 hello type Servlet struct{}
package main import "fmt" func main() { var e, max, sum int for fmt.Scan(&e); e != 0; fmt.Scan(&e) { if e == max { sum++ } else if e > max { max = e sum = 1 } } fmt.Print(sum) } // Последовательность состоит из натуральных чисел и завершается числом 0. // Определите количество элементов этой посл...
package network import ( "sort" corev1 "k8s.io/api/core/v1" ) type NetworkCache struct { nodeNetworks map[string]*NodeNetwork podNetworks map[string]*PodNetwork serviceNetworks map[string]*ServiceNetwork } func newNetworkCache() *NetworkCache { return &NetworkCache{ nodeNetworks: make(map[string]*...