blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
e5b6ce24b3db93245a8d34fa79875a0976312b86 | f62b410a3297bdad36527dcf09e62def684a78be | Thomas-T/origin | /pkg/api/v1beta3/deep_copy_generated.go | Go | go | 87,488 | permissive | package v1beta3
// AUTO-GENERATED FUNCTIONS START HERE
import (
v1beta3 "github.com/openshift/origin/pkg/authorization/api/v1beta3"
apiv1beta3 "github.com/openshift/origin/pkg/build/api/v1beta3"
deployapiv1beta3 "github.com/openshift/origin/pkg/deploy/api/v1beta3"
imageapiv1beta3 "github.com/openshift/origin/pkg/i... |
4e14f39def7536372cf309229d4a1c2f20727453 | 1f42747315efa67896b6f0455864248fb3e1c60d | andrekis/telefonist | /webhook.go | Go | go | 863 | permissive | package main
import (
"bytes"
"fmt"
"net/http"
"strings"
"time"
)
const warnEmo = ":warning: "
const fireEmo = ":fire: "
func page(webhookUrl string, level, msg string) error {
if level == "warning" {
msg = warnEmo + msg
} else if level == "error" {
msg = fireEmo + msg
}
text := "{\"text\":" + fmt.Spri... |
3323f6c6710ec22762efc657b0f80e7733b9cfbf | 723e51f7f58cc3f7dfbaecfc7715aff3fa0b433d | patrickpreuss/flogviewer | /dal/category.go | Go | go | 1,607 | permissive | /*
* Copyright 2015 Fabrício Godoy
*
* 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... |
f0e2a850f2f85e4e149d04dda2afb083b85c6f77 | f72a7db970587edd8196d6b45c43e6e125d0fd71 | btcsuite/btcd | /btcutil/txsort/txsort.go | Go | go | 3,370 | permissive | // Copyright (c) 2015-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
// Provides functions for sorting tx inputs and outputs according to BIP 69
// (https://github.com/bitcoin/bips/blob/master/bip-0069.mediawiki)
package txsort
import (... |
aed78c8ae464673922947f123c4905ebf2d862d8 | 8c48a0432cdc62c74405a960539ddc469c34dde4 | c-darwin/dcoin-go-tmp | /packages/controllers/money_back.go | Go | go | 1,552 | no_license | package controllers
import (
"github.com/c-darwin/dcoin-go-tmp/packages/utils"
)
type moneyBackPage struct {
Alert string
SignData string
ShowSignData bool
CountSignArr []int
Lang map[string]string
UserId int64
OrderId int64
Amount float64
Arbitrator int64
Li ... |
c628f3c60857ebf48741f8f62e62d23a902340d4 | 40b78802b4c5817c00c864f65b507f085f43ec05 | sx202/blog_api | /main.go | Go | go | 497 | no_license | package main
import (
_ "github.com/sx202/blog_api/routers"
"github.com/astaxie/beego"
)
func main() {
if beego.BConfig.RunMode == "dev" {
beego.BConfig.WebConfig.DirectoryIndex = true
beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
}
//这个程序采用前后端分离的架构,前端所需要的所有数据都是通过API接口提供
//如果数据库采用的是sqlite3,只能做单用... |
213f4875a2857e303183e360207a3fe8d721d6de | 440f5b49970c432ccc5f85f66d8bda2a3b2f1cb5 | jingyuan-git/temp | /leetcode/editor/cn/[166]Fraction to Recurring Decimal.go | Go | go | 4,142 | no_license | //Given two integers representing the numerator and denominator of a fraction, r
//eturn the fraction in string format.
//
// If the fractional part is repeating, enclose the repeating part in parenthese
//s.
//
// If multiple answers are possible, return any of them.
//
// It is guaranteed that the length of the an... |
a36892cbad8b99cfa24856647cd257392a33668c | 24681627c69d1698f73332b1aef13be91f127bf0 | kedacore/keda | /vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.exists_component_template.go | Go | go | 6,059 | permissive | // Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
699cc32b7f4c8117244233a531166f69c6394879 | b303ec3282fb3e80e4dc145229ef62c2100d9b4b | 574939856/git-lfs | /commands/command_migrate_import.go | Go | go | 12,079 | permissive | package commands
import (
"bufio"
"bytes"
"encoding/hex"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/git-lfs/git-lfs/errors"
"github.com/git-lfs/git-lfs/filepathfilter"
"github.com/git-lfs/git-lfs/git"
"github.com/git-lfs/git-lfs/git/gitattr"
"github.com/git-lfs/git-lfs/git/githistory"
"github.com/g... |
ff2a309db6bd3f95ba0e2c3736a74c72a3ee2034 | 5c8e50370f29fc4150bc1ff829974fdf6520ac39 | jpancoast/notes_learning_and_tutorials | /go/year_perfect_squares.go | Go | go | 609 | no_license | package main
import (
"fmt"
"math"
)
func main() {
num_years := 100000
num_years_perfect_square := 0
for year := 0; year < num_years; year++ {
square_root_float := math.Sqrt(float64(year))
if float64(int(square_root_float)) == square_root_float {
// fmt.Printf("Year: %d. SQRT: %f, temp: %d\n", i, squa... |
bb321d0d1fae7a9d4fc9aa706cf6673612f19ce1 | bf2d7f3fc7832bd2850e405951c38646c4e49989 | tmshort/istio | /pilot/pkg/features/pilot.go | Go | go | 33,163 | permissive | // Copyright Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... |
5221a408d8ce7334282e571f3249afa262ebb125 | e82fe4a565b6cbe4108f5017a8be2ca8e3c02c98 | chris-rock/nginx-unit-4-go | /hello.go | Go | go | 316 | no_license | package main
import (
"net/http"
"nginx/unit"
)
func sayHello(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello World"))
}
func main() {
http.HandleFunc("/", sayHello)
// instead of http.ListenAndServe(":8080", nil)
if err := unit.ListenAndServe(":8080", nil); err != nil {
panic(err)
}
}
|
d5a3d612d7e4febf366086766144c1916d286a05 | 0446f1dc6980f95076d4e2f01e163138837ed0d3 | PithomLabs/go-guardian | /auth/strategies/x509/x509_test.go | Go | go | 3,740 | permissive | package x509
import (
"crypto/tls"
"crypto/x509"
"encoding/pem"
"io/ioutil"
"net/http"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func Test(t *testing.T) {
table := []struct {
name string
certs []*x509.Certificate
insecure bool
expectedErr bool
}{
{
name: ... |
e3866c1e389e712b26a2dd010072573cc31cb050 | eacc3d1e5fa84308ddfb19f4e507e03632986f4e | Kushalkhadka7/mocroservice-go-python | /go-client/authclient/authClient.go | Go | go | 910 | no_license | package authclient
import (
pb "client/pb"
"time"
"context"
"google.golang.org/grpc"
)
// AuthClient struct.
type AuthClient struct {
service pb.AuthServiceClient
username string
password string
}
// NewAuthClient creates new authentication client.
func NewAuthClient(conn *grpc.ClientConn, username, passwo... |
4a33c90329d4c748ef760f1d91db3c98361d7e74 | e204b6644a62f18897b30f1cab939f0f5c2d703f | herlegs/GoTest | /pprof/main.go | Go | go | 611 | no_license | package main
import (
"encoding/json"
"fmt"
"net/http"
_ "net/http/pprof"
"time"
)
func main() {
go func() {
for {
LocalTz()
doSomething([]byte(`{"a": 1, "b": 2, "c": 3}`))
}
}()
fmt.Println("start api server...")
panic(http.ListenAndServe(":8080", nil))
}
func doSomething(s []byte) {
var m ma... |
8898ce182b82a7ceb417d9966a2931632727f9e9 | e19005f62d758224b1972c5736268bd4e8625334 | akuan/oauth2 | /generates/authorize.go | Go | go | 770 | permissive | package generates
import (
"bytes"
"encoding/base64"
"strings"
"github.com/akuan/oauth2"
"github.com/akuan/oauth2/utils/uuid"
)
// NewAuthorizeGenerate create to generate the authorize code instance
func NewAuthorizeGenerate() *AuthorizeGenerate {
return &AuthorizeGenerate{}
}
// AuthorizeGenerate generate th... |
3c4cd8eb029062d927e0620399a39657ee14715c | f434cebd302c3084890abb1244bb4fbc4f2ba162 | tokibi/sabakan | /gql/match_test.go | Go | go | 6,934 | permissive | package gql
import (
"testing"
"time"
"github.com/cybozu-go/sabakan/v2"
)
func testInt(i int) *int {
return &i
}
func TestMatchMachine(t *testing.T) {
now := time.Date(2018, time.November, 26, 0, 0, 0, 0, time.UTC)
nowPlus60 := now.Add(time.Hour * 24 * 60)
testCases := []struct {
name string
machin... |
3b3a6d891426dd102f187fa59999a1951242ec76 | 2c1567396c251c0e81e658065b1f1ec28f6a74d4 | pbajjuri20/istio-operator | /vendor/github.com/timtadh/data-structures/types/map_entry.go | Go | go | 562 | permissive | package types
import (
"fmt"
)
type MapEntry struct {
Key Hashable
Value interface{}
}
func (m *MapEntry) Equals(other Equatable) bool {
if o, ok := other.(*MapEntry); ok {
return m.Key.Equals(o.Key)
} else {
return m.Key.Equals(other)
}
}
func (m *MapEntry) Less(other Sortable) bool {
if o, ok := othe... |
64155a83a9e8c7c80b4e852bdd3812bc21f3a061 | 254562147c7654f4f9b1eb25d68665363868c02b | IvanAlekseevichPopov/questBot | /main.go | Go | go | 16,224 | no_license | package main
import (
"encoding/json"
"github.com/go-telegram-bot-api/telegram-bot-api"
"github.com/joho/godotenv"
"github.com/robfig/cron"
"golang.org/x/net/proxy"
"gopkg.in/yaml.v2"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"questBot/sess"
"strings"
"time"
)
const questStartLink = "first"
const ques... |
e5a42764d9d8ff929533dcaa98d14d15c6bccc5d | 6c8dc4f9ff2edd815406028797f7a3a0fef4919c | liveball/gosrc | /practice/runtime/goroutine/stack/main.go | Go | go | 1,001 | no_license | package main
import (
"os"
"os/signal"
"runtime"
"syscall"
"time"
)
//awk -F '[' '/goroutine \d*/{print "[" $2}' stack.log | sort | uniq -c | sort -k1nr | head -20
//2 [running]:
//2 [sleep]:
//2 [syscall]:
func main() {
//SetupStackTrap()
SetupStackTrap("stack.log")
time.Sleep(100 * time.Second)
}
// how ... |
6c198e98fde22e1f8b3d9973543deb0ad608d7c7 | d29a6f2056c9c714346cd926b80682604627fe0a | banjin/go_base_study | /arrays/sum_test.go | Go | go | 895 | no_license | package main
import "testing"
import "reflect"
func TestSum(t *testing.T){
t.Run("collection of 5 numbers", func(t *testing.T){
numbers := []int{1, 2, 3, 4, 5}
got := Sum(numbers)
want := 15
if got != want {
t.Errorf("got %d want %d given, %v", got, want, numbers)
}
})
t.Run("collection of any size"... |
962dc24ecf119c75822c47a35bd96488cef90990 | 0030be9ad71950e018ffc02364318dfc29a25287 | Yolo62442/Design-patterns | /Data.go | Go | go | 246 | no_license | package main
import "fmt"
type Data struct {
School string
Year int
Winner *Wizard
}
func (d *Data) String() {
fmt.Printf("In %d year the tournament was held at " + d.School + " and the winner is ", d.Year)
fmt.Print(d.Winner.String())
} |
935613185411d71ce2297947b4bccf0a23b1c66c | 99d486a5c61a8473dd6aae8910fdcb903f306da0 | rif123/go-react | /models/JwtModel.go | Go | go | 258 | no_license | package models
type Jwks struct {
Keys []JSONWebKeys `json:"keys"`
}
type JSONWebKeys struct {
Kty string `json:"kty"`
Kid string `json:"kid"`
Use string `json:"use"`
N string `json:"n"`
E string `json:"e"`
X5c []string `json:"x5c"`
}
|
fac4b31609541efe3e4086cd66133b86dfd7d78a | 77d46c3d8177bb486b18ebdc8c47cecb91655e42 | nabla-containers/gorump | /1.7/go/src/syscall/zsyscall_nacl_arm.go | Go | go | 1,820 | permissive | // mksyscall.pl -l32 -nacl -arm syscall_nacl.go syscall_nacl_arm.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// +build arm,nacl
package syscall
import "unsafe"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func naclClose(fd int) (err error) {
_, _, e1 := Syscall(sys_close, uintptr... |
6339d486f8984d518ba0c8e282465a68039948eb | b657b51acbe08236d7e4f7e2d99e4bf4fe227898 | tsuru/globomap-integration | /vendor/github.com/tsuru/tsuru/provision/swarm/node_test.go | Go | go | 2,623 | permissive | // Copyright 2016 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package swarm
import (
"github.com/docker/docker/api/types/swarm"
"github.com/tsuru/tsuru/app"
"github.com/tsuru/tsuru/app/image"
"gopkg.in/check.v1"
)
fun... |
a495998a8191b1c21e0770300756e9224089a491 | 1e40d66f10593fc74a590d379c97a5fbb43c20aa | DonelAdam/datadog-agent | /pkg/trace/metrics/timing/example_test.go | Go | go | 591 | permissive | // Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-2020 Datadog, Inc.
package timing
import "time"
// The most basic usage for the package is ti... |
92ab5b3d48bfcdb0396f758b0955e700358c433c | 5283f4da20a7c23909ea893c2f566ac999ca00c8 | Hehongyuanlove/ego | /http/server.go | Go | go | 1,634 | permissive | package http
import (
"errors"
"github.com/ebar-go/ego/app"
"github.com/ebar-go/ego/config"
"github.com/ebar-go/ego/http/handler"
"github.com/ebar-go/ego/http/middleware"
"github.com/ebar-go/event"
"github.com/gin-gonic/gin"
"net"
"strconv"
"sync"
)
// Server Web服务管理器
type Server struct {
// 并发锁,可导出结构体采用私有... |
ca988bba2793a07d243f6a623457ebe5d02f8991 | d73b07075417ec91238582aa2cae41f6ceb4d84d | arvindkandhare/distribution | /Godeps/_workspace/src/github.com/arvindkandhare/goamz/s3/sign_test.go | Go | go | 5,399 | permissive | package s3_test
import (
"github.com/arvindkandhare/goamz/aws"
"github.com/arvindkandhare/goamz/s3"
"gopkg.in/check.v1"
)
// S3 ReST authentication docs: http://goo.gl/G1LrK
var testAuth = aws.Auth{AccessKey: "0PN5J17HBGZHT7JJ3X82", SecretKey: "uV3F3YluFJax1cknvbcGwgjvx4QpvB+leU8dUj2o"}
func (s *S) TestSignExamp... |
de18594098a06dd5f5f0dc25142020cde0a3e0d9 | 9b578700df91fecd6287bad381ed047dedda5b6b | Kanakonn/SmolBot | /moderation/punishments.go | Go | go | 15,370 | permissive | package moderation
import (
"context"
"strconv"
"strings"
"time"
"emperror.dev/errors"
"github.com/jinzhu/gorm"
"github.com/jonas747/discordgo"
"github.com/jonas747/dstate/v2"
"github.com/jonas747/yagpdb/bot"
"github.com/jonas747/yagpdb/common"
"github.com/jonas747/yagpdb/common/scheduledevents2"
seventsm... |
63b1f2a18b0ad3a2df7a18583911728b611d610c | 0b649af794e3b66d877542a3f8d32df45577b90d | jjimenez22/go-playground | /pow/pow.go | Go | go | 1,050 | no_license | package main
import (
"fmt"
"os"
"strconv"
)
func getLastDigit(n int) int {
for n >= 10 {
n %= 10
}
return n
}
func contains(s []int, x int) bool {
for _, v := range s {
if x == v {
return true
}
}
return false
}
func isOdd(n int) bool {
re... |
e3f5a87d944a69e11a0a652e918f4481aea5d321 | 4fa4c06bd8b917a8a82c7327c8f1ce54ff60cc6c | janfalee/cli | /cf/commands/securitygroup/assign_security_group.go | Go | go | 2,738 | permissive | package securitygroup
import (
"github.com/cloudfoundry/cli/cf/api"
"github.com/cloudfoundry/cli/cf/api/security_groups"
"github.com/cloudfoundry/cli/cf/api/security_groups/spaces"
"github.com/cloudfoundry/cli/cf/command_metadata"
"github.com/cloudfoundry/cli/cf/configuration"
"github.com/cloudfoundry/cli/cf/req... |
b163962faf60bf281d1b20206d3723c467d3ff57 | bdaabc409f12abe76900ed5d8396d52d71d37b9b | andyfenggq/ari | /_examples/helloworld/main.go | Go | go | 745 | permissive | package main
import (
"github.com/inconshreveable/log15"
"github.com/CyCoreSystems/ari/v5/client/native"
)
func main() {
// OPTIONAL: setup logging
log := log15.New()
native.Logger = log
log.Info("Connecting")
cl, err := native.Connect(&native.Options{
Application: "example",
Username: "admin",
P... |
0b26ea3297222a8d70c9d0bc0bfbbbf8c2f59eda | bd2af24c3509b9c507a12dcc12dc10db9b9cc098 | RamLavi/kubemacpool | /vendor/kubevirt.io/kubevirt/pkg/virt-handler/rest/console.go | Go | go | 6,615 | permissive | /*
* This file is part of the KubeVirt project
*
* 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 la... |
0173eeea306f543a63fa7f95297d35715b284cef | a853698676a3a8b4294dcc3b3d6e1a2af638c464 | puppycodes/torus-cli | /registry/utils.go | Go | go | 212 | permissive | package registry
import "net/http"
func replaceAuthToken(req *http.Request, token string) {
if token != "" {
req.Header.Set("Authorization", "Bearer "+token)
} else {
req.Header.Del("Authorization")
}
}
|
c28c4a1f2b9e49001777fb56adb0c599b0bde08e | 38c651634915684d8f4a6781c09a248ca320bec7 | HewlettPackard/ODIM | /svc-api/rpc/events.go | Go | go | 4,623 | permissive | //(C) Copyright [2020] Hewlett Packard Enterprise Development LP
//
//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 a... |
709a9c2bb91f1070b4db89840a0783def3879563 | 8be08eb271e6ff38e4839bd72de5767e5a9c9097 | lewisxy/rclone-library | /backend/azureblob/azureblob.go | Go | go | 60,889 | permissive | // Package azureblob provides an interface to the Microsoft Azure blob object storage system
// +build !plan9,!solaris,!js,go1.13
package azureblob
import (
"bytes"
"context"
"crypto/md5"
"encoding/base64"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"path"
"strings"
"sync... |
9191186cada564b970986aea1f484b0e69862c09 | 8973ddde6e53bac3f006261021df9eab8ce20505 | xiet16/go_gateway_gin_scaffold | /middleware/request_log.go | Go | go | 1,567 | no_license | package middleware
import (
"bytes"
"io/ioutil"
"time"
"github.com/gin-gonic/gin"
"github.com/xiet16/go_gateway_gin_scaffold/golang_common/lib"
"github.com/xiet16/go_gateway_gin_scaffold/public"
)
// 请求进入日志
func RequestInLog(c *gin.Context) {
traceContext := lib.NewTrace()
if traceId := c.Request.Header.Get(... |
4fdb3e2395d2c65b62ad449d10a7215d86f6d956 | 119a99cfcf3539dff2d1cf1c8fc8e213467d6d74 | martinohmann/kubernetes-cluster-manager | /pkg/manifest/parse.go | Go | go | 1,935 | permissive | package manifest
import (
"bytes"
"io"
"github.com/martinohmann/kubernetes-cluster-manager/pkg/hook"
"github.com/martinohmann/kubernetes-cluster-manager/pkg/resource"
log "github.com/sirupsen/logrus"
yaml "gopkg.in/yaml.v2"
)
// Parse takes a byte slice of yaml documents and parses all resources and
// hooks f... |
a3f25620af3b777ca577954ea6d2c67e6a2de932 | 7650ad64862cf1d78bb004ef000e01d0e872d4ca | rawg/bitsandfytes | /submissions/kirchmeier-john/categoryReduce.go | Go | go | 5,883 | no_license | package main
import (
"encoding/csv"
"fmt"
"log"
"os"
"path/filepath"
)
func main() {
inFile := ""
//inFile = "c:/users/dt12944/downloads/category-article.csv"
//inFile = "c:/users/dt12944/downloads/multiple-merges.csv"
//inFile = "c:/users/dt12944/downloads/remix.csv"
//inFile = "c:/users/dt12944/downloads... |
795c07967a626d8b517a9ed984727cdbbe097701 | 7fc04a28f75320d5018b0de1cb2de7ba4a8c0116 | open-estuary/influxdb | /task/servicetest/servicetest.go | Go | go | 47,583 | permissive | // Package servicetest provides tests to ensure that implementations of
// platform/task/backend.Store and platform/task/backend.LogReader meet the requirements of influxdb.TaskService.
//
// Consumers of this package must import query/builtin.
// This package does not import it directly, to avoid requiring it too earl... |
7e85763beb68658854194be61371479cfd1868a4 | 3c68a647cec7597c519379bee1bc5139bd68f292 | KI-labs/pachyderm | /src/server/pfs/s3/s3_test.go | Go | go | 22,789 | permissive | package s3
// Tests for the PFS' S3 emulation API. Note that, in calls to
// `tu.UniqueString`, all lowercase characters are used, unlike in other
// tests. This is in order to generate repo names that are also valid bucket
// names. Otherwise minio complains that the bucket name is not valid.
import (
"crypto/md5"
... |
cd276d9895808040187f397505af87c95671c6a3 | 014bddaac451daa2dbc02ca82f0debf2e5cdc283 | EVANSADOM/magma | /feg/gateway/services/testcore/pcrf/mock_pcrf/ccr_handler.go | Go | go | 6,234 | permissive | /*
* Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
package mock_pcrf
import (
"errors"
"fmt"
"magma/feg/cloud/go/protos"
"magma/feg/gateway/servic... |
4f0ff717754b7667291eb892c59138639f88519b | a5a4cc6f7391f44df25df6f77860bdc0e0feda51 | arangodb/go-driver | /v2/arangodb/client_server_info_impl.go | Go | go | 5,678 | permissive | //
// DISCLAIMER
//
// Copyright 2020-2023 ArangoDB GmbH, Cologne, Germany
//
// 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 re... |
48cbf0bad2e501f430d6e28bc37901fc484bbd56 | 750ccda51ef395783c99d29e1be79b1d5d02e1d4 | ggilley/ramsql | /engine/update.go | Go | go | 2,305 | permissive | package engine
import (
"fmt"
"strings"
"time"
"github.com/proullon/ramsql/engine/log"
"github.com/proullon/ramsql/engine/parser"
"github.com/proullon/ramsql/engine/protocol"
)
/*
|-> update
|-> account
|-> set
|-> email
|-> =
|-> roger@gmail.com
|-> where
|-> id
|-> =
|-... |
18a655ee033b74cca65ab96c5463357875d37910 | 360ae2c12988f20756a59a8627abb9f211ec75d9 | thaoducphung/go-language-tutorials | /sorting.go | Go | go | 271 | no_license | package main
import (
"fmt"
"sort"
)
func main() {
strs := []string{"c","a","b"}
sort.Strings(strs)
fmt.Println("Strings:",strs)
ints := []int{7, 2, 4}
sort.Ints(ints)
fmt.Println("Ints: ", ints)
s := sort.IntsAreSorted(ints)
fmt.Println("Sorted:", s)
}
|
6a9ba0ebf8c8b0dd2628bb14d8f338767490869a | 22034b89700c1505ca64793b6dea1ae0bc6ba2b6 | yoavweber/PGFS | /reciever/main.go | Go | go | 2,355 | no_license | package main
import (
"PGFS/content"
"PGFS/global"
"PGFS/node"
"PGFS/peers"
"context"
"fmt"
"github.com/ipfs/go-ipfs/repo/fsrepo"
icore "github.com/ipfs/interface-go-ipfs-core"
"log"
"strconv"
"time"
)
func main() {
/*
Initializes the context
*/
ctx, cancel := context.WithCancel(context.Background())... |
f65053e1a493a891f4bc529cb8250fb0818c742c | b37b28e6ed54dd4359e4eeadad316e6ddc7931f2 | methane/isu6f-app | /src/app/stroke.go | Go | go | 4,213 | no_license | package main
import (
"encoding/json"
"fmt"
"log"
"runtime/debug"
"time"
)
func need(err error) {
if err != nil {
debug.PrintStack()
log.Println(err)
}
}
type RoomRepo struct {
lock chan bool
Rooms map[int64]*Room
}
func NewRoomRepo() *RoomRepo {
return &RoomRepo{
lock: make(chan bool, 1),
Rooms... |
dbd4a20e796aff22180f2492800a53b2d056d3dd | dd9ed3e667d8ab53fcf28648987f46e05f1217ce | mmkider/nats-server | /server/sublist.go | Go | go | 38,909 | permissive | // Copyright 2016-2020 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
cd099ab1067ade4708204e36f006742be19c2f9d | 24374596e5eedf7038a8611dbc663e9c75a789c8 | jurycu/sealer | /plugin/labels_test.go | Go | go | 927 | permissive | package plugin
import (
"testing"
v1 "github.com/alibaba/sealer/types/api/v1"
)
func TestLabelsNodes_Run(t *testing.T) {
type fields struct {
data map[string][]label
}
plugin := &v1.Plugin{}
plugin.Spec.Data = "192.9.200.21 ws=demo21\n192.9.200.22 ssd=true\n192.9.200.23 ssd=true,hdd=false"
type args struc... |
f4f831136f9b2a160af7b1993f44a95ec75a57a2 | 535561d166f630090121e11b7d77e4cc5410f41c | redsift/contrib | /service-loadbalancer/service_loadbalancer.go | Go | go | 23,699 | permissive | /*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
8a9ac4df5517c99e5bbce7719934053de8fbf1eb | 9321c3901813c177255177dcbcd3024a3f85f9e9 | calvinx408/terraform-provider-signalform | /src/terraform-provider-signalform/signalform/detector_test.go | Go | go | 1,844 | permissive | package signalform
import (
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/stretchr/testify/assert"
"testing"
)
func TestGetNotifications(t *testing.T) {
values := []interface{}{
"Email,test@yelp.com",
"PagerDuty,credId",
"Webhook,test,https://foo.bar.com?user=test&action=alert",
}
expected... |
93c6906b3a0fdfa7fb996da83a2a87753bc78285 | 98f80552cfc683ab7cb82503744e77932176eff8 | alexellis/jaas | /vendor/github.com/docker/docker/integration-cli/docker_api_swarm_node_test.go | Go | go | 4,412 | permissive | // +build !windows
package main
import (
"time"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/integration-cli/checker"
"github.com/docker/docker/integration-cli/daemon"
"github.com/go-check/check"
)
func (s *DockerSwarmSuite) TestAPISwarmListNodes(c *check.C) {
d1 := s.AddDaemon(c, true... |
f2607fe411fff943bf57ef6dea5b3b593d6180bc | c81aa975391299e723c4c0763f410f122bb84291 | imnaifu/go-demo | /loop.go | Go | go | 973 | no_license | package main
import "fmt"
func demoLoop () {
// for loop
for i:=0; i<5; i++ {
fmt.Println(i) // 0 1 2 3 4
}
names := []string {"mario", "luigi", "peach", "lava"}
// for loop in array
for i := 0; i < len(names); i++ {
fmt.Println(names[i])
}
// for in loop in array
for index, value := range names {
... |
ed9453f80a9c6316734529fdcf60a98dff0b6761 | c416fb198425bf24f1245ea89a570e9dd6b58bac | xbmc/mirrorbits | /cli/rpc.go | Go | go | 1,433 | permissive | // Copyright (c) 2014-2019 Ludovic Fauvet
// Licensed under the MIT license
package cli
import (
"context"
"fmt"
"os"
"strconv"
"github.com/xbmc/mirrorbits/core"
"github.com/xbmc/mirrorbits/rpc"
"github.com/golang/protobuf/ptypes/empty"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang... |
f9c4b7726e5ab6ecfb0684eeb1e35a3ca7abc006 | d0d5f1027ff3c7fad6a2ae6115b3371821564652 | looyun/clicksend-go | /api_inbound_sms_rules.go | Go | go | 29,684 | no_license | /*
* ClickSend v3 API
*
* This is an official SDK for [ClickSend](https://clicksend.com) Below you will find a current list of the available methods for clicksend. *NOTE: You will need to create a free account to use the API. You can register [here](https://dashboard.clicksend.com/#/signup/step1/)..*
*
* API v... |
3286c094fae723c6acf1ed14a2e3e578e70807e5 | 2ed41c0e3a31df5df65d687bb2e1e5f29660b42f | go-inpro/redis-in-action | /main.go | Go | go | 266 | no_license | /*
* @Description: Do not edit
* @Date: 2021-09-27 14:15:09
* @LastEditors: viletyy
* @Author: viletyy
* @LastEditTime: 2021-10-08 15:27:56
* @FilePath: /redis-in-action/main.go
*/
package main
import (
_ "go-inpro/redis-in-action/util"
)
func main() {
}
|
98cc07923f53fd11e1bc9477e8455f369bc673b0 | 3592a8f81aa51590f52dd7209decf2ade1589557 | mvladev/kubernikus | /pkg/util/helm/helm.go | Go | go | 8,198 | permissive | package helm
import (
"fmt"
"hash/crc64"
"math/rand"
"net/url"
"github.com/go-openapi/swag"
"golang.org/x/crypto/bcrypt"
yaml "gopkg.in/yaml.v2"
v1 "github.com/sapcc/kubernikus/pkg/apis/kubernikus/v1"
etcd_util "github.com/sapcc/kubernikus/pkg/util/etcd"
"github.com/sapcc/kubernikus/pkg/version"
)
//conta... |
d4f23a36eeb4867b74398e9122be679a9ce7b1aa | f6edf2547d6abf7acb03d8d51a0d3c04f141865c | sagar104g/go_basics | /ninja-level-8/exercise-3.go | Go | go | 1,232 | permissive | // Hands-on exercise #3
// Starting with this code, encode to JSON the []user sending the results to Stdout. Hint: you will need to use json.NewEncoder(os.Stdout).encode(v interface{})
// solution: https://play.golang.org/p/ql90D1OQqd
// video: 127
package main
import (
"encoding/json"
"fmt"
"os"
)
type user stru... |
1c57d3b37a6d0bdbfb08c1b87de4a0e64a9b1d2f | 979414a08389f364e2c2bbe96b82a550c41a0217 | alimy/hori | /internal/cache/ristretto.go | Go | go | 1,048 | permissive | // Copyright 2021 Michael Li <alimy@gility.net>. All rights reserved.
// Use of this source code is governed by Apache License 2.0 that
// can be found in the LICENSE file.
package cache
import (
"github.com/alimy/hori/dao"
"github.com/dgraph-io/ristretto"
"github.com/sirupsen/logrus"
)
type mr struct {
*ristret... |
3916a29b875c7c5e5ae32e599999f6d79368dfcb | 33bc6b40997f9510c666ac20f9e1be0516794003 | sishen007/go | /orm中对接口的使用示例.go | Go | go | 780 | no_license | package main
import (
"fmt"
"reflect"
)
type IBaseModel interface {
GetName() string
GetAge() uint8
}
type Base struct {
}
type IBaseDao interface {
GetList()
}
type BaseDao struct {
EntityType reflect.Type
}
var IStuDaoImpl IStuDao
type IStuDao interface {
IBaseDao
}
type StuDao struct {
BaseDao
}
func (... |
0695b531a079e51bc904e0b1a3c06dcfdca0b2b4 | a505e082f5565f2264922d1aa6dad9b47cc2dc91 | Linuxbody/wjjgolearn | /01caichao/eaa_share_mem/share_mem_test.go | Go | go | 1,066 | permissive | package eaa_share_mem
import (
"sync"
"testing"
"time"
)
/**
* @author wjj
* @date 2020/8/30 6:19 下午
* @description 锁机制
*/
func TestCounter(t *testing.T) {
counter := 0
for i := 0; i < 5000; i++ {
go func() {
counter++
}()
}
time.Sleep(1 * time.Second)
t.Logf("counter = %d", counter)
}
func Tes... |
908d7b6199775571331d45fddbbcf58e76704e6c | f33d15238182d2d7328173f84e0969b2bfff1d94 | wakamenod/sqls | /internal/handler/handler_test.go | Go | go | 4,655 | permissive | package handler
import (
"context"
"log"
"net"
"reflect"
"testing"
"github.com/sourcegraph/jsonrpc2"
"github.com/lighttiger2505/sqls/internal/lsp"
)
type TestContext struct {
h jsonrpc2.Handler
conn *jsonrpc2.Conn
connServer *jsonrpc2.Conn
server *Server
ctx context.Context
}
... |
3cc918b9d63e53f17c24b395d54e21ef0cd00eb7 | e33583a0e45289b4345c707f94d34526747a6a64 | dadwic/hugo | /media/mediaType.go | Go | go | 11,869 | permissive | // Copyright 2019 The Hugo Authors. 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 ... |
02628c83d3ee100635e1d5065c60fcefe026e05a | 4aac9117d3a6be0a362196f1bd635477a5bec1a0 | as/transcode-orchestrator | /client/transcoding/job/job.go | Go | go | 2,598 | permissive | package job
import (
"path"
"time"
"github.com/gofrs/uuid"
)
// TagTranscodeDefault runs any default transcodes
// TagDolbyVisionTranscode runs Dolby Vision transcodes
// TagDolbyVisionPreprocess runs Dolby Vision pre-processing
// TagDolbyVisionMezzQC runs QC check on the mezzanine
const (
TagTranscodeDefault ... |
424b8b5f1be034f00be265073163d8b6ec652f88 | 007a1c37c3ad0d99ca7e4448233138fa127cd154 | yinsongbj/tinychain-1 | /core/vm/evm/logger_test.go | Go | go | 2,502 | permissive | // Copyright 2016 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... |
65f700279660bbe67c8ae8f3c4b955b5baf13b6b | 2f67b936e709de4524af81fc940ffb614cb67521 | liwei1dao/prototool | /tools/protoc/frankee/protobuf/test/unrecognized/oldnew_test.go | Go | go | 5,647 | permissive | // Protocol Buffers for Go with Gadgets
//
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
// http://github.com/frankee/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistribu... |
993ed989a350973bc45a71ae853b5ab731f0cf97 | 3991a63a656898958fa31d2ac3132ced2a3a8cd9 | xmidt-org/themis | /xhealth/log.go | Go | go | 1,813 | permissive | package xhealth
import (
"fmt"
healthlog "github.com/InVisionApp/go-logger"
"go.uber.org/zap"
)
type loggerAdapter struct {
Logger *zap.Logger
}
func (la loggerAdapter) Debug(msg ...interface{}) {
la.Logger.Debug(fmt.Sprint(msg...))
}
func (la loggerAdapter) Info(msg ...interface{}) {
la.Logger.Info(fmt.Spri... |
4bd0376f539c8091b1c4ee350580d75f8af9a1ed | 4c0fca7b2379c36156c4d95f1cf566ee3d951c82 | leononame/advent-of-code | /pkg/aoc/2018/day10/day10.go | Go | go | 2,411 | no_license | package day10
import (
"fmt"
"math"
"strings"
"time"
"gitlab.com/leononame/advent-of-code/pkg/geo"
"gitlab.com/leononame/advent-of-code/pkg/mmath"
"github.com/sirupsen/logrus"
"gitlab.com/leononame/advent-of-code/pkg/aoc"
)
var logger *logrus.Logger
func Run(c *aoc.Config) (result aoc.Result) {
logger = c... |
07bbdcaa3d90bd8d7ce80ed4b67a0d67153c6eba | 9e3245fb9a4dc5945ece090302e181823cac40d2 | huaweicloud/huaweicloud-sdk-go-v3 | /services/workspace/v2/model/model_unused_desktop_info.go | Go | go | 700 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// UnusedDesktopInfo 未使用的桌面信息。
type UnusedDesktopInfo struct {
// 桌面id。
DesktopId *string `json:"desktop_id,omitempty"`
// 桌面名称。
ComputeName *string `json:"compute_name,omitempty"`
// 桌面创建时间。
CreateTime *string `j... |
e9e00e2e6775ab62666b20b29cfba8b33975dca0 | 12cf902477329e2cd8ec25299dc2c9c488ea5e50 | rn/linuxkit | /src/cmd/linuxkit/pkglib/pkglib.go | Go | go | 9,023 | permissive | package pkglib
import (
"crypto/sha1"
"fmt"
"os"
"path"
"path/filepath"
"strings"
"gopkg.in/yaml.v2"
"github.com/linuxkit/linuxkit/src/cmd/linuxkit/moby"
"github.com/linuxkit/linuxkit/src/cmd/linuxkit/util"
)
// Contains fields settable in the build.yml
type pkgInfo struct {
Image string ... |
c7e4ca1b03bc3b356f9e31d9a768794625d81e20 | ed1c24559285bae57887341bfc53c09a72ceb4ce | SoMuchForSubtlety/tview | /util.go | Go | go | 23,793 | permissive | package tview
import (
"math"
"regexp"
"sort"
"strconv"
"github.com/gdamore/tcell/v2"
runewidth "github.com/mattn/go-runewidth"
"github.com/rivo/uniseg"
)
// Text alignment within a box.
const (
AlignLeft = iota
AlignCenter
AlignRight
)
// Common regular expressions.
var (
colorPattern = regexp.MustC... |
20eca1e55e20564827395e4695b801329981b686 | 38b53122900a22a0e4675cb560b0a0a8716cb5e3 | bazk/advent-of-code-2019-solutions | /day02/day2.go | Go | go | 1,789 | no_license | package main
import (
"fmt"
"io/ioutil"
"log"
"strconv"
"strings"
)
type Memory []int
func createMemory(size int) Memory {
return make(Memory, size)
}
func debugMemory(memory Memory) {
fmt.Println(memory[:32], " ...")
}
func flashProgram(memory Memory, programFile string) error {
content, err := ioutil.Rea... |
04b8a8c64e6342b9f4dff6e46d4799e83b41d755 | 702d204b54c51c349eee9923b36b5fb2a070859e | anders0913/luci-go | /led/ledcli/get_swarm.go | Go | go | 2,578 | permissive | // Copyright 2020 The LUCI Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
8c9b40a1d951d949a1a233e4d2e432657ae3ef00 | 0cca325fff8338684088ab3faf7cce8dc45b6080 | tsaiyang/leetcode-top250-easy-and-medium | /59. Spiral Matrix II.go | Go | go | 1,015 | no_license | package main
func generateMatrix(n int) [][]int {
startRow, startCol, endRow, endCol := 0, 0, n-1, n-1
result := make([][]int, n)
for i := range result {
result[i] = make([]int, n)
}
count := 1
for startRow <= endRow {
if startRow == endRow {
result[startRow][startCo... |
e9b2790abecee32bd5698d1ac1276311b9a54cce | fd48b832d486fa476bf50c874ccfda24d26a4bc1 | lzpfmh/ShadowEditor | /server/server/assets/animation/model.go | Go | go | 893 | permissive | // Copyright 2017-2020 The ShadowEditor Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
//
// For more information, please visit: https://github.com/tengge1/ShadowEditor
// You can also visit: https://gitee.com/tengge1/ShadowEditor
p... |
ddf07bfd0f8a28723ac0ff6ab2f5ce93802bd902 | 04d4677267f135843eeb25a577250e2a94ecd2f0 | mom0tomo/til | /args/args.go | Go | go | 395 | no_license | package main
import (
"fmt"
"os"
)
func run() error {
argc := len(os.Args)
if argc < 2 {
return fmt.Errorf("引数が足りません。")
}
fmt.Println("argc=", argc)
for i := 0; i < argc; i++ {
argv := os.Args
fmt.Printf("argv[%d]=%s\n", i, argv[i])
}
return nil
}
func main() {
if err := run(); err != nil {
fmt.F... |
9ad310f4daf4fb996aa5002bf30b47d5244dee01 | 67e053105162b9199f380fa48b5035ef22d1b2ad | thomasluce/gosound | /wav/wav.go | Go | go | 7,469 | no_license | package wav
import (
"bytes"
"encoding/binary"
"fmt"
"io"
"os"
"github.com/thomasluce/gosound"
"github.com/thomasluce/util"
)
func init() {
gosound.RegisterAudioFormat("wav", "wav", decodeWavFile)
}
type sampleReader interface {
ReadSample(io.Reader, *wavFile) (float32, error)
}
type soundConfig struct {
... |
c75540216b68235e3c8b4196432a158d3c019c5d | 8c03a4defae5d4d52e2c0309646f21774025cf37 | gbenhaim/cluster-network-addons-operator | /pkg/network/network.go | Go | go | 2,996 | permissive | package network
import (
"log"
"reflect"
osv1 "github.com/openshift/api/operator/v1"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
opv1alpha1 "github.com/kubevirt/cluster-network-addons-operator/pkg/apis/networkaddonsoperator/v1alpha1"
)
// Canonicalize converts configuration to ... |
12bd1e690886cd2dd24e0824ec333bfb80326d62 | c5c997c1bd5a94896f8ef6f8a1ef8b0a352ed3f4 | SPMechanic/teleport | /lib/backend/dir/impl.go | Go | go | 13,352 | permissive | /*
Copyright 2016-2017 Gravitational, 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 in writing,... |
9609f46331113e336b7ac845262ec593a22f006d | 1471235b68de45673810bd8fc68977224cecdf21 | mattmoor/mink | /vendor/github.com/theupdateframework/go-tuf/pkg/keys/ecdsa.go | Go | go | 1,376 | permissive | package keys
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/sha256"
"encoding/asn1"
"encoding/json"
"errors"
"math/big"
"github.com/theupdateframework/go-tuf/data"
)
func init() {
VerifierMap.Store(data.KeyTypeECDSA_SHA2_P256, NewEcdsaVerifier)
}
func NewEcdsaVerifier() Verifier {
return &p256Verifier{... |
1b6886a8f925b69ad7c70725fc3edd25f7f3d656 | 5dac36973dd8985134bfd19340f0854802e39e88 | devasiajoseph/wemebox | /website/page.go | Go | go | 1,301 | no_license | package website
import (
"fmt"
"log"
"net/http"
"text/template"
"github.com/devasiajoseph/wemebox/api"
)
type Object struct {
Title string
Content string
CSRF string
PageData interface{}
}
func RenderPageTemplate(w http.ResponseWriter, r *http.Request, pd PageData) {
//pageData := pd
paths := Pa... |
121eb2d1d71683868c33fa6e9d1b7aeb2dc3eea2 | 9f11605dfe03a106e0eb905c5a9cae579da88913 | ruckstack/ruckstack | /builder/internal/util/util.go | Go | go | 3,560 | permissive | package util
import (
"archive/tar"
"compress/gzip"
"fmt"
"github.com/ruckstack/ruckstack/builder/internal/environment"
"github.com/ruckstack/ruckstack/common/ui"
"io"
"io/fs"
"net/http"
"os"
"path/filepath"
"regexp"
)
func DownloadFile(url string) (string, error) {
cacheKey := regexp.MustCompile(`https?... |
c8a593037a8491b22f991ed8f59534bdd5556540 | 27909dc40dc5151620f7a5306cfcc597a60708b3 | integr8ly/walkthrough-operator | /vendor/github.com/kubernetes-incubator/service-catalog/test/integration/controller_instance_test.go | Go | go | 61,486 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
b87908bdb904900dbe352eb4a784471b76d062bd | b7ab2b74997eb41bcd218b0791d5048396a8ebdf | QiuMike/l4proxy | /src/handler/conn.go | Go | go | 1,414 | permissive | package handler
import (
"fmt"
"io"
"net"
"sync"
log "github.com/sirupsen/logrus"
)
type PairedConn struct {
SRC, DEST net.Conn
OnClose func()
}
type Pairs map[string]*PairedConn
type Token int
type ServiceUser struct {
}
type Backend struct {
name string
}
func (pc *PairedConn) Copy(wg *sync.WaitGrou... |
742bf5a87d88865829bb21515ffd5a37c4442211 | 89634e69f37a822e680e9ae5f3087875d77a3813 | piotrszlenk/ssl-test | /main.go | Go | go | 1,241 | no_license | package main
import (
"flag"
"github.com/piotrszlenk/ssl-test/pkg/certcheck"
"github.com/piotrszlenk/ssl-test/pkg/endpoint"
"github.com/piotrszlenk/ssl-test/pkg/logz"
)
func main() {
var logger *logz.LogHandler
// Parse CLI arguments
endpointFile := flag.String("endpoints-file", "endpoints.txt", "Flat file w... |
c208fbf163b1242eb942812ba351c475593024db | 537e96a35cde1faf6b94cc99da0e32824d46349d | isabella232/vcsserver | /storage.go | Go | go | 691 | no_license | package vcsserver
import (
"github.com/sourcegraph/go-vcs"
"os"
"path/filepath"
"strings"
)
// StorageDir is the root directory underneath which repositories are stored.
var StorageDir = "/tmp/vcsserver"
func repoDir(vcs vcs.VCS, uri string) string {
preferred := filepath.Join(StorageDir, vcs.ShortName(), uri)
... |
dedab4c8bbb1275b6a598d1ab911478419145e49 | 8a51cf35e93395cc12dd817d0c934f5f8483b5be | digitascientia/xendit-go | /integration_test/main.go | Go | go | 722 | permissive | package main
import (
"os"
"sync"
"github.com/xendit/xendit-go"
)
func main() {
xendit.Opt.SecretKey = os.Getenv("SECRET_KEY")
wg := sync.WaitGroup{}
wg.Add(11)
go func() {
balanceTest()
wg.Done()
}()
go func() {
cardTest()
wg.Done()
}()
go func() {
cardlesscreditTest()
wg.Done()
}()
go fun... |
065da86927a1706dabe1328533c1b74147e66890 | fe6aa07fe2a13199816e5279b8efa1174cdb8383 | BrentNoorda/catchy-link | /vars.go | Go | go | 3,744 | no_license | package catchylink
import (
)
var myRootUrl = "http://catchy.link" // this overridden if "CATCHYLINK_ROOT_URL" environment variable
const RequestTimeMin = 30 // requests will timeout in this many minutes
const expiration_warning_days = 3 // how many days before expiration will an email be sent out
const max_em... |
64e07004b086580bdc00284225748888bac7bee5 | 99b0452a9eddec67736cb465e64684b4e4c072e7 | holdno/alidayu | /client.go | Go | go | 4,052 | no_license | package hnAlidayu
import (
"crypto/hmac"
"crypto/sha1"
"encoding/base64"
"encoding/json"
"io/ioutil"
"math/rand"
"net/http"
"net/url"
"sort"
"strings"
"time"
)
const (
domain = "dysmsapi.aliyuncs.com"
)
func SendMessage(userInput *UserParams) (bool, string, error) {
params := make(Params)
params.Set("A... |
21c0e402252d54edad8edb061638507d1d7a1d0c | 10482af7e85e0a5f82af45042ab4908836d16928 | BlockPropeller/BlockPropeller | /blockpropeller/config.go | Go | go | 1,226 | no_license | package blockpropeller
import (
"blockpropeller.dev/blockpropeller/account"
"blockpropeller.dev/blockpropeller/ansible"
"blockpropeller.dev/blockpropeller/database"
"blockpropeller.dev/blockpropeller/encryption"
"blockpropeller.dev/blockpropeller/provision"
"blockpropeller.dev/blockpropeller/terraform"
"blockpr... |
b93d33055b71c40ed5ee38d15279bdb89c70c6eb | 4791a9673332b97b29e7e3e095f5f1e5ee6006ad | x86core/go-note | /demo/crypto.go | Go | go | 353 | no_license | package main
import (
"crypto/md5"
"crypto/sha1"
"fmt"
)
func main() {
Tstring := "need to encrypt"
Md5inst := md5.New()
Md5inst.Write([]byte(Tstring))
Result := Md5inst.Sum([]byte(""))
fmt.Printf("%x\n\n", Result)
Sha1inst := sha1.New()
Sha1inst.Write([]byte(Tstring))
Result = Sha1inst.Sum([]byte(""))... |
54e8af2486c145e822cc22892376dbe21424dd63 | b407121d4e8db5140f33ee8db14f2edd5cab4d7d | ganbarodigital/go_scriptish | /aliases.go | Go | go | 3,318 | permissive | // scriptish is a library to help you port bash scripts to Golang
//
// inspired by:
//
// - http://labix.org/pipe
// - https://github.com/bitfield/script
//
// Copyright 2019-present Ganbaro Digital Ltd
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, ar... |
a4511557d363dd3aef0fdda5ad291d78451f04d2 | c1ab6f4cf5446cbf78b30ad475763c05ad0e5e19 | huaweicloud/huaweicloud-sdk-go-v3 | /services/organizations/v1/model/model_invite_account_request.go | Go | go | 444 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// InviteAccountRequest Request Object
type InviteAccountRequest struct {
Body *InviteAccountReqBody `json:"body,omitempty"`
}
func (o InviteAccountRequest) String() string {
data, err := utils.Marshal(o)
if err != nil... |
22ea38891a0643fb30420431c6eab1f942c1cdd3 | 8f15777f4564698de86ae7170a06c70d4240d841 | harness/harness-go-sdk | /harness/nextgen/model_elk_credential.go | Go | go | 826 | permissive | /*
* Harness NextGen Software Delivery Platform API Reference
*
* This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of the breaking change with respect to the generated code stub # Authentication <!-- ReDoc-Inject: <security-definitions> -->
*
* API version: 3.0
* Con... |
23a145375f734bcdb31c99fd32c9d1cf97e6c9a0 | b5908d262dc90400fb326dc740399b4eee803ddb | gardener/etcd-backup-restore | /cmd/miscellaneous.go | Go | go | 2,748 | permissive | // Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Lic... |
3c55b3620b21aea5a3e860e6607d3b24ec5f0040 | b6c93073d0066298f4e96b3af7bc95ef5f80e883 | menakaj/GO | /loops/forLoop.go | Go | go | 718 | no_license | package main
import "fmt"
func forLoop() {
for i := 1; i < 10; i++ {
fmt.Println(i)
}
}
func infinite() {
var i int
for {
fmt.Println(i)
i++
if i > 1000 {
break
}
}
}
func loopArray() {
arr := []string{"a", "b", "c", "d", "e"}
for i := 0; i < len(arr); i++ {
fmt.Println(arr[i])
}
}
func loop... |
1738189eb1a25f81899342a0993e5808ef88c115 | 397179615ec48516638a749ff864d018e6fd7753 | vilterp/instance-manager-toy | /server/decide.go | Go | go | 1,044 | no_license | package server
import (
"fmt"
"github.com/vilterp/instance-manager-toy/db"
"github.com/vilterp/instance-manager-toy/proto"
)
func Decide(st *db.StateDB, input *proto.Input) (*proto.TaskGraphSpec, error) {
switch tInput := input.Input.(type) {
case *proto.Input_UpdateSpec:
spec := tInput.UpdateSpec.Spec
st.G... |
bb76fae6a24fe5610caaf77bf90d1a5206d23bbd | e4ea64be821b95e3a64f85b5970768a786aa39d4 | DanielXLee/operator-lifecycle-manager | /test/e2e/subscription_e2e_test.go | Go | go | 117,709 | permissive | package e2e
import (
"context"
"encoding/json"
"fmt"
"reflect"
"strings"
"sync"
"time"
"github.com/blang/semver/v4"
"github.com/ghodss/yaml"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
configv1 "github.com/openshift/api/config/v1"
configv1client "github.com/openshift/client-go/config/clientset/... |
746fbf285315259ea3028e9b1687be430546fe3f | da27c92493e5ee271794667101b285a234c61896 | tsileo/blobstash | /pkg/stash/store/store.go | Go | go | 9,835 | permissive | package store // import "a4.io/blobstash/pkg/stash/store"
import (
"context"
"fmt"
"sort"
"strconv"
"strings"
"a4.io/blobsfile"
"a4.io/blobstash/pkg/blob"
"a4.io/blobstash/pkg/blobstore"
"a4.io/blobstash/pkg/vkv"
)
var sepCandidates = []string{":", "&", "*", "^", "#", ".", "-", "_", "+", "=", "%", "@", "!"}... |
57ad0a731552fd818d887b0c3a6425eaa7a1120d | 85e498793a1426f7971615d18913ceae17968c6e | drtchops/aoc2020 | /solutions/day17/solver.go | Go | go | 200 | no_license | package day17
type Solver struct{}
func New() *Solver {
return &Solver{}
}
func (s *Solver) SolveA(input string) string {
return ""
}
func (s *Solver) SolveB(input string) string {
return ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.