text
stringlengths
11
4.05M
package main import ( "fmt" //"database/sql" //"github.com/golang/crypto/ssh" "golang.org/x/crypto/ssh" //utils "github.com/converge/wandycatkeeper/utils" //"os" "strings" "io/ioutil" //"bufio" "github.com/google/uuid" ) type DiskInfo struct { Uuid string Ip string Name string Capi...
/** * Copyright 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 to i...
package main /** 对称二叉树 给定一个二叉树,检查它是否是镜像对称的。 例如,二叉树 `[1,2,2,3,4,4,3]` 是对称的。 ``` 1 / \ 2 2 / \ / \ 3 4 4 3 ``` 但是下面这个 `[1,2,2,null,3,null,3]` 则不是镜像对称的: ``` 1 / \ 2 2 \ \ 3 3 ``` */ /** 还可以用递归做,第一时间没想到 */ /** * Definition for a binary tree node. * type TreeNode struct { * Va...
package main import ( "flag" "github.com/astaxie/beego" "github.com/astaxie/beego/logs" "github.com/uxff/taniago/conf/inits" "github.com/uxff/taniago/models" "github.com/uxff/taniago/models/picset" _ "github.com/uxff/taniago/routers" ) func main() { logdeep := 3 serveDir := "r:/themedia" //"." addr := ":" +...
package remote import ( "fmt" "github.com/callumj/weave/remote/s3" "github.com/callumj/weave/remote/uptypes" "github.com/callumj/weave/tools" "io" "io/ioutil" "log" "net/http" "os" ) type DownloadInfo struct { FilePath string ETag string } func UploadToS3(config uptypes.S3Config, files []uptypes.FileD...
package main import ( "encoding/json" "fmt" "io/ioutil" "log" "os" ) type Users struct { Users []User `json:"users"` } type User struct { Name string `json:"name"` Type string `json:"type"` Age int `json:"age"` Social Social `json:"social"` } type Social struct { Facebook string `json:"facebook...
package alerts import ( "github.com/dennor/go-paddle/events/types" "github.com/dennor/phpserialize" "github.com/shopspring/decimal" ) const PaymentRefundedAlertName = "payment_refunded" // PaymentRefunded refer to https://paddle.com/docs/reference-using-webhooks/#payment_refunded type PaymentRefunded struct { Al...
package day4 import ( "regexp" "strconv" "strings" "github.com/littleajax/adventofcode/helpers" ) func checkField(name string, value string) bool { switch name { case "cid": return false case "byr": return stringToIntRange(value, 1920, 2002) case "iyr": return stringToIntRange(value, 2010, 2020) case ...
package strmap import ( "sync" ) type ( // ConcurrentMap is a synchronous map. ConcurrentMap struct { data map[Key]Value mutex sync.RWMutex // used only by writers } ) // NewConcurrentMap initializes a new empty map. // Use of nil to empty the ConcurrentMap is okay. func NewConcurrentMap() *ConcurrentMap { ...
package cos_test import ( "fmt" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" sut "github.com/rancher-sandbox/ele-testhelpers/vm" ) var _ = Describe("cOS Installer tests", func() { var s *sut.SUT BeforeEach(func() { s = sut.NewSUT() s.EventuallyConnects() }) Context("Using bios", func() { ...
package main import ( "encoding/json" "fmt" "io" "log" "strconv" ini "gopkg.in/ini.v1" ) //AccessPoint is the access point configuration type AccessPoint struct { Channel string `ini:"CHANNEL" json:"channel"` Gateway string `ini:"GATEWAY" json:"gateway"` WPAVersion int `ini:"WPA_VER...
package helper func ConvInterfaceSliceToStringSlice(slice []interface{}) []string { outp := make([]string, len(slice)) for k, v := range slice { outp[k], _ = v.(string) } return outp }
package vsphere // Metadata contains vSphere metadata (e.g. for uninstalling the cluster). type Metadata struct { // VCenter is the domain name or IP address of the vCenter. VCenter string `json:"vCenter"` // Username is the name of the user to use to connect to the vCenter. Username string `json:"username"` // P...
package main import ( "context" "flag" "fmt" "log" "net/http" "os" "os/signal" "syscall" "time" "github.com/danikarik/handler/pkg/service" ) var addr = flag.String("http.addr", "", "Address for listening") func main() { flag.Parse() if *addr == "" { *addr = ":" + os.Getenv("PORT") } var ( srv = ...
// Copyright 2020 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 utils import "os" // GetEnvOrDefault is a helper func for get env or use default value func GetEnvOrDefault(k, defaultValue string) string { v := os.Getenv(k) if v == "" { return defaultValue } return v }
package order import ( "github.com/jinzhu/gorm" "github.com/qor/transition" "github.com/satori/go.uuid" "github.com/tppgit/we_service/entity/service" "github.com/tppgit/we_service/entity/user" "time" ) type Comment struct { ID uuid.UUID `gorm:"type:char(36); primary_key"` Content string `gorm:"typ...
package schema // AccessControl represents the configuration related to ACLs. type AccessControl struct { // The default policy if no other policy matches the request. DefaultPolicy string `koanf:"default_policy" json:"default_policy" jsonschema:"default=deny,enum=deny,enum=one_factor,enum=two_factor,title=Default A...
package main import ( "./dock" "github.com/ssgo/s" ) func main() { dock.Registers() dock.AsyncStart() s.Start() dock.AsyncStop() }
package main import ( "fmt" "io/ioutil" "log" "net/url" "path/filepath" "time" "github.com/jonmorehouse/gatekeeper/gatekeeper" "github.com/jonmorehouse/gatekeeper/gatekeeper/utils" "github.com/mitchellh/go-homedir" "gopkg.in/yaml.v2" ) // serviceDef represents an individual upstream configuration in a yaml...
package etcd import ( "time" "github.com/yuexclusive/utils/config" etcd "go.etcd.io/etcd/client/v3" ) func Client() (*etcd.Client, error) { config := etcd.Config{ Endpoints: config.MustGet().ETCDAddress, DialTimeout: 10 * time.Second, } return etcd.New(config) }
package kcpNetwork import ( "bytes" "encoding/binary" "github.com/yaice-rx/yaice/network" "github.com/yaice-rx/yaice/utils" ) const ( ConstMsgLength = 4 //消息长度 ConstMsgIdLen = 4 ) type packet struct { } func NewPacket() network.IPacket { return &packet{} } func (dp *packet) GetHeadLen() uint32 { return Co...
package p05 func checkRecord(s string) bool { aNums := 0 lNums := 0 for i := 0; i < len(s); i++ { if s[i] == 'A' { aNums++ if aNums > 1 { return false } lNums = 0 } else if s[i] == 'L' { lNums++ if lNums > 2 { return false } } else { lNums = 0 } } return true }
package Problem0522 import ( "sort" ) func findLUSlength(strs []string) int { // 统计每个单词出现的次数 count := make(map[string]int, len(strs)) for _, s := range strs { count[s]++ } // 让 strs 中的每个单词只出现一次 // 这样的话,后面检查是否为子字符串的时候,可以避免重复检查 strs = strs[:0] for s := range count { strs = append(strs, s) } // 按照字符串的长度...
package main import ( "fmt" "log" "os" "os/exec" "strings" cli "gopkg.in/urfave/cli.v1" "github.com/transactional-cloud-serving-benchmark/tcsb/kv_query_util" ) func main() { app := cli.NewApp() app.Flags = []cli.Flag{ cli.StringFlag{Name: "cmd", Value: "", Usage: `Command, with arguments, to invoke as IP...
package main import ( "encoding/json" "fmt" "io/ioutil" "log" "os" "time" "golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh/terminal" ) type serverInfo struct { Host string `json:"host"` Port int `json:"port"` User string `json:"user"` Passwd string `json:"passwd"` } type areaSer struct { Are...
package parser import ( "bytes" "golang.org/x/net/html" "strings" ) // Parser : struct that takes parses HTML documents, using a domain to find links for, // patterns to look for, links to exclude, and a trim marker to crop HTML at type Parser struct { domain string pattern []string exclude ...
package semt import ( "encoding/xml" "github.com/thought-machine/finance-messaging/iso20022" ) type Document02000101 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:semt.020.001.01 Document"` Message *SecuritiesMessageCancellationAdviceV01 `xml:"SctiesMsgCxlAdvc"` } ...
package travis import ( "os" "testing" ) func TestIsRunning(t *testing.T) { tr := os.Getenv("TRAVIS") == "true" && os.Getenv("CI") == "true" if tr != IsRunning() { t.Error("IsRunning() does not match TRAVIS && CI env var check") } }
package c31_hmac_sha1_timing_leak import ( "errors" "fmt" "time" "github.com/vodafon/cryptopals/set1/c1_hex_to_base64" ) type ServerExp struct { BasePath string BaseDuration time.Duration } func Exploit(server Server, fn string, dur time.Duration) ([]byte, error) { se := ServerExp{ BasePath: "file=...
package datastruct import ( "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" ) func Yml2Map(text string) map[interface{}]interface{} { mapYml := make(map[interface{}]interface{}) bText := []byte(text) err := yaml.Unmarshal(bText,&mapYml) if err != nil { logrus.Error(err) } return mapYml } func Map2Yml(mpaz...
func isSubsequence(s string, t string) bool { i:=0 n:=len(s) if n==0{return true} for _,v:=range t{ if v==rune(s[i]){ i++ if i==n{return true} } } return false }
package main import "fmt" var age int32 = 25 func main() { // Main types // string // bool // int // int int8 int16 int32 int64 // uint uint8 uint16 uint32 uint64 - unsigned // byte - alias for uint8 // rune - alias for int32 // float32 float64 // complex64 complex128 // Using var //var name = "Varien" ...
package builder import ( "fmt" "io" "io/ioutil" "os" "path/filepath" "bldy.build/build" "bldy.build/build/graph" ) const ( SCSSLOG = "success" FAILLOG = "fail" ) func (b *Builder) buildpath(n *graph.Node) string { return filepath.Join( *b.config.Cache, nodeid(n), ) } func (b *Builder) cached(n *grap...
//FOR package main import "fmt" func main(){ alumnos := 1 for alumnos <= 3{ fmt.Println(alumnos) alumnos = alumnos+1 } for calificaciones :=7; calificaciones <= 9; calificaciones++{ fmt.Println(calificaciones) } }
package hrp import ( "testing" "time" "github.com/stretchr/testify/assert" ) var ( stepGET = NewStep("get with params"). GET("/get"). WithParams(map[string]interface{}{"foo1": "bar1", "foo2": "bar2"}). WithHeaders(map[string]string{"User-Agent": "HttpRunnerPlus"}). WithCookies(map[string]string{"user": "...
package problem0429 type Node struct { Val int Children []*Node } func levelOrder(root *Node) [][]int { result := [][]int{} if root == nil { return result } queue := []*Node{root} nextQueue := []*Node{} for len(queue) > 0 { level := []int{} for len(queue) > 0 { node := queue[0] queue = queue[...
package pgsql import ( "database/sql" "database/sql/driver" "time" ) // TimetzArrayFromTimeSlice returns a driver.Valuer that produces a PostgreSQL timetz[] from the given Go []time.Time. func TimetzArrayFromTimeSlice(val []time.Time) driver.Valuer { return timetzArrayFromTimeSlice{val: val} } // TimetzArrayToTi...
package stream import ( "io" "time" ) type Sample struct { SampleID int64 `json:"sampleId"` Current int64 `json:"bytesPerSec"` Peak int64 `json:"peak"` Low int64 `json:"low"` Average int64 `json:"average"` MovingPeak int64 `json:"movingPeak"` MovingLow ...
// Copyright 2016 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 detail import ( "fpdapp/models/entity" "github.com/gin-gonic/gin" ) type Response struct { ID uint `json:"id"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Publishing int `json:"publishing"` DogName string `json:"dog_name"` Breed ...
package entity type KubePod struct { Name string `json:"name"` Status string `json:"status"` Restarts string `json:"restarts"` Age string `json:"age"` }
package friend import ( "GP/db" "database/sql" "log" ) type CheckFriendInfo struct { Id string `json:"id"` FriendId string `json:"friendid"` UserName string `json:"username"` FriendName string `json:"friendname"` Label string `json:"label"` } func GetCheckFriend(username string) (friendInfo ...
package main import ( "fmt" ) // 定义一个人的结构体 type Person struct { name string sex byte age int } // 为Person结构体新增一个打印方法 func (p Person) printInfo() { fmt.Println("p = ", p) } // 定义一个Student结构体并继承Person type Student struct { Person id int addr string } func main() { // 定义并初始化Student结构体 s := Student{Perso...
package types import ( sdk "github.com/irisnet/irishub/types" ) // the address for where distributions rewards are withdrawn to by default // this struct is only used at genesis to feed in default withdraw addresses type DelegatorWithdrawInfo struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` WithdrawAd...
package handlers import "encoding/json" type InvalidParam struct { Name string `json:"name"` Reason string `json:"reason,omitempty"` Code string `json:"code,omitempty"` } type Error struct { Status int `json:"status"` Title string `json:"title"` Type string ...
package honeycombio import ( "context" "fmt" ) // Queries describe all the query-related methods that the Honeycomb API // supports. // // API docs: https://docs.honeycomb.io/api/queries/ type Queries interface { // Get a query by its ID. Get(ctx context.Context, dataset string, id string) (*QuerySpec, error) /...
package task import ( "errors" "fmt" "github.com/tornadoyi/viking/goplus/runtime" "sync" "time" ) const ( Init int = iota Running Finished Canceled ) type Task struct { function *runtime.JITFunc state int result interface{} error error stack runtime.StackInfo wg *sync.WaitGroup mu...
package main func main(){ print("hello world\n") } /* //launch.json { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [...
package rolluptracer import ( "time" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" ) // RollupTracer wraps another tracer, and produces spans which roll up // tags and durations to the nearest ancestor span from the parent tracer. type RollupTracer struct { parent opentracin...
// Copyright 2016 Matthew Endsley // All rights reserved // // Redistribution and use in source and binary forms, with or without // modification, are permitted providing that the following conditions // are met: // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions ...
package catfile import ( "errors" "fmt" "got/internal/got/filesystem" "github.com/spf13/cobra" "got/internal/objects" ) var Cmd = &cobra.Command{ Use: "cat-file { -t | -p } object", DisableFlagsInUseLine: true, Short: "Provide content or type and size information for repos...
package main import ( "fmt" "testing" ) func TestFilterForGoRepos(t *testing.T) { testCases := []struct { languages map[string]int expected bool }{ { languages: map[string]int{"Go": 24031}, expected: true, }, { languages: map[string]int{"Perl": 19111, "Shell": 8593, "Perl 6": 2945, "Makefile"...
package main import ( "fmt" "resk/infra/algo" ) func main() { fmt.Printf("%v\n", algo.AfterShuffle(int64(10), int64(100)*100)) }
// Copyright 2017 Vector Creations Ltd // Copyright 2018 New Vector Ltd // Copyright 2019-2020 The Matrix.org Foundation C.I.C. // // 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 // // h...
package main import "fmt" func array() { var a [2]int a[0] = 100 a[1] = 200 fmt.Println(a) var b [2]int = [2]int{100, 200} fmt.Println(b) var c []int = []int{100, 200} d := append(c, 300) fmt.Println(c, d) } func slice() { n := []int{1, 2, 3, 4, 5, 6} fmt.Println(n) fmt.Println(n[2]) fmt.Println(n[2:4...
package urldispatch import ( "errors" "fmt" "strings" ) const ( nullptr = index(^uint8(0)) ) type segment struct { value string amap argsMap next []segment } type args2 struct { psection indexes params []string asection indexes array []string } func (a *args2) appendParamValue(value string) { p...
/* 给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点。 示例: 给定一个链表: 1->2->3->4->5, 和 n = 2. 当删除了倒数第二个节点后,链表变为 1->2->3->5. */ /** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */ func removeNthFromEnd(head *ListNode, n int) *ListNode { p1,p2:=head,head for n>0{ ...
package game type Puff struct { *Entity lived float32 lifeTime float32 } func newPuff(gameMap *Map, x, y, vx, vy, minSize, maxSize float32) *Puff { puff := &Puff{} puff.Entity = newEntity(gameMap, puff, "puff", x, y, randRange(minSize, maxSize), randRange(minSize, maxSize), ) puff.lifeTime = 0.1 + r...
package main import ( "fmt" "movies_api/handlers" "log" ) func main() { server := handlers.NewServer() fmt.Println("Server is running on port 8080") log.Fatal(server.ListenAndServe()) }
package fashionjson import ( "encoding/json" "log" "strings" "testing" ) func TestJsonDecode(t *testing.T) { const jsonStream = `{ "info": { "url": "https://www.wish.com", "dateCreated": "2-27-2018", "version": "2", "description": "Train Set for FGVC5 CVPR 2018 by https://www.wish.com", "year": "2018"...
package main import ( "net/http" "github.com/atselitsky/wb-mqtt-web-client-go/pkg/devices" "github.com/atselitsky/wb-mqtt-web-client-go/pkg/mqttConn" "github.com/atselitsky/wb-mqtt-web-client-go/pkg/rules" "github.com/atselitsky/wb-mqtt-web-client-go/pkg/websocketConn" "github.com/gin-contrib/cors" "github.com...
// Copyright 2021 BoCloud // // 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...
package main import ( "fmt" "math/rand" "reflect" "sync" "testing" "time" ) type TestData struct { data []int target int } var ( data TestData cases = []struct { data []int target int expected []int }{ { []int{1, 2, 3}, 3, []int{0, 1}, }, { []int{2, 3, 4, 5}, 8, []in...
// Copyright © 2018 Inanc Gumus // Learn Go Programming Course // License: https://creativecommons.org/licenses/by-nc-sa/4.0/ // // For more tutorials : https://learngoprogramming.com // In-person training : https://www.linkedin.com/in/inancgumus/ // Follow me on twitter: https://twitter.com/inancgumus package main ...
package slacktest import ( "github.com/slack-go/slack/internal/errorsx" ) const ( // ErrEmptyServerToHub is the error when attempting an empty server address to the hub ErrEmptyServerToHub = errorsx.String("Unable to add an empty server address to hub") // ErrPassedEmptyServerAddr is the error when being passed a...
package rpubsub import ( "context" "encoding/json" "fmt" "time" "github.com/pkg/errors" uuid "github.com/satori/go.uuid" "github.com/batchcorp/plumber-schemas/build/go/protos/opts" "github.com/batchcorp/plumber-schemas/build/go/protos/records" "github.com/batchcorp/plumber/util" "github.com/batchcorp/plum...
// Copyright 2015-2018 trivago N.V. // // 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 routes import ( "fmt" "joebot/rds" t "joebot/tools" "strings" ) func passiveRouteDWU(playerName string) (res string) { playerName = strings.ToLower(playerName) lookupKey := fmt.Sprintf("passive_%s", playerName) res, err := rds.RedisGet(rds.RC, lookupKey) if err != nil { t.WriteErr(err) res = "Pla...
package main import ( "github.com/go-chi/chi" ) func getRoutes() chi.Router { // We're using chi as the router. You'll want to read // the documentation https://github.com/go-chi/chi // so that you can capture parameters like /events/5 // or /api/events/4 -- where you want to get the // event id (5 and 4, respe...
package game_map import ( "fmt" "github.com/steelx/go-rpg-cgm/combat" ) func (c *CombatState) AddTurns(actorList []*combat.Actor) { for _, v := range actorList { hpNow := v.Stats.Get("HpNow") if hpNow > 0 && !c.EventQueue.ActorHasEvent(v) { event := CETurnCreate(c, v) tp := event.TimePoints(c.EventQueue)...
package internal import ( "log" "math" "testing" "time" ) func TestWhoisWorkerCheckDomains(t *testing.T) { appConfig := InitConfiguration() if len(appConfig.Domains) < 4 { t.Errorf("expected at least four domains in configuration, found %d", len(appConfig.Domains)) } whoisWorker := NewWhoisWorker(Applicati...
package main import "fmt" func main() { fmt.Println("binarySearch") fmt.Println(binarySearch(23, []int{10, 11, 12, 16, 18, 23, 29, 33, 48, 54, 57, 68, 77, 84, 98})) fmt.Println(binarySearch(50, []int{10, 11, 12, 16, 18, 23, 29, 33, 48, 54, 57, 68, 77, 84, 98})) } func binarySearch(key int, sorted []int) int { va...
package frontend import ( "crypto/rand" "crypto/rsa" "encoding/json" "io/ioutil" "math/big" "net/http" "github.com/gorilla/mux" uuid "github.com/satori/go.uuid" "github.com/sirupsen/logrus" "github.com/jim-minter/rp/pkg/api" "github.com/jim-minter/rp/pkg/database/cosmosdb" ) func (f *frontend) putOrPatch...
package main import ( "bufio" "bytes" "crypto/aes" "crypto/cipher" "crypto/rand" "encoding/base64" "fmt" "io" "io/ioutil" "os" ) func generateIV(bytes int) []byte { b := make([]byte, bytes) rand.Read(b) return b } func encrypt(block cipher.Block, value []byte, iv []byte) []byte { stream := cipher.NewCT...
/* * @lc app=leetcode id=74 lang=golang * * [74] Search a 2D Matrix * * https://leetcode.com/problems/search-a-2d-matrix/description/ * * algorithms * Medium (35.04%) * Likes: 907 * Dislikes: 108 * Total Accepted: 234.7K * Total Submissions: 669.9K * Testcase Example: '[[1,3,5,7],[10,11,16,20],[23,3...
package server import ( "time" "github.com/sirupsen/logrus" ) func (s *server) logInfo(pkg, function, msg string, t time.Duration) { s.log.WithFields(logrus.Fields{ "db": s.dbPlatform, "cache": s.cachePlatform, "grpcAddr": s.listener.Addr().String(), "httpPort": s.httpPort, "ssl": s.ssl, ...
package storage //Storage is an interface to storage of Users type Storage interface { Users() UserRepo }
package service import ( "github.com/irisnet/irishub/app/v1/auth" "github.com/irisnet/irishub/app/v1/service/tags" "github.com/irisnet/irishub/types" ) func EndBlocker(ctx types.Context, keeper Keeper) (resTags types.Tags) { ctx = ctx.WithLogger(ctx.Logger().With("handler", "endBlock").With("module", "iris/servic...
package inttest import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" "tagallery.com/api/config" ) type ErrorResponse struct { Error string `json:"error"` } // apiURL takes a route and returns the full API url. func apiURL(route string) string { return fmt.Sprintf("http://localhost:%v%v", config.Get...
package ds /** * In a deck of cards, each card has an integer written on it. Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more groups of cards, where: Each group has exactly X cards. All the cards in each group have the same integer. Example ...
package caam import ( "encoding/xml" "github.com/thought-machine/finance-messaging/iso20022" ) type Document01200101 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:caam.012.001.01 Document"` Message *ATMExceptionAcknowledgementV01 `xml:"ATMXcptnAck"` } func (d *Document012...
/** * @program: Go * * @description: * * @author: Mr.chen * * @create: 2020-03-06 10:54 **/ package admin import ( "github.com/kataras/iris" "github.com/kataras/iris/mvc" "iris_demo/services" ) type OrderController struct { Ctx iris.Context OrderService services.IOrderService } func (o *OrderController) Get() m...
package main import "fmt" type person struct { firstName string lastName string } type secretAgent struct { person ltk bool } func (s secretAgent) speak() { fmt.Println(s.firstName) fmt.Println(s.lastName) } func main() { sa := secretAgent{ person: person{ firstName: "Selva", lastName: "Mohandoss",...
package activitylog import ( md "github.com/ebikode/eLearning-core/model" ut "github.com/ebikode/eLearning-core/utils" ) // Service provides activityLog operations type ActivityLogService interface { GetActivityLogs(int, int) []*md.ActivityLog CreateActivityLog(md.ActivityLog) error } type service struct { alRe...
package 单调栈 // --------------- 从左到右遍历的 单调递增栈 --------------- func finalPrices(prices []int) []int { indexStack := NewMyStack() result := make([]int, len(prices)) for i := 0; i < len(prices); i++ { for !indexStack.IsEmpty() && prices[indexStack.GetTop()] >= prices[i] { result[indexStack.GetTop()] = prices[index...
package testing import ( "time" "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/crossregionsubnets" "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/servers" "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/subnets" ) // TestGetCrossRegionSubnetResponseRaw represents a raw respo...
package pojo import ( "tesou.io/platform/brush-parent/brush-api/common/base/pojo" ) /** 近期战绩 */ type BFJin struct { //比赛ID ScheduleID int64 `json:"ScheduleID" xorm:"comment('比赛ID') index"` //联赛ID SclassID int64 `json:"SclassID" xorm:"comment('联赛ID') index"` //联赛名称 SclassName string `json:"SclassName" xorm:"...
package models import ( "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/mysql" ) type AdminAccount struct { gorm.Model Id int `json:"id"` UserName string `json:"user_name"` Phone string `json:"phone"` Pwd string `json:"pwd"` Level int `json:"level"` State int `json:"s...
/* * Tencent is pleased to support the open source community by making Blueking Container Service available. * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obta...
package models type Root struct { EndPoint string `json:"end_point"` Arguments map[string]Argument `json:"arguments"` }
package main import ( "bufio" "os" "strings" "github.com/gookit/color" ) func logInfo(m string) { color.Printf("<fg=white>[</><fg=cyan;op=bold>info</><fg=white>]</> » %s\n", m) } func logSuccess(m string) { color.Printf("<fg=white>[</><fg=green;op=bold>success</><fg=white>]</> » %s\n", m) } func logErr(m str...
package main type PaymentMethod interface { Pay(amount float32) string } type PaymentType int const ( Cash PaymentType = iota DebitCard ) type CashPM struct{} type DebitCardPM struct{} func (c *CashPM) Pay(amount float32) string { return "" } func (c *DebitCardPM) Pay(amount float32) string { return "" } fu...
package searching // BinarySearch will search the key from item array and return boolean value... func BinarySearch(key int, item []int) bool { low := 0 high := len(item) - 1 for low <= high { median := (high + low) / 2 if item[median] == key { return true } else if item[median] < key { low = median ...
package message import ( "bytes" "encoding/json" "io" "io/ioutil" ) // JSONMessage json message format type JSONMessage struct{} // Marshal marshal func (j *JSONMessage) Marshal(v interface{}) (io.Reader, error) { data, err := json.Marshal(v) if err != nil { return nil, err } return bytes.NewBuffer(data),...
package address import ( "encoding/json" "strings" ) type Address struct { local string domain string } func (a *Address) Local() string { return a.local } func (a *Address) Domain() string { return a.domain } func (a *Address) String() string { if a.domain == "" { return a.local } return a.local + "@...
package pg import ( "github.com/kyleconroy/sqlc/internal/sql/ast" ) type AlterFdwStmt struct { Fdwname *string FuncOptions *ast.List Options *ast.List } func (n *AlterFdwStmt) Pos() int { return 0 }
package codebase import "github.com/almighty/almighty-core/errors" // CodebaseContent defines all parameters those are useful to associate Che Editor's window to a WI type CodebaseContent struct { Repository string `json:"repository"` Branch string `json:"branch"` FileName string `json:"filename"` LineNumbe...
package torbula import ( "bytes" "fmt" "os" "path/filepath" "time" "github.com/kjk/dailyrotate" ) var logger struct { path string file *dailyrotate.File } func logInit(path string) error { err := os.MkdirAll(path, 0755) if err != nil { return fmt.Errorf("failed create log dir: %s %v", path, err) } lo...
/* Written by mint.zhao.chiu@gmail.com. github.com: https://www.github.com/mintzhao 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...