Dataset Viewer
Auto-converted to Parquet Duplicate
content
stringlengths
44
6.13M
membership
stringclasses
2 values
package systems import ( "image" "sync" "golang.org/x/image/colornames" "github.com/brunoga/robomaster/sdk" "github.com/EngoEngine/ecs" "github.com/EngoEngine/engo" "github.com/EngoEngine/engo/common" ) type systemVideoEntity struct { ecs.BasicEntity *common.SpaceComponent *common.RenderComponent } type...
member
package main import ( "bufio" "encoding/binary" "flag" influxdb2 "github.com/influxdata/influxdb-client-go/v2" "github.com/influxdata/influxdb-client-go/v2/api" "log" "math" "net" "os" "strings" "time" ) const hostname = "0.0.0.0" // Address to listen on (0.0.0.0 = all interfaces) const port = "...
non-member
package transformer import ( "regexp" "strings" "unicode" "unicode/utf8" ) type capitalization int const ( noCapitalization capitalization = iota firstCapitzlized allCapitalized ) // Regexes for handling how to split messages into usable components. var wordSplitRegex = regexp.MustCompile(`(\w+\b-+|\S+)[\n]*...
non-member
package main import ( "testing" ) func TestActivityNotifications(t *testing.T) { cases := []struct { result int expected int }{ { countInversions([]int{1, 1, 1, 2, 2}), 0, }, { countInversions([]int{2, 1, 3, 1, 2}), 4, }, } for _, c := range cases { if c.result != c.expected { t.Errorf("...
non-member
package mysqlparse import ( "bytes" "fmt" "io" "strings" "github.com/xwb1989/sqlparser" ) // Parse blabla func Parse(sql string) { tokens := sqlparser.NewTokenizer(strings.NewReader(sql)) for { stmt, err := sqlparser.ParseNext(tokens) if err == io.EOF { // t.Error(err) break } fmt.Println(parseS...
non-member
// user.go package main import ( "crypto/x509" "database/sql" "errors" "fmt" "strings" "sync" "github.com/golang/glog" ) // ----------------------------------------------- type TUserProfil int const ( ProfilNone = iota ProfilAdmin ProfilUser ) // ----------------------------------------------- var user...
non-member
//go:build !windows // +build !windows package ledgerbackend import ( "os" "github.com/pkg/errors" ) // Posix-specific methods for the StellarCoreRunner type. func (c *stellarCoreRunner) getPipeName() string { // The exec.Cmd.ExtraFiles field carries *io.File values that are assigned // to child process fds co...
member
package main // #cgo CPPFLAGS: -I/usr/local/modsecurity/include // #cgo LDFLAGS: /usr/local/modsecurity/lib/libmodsecurity.so // #include "modsec.c" import "C" import ( "encoding/json" "fmt" "github.com/gorilla/mux" "log" "net/http" "net/http/httputil" "net/url" "time" "unsafe" ) func HomeFunc(w http.Respon...
non-member
package msg import ( "bufio" "encoding/gob" "fmt" "io" "sync" ) // Reader : simple bufio.Reader safe for goroutines... type Reader struct { b *bufio.Reader m sync.Mutex } // NewReader : constructor func NewReader(rd io.Reader) *Reader { s := new(Reader) s.b = bufio.NewReader(rd) return s } // ReadString :...
non-member
package panda import ( "net/http" "github.com/LeeEirc/httpsig" ) const ( signHeaderRequestTarget = "(request-target)" signHeaderDate = "date" signAlgorithm = "hmac-sha256" ) type ProfileAuth struct { KeyID string SecretID string } func (auth *ProfileAuth) Sign(r *http.Request) error { ...
non-member
package linux import ( "net" ) func LocalIp() (string, error) { localIp := "N/A" adders, err := net.InterfaceAddrs() if err != nil { return localIp, err } for _, addr := range adders { if ipNet, ok := addr.(*net.IPNet); ok && !ipNet.IP.IsLinkLocalUnicast() && !ipNet.IP.IsLoopback() && ipNet.IP.To4() != n...
non-member
package main import ( "flag" "fmt" "os" "os/exec" "runtime" "stashbox/pkg/archive" "stashbox/pkg/crawler" ) func usage() { fmt.Println("Usage: stashbox <command> <options>") fmt.Println("") fmt.Println(" Where command is one of:") fmt.Println(" add -- add a url to the archive") fmt.Println(" li...
non-member
package valuechangevalidationfuncinfo import ( "testing" "golang.org/x/tools/go/analysis" ) func TestValidateAnalyzer(t *testing.T) { err := analysis.Validate([]*analysis.Analyzer{Analyzer}) if err != nil { t.Fatal(err) } }
non-member
package main import ( "flag" "log" "net" "strconv" ) func main() { port := flag.Int("port", 8080, "Port to accept connections on.") host := flag.String("host", "0.0.0.0", "Host or IP to bind to") flag.Parse() l, err := net.Listen("tcp", *host+":"+strconv.Itoa(*port)) if err != nil { log.Panicln(err) } l...
non-member
package lib import ( "errors" "fmt" "runtime" "strings" "testing" ) func TestF테스트_중(t *testing.T) { t.Parallel() F테스트_모드_종료() F테스트_거짓임(t, F테스트_모드_실행_중()) F테스트_모드_시작() F테스트_참임(t, F테스트_모드_실행_중()) } func TestF테스트_참임(t *testing.T) { //t.Parallel() // 화면 출력 중지 로 인하여 병렬 실행 불가. F테스트_참임(t, true) 모의_테스트 := n...
non-member
package main import ( "fmt" "sync" ) func greeter(wg *sync.WaitGroup, name string) { fmt.Printf("Hallo %s\n", name) wg.Done() } func main() { wg := &sync.WaitGroup{} wg.Add(1) go greeter(wg, "Alice") wg.Wait() }
non-member
package hexaring import ( "hash" "math/big" ) // CalculateRingVertexes returns the requested number of vertexes around the ring // equi-distant from each other except for potentially the last one which may be larger func CalculateRingVertexes(hash []byte, count int64) []*big.Int { var circum big.Int //circum.SetB...
non-member
package main import ( "fmt" "github.com/formicidae-tracker/zeus/internal/zeus" flags "github.com/jessevdk/go-flags" ) type VersionCommand struct { Args struct { Config flags.Filename } `positional-args:"yes"` } func (c *VersionCommand) Execute(args []string) error { fmt.Printf("%s\n", zeus.ZEUS_VERSION) re...
non-member
package build import ( "io" "text/template" "github.com/benpate/html" ) // StepInlineSaveButton represents an action-step that can build a Stream into HTML type StepInlineSaveButton struct { ID *template.Template Class string Label *template.Template } // Get builds the Stream HTML to the context func (ste...
non-member
/* * @Description: 前置重贴标签算法中图的节点类型 FrontFlowVertex * @Author: wangchengdg@gmail.com * @Date: 2020-02-18 10:31:22 * @LastEditTime: 2020-03-13 22:27:34 * @LastEditors: */ package GraphVertex /*! * * FrontFlowVertex 继承自 FlowVertex,它比FlowVertex顶点多了一个`N_List`数据成员,表示邻接链表 * * relabel_to_front 算法中,每一个FrontFlowVertex顶点位于...
non-member
package main import ( "log" ) func main() { log.SetFlags(log.Ldate | log.Lmicroseconds | log.Llongfile) name := "q0phi80" log.Println("Demo app") log.Printf("%s is here!", name) log.Print("Run") }
non-member
package main import ( "flag" "fmt" "log" "net/http" "os" "github.com/eniehack/persona-server/config" "github.com/eniehack/persona-server/handler" "github.com/go-chi/cors" "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/jmoiron/sqlx" _ "github.com/lib/pq" migrate "github.com/ruben...
non-member
package models type NoSuchObjectError struct { Info string } func (e NoSuchObjectError) Error() string { return e.Info } func NewNoSuchObjectError(s string) NoSuchObjectError { return NoSuchObjectError{Info: s} }
member
package main import ( "encoding/json" "fmt" "log" "net/http" "strings" "github.com/pkg/errors" ) func repoNameToRegistryImageTuple(repo string) (string, string, error) { s := strings.Split(repo, "/") var registryURL, image string switch len(s) { case 2: registryURL = "registry.hub.docker.com" image = ...
non-member
package cpu /* will be useful for debugging func getMode(mode uint8) string { switch mode { case ModeInvalid: return "ModeInvalid" case ModeZeroPage: return "ModeZeroPage" case ModeIndexedZeroPageX: return "ModeIndexedZeroPageX" case ModeIndexedZeroPageY: return "ModeIndexedZeroPageY" case ModeAbsolute: return "...
member
package cluster import ( "testing" "github.com/ditrit/gandalf/core/cluster" ) func TestNewClusterMember(t *testing.T) { const ( logicalName string = "test" databasePath string = "test" logPath string = "test" shosetType string = "cl" ) connectorMember := cluster.NewClusterMember(logicalName, da...
non-member
package main import ( "flag" "log" "net/http" "os" "github.com/nsmith5/vgraas/pkg/middleware" "github.com/nsmith5/vgraas/pkg/vgraas" ) func main() { var ( addr = flag.String("api", ":8080", "API listen address") ) flag.Parse() var api http.Handler { repo := vgraas.NewRAMRepo() api = vgraas.NewAPI(r...
non-member
package util import ( "fmt" "testing" ) func TestGenerateRandomString(t *testing.T) { for _, length := range []int{0, 10, 25} { t.Run(fmt.Sprintf("length_%d", length), func(t *testing.T) { rnd := GenerateRandomString(length) if len(rnd) != length { t.Errorf("GenerateRandomString() = %v, want %v", len(r...
non-member
package web import "testing" func TestIndexHandler(t *testing.T) { rr := testHandler(createRouter(), "GET", "/", nil) if rr.Code != 200 { t.Fatalf("Expected index to respond with 200, got %d instead", rr.Code) } }
non-member
package uix import ( "git.kirsle.net/SketchyMaze/doodle/pkg/shmem" "git.kirsle.net/go/render" "git.kirsle.net/go/ui" ) /* Functions for the Crosshair feature of the game. NOT dependent on Canvas! */ type Crosshair struct { LengthPct float64 // between 0 and 1 Widget ui.Widget } func NewCrosshair(child ui.W...
non-member
package polyglot var zobristHashes = [781]uint64{ 0x9D39247E33776D41, 0x2AF7398005AAA5C7, 0x44DB015024623547, 0x9C15F73E62A76AE2, 0x75834465489C0C89, 0x3290AC3A203001BF, 0x0FBBAD1F61042279, 0xE83A908FF2FB60CA, 0x0D7E765D58755C10, 0x1A083822CEAFE02D, 0x9605D5F0E25EC3B0, 0xD021FF5CD13A2ED5, 0x40BDF15D4A672E32, 0x011...
non-member
package stencil import ( "fmt" "strings" "github.com/harrowio/harrow/domain" ) // CapistranoRails sets up default tasks and environments for working // with a RubyOnRails application using capistrano. type CapistranoRails struct { conf *Configuration } func NewCapistranoRails(configuration *Configuration) *Capi...
non-member
package parser // https://github.com/SatisfactoryModdingUE/UnrealEngine/blob/4.22-CSS/Engine/Source/Runtime/Core/Public/Misc/FrameNumber.h#L16 type FFrameNumber struct { Value int32 `json:"value"` } func (parser *PakParser) ReadFFrameNumber() *FFrameNumber { return &FFrameNumber{ Value: parser.ReadInt32(), } }
non-member
package events type ( Event struct { stopped bool } ) // StopPropagation Stops the propagation of the event to further event listeners func (e *Event) StopPropagation() { e.stopped = true } // IsPropagationStopped returns whether further event listeners should be triggered func (e *Event) IsPropagationStopped()...
non-member
package mysqlutil import ( "database/sql/driver" "fmt" "log" "net/url" "strings" "github.com/leizongmin/go/sqlutil" ) type ConnectionOptions struct { Host string Port int User string Password string Database string Charset string Timezone string // +8:00 ParseTime bool Auto...
non-member
package types import ( "regexp" "whapp-irc/ircconnection" "whapp-irc/whapp" ) const messageIDListSize = 750 var ( numberRegex = regexp.MustCompile(`^\+[\d ]+$`) nonNumberRegex = regexp.MustCompile(`[^\d]`) ) // A Participant is an user on WhatsApp. type Participant whapp.Participant // FullName returns the...
non-member
package subsonic import ( "errors" "net/http" "time" "github.com/navidrome/navidrome/model" "github.com/navidrome/navidrome/model/request" "github.com/navidrome/navidrome/server/subsonic/responses" "github.com/navidrome/navidrome/utils/req" "github.com/navidrome/navidrome/utils/slice" ) func (api *Router) Ge...
non-member
package iterables import ( "container/heap" "fmt" ) func (i Iterable[T]) Sort(cmp func(T, T) int) Iterable[T] { gen := sort[T]{tHeap[T]{cmpFunc: cmp}} for true { item, err := i.Next() if (err == IterationStop{}) { break } else if err != nil { invalid := invalidIterable[T]{InvalidSort{err}} return ...
non-member
package main import "fmt" func filter(in, out chan int) { go func() { for n := range in { if n%2 == 0 { out <- n } } close(out) }() } func main() { done := make(chan struct{}) ch := gen(done) f := make(chan int) filter(ch, f) quadratChannel := sq(f) fmt.Println(<-quadratChannel) fmt.Println(<...
non-member
package k8sutil import ( "context" "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" ) // UpdatePodCondition updates the given condition type of the given pod with the new status and reason func UpdatePodCondition(pod *corev1.Pod, condTy...
non-member
// Pictures fetcher package pictures import ( "fmt" "io/ioutil" "log" "math/rand" "github.com/PeterCxy/gotelegram" "github.com/PeterCxy/gotgbot/support/types" ) type Pictures struct { tg *telegram.Telegram pic string debug bool } func Setup(t *telegram.Telegram, config map[string]interface{}, modules ...
non-member
package telegram import ( "main/pkg/constants" tele "gopkg.in/telebot.v3" ) func (reporter *Reporter) GetHelpCommand() Command { return Command{ Name: "help", Query: constants.ReporterQueryHelp, Execute: reporter.HandleHelp, } } func (reporter *Reporter) HandleHelp(c tele.Context) (string, error) { ...
non-member
package jsonrpc import ( "strings" "testing" "time" "github.com/stretchr/testify/assert" "github.com/yellomoon/web3tool" "github.com/yellomoon/web3tool/testutil" ) func TestSubscribeNewHead(t *testing.T) { testutil.MultiAddr(t, func(s *testutil.TestServer, addr string) { if strings.HasPrefix(addr, "http") {...
non-member
package admin_controller import ( "net/http" "github.com/gin-gonic/gin" "github.com/y-transport-server/pkg/app" "github.com/y-transport-server/pkg/e" "github.com/y-transport-server/service/admin_service" ) type login struct { User string `json:"user" valid:"Required; MaxSize(20);"` // 用户名 也是...
member
package users import ( "Office-Booking/app/config" mid "Office-Booking/delivery/http/middleware" domain "Office-Booking/domain/users" "Office-Booking/domain/users/request" "Office-Booking/domain/users/response" "net/http" "strconv" "github.com/labstack/echo/v4" ) type UserController struct { UserUsecase dom...
non-member
package dtclient import ( "encoding/json" "github.com/pkg/errors" ) type ConnectionInfo struct { TenantUUID string TenantToken string Endpoints string } type ActiveGateConnectionInfo struct { ConnectionInfo } type OneAgentConnectionInfo struct { ConnectionInfo CommunicationHosts []CommunicationHost } /...
member
package aomx import ( "net/url" ) // MustUrl enables parsing and dereferencing a URL in one line. // It returns a panic if err is not nil. // Call it for example when you want to dereference the pointer to a parsed URL // and assign the value to a variable in one line of code. // This can be useful when initializing...
non-member
package main import "testing" var TestCases = []struct { Str string WordExpected string SentenceExpected string }{ {"a", "a", "a"}, {"word", "drow", "word"}, {"word1 word2", "2drow 1drow", "word2 word1"}, {"sentence, with. punctuation;", ";noitautcnup .htiw ,ecnetnes", "punctuation; with. sentence,"}, } func ...
non-member
package db import ( "database/sql" "errors" "github.com/google/uuid" "strconv" "tide/common" "tide/pkg/custype" ) type Item struct { StationId uuid.UUID `json:"station_id" binding:"required"` Name string `json:"name" binding:"max=20"` Type string ...
non-member
package verification type Type int const ( Registration Type = 0 Recovery Type = 1 )
non-member
package database import ( "testing" "os" "flag" "database/sql" ) var databaseFlag = flag.Bool("database", false, "run database integration tests") var messageQueue = flag.Bool("messageQueue", false, "run message queue integration tests") var integration = flag.Bool("integration", false, "run all integration tests...
member
package model import ( "fmt" "gorm.io/gorm" ) type ArticleView struct { gorm.Model Title string `gorm:"type:varchar(50) not null;commit:标题"` Content string `gorm:"type:text not null;commit:内容"` CategoryID uint8 `gorm:"type:smallint not null;commit:分类ID"` CategoryName string `gorm:"type:varchar(2...
member
package wally import ( "errors" "fmt" "github.com/google/gousb" "io/ioutil" "time" ) type status struct { bStatus string bwPollTimeout int bState string iString string } func dfuCommand(dev *gousb.Device, addr int, command int, status *status) (err error) { var buf []byte if command == ...
member
package utils import ( "github.com/dgrijalva/jwt-go" "pledge-bridge-backend/config" "time" ) func CreateToken(username string) (string, error) { at := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ "username": username, "exp": time.Now().Add(time.Hour * 24 * 30).Unix(), }) token, err := at.Si...
non-member
package main import ( "github.com/kataras/iris" "github.com/kataras/iris/context" ) func main() { app := iris.New() none := app.None("/invisible/{username}", func(ctx context.Context) { ctx.Writef("Hello %s with method: %s", ctx.Values().GetString("username"), ctx.Method()) if from := ctx.Values().GetString...
non-member
package workflow_error import ( "time" "go.temporal.io/sdk/temporal" "go.temporal.io/sdk/workflow" ) type BusinessError struct{} func (be BusinessError) Error() string { return "business error" } func ExperimentalWorkflow(ctx workflow.Context) error { ctx = defineActivityOptions(ctx, "some") err := workflow....
non-member
package psql_test import ( "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/dobermanndotdev/dobermann/internal/app/query" "github.com/dobermanndotdev/dobermann/internal/domain" "github.com/dobermanndotdev/dobermann/internal/domain/monitor" "github.com/do...
non-member
package finder import ( "testing" ) func TestFunction_elemInSlice(t *testing.T) { var elem string = "elem" var slice = []string{"elem", "foo", "bar"} if !elemInSlice(slice, elem) { t.Errorf("Failure: Expected to find element 'elem' in slice!") } elem = "elem" slice = []string{"foo", "bar"} if elemInSlice...
non-member
package transfer_test import ( "testing" ) func TestAccTransfer_serial(t *testing.T) { testCases := map[string]map[string]func(t *testing.T){ "Access": { "disappears": testAccAccess_disappears, "EFSBasic": testAccAccess_efs_basic, "S3Basic": testAccAccess_s3_basic, "S3Policy": testAccAccess_s3_...
non-member
package utils import ( "encoding/json" "fmt" "io/ioutil" "log" "minirpc/Model" "net/http" "net/url" "regexp" "strconv" "strings" "time" "unsafe" ) type StackInfo struct { Name string `json:"name"` Code string `json:"code"` Ocode string `json:"ocode"` Gcode string `json:"gcode"` Val string `json:"val"...
non-member
package files import ( "fmt" "github.com/alexcoder04/iserv2go/iserv/types" "github.com/studio-b12/gowebdav" ) type FilesClient struct { config *types.ClientConfig davClient *gowebdav.Client } func (c *FilesClient) Login(config *types.ClientConfig) error { c.config = config c.davClient = gowebdav.NewClien...
non-member
package currency import ( "github.com/pkg/errors" "go.mongodb.org/mongo-driver/bson/bsontype" "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" ) func (a Big) MarshalBSONValue() (bsontype.Type, []byte, error) { return bsontype.String, bsoncore.AppendString(nil, a.String()), nil } func (a *Big) UnmarshalBSONValue(t ...
non-member
package main import ( glog "github.com/Sirupsen/logrus" "k8s.io/apimachinery/pkg/api/resource" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/pkg/api/v1" ) // Load nodes func LoadNodes() []v1.Node { nodes, err := GetKubeCli().CoreV1().Nodes().List(meta_v1.ListOptions{}) if err != nil { panic...
member
package types import ( log "github.com/33cn/chain33/common/log/log15" "github.com/33cn/chain33/types" ) /* * 交易相关类型定义 * 交易action通常有对应的log结构,用于交易回执日志记录 * 每一种action和log需要用id数值和name名称加以区分 */ // action类型id和name,这些常量可以自定义修改 const ( TyUnknowAction = iota + 100 TyAddAction TySubAction TyMulAction TyDivAction N...
member
package runner import ( "errors" "io/ioutil" "os" "os/exec" "path/filepath" "runtime" "strconv" "strings" "syscall" "testing" "time" ) func TestIsDirRootPath(t *testing.T) { result := isDir(".") if result != true { t.Errorf("expected '%t' but got '%t'", true, result) } } func TestIsDirMainFile(t *tes...
non-member
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
43