First 37 rows of go
| uuidstring | repo_namestring | relative_pathstring | contentstring | categorystring | algo_rel_scorefloat64 | quality_scorefloat64 |
|---|---|---|---|---|---|---|
| d6d72539-c00a-4dfa-9542-76dcffc6086f | TomLan42/snippet | leetcode/2.add-two-numbers.go | /* * @lc app=leetcode id=2 lang=golang * * [2] Add Two Numbers */ // @lc code=start /** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */ func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode { // rl1 := revers… | ALGO | 0.9972546696662903 | 5.596871376037598 |
| 1546a5c0-b60c-4e7c-ac1c-3710da32f113 |
| samepermutationargument/samepermutationargument.go |
| package samepermutationargument import ( "fmt" "io" bls12381 "github.com/consensys/gnark-crypto/ecc/bls12-381" "github.com/consensys/gnark-crypto/ecc/bls12-381/fr" "github.com/jsign/curdleproofs/common" "github.com/jsign/curdleproofs/grandproductargument" "github.com/jsi… |
| ALGO |
| 0.7841778993606567 |
| 7.071456432342529 |
| c60b9531-cacf-402f-9851-0a490b3b26b1 | chenyue233/algorithm-notes | sort/selectionSort_test.go | package sort import ( "reflect" "testing" ) func TestSelectionSore(t *testing.T) { origin1 := []int{5, 6, 6, 1, 2, 4, 3} expect1 := []int{1, 2, 3, 4, 5, 6, 6} if result := SelectionSore(origin1); !reflect.DeepEqual(expect1, result) { t.Errorf("SelectionSore %v expected %… | TEST | 0.7492288947105408 | 4.540839672088623 |
| 6420644d-4915-4ba8-938f-fbfe2d3944d4 | myandrew/bilibili | app/job/main/videoup/dao/archive/forbid.go | package archive import ( "context" "go-common/app/job/main/videoup/model/archive" "go-common/library/database/sql" "go-common/library/log" ) const ( _inForbidSQL = `INSERT INTO archive_forbid (aid,rank_attr,recommend_attr,dynamic_attr,show_attr) VALUES (?,?,?,?,?) ON DUPL… | TOOL | 0.5115413665771484 | 6.4220781326293945 |
| 6dce5317-e118-480a-adf3-85d54d48cb40 | geoo115/piscine-go | basicatoi.go | package piscine func BasicAtoi(s string) int { result := 0 for _, c := range s { digit := int(c - '0') result = result*10 + digit } return result } | ALGO | 0.963860034942627 | 5.565145015716553 |
| 43fa7592-9955-4460-856f-6984e59e3eff | p1ass/leetcode | Search in Rotated Sorted Array/solution.go | package Search_in_Rotated_Sorted_Array func search(nums []int, target int) int { if len(nums) == 0 { return -1 } return binarySearch(nums, 0, len(nums)-1, target) } func binarySearch(nums []int, left, right int, target int) int { if left > right { return -1 } mid :=… | ALGO | 0.9981616139411926 | 5.962009429931641 |
| 51363450-6080-448a-8f23-2878ed49140e | alexandrepataut/ether | light/trie.go | package light import ( "context" "errors" "fmt" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "git… | TOOL | 0.8455954790115356 | 3.848039388656616 |
| 840f02db-c928-4c89-a12b-da1d895cda9f | neil-justice/go-data-structures | stack/stack_test.go | package stack import ( "reflect" "testing" ) func TestStack_Pop(t *testing.T) { type fields struct { contents []string } tests := []struct { name string stack *Stack want string ok bool size int }{ {"one element", CreateStack("a"), "a", true, 0}, {"m… | TEST | 0.644513726234436 | 5.868764400482178 |
| 7d256e87-f71d-489b-a3e6-bd0b5522b714 | cknolla/advent-of-code-2023 | day13/part1_test.go | package day13 import ( "github.com/stretchr/testify/assert" "testing" ) func TestParseFile(t *testing.T) { patterns := parseFile("sample.txt") assert.Equal(t, 358, patterns[0].rows[0]) assert.Equal(t, 90, patterns[0].rows[1]) assert.Equal(t, 89, patterns[0].columns[0]) a… | TEST | 0.6075447797775269 | 5.292998313903809 |
| 9fd9da21-0119-4d58-adb6-89979bdab521 | luomingguo/compiler_mit | workspace/src/github.com/timtadh/lexmachine/inst/inst.go | package inst import ( "fmt" "strings" ) const ( CHAR = iota // CHAR instruction op code: match a byte in the range [X, Y] (inclusive) SPLIT // SPLIT instruction op code: split jump to both X and Y JMP // JMP instruction op code: jmp to X MATCH // M… | ALGO | 0.893458366394043 | 5.948411464691162 |
| ab777f5e-acde-4767-a695-2dc608d7bc05 | kinisky564477/wechat | core/xml.go | package core import ( "errors" "regexp" "strings" ) /** * 针对微信支付接口设计实现的极简 XML 解析器 * **/ const ( NodeTag = iota + 1 NodeValue ) type XMLCDATA struct { Value string `xml:",cdata"` } type XMLElement struct { TagName string Value string Children []XMLElement } type… | TOOL | 0.9035274386405945 | 4.034463405609131 |
| 6386a69f-eae8-4374-ab09-d7421d10a1ff | braveheart12/tomochain | crypto/ecies/params.go | package ecies // This file contains parameters for ECIES encryption, specifying the // symmetric encryption and HMAC parameters. import ( "crypto" "crypto/aes" "crypto/cipher" "crypto/elliptic" "crypto/sha256" "crypto/sha512" "fmt" "hash" ethcrypto "github.com/ethereu… | TOOL | 0.7804742455482483 | 6.100946426391602 |
| cc300fff-7979-49a5-b196-d05084b8d714 | maksadbek/go-mon-service | rcache/calibration.go | package rcache import ( "errors" "strconv" "strings" "bitbucket.org/maksadbek/go-mon-service/conf" "bitbucket.org/maksadbek/go-mon-service/logger" ) var ( Calibres map[int][]Calibration TopLitres map[int]int ) type Calibration struct { ID int FleetID int Litre… | TOOL | 0.7675760388374329 | 3.6974782943725586 |
| 1cfd4521-3e2c-461e-8453-e134525d202a | huesflash/ziptree | ziptree_test.go | package ziptree import ( "fmt" "github.com/stretchr/testify/assert" "golang.org/x/exp/slices" "math/rand/v2" "testing" ) func TestZipTrees(t *testing.T) { arrays := [][]int32{ {1, 3, 4, 6}, {9, 7, 8, 4}, {-10, 12, -99, 8, 3, 7, 4, 6, 1, 2}, } for _, arr := range arra… | TEST | 0.8918609023094177 | 3.6673760414123535 |
| b6bb3b2a-6387-4346-a015-8442919d5d8a | libaoan/leecode | array/11_container_with_most_water.go | package main import "fmt" func main(){ fmt.Println(getBestPos1([]int{1,8,6,2,5,4,8,3,7})) fmt.Println(getBestPos2([]int{1,8,6,2,5,4,8,3,7})) } func getBestPos1(nums []int)(a1,a2,area int){ n := len(nums) if n < 2{ return 0, 0, area } a1, a2 = 0, 0 area = 0 for i, a :… | ALGO | 0.997747004032135 | 3.72184681892395 |
| ba791ebb-e28d-4af5-aa17-0bf22b9d4781 | TesraSupernet/Tesra | consensus/dbft/consensus_context.go | package dbft import ( "fmt" "github.com/TesraSupernet/tesracrypto/keypair" "github.com/TesraSupernet/Tesra/account" "github.com/TesraSupernet/Tesra/common" "github.com/TesraSupernet/Tesra/common/log" "github.com/TesraSupernet/Tesra/core/ledger" "github.com/TesraSupernet/… | TOOL | 0.6751206517219543 | 3.4421260356903076 |
| a4b1d6df-96f5-4a4a-bcf6-de6dce25b10c | FranxxOS-kazuwa/build | tools/compliance/cmd/dumpresolutions/dumpresolutions.go | package main import ( "bytes" "flag" "fmt" "io" "io/fs" "os" "path/filepath" "sort" "strings" "android/soong/response" "android/soong/tools/compliance" ) var ( failNoneRequested = fmt.Errorf("\nNo license metadata files requested") failNoLicenses = fmt.Errorf("… | TOOL | 0.628903329372406 | 4.75482177734375 |
| 83d89c90-f2bf-4597-b565-d995e9ac571a | leerycorsair/mephi-master-sem2-formals | lab_03/main.go | package main func sqr(v int) int { return v * v } func double(v int) float64 { return float64(v) * 2.0 } func main() { } | TOOL | 0.6017366051673889 | 3.535116672515869 |
| 66b75b90-9e44-496c-8acf-5851b37fdee6 | xukgo/gsaber | compon/prioriyQueue/queue.go | package prioriyQueue import ( "container/heap" "errors" "sync" ) // Only items implementing this interface can be enqueued // on the priority queue. type SortData interface { Less(other interface{}) bool } type Queue struct { Limit int items *sorter cond *sync.Cond } … | ALGO | 0.9089085459709167 | 6.743767738342285 |
| abbc7610-7c7e-422c-84f3-a59ed7af8eb3 | maxx066493/logo | go/pkg/mod/golang.org/x/crypto@v0.14.0/openpgp/s2k/s2k_test.go | package s2k import ( "bytes" "crypto" _ "crypto/md5" "crypto/rand" "crypto/sha1" _ "crypto/sha256" _ "crypto/sha512" "encoding/hex" "testing" _ "golang.org/x/crypto/ripemd160" ) var saltedTests = []struct { in, out string }{ {"hello", "10295ac1"}, {"world", "ac587… | TEST | 0.6551145911216736 | 6.5520453453063965 |
| d7fee0c8-4e90-4402-ae8b-936b60e18330 | VishalYAD/cryft-cli-test | cryft-cli/go/src/runtime/stack_test.go | package runtime_test import ( "fmt" "internal/testenv" "reflect" "regexp" . "runtime" "strings" "sync" "sync/atomic" "testing" "time" _ "unsafe" // for go:linkname ) // TestStackMem measures per-thread stack segment cache behavior. // The test consumed up to 500MB in… | TEST | 0.70573890209198 | 4.318556308746338 |
| 33243cb9-bdb0-4b2f-8393-ec3d2ed8736d | Breeze1203/JavaAdvanced | JavaAdvanced/go-demo/pkg/mod/golang.org/x/net@v0.30.0/quic/sent_val.go | //go:build go1.21 package quic // A sentVal tracks sending some piece of information to the peer. // It tracks whether the information has been sent, acked, and // (when in-flight) the most recent packet to carry it. // // For example, a sentVal can track sending of a RESET_STR… | TOOL | 0.5756455063819885 | 7.032040119171143 |
| fccb9014-0c4d-4c92-a706-242bc5cc87c0 | wylu/leetcodecn | src/golang/p700to799/704.二分查找.go | package p700to799 /* * @lc app=leetcode.cn id=704 lang=golang * * [704] 二分查找 * * https://leetcode-cn.com/problems/binary-search/description/ * * algorithms * Easy (55.13%) * Likes: 159 * Dislikes: 0 * Total Accepted: 69.8K * Total Submissions: 126.7K * Testcas… | ALGO | 0.9939739108085632 | 5.777313709259033 |
| 676cfb4f-b159-410f-9014-2467f7527c94 | zagto/zagtOS | src/gcc/libgo/go/crypto/ed25519/internal/edwards25519/scalarmult.go | package edwards25519 import "sync" // basepointTable is a set of 32 affineLookupTables, where table i is generated // from 256i * basepoint. It is precomputed the first time it's used. func basepointTable() *[32]affineLookupTable { basepointTablePrecomp.initOnce.Do(func() { … | ALGO | 0.9821411371231079 | 6.577500820159912 |
| 553be2f6-e413-4b7a-8cc5-b06096f0f24a | backendcloud/k8s-analysis | cmd/kubeadm/app/phases/addons/dns/dns.go | package dns import ( "context" "fmt" "io" "strings" "github.com/coredns/corefile-migration/migration" "github.com/pkg/errors" apps "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" rbac "k8s.io/api/rbac/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/ap… | TOOL | 0.5400053262710571 | 5.450924396514893 |
| 0e56087f-d1a1-4c2b-b1b6-77e733edbe7d | LoveBlock/loveblock | accounts/abi/pack.go | package abi import ( "math/big" "reflect" "github.com/LoveBlock/loveblock/common" "github.com/LoveBlock/loveblock/common/math" ) // packBytesSlice packs the given bytes as [L, V] as the canonical representation // bytes slice func packBytesSlice(bytes []byte, l int) []byte… | TOOL | 0.556098997592926 | 4.77103328704834 |
| a8d9bd51-c6c2-4adb-ba3f-c89cd894ebf5 | grasscy/algo | ac/931_test.go | package ac import "testing" func Test_minFallingPathSum(t *testing.T) { type args struct { matrix [][]int } tests := []struct { name string args args want int }{ {"", args{[][]int{{2, 1, 3}, {6, 5, 4}, {7, 8, 9}}}, 13}, } for _, tt := range tests { t.Run(tt.na… | TEST | 0.8223721385002136 | 6.351405620574951 |
| 92810be8-e35f-4e9c-9fcc-a1c95b2a4961 | erda-project/erda | internal/apps/msp/apm/browser/components/browser-overview/charts/page_req_duration_distribution/provider.go | package page_req_duration_distribution import ( "fmt" "reflect" "strconv" "time" "google.golang.org/protobuf/types/known/structpb" "github.com/erda-project/erda-infra/base/logs" "github.com/erda-project/erda-infra/base/servicehub" "github.com/erda-project/erda-infra/pk… | TOOL | 0.6346849203109741 | 6.754576206207275 |
| caae4e70-f48c-4b99-8f4c-04ceaee672fa | mustakimur/CFI-LB | llvm-project/llgo/third_party/gofrontend/libgo/go/image/color/ycbcr.go | package color // RGBToYCbCr converts an RGB triple to a Y'CbCr triple. func RGBToYCbCr(r, g, b uint8) (uint8, uint8, uint8) { // The JFIF specification says: // Y' = 0.2990*R + 0.5870*G + 0.1140*B // Cb = -0.1687*R - 0.3313*G + 0.5000*B + 128 // Cr = 0.5000*R - 0.4187*G - … | TOOL | 0.9361703991889954 | 5.160065650939941 |
| 5604c6e3-55b5-46a2-aaa4-ae279d5991be | spanocc/6.5840 | src/kvraft/server.go | package kvraft import ( "bytes" "sync" "sync/atomic" "time" "6.5840/labgob" "6.5840/labrpc" "6.5840/raft" ) // const Debug = false // func DPrintf(format string, a ...interface{}) (n int, err error) { // if Debug { // log.Printf(format, a...) // } // return // } … | TOOL | 0.6276402473449707 | 3.792678117752075 |
| aa372011-4939-41e6-a91a-6316beee84c2 | theadarshsaxena/go-noob-to-hero | 01-mathematics/08-count-set-bits.go | package main // logic: // If you subtract 1 from a num, least significant set bit becomes 0 and all the bits following it becomes 1 // e.g. 0100011100 - 1 => 0100011011 // And do a & between (num-1) and (num) removes the least significant set bit. func countSetBits(num int) … | ALGO | 0.9956383109092712 | 6.10601282119751 |
| efdf740d-da8e-424d-9b9f-8ccaeae745fb | 3loka/air | internal/ai/rag/retriever.go | package rag import ( "context" "fmt" "strings" "github.com/3loka/air/pkg/config" "go.uber.org/zap" ) // Retriever defines the interface for retrieving documents type Retriever interface { // Retrieve gets relevant documents for a query Retrieve(ctx context.Context, quer… | TOOL | 0.7520707845687866 | 6.374510765075684 |
| 50b80950-ef13-455a-8c68-5229d1ed15f6 | sbu-416-24sp/orcanet-go | coin/OrcaNet/mining/cpuminer/cpuminer.go | package cpuminer import ( "errors" "fmt" "math/rand" "runtime" "sync" "time" "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/mining" … | TOOL | 0.7957491874694824 | 6.51237154006958 |
| d5e66fd0-4153-482a-9249-231a61f8f503 | krantirk/Kubernetes | pkg/controller/garbagecollector/graph.go | package garbagecollector import ( "fmt" "sync" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ) type objectReference struct { metav1.OwnerReference // This is needed by the dynamic client Namespace string } func (s objectReference) String… | TOOL | 0.7062305808067322 | 6.773831844329834 |
| 915c2729-0aef-437c-86dc-44d931d65d6b | hongry18/leetcode | go/easy/202.-Happy-Number/main.go | package main func isHappy(n int) bool { for { if n == 1 || n == 7 { return true } else if n < 10 { return false } var tmp int for n > 0 { tmp += (n % 10) * (n % 10) n /= 10 } n = tmp } } | ALGO | 0.9908738136291504 | 5.82769250869751 |
| 6c25bc06-9c8d-4e63-b781-a6d2b4b6a122 | rsc/xstd | go1.16.2/unicode/graphic.go | package unicode // Bit masks for each code point under U+0100, for fast lookup. const ( pC = 1 << iota // a control character. pP // a punctuation character. pN // a numeral. pS // a symbolic character. pZ … | ALGO | 0.8584991097450256 | 7.282168388366699 |
| ac422e5d-597b-43cc-882f-0ebe6752d83f | joshuafried/gcc | libgo/go/hash/maphash/maphash_test.go | package maphash import ( "bytes" "hash" "testing" ) func TestUnseededHash(t *testing.T) { m := map[uint64]struct{}{} for i := 0; i < 1000; i++ { h := new(Hash) m[h.Sum64()] = struct{}{} } if len(m) < 900 { t.Errorf("empty hash not sufficiently random: got %d, want … | TEST | 0.5175138115882874 | 6.470426559448242 |