id stringlengths 1 3 | code_masked stringlengths 801 162k | target stringlengths 3 28 |
|---|---|---|
0 | package main
import (
"fmt"
"github.com/nsf/termbox-go"
"time"
"strings"
"math/rand"
)
var score = 0
var colon string = `
§
##§
§
##§
§
`
var upArrow string = `
§
- §
/@\ §
/@@@\ §
/@@@@@\§
§
§
`
var downArrow string = `
§
§
\@@@@@/§
\@@@/ §
\@/ §
- ... | msg |
1 | package main
import (
"log"
"os/exec"
"regexp"
"strconv"
"github.com/bluele/slack"
)
const (
webhook = "webHook"
)
func getTemp() float64 {
reg, err := regexp.Compile("[^0-9.]+")
if err != nil {
log.Fatal(err)
}
output, execErr := exec.Command("vcgencmd", " measure_temp").Output()
if execErr != nil {
... | tmp |
2 | package natsio
import (
"encoding/json"
"github.com/nats-io/nats.go"
"{{ cookiecutter.go_module_path.strip() }}/internal/config"
"github.com/rs/zerolog/log"
"io"
"os"
"sync"
"time"
)
type Nats struct {
Conn *nats.Conn
EncConn *nats.EncodedConn
once sync.Once
}
func Encoder(v io.Reader, ptr interface... | reconnectDelay |
3 | package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"strings"
"time"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3ma... | today |
4 | // Copyright (c) 2019, the Drone Plugins project authors.
// Please see the AUTHORS file for details. All rights reserved.
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.
package drone
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
)
// RegistryType... | artifactFilePath |
5 | // Copyright 2020 arugal, <EMAIL>
//
// 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... | conf |
6 | package main
import (
"database/sql"
"fmt"
"log"
"net/http"
"os"
"github.com/gin-gonic/gin"
_ "github.com/lib/pq"
)
type URL struct {
Route string `json:"route"`
URL string `json:"url"`
}
func main() {
router := gin.Default()
router.Use(allowCORS())
// Define a GET endpoint
router.GET("/health", fun... | routeId |
7 | package main
import (
"strings"
"github.com/larsve/aoc2023/tools"
)
const (
one = "one"
two = "two"
three = "three"
four = "four"
five = "five"
six = "six"
seven = "seven"
eight = "eight"
nine = "nine"
)
var nbrs = [...]string{one, two, three, four, five, six, seven, eight, nine}
// nbrsToi1 is... | input |
8 | // Package main provides the entry point for the application. It loads the configuration, initializes the server, and starts the server.
package main
import (
"log"
"lemma/internal/app"
"lemma/internal/logging"
)
// @title Lemma API
// @version 1.0
// @description This is the API for Lemma markdown note taking ap... | cfg |
9 | package main
import (
"bufio"
"fmt"
"google.golang.org/api/youtube/v3"
"log"
"os"
"strings"
)
func lookupChannel(service *youtube.Service, reader *bufio.Reader) Channel {
title := quittingInput(reader, "Enter channel title")
request := service.Search.List([]string{"snippet"}).Type("channel").MaxResults(10).Q(... | choices |
10 | package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"os/signal"
"syscall"
"time"
"github.com/spf13/viper"
"github.com/wureny/FluxGo/internal/gateway"
"github.com/wureny/FluxGo/internal/limiter"
"github.com/wureny/FluxGo/pkg/client"
)
var (
configFile string
)
func init() {
flag.StringVar(&configFi... | ctx |
11 | package door
import (
"strings"
"github.com/golang/protobuf/proto"
"github.com/gorilla/websocket"
)
// Context 内容.
type Context struct {
Method MethodEnum
door *Door
conn *websocket.Conn
data []byte
num uint32
filter int
path string
}
// Execute 执行过滤器.
func (context *Context) Execute(path strin... | eventBytes |
12 | // github.com/Guohuixixi/crawDemo/craw
package craw
import (
"bufio"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path"
"regexp"
"strconv"
"strings"
"time"
)
var (
// 正则查找图片的地址
reImg = `http://i.52desktop.cn:81/upimg/allimg/[^"]+?(\.((jpg)|(png)|(jpeg)|(gif)|(bmp)))`
)
// 读取链接中所有的内容
func GetPageStr(url strin... | pagebytes |
13 | package internal
import (
"encoding/json"
"errors"
"fmt"
"os"
"time"
)
type baseOptions struct {
VersionNumber int64 `json:"versionNumber"`
}
type optionsV1 struct {
VersionNumber int64 `json:"versionNumber"`
GlowVersion string `json:"glowVersion"`
}
type optionsV2 struct {
VersionNumber int64 `json:"v... | ov1 |
14 | package main
import twodee "../../libs/twodee"
type AudioSystem struct {
app *Application
bgmusic *twodee.Music
menumusic *twodee.Music
click *twodee.SoundEffect
sel *twodee.SoundEffect
bgmusicObserverId int
menumusicObserverId ... | audioSystem |
15 | // Copyright 2018 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... | leftMask |
16 | package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"net/url"
"os"
"github.com/frobware/grawler"
)
var concurrency int
func init() {
flag.IntVar(&concurrency, "j", 50, "number of concurrent downloads")
}
var usage = func() {
fmt.Fprintf(os.Stderr, "%s [ -j <concurrency> ] URL\n", os.Args[0])
flag.Pr... | fetcher |
17 | package mydeployment
import (
"context"
"fmt"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/kubernetes"
k8slisters "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
kubeclient "knative.dev/pkg/client/injection/kube/... | logger |
18 | package cmd
import (
"fmt"
"os"
"sort"
"strings"
"time"
"unicode"
"github.com/containers/common/pkg/report"
"github.com/containers/podman-bootc/pkg/utils"
"github.com/containers/podman/v5/pkg/bindings/images"
"github.com/containers/podman/v5/pkg/domain/entities"
"github.com/distribution/reference"
"github... | filters |
19 | // Copyright 2022 <NAME>
//
// 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 writ... | ctx |
20 | package main
import (
"fmt"
"github.com/qiuzhanghua/common/util"
"os"
)
func main() {
if len(os.Args) <= 1 {
fmt.Printf("Usage:\n %s <filename>\n", os.Args[0])
os.Exit(0)
}
hasMode := false
var replaceMode util.ReplaceMode = util.Keep
if os.Args[1] == "-b" {
replaceMode = util.BackSlash
hasMode = tr... | content |
21 | // Package bridge implements the Bridge design pattern.
// In the context of woodworking projects, the bridge is implemented through dependency inversion.
// The specific projects (Desk, Chair) are not tightly coupled to a particular tool set (ManualToolSet or PowerToolSet),
// but instead depend on an abstract interfa... | deskProject |
22 | package main
import (
"bytes"
"flag"
"io/fs"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
"time"
"github.com/google/go-cmp/cmp"
libtime "go.starlark.net/lib/time"
)
var update = flag.Bool("update", false, "update golden files")
type testFile struct {
path string
content []byte
}
type goldenTe... | tmpdir |
23 | package tools
import (
"fmt"
"log"
"time"
"os"
"runtime"
"io"
"net/http"
"regexp"
"github.com/gorilla/websocket"
)
type WS struct {
Server *http.Server
Mux *http.ServeMux
Addr string
DemoPath string
Repo string
}
type RequestJSON struct {
Command string
Text string
}
type ResponseJSON struct {
Sta... | filepath |
24 | // Author: yann
// Date: 2021/9/27 3:21 下午
// Desc:
package utils
import (
"fmt"
"sync"
"sync/atomic"
"time"
)
// 如果传入任务超时返回的错误信息
var ErrScheduleTimeout = fmt.Errorf("schedule error: timed out")
// 线程池模型
type GoPool struct {
sem chan struct{} //线程池队列
work chan func() //任务队列
stop chan int
min uint32 //最小... | opt |
25 | package embench
import (
"bufio"
_ "embed"
"fmt"
"os"
"riscv/tools/bootloader"
bld "riscv/tools/build-scripts"
"strconv"
"github.com/magefile/mage/sh"
)
const workDir = "./programs/compliance-tests/"
// Build builds test for a selected instruction
func Build(instruction string) error {
if err := compile(in... | referencePath |
26 | package main
import (
"fmt"
"log"
"net"
"net/http"
_ "net/http/pprof" // register in DefaultServerMux
"os"
"time"
"crypto/tls"
"github.com/grpc-ecosystem/go-grpc-middleware"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
"github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/improbable... | director |
27 | package main
import (
"bytes"
"fmt"
"io"
"strings"
)
// 字节读取
func main() {
//ByteReaderByte()
//RuneReaderReader()
ReaderLimited()
}
func ByteReaderByte() {
var ch byte
fmt.Println("输入:")
fmt.Scanf("%c\n", &ch)
[MASK] := new(bytes.Buffer)
err := [MASK] .WriteByte(ch)
if err == nil {
fmt.Println("写入... | buffer |
28 | package data
import (
"math"
"sort"
)
// a node in the kdtree
type kdnode struct {
axis int
data Interface
left *kdnode
right *kdnode
}
// KDTree implements SpacialTree using the kd-tree data structure.
type KDTree struct {
root *kdnode
dimensions int
items []Interface
}
// NewKDTree creates ... | sum |
29 | package main
import (
"bufio"
"encoding/base64"
"errors"
"fmt"
"github.com/realth000/ToGoTool/html"
"github.com/realth000/ToGoTool/http"
"net/url"
"os"
"path/filepath"
"regexp"
)
const (
mediaDownloadUrlPrefix = `https://res.wx.qq.com/voice/getvoice?mediaid=`
)
var (
mediaIdRegexp = regexp.MustCompile(`m... | info |
30 | package main
import (
"fmt"
"os"
"runtime"
"path/filepath"
"github.com/chainhero/heroes-service/blockchain"
"github.com/chainhero/heroes-service/web"
"github.com/chainhero/heroes-service/web/controllers"
)
// Fix empty GOPATH with golang 1.8 (see https://github.com/golang/go/blob/1363eeba6589fca217e155c829b2a7... | fabricSdk |
31 | package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"strings"
"time"
)
func startWebServer() {
pageHTML := getHtmlContent(htmlFile)
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html")
fmt.Fprint(w, pageHTML)
})
http.HandleFunc("... | ipStatus |
32 | package lister
import (
"time"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
leaselisterv1 "k8s.io/client-go/listers/coordination/v1"
listerv1 "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
)
const (
resyncInt = 5 * time.Second
)
var (
factory inf... | lInformer |
33 | package analysis
import (
"fmt"
"strings"
"github.com/montanaflynn/stats"
)
func AvailableStats() map[string]func(stats.Float64Data) (float64, error) {
return map[string]func(stats.Float64Data) (float64, error){
"count": Count,
"mean": stats.Mean,
"std": stats.StandardDeviation,
"stds": stats.StandardDev... | maxNameLen |
34 | package gosilk
// #include <stdio.h>
// #include <silk/silk.h>
// #include <silk/sksite.h>
// #include <silk/skstream.h>
// #include <silk/utils.h>
// #include <silk/silk_types.h>
// #include <silk/rwrec.h>
// #cgo LDFLAGS: -lsilk
import "C"
import "fmt"
import "log"
import "time"
import "net"
import "encoding/binary"... | options |
35 | /*
Copyright 2022.
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 un... | mgr |
36 | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
)
type Payload struct {
Url string `json:"url"`
ValueKeyName string `json:"value_key_name"`
MaxKeyName string `json:"max_key_name"`
}
func handler(reques... | upstreamStatusCode |
37 | // SPDX-FileCopyrightText: 2023 <NAME> <<EMAIL>>
//
// SPDX-License-Identifier: MIT
package main
import (
"log/slog"
"os"
"os/signal"
"path/filepath"
"syscall"
"github.com/wneessen/logranger"
)
const (
// LogErrKey is the keyword used in slog for error messages
LogErrKey = "error"
)
func main() {
logger :... | signalChan |
38 | package controllers
import (
"encoding/json"
"rustdesk-api-server/app/dto"
"rustdesk-api-server/app/services"
"rustdesk-api-server/utils/beegoHelper"
"strings"
"strconv"
)
var Address = new(AddressBookController)
type AddressBookController struct {
BaseController
}
// 查看地址谱列表
func (ctl *AddressBookController... | tokens |
39 | package raftnode
import (
"encoding/json"
"errors"
"fmt"
"net"
"os"
"path/filepath"
"strings"
"time"
"github.com/forjoin92/depot/store"
"github.com/hashicorp/raft"
"github.com/hashicorp/raft-boltdb"
)
type RaftNode struct {
id string
peers []string
dataDir string
snapshotPath string
raftDBPa... | clusters |
40 | package client
import (
"bytes"
"crypto/tls"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"strconv"
"github.com/drone/drone/model"
"golang.org/x/net/proxy"
"golang.org/x/oauth2"
)
const (
pathPull = "%s/api/queue/pull/%s/%s"
pathWait = "%s/api/queue/wait/%d"
pathStream =... | values |
41 | /*
* @Author: <NAME>
* @Date: 2021-03-10 17:02:24
* @LastEditTime: 2021-03-10 17:45:17
* @LastEditors: Please set LastEditors
* @Description: 系统接口
* @FilePath: \readygo\api\system.go
*/
package api
import (
"context"
"readygo/apistruct"
"readygo/permission/permutil"
"github.com/cloudwego/hertz/pkg/app"
)... | err |
42 | // Copyright 2014 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... | msb |
43 | package config
import (
"strings"
"bufio"
"os"
"github.com/spf13/viper"
)
type (
// Config type
Config struct {
Verbosity int `yaml:"verbosity"`
Dir string `yaml:"dir"`
Host string `yaml:"host"`
Services Services `yaml:"services"`
}
// Service ...
Service struct {
Branch ... | rez |
44 | package db
import (
"context"
"database/sql"
"fmt"
)
type Bank struct {
*Queries
db *sql.DB
}
func NewBank(db *sql.DB) *Bank {
return &Bank{
db: db,
Queries: New(db),
}
}
func (bank *Bank) execTx(ctx context.Context, fn func(*Queries) error) error {
tx, err := bank.db.BeginTx(ctx, nil)
if err != n... | creditAmount |
45 | package provider
import (
"context"
"github.com/dronestock/cdn/internal/internal/config"
"github.com/goexl/gox/field"
"github.com/goexl/log"
cdn "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn/v20180606"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
"github.com/tencentcloud/te... | req |
46 | package oaichecker
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"strconv"
"strings"
"github.com/go-openapi/analysis"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware/denco"
"github.com/go-openapi/spec"
"github.com/go-openapi/strfmt"
"github.com/go-opena... | bodyReader |
47 | /*
* Copyright (c) 2021 The Clymene 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 ... | ctxScrape |
48 | package main
import (
"fmt"
"log"
"net/http"
"os"
)
func main() {
web()
}
func web() {
http.HandleFunc("/", httpHello)
http.HandleFunc("/host", httpHost)
//http.HandleFunc("/stop", httpStop)
listenPort := ":8080"
if [MASK] := os.Getenv("HTTP_PLATFORM_PORT"); [MASK] != "" {
listenPort = ":" + [MASK] ... | val |
49 | package main
import (
"bytes"
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
"github.com/spf13/viper"
"github.com/spf13/pflag"
)
const PREFIX = "K8SCONFIG"
const NAME = "vName"
const ENVIRONMENTVALUE = "environment"
const DEFAULTVALUE = "default"
const COMMANDLINEVALUE = "command-line"
const CONFIGFILEVALUE... | buffer |
50 | package main
import (
"context"
"flag"
"log"
"net"
"net/http"
"os"
"os/signal"
"syscall"
"gopkg.in/ini.v1"
"gopkg.in/natefinch/lumberjack.v2"
)
var cfg = struct {
Main struct {
Addr string
Certificate string
CertificateKey string
LogPath string
LogMaxSize int
LogMaxBack... | conn |
51 | // Copyright 2017 orijtech. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable ... | pager |
52 | package heap
import (
"errors"
"fmt"
)
type Heap struct {
items []int
}
func NewHeap() *Heap {
return &Heap{}
}
func (h *Heap) Insert(key int) {
h.items = append(h.items, key)
h.heapifyUp(len(h.items) - 1)
}
func (h *Heap) ExtractMax() (int, error) {
if len(h.items) == 0 {
return 0, errors.New("heap is em... | index2 |
53 | package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/anchore/ecs-inventory/internal/config"
"github.com/anchore/ecs-inventory/internal/logger"
"github.com/anchore/ecs-inventory/pkg"
pkgLog "github.com/anchore/ecs-inventory/pkg/logger"
)
var (
appConfig *config.App... | cfg |
54 | package conn
import (
"crypto/hmac"
"crypto/sha256"
"fmt"
"log"
"strings"
"time"
"github.com/dgrijalva/jwt-go"
"github.com/bytehouse-cloud/driver-go/driver/lib/ch_encoding"
"github.com/bytehouse-cloud/driver-go/driver/protocol"
)
const (
SignatureAuthService = "bytehouse" // Bytehouse is one of Volcano se... | jwtc |
55 | package tini
import (
"os"
"path/filepath"
"time"
"github.com/paketo-buildpacks/packit/v2"
"github.com/paketo-buildpacks/packit/v2/cargo"
"github.com/paketo-buildpacks/packit/v2/chronos"
"github.com/paketo-buildpacks/packit/v2/postal"
"github.com/paketo-buildpacks/packit/v2/sbom"
"github.com/paketo-buildpack... | buildMetadata |
56 | // Copyright (C) GRyCAP - I3M - UPV
//
// 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... | verify |
57 | // Package handlers manages the different versions of the API.
package handlers
import (
"context"
"database/sql"
"encoding/json"
"errors"
"fmt"
"net/http"
"os"
"time"
"github.com/gorilla/mux"
"github.com/jmoiron/sqlx"
"go.uber.org/zap"
"github.com/illyasch/url-shortener/pkg/business/shortener"
"github.... | router |
58 | // timescaledb-parallel-query creates some query performance data for a batch
package main
import (
"bufio"
"flag"
"fmt"
"log"
"os"
"runtime"
"strings"
"sync"
"time"
"github.com/jhoelzel/pparallel-bench/internal/db"
"github.com/jhoelzel/pparallel-bench/internal/resultaggregator"
"github.com/jmoiron/sqlx"
... | readStart |
59 | package main
import (
"fmt"
"net/http"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
dms "github.com/aws/aws-sdk-go/service/databasemigrationservice"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/sirupsen/logru... | addr |
60 | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package common
import (
"fmt"
"net/http"
"github.com/hyperledger/aries-framework-go/pkg/doc/ld"
"github.com/hyperledger/aries-framework-go/pkg/doc/ldcontext/remote"
ldstore "github.com/hyperledger/aries-framewo... | logLevel |
61 | // meek-client-torbrowser is an auxiliary program that helps with connecting
// meek-client to meek-http-helper running in Tor Browser.
//
// Sample usage in torrc (exact paths depend on platform):
// ClientTransportPlugin meek exec ./meek-client-torbrowser --log meek-client-torbrowser.log -- ./meek-client --url=https... | meekClientPath |
62 | package ring_buffer_go
import (
"fmt"
"sync"
"testing"
"time"
)
func producer(buffer LockingRingBufferInterface, iterations int, data []byte, wg *sync.WaitGroup, totalBytes *int) {
defer wg.Done()
for i := 0; i < iterations; i++ {
n, err := buffer.Write(data)
if err != nil {
continue
}
*totalBytes ... | bytesRead |
63 | package main
import (
"C"
"errors"
"fmt"
"log"
"os"
riak "github.com/basho/riak-go-client"
)
var slog = log.New(os.Stdout, "", log.LstdFlags)
var elog = log.New(os.Stderr, "", log.LstdFlags)
func LogInfo(source, format string, v ...interface{}) {
slog.Printf(fmt.Sprintf("[INFO] %s %s", source, format), v...)... | builder |
64 | package converter
import (
"reflect"
"unsafe"
)
// sizeOf computes the size of a type using reflection.
//
// TODO(bga): Change this if we are ever allowed to use unsafe.Sizeof with
// generic types.
func sizeOf[T any](t T) uintptr {
return reflect.TypeOf(t).Size()
}
// convertSlice does a completelly ... | dstTypeSize |
65 | /*
Copyright © 2020-2025 Dell Inc. or its subsidiaries. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by ... | leaderElectionLeaseDuration |
66 | package aex
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"regexp"
"time"
"github.com/skypies/adsb"
"github.com/skypies/geo"
"github.com/skypies/pi/airspace"
fdb "github.com/skypies/flightdb"
)
type AdsbExchange struct {
Client *http.Client
}
// {{{ args2url
func (aex AdsbExchange)args2url(args ... | counts |
67 | /**
* Created by GoLand.
* User: 平凡
* Date: 2024/1/7
* Time: 16:03
* Remark: 上传单个图片
*/
package images_api
import (
"admin/global"
"admin/models"
"admin/models/res"
"admin/utils"
"fmt"
"github.com/gin-gonic/gin"
"io"
"io/fs"
"os"
"path"
"strings"
)
var (
// WhiteImageList 图片上传的白名单
WhiteImageList = []stri... | err |
68 | /*******************************************************************************
* Copyright 2021 Dell 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/licen... | configPath |
69 | package processagent
import (
"context"
)
// InputPort represents a point of entry of the incoming requests to be processed.
// An input port may be for example an HTTP listener, WebSocket server or AMQP
// topic or queue.
// An incoming message (HTTP request, message over WebSocker or consumed from
// AMQP queue) i... | resp |
70 | /*
* Copyright(c) 2022 Intel Corporation.
* 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 agr... | code |
71 | package main
import (
"flag"
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/tools/cache"
"time"
"github.com/golang/glog"
"k8s.io/client-go/tools/clientcmd"
"github.com/bingerambo/crd-code-generation/cmd/nodecache/sdhedulerCache"
ncver "github.com... | nodecacheclientset |
72 | package api
import (
"github.com/busragumusel/insider-case/internal/handler"
"github.com/busragumusel/insider-case/internal/service"
"github.com/go-chi/chi/v5"
"github.com/go-redis/redis/v8"
"gorm.io/gorm"
)
type API struct {
db *gorm.DB
redisClient *redis.Client
messageService *service.Message... | router |
73 | package main
import (
"errors"
"fmt"
"github.com/crosseyed/versionbump/internal"
"github.com/crosseyed/versionbump/pkg/versionbump"
"os"
)
var App = internal.AppHelper{}
func main() {
// Inject into internal
internal.App = App
opts, err := internal.Args(os.Args[1:], nil, Version)
App.Errors(err, func(err e... | exit |
74 | package dailyLogger
import (
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
"time"
)
func NewDelete(logsDir string, [MASK] int, logger *log.Logger) {
logsDir = filepath.Base(logsDir)
timeLong := time.Hour * 24 * time.Duration( [MASK] )
delLogsDir(logsDir, timeLong, logger)
go func(dir string, timeLong... | days |
75 | package contracts
import (
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/rs/zerolog"
"github.com/smartcontractkit/chainlink-testing-framework/blockchain"
le "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/log_emitter"
)
type... | count |
76 | package ratelimiter
import (
"context"
"fmt"
"github.com/go-redis/redis/v8"
"time"
)
var limitScript = `
local strategies = ARGV
local currentScore = tonumber(strategies[#strategies]) -- 当前时间戳
-- 从 strategies 中移除当前时间戳
table.remove(strategies)
local results = {}
for i = 1, #KEYS do
local pass = true
for j = 1,... | formatRs |
77 | package main
import (
"os"
"github.com/adrg/xdg"
"github.com/alexflint/go-arg"
"github.com/charmbracelet/log"
)
var CONFIG_PATH = xdg.ConfigHome + "/distantroom"
var args struct {
Debug bool `arg:"-d, --debug" help:"sets log level to debug"`
}
var Error = "[-]"
var Warn = "[!]"
var Info = "[+]"
var Debug = "[*... | logger |
78 | /*
Copyright 2025 <NAME>.
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
distrib... | retries |
79 | package main
import (
"context"
"testing"
"github.com/aws/aws-lambda-go/events"
"github.com/jcmturner/ddns/awsclient"
"github.com/stretchr/testify/assert"
)
const (
TestUserName = "testuser"
AuthHeaderValue = "Basic dGVzdHVzZXI6c2VjcmV0U3RyaW5nVmFsdWU="
AuthHeaderInvalidUser = "Basic aW5... | ssmCl |
80 | package main
import (
"github.com/ekyoung/gin-nice-recovery"
"github.com/gin-gonic/gin"
"github.com/maczh/mgin/middleware/cors"
"github.com/maczh/mgin/middleware/postlog"
"github.com/maczh/mgin/middleware/trace"
"github.com/maczh/mgin/models"
"github.com/maczh/mgrmq/controller"
_ "github.com/maczh/mgrmq/docs"... | engine |
81 | package main
import (
"context"
"strconv"
"strings"
"time"
"github.com/mchmarny/gcp-metrics/pkg/metric"
"github.com/pkg/errors"
gha "github.com/sethvargo/go-githubactions"
)
var (
version = "v0.0.1-default"
int64Base = 10
)
func main() {
a := gha.WithFieldsMap(map[string]string{
"version": version,
... | projectID |
82 | package main
import (
"log"
"os"
"sync"
"github.com/mrbuk/mitm/server"
"github.com/mrbuk/ntt/shared"
)
func main() {
log.SetOutput(os.Stdout)
httpServerPort := shared.GetOsEnv("MITM_HTTP_SERVER_PORT", "10080")
httpsServerPort := shared.GetOsEnv("MITM_HTTPS_SERVER_PORT", "10443")
httpTargetScheme := shared... | httpsServerAddr |
83 | package property
type Property struct {
squareFootage int
lighting string
price float64
rooms int
bathrooms int
location []int
description string
ammenities map[string]bool
}
func (p *Property) SetSquareFootage(squareFootage int) {
p.squareFootage = squareFootage
}
func (p... | ammenity |
84 | package main
import (
"context"
"flag"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest"
"github.com/zgsm-ai/codebase-indexer/internal/config"
"github.com/zgsm-ai/codebase-indexer/internal/handler"
"github.com/zgsm-ai/codebase-indexer/internal... | svcCtx |
85 | package api
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"time"
"github.com/gorilla/mux"
"github.com/zhaoweiguo/log"
)
type Response map[string]interface{}
const (
DefaultLimit int = 100
MaxLimit int = 10000
MaxBatchSize int = 1000
)
func MakeHandler(fn func(http.ResponseWriter, *http.Reques... | statusCode |
86 | // Copyright 2010-2022 the original author or 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 l... | quit |
87 | /*
Copyright 2025 <NAME>
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, s... | info |
88 | package main
import (
"archive/zip"
"bytes"
"context"
"crypto/sha256"
_ "embed"
"encoding/base64"
"encoding/hex"
"fmt"
"io"
"net/http"
"os"
"slices"
"strings"
"golang.org/x/sync/errgroup"
"github.com/vic/ntv/packages/flake"
"github.com/vic/ntv/packages/search"
"github.com/vic/ntv/packages/search_spe... | outs |
89 | package main
import (
"encoding/json"
"fmt"
kubewarden "github.com/kubewarden/policy-sdk-go"
kubewarden_protocol "github.com/kubewarden/policy-sdk-go/protocol"
)
// Settings describes the policy settings.
type Settings struct {
AllowArgsAndCommand bool `json:"allow_args_and_command"`
}
// NewSettingsFromValida... | payload |
90 | /*
Copyright © 2021 yok4i <<EMAIL>>
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, softwa... | args |
91 | package main
import (
"context"
"encoding/json"
"fmt"
"os"
"strings"
"time"
// "k8s.io/client-go/kubernetes"
"github.com/jetstack/cert-manager/pkg/acme/webhook/apis/acme/v1alpha1"
"github.com/jetstack/cert-manager/pkg/acme/webhook/cmd"
etcdcv3 "go.etcd.io/etcd/client/v3"
extapi "k8s.io/apiextensions-apiser... | domains |
92 | package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"os"
"strconv"
"time"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/credentials/stscreds"
"github.com/aws/aws-sdk-go-v2/service/sts"
)
type IdentityTokenRetriever struct{}
func (i IdentityTokenRetriever) GetIdentityToken() ([]by... | webIdentityRoleProvider |
93 | package scclient
import (
"fmt"
"math/rand"
"sync"
"sync/atomic"
"time"
"github.com/gorilla/websocket"
)
type connection struct {
*websocket.Conn
startTime *time.Time
pingCounter uint64
msgCounter uint64
sendMu *sync.Mutex // Prevent "concurrent write to websocket connection"
receiveMu *sync.Mutex... | napTime |
94 | package controller
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/hielkefellinger/go-dnd/app/models"
"github.com/hielkefellinger/go-dnd/app/session"
"golang.org/x/crypto/bcrypt"
"golang.org/x/net/html"
"net/http"
"slices"
)
func CampaignSelectPage(c *gin.Context) {
user := getUserFromContextOrRedirect... | code |
95 | package hls
import (
"os"
"gocloud.dev/blob"
)
type TranscodeEvent struct {
Bucket string `json:"bucket"`
Key string `json:"key"`
DRMKey []byte `json:"drmKey"`
DRMInitializationVector string `json:"drmInitializationVector"`
Qualities ... | segmentFiles |
96 | package repeater
import (
"errors"
"testing"
"time"
)
func TestIncreaseDelay(t *testing.T) {
[MASK] := []struct {
name string
r *repeaterImpl
initial time.Duration
expectations []time.Duration
}{
{
name: "Default",
r: &defaultRepeaterImpl,
initial: 100 * time... | tests |
97 | package main
import (
"encoding/json"
"fmt"
"net/http"
"github.com/gin-gonic/gin"
"github.com/hguandl/dr-feeder/v2/common"
"github.com/hguandl/dr-feeder/v2/notifier"
"github.com/hguandl/dr-feeder/v2/notifier/wxmsgapp"
"github.com/hguandl/rhodes-deliver/database"
"github.com/lithammer/shortuuid"
)
func handl... | payload |
98 | // Copyright 2019 Altinity Ltd and/or its affiliates. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unles... | opts |
99 | package adminapi
import (
"fmt"
"github.com/HydroProtocol/hydro-scaffold-dex/backend/models"
"github.com/HydroProtocol/hydro-sdk-backend/common"
"github.com/HydroProtocol/hydro-sdk-backend/utils"
"github.com/labstack/echo"
"github.com/shopspring/decimal"
"math/big"
"net/http"
"os"
"time"
)
func RestartEngin... | restartEngineEvent |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.