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 |
|---|---|---|---|---|---|---|---|---|
4a396b495f2b69e5c1d914675bcc5d1de7885c7e | 346bca132fee9ab767f8226850290516364e0c9e | hzxuzhonghu/istio | /pilot/pkg/xds/proxy_dependencies.go | Go | go | 3,596 | 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... |
70c958e5cbde83cfa73baf3892fd7200e9899cdb | f4ab8db734a2d8853a040f2778073d428dee4f66 | timrchavez/atc | /creds/credhub/credhub.go | Go | go | 2,214 | permissive | package credhub
import (
"path"
"code.cloudfoundry.org/lager"
"github.com/cloudfoundry-incubator/credhub-cli/credhub"
"github.com/cloudfoundry-incubator/credhub-cli/credhub/credentials"
"github.com/cloudfoundry/bosh-cli/director/template"
)
type CredHubAtc struct {
CredHub lazyCredhub
logger lager.Logger
... |
3e5c5d25940a3a84941663bdd9df11bb060a55c5 | 2ba54a3d19daecafc11d2fff4a11031a2d0d1366 | Dipper-Labs/go-sdk | /client/rpc/get_tx.go | Go | go | 659 | permissive | package rpc
import (
"encoding/hex"
"github.com/Dipper-Labs/Dipper-Protocol/app/v0/auth"
"github.com/Dipper-Labs/go-sdk/types"
)
func (c *client) GetTx(txHash string) (res Tx, err error) {
hash, err := hex.DecodeString(txHash)
if err != nil {
return
}
resultTx, err := c.rpc.Tx(hash, true)
if err != nil {
... |
66a2466381002720dd7ae4eaa147387168fd5fac | d5b4f12a3a45f0836bf5d8fa0d3dd674c2f1f1ab | snakeru/stm32 | /p/sdio/stm32f407.go | Go | go | 8,929 | permissive | // DO NOT EDIT THIS FILE. GENERATED BY svdxgen.
// +build stm32f407
// Package sdio provides access to the registers of the SDIO peripheral.
//
// Instances:
// SDIO SDIO_BASE APB2 SDIO Secure digital input/output interface
// Registers:
// 0x000 32 POWER power control register
// 0x004 32 CLKCR SDI cl... |
5d74b1aeb2c07d789f2d32a3098f1f353d3497d0 | ca2fd0f54fd94bb3253ce830ca2d108d2fc00614 | Des-Nerger/sinojapsubs-tools | /mandarin/mark-unfreq.go | Go | go | 3,525 | permissive | package main
import (
"bufio"
"errors"
"flag"
"fmt"
"os"
"regexp"
"runtime"
"strings"
"github.com/Des-Nerger/go-astisub"
"github.com/Des-Nerger/gonlpir"
"github.com/asticode/go-astilog"
)
func init() {
astilog.SetLogger(astilog.New( astilog.Configuration{Verbose: true} ))
}
func FatalCheck(err error) {
... |
fa81feacdd9d61b6980d6575465c8d4e0434c8df | 3d02f0bf9f931664a4a16251655db1c5e9472f87 | bvbek/kubekey | /pkg/images/images.go | Go | go | 3,694 | permissive | /*
Copyright 2020 The KubeSphere 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, ... |
612f09e2f6ca07f490cd71417048f730a7436969 | 26b7b3f9014b80ca3750ed2f2b7b2b7ff6ffa257 | treejames/dataux | /pkg/proxy/server.go | Go | go | 2,868 | permissive | package proxy
import (
u "github.com/araddon/gou"
"github.com/dataux/dataux/pkg/models"
"strings"
)
var asciiIntro = `
_ _
| | | |
__| | __ _| |_ __ _ _ ___ __
/ _* |/ _* | __/ _* | | | \ \/ /
| (_| | (_| | || (_| | |_| |> <
\__,_|\__,_|\__\__,_|\__,_/_/\_\
`
func banner() string {
r... |
530ff555505d979ea820b6187e6978d0e67a4338 | fc9c09672769a47a0f15bbe8bc500a1253b0b4b7 | ligi/go-ipfs | /routing/kbucket/table.go | Go | go | 5,797 | permissive | // package kbucket implements a kademlia 'k-bucket' routing table.
package kbucket
import (
"fmt"
"sort"
"sync"
"time"
peer "gx/ipfs/QmQGwpJy9P4yXZySmqkZEXCmbBpJUb8xntCv8Ca4taZwDC/go-libp2p-peer"
pstore "gx/ipfs/QmZ62t46e9p7vMYqCmptwQC1RhRv5cpQ5cwoqYspedaXyq/go-libp2p-peerstore"
logging "gx/ipfs/QmaDNZ4QMdBdku... |
baa6f5c73b44db9c5d3d3d3b41c83c70de2ed3c7 | bea1e22e178f1d1355badaf7cfb4aa3696529f5f | newedward/fluid | /pkg/webhook/certificate_builder_test.go | Go | go | 7,164 | permissive | /*
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 under the License ... |
75b9b77bee557123330cebbafa135518e7c0c1ff | b3053077e1e3633916d3c100a0e80cf33323aad1 | viccom/influxdb | /http/org_service.go | Go | go | 20,409 | permissive | package http
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"path"
"strconv"
platform "github.com/influxdata/influxdb"
kerrors "github.com/influxdata/influxdb/kit/errors"
"github.com/julienschmidt/httprouter"
"go.uber.org/zap"
)
// OrgHandler represents an HTTP API handler for orgs.
type OrgH... |
080a97d069a593436ed5bd3a0032bda83ebce46d | eb3e3eaa897f33b486e5b2dd3d782bddf6dc4118 | daviogg/vouch | /strategies/synccommitteecontribution/best/synccommitteecontribution_test.go | Go | go | 4,371 | permissive | // Copyright © 2021 Attestant Limited.
// 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 ... |
3f521b06ce50275b202e5e349d9a82db8ca64707 | ba96487a4d0f251c2fbbb7914bbf4575fae0e5b4 | THoelzel/patient-feedback | /models/feedback.go | Go | go | 1,888 | no_license | package models
import (
"context"
"feedback/logger"
"github.com/google/uuid"
"github.com/jackc/pgx/v4/pgxpool"
"time"
)
type Feedback struct {
Rating int
DiagnosisUnderstood bool
Improvement string
Feelings string
Diagnosis string
}
var FeedbackTranslation = map[in... |
8274f55dd8f8be3e00b6f01048bdc5fe5c00c209 | 0e1debd12ce7c2ccf245f60cb53e3a5942fb681a | dbogatov/fabric-simulator | /distributed/definitions.go | Go | go | 1,208 | no_license | package distributed
import "github.com/dbogatov/dac-lib/dac"
// KeysHolder ...
type KeysHolder struct {
pk dac.PK
sk dac.SK
}
// CredentialsHolder ...
type CredentialsHolder struct {
KeysHolder
credentials dac.Credentials
id int
kind string
}
// CredRequest ...
type CredRequest struct {
Reque... |
4c73943603a0455543f71503001c538d2dc8dc3b | 6e17eec5272a76aa9e53bc8ab65fde46466fb79d | huaweicloud/huaweicloud-sdk-go-v3 | /services/ocr/v1/model/model_toll_invoice_request_body.go | Go | go | 1,668 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// TollInvoiceRequestBody
type TollInvoiceRequestBody struct {
// 与url二选一 图像数据,base64编码,要求base64编码后大小不超过10MB。图片最小边不小于15px,最长边不超过4096px,支持JPEG、JPG、PNG、BMP、TIFF格式。 图片文件Base64编码字符串,点击[这里](https://support.huaweicloud.com/o... |
857216e014145086700a163ae6b8abcddc3933a4 | bb8ef99c0bec2c78757dc7a0500862ffcdb21597 | xczas/go-sfdc | /composite/composite.go | Go | go | 4,633 | permissive | package composite
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"net/http"
"github.com/xczas/go-sfdc"
"github.com/xczas/go-sfdc/session"
)
// Subrequester provides the composite API requests. The
// order of the array is the order in which the subrequests are
// placed in the composite body.
type Subreques... |
e38fa30750bd10a3ceed8b12cc5ba36c9706d246 | 467e8d99fd7c81751809b137aa767f2e31e599d8 | MrTuesday1020/Algorithms | /GO/763. Partition Labels.go | Go | go | 358 | no_license | package main
func partitionLabels(s string) []int {
lastPos := make(map[rune]int)
for i, char := range s {
lastPos[char] = i
}
var ans []int
start, end := 0, 0
for i, char := range s {
if lastPos[char] > end {
end = lastPos[char]
}
if i == end {
ans = append(ans, end-start+1)
start = end + 1
... |
545b2bc20d70a388cd352138df9089801721e849 | 1a2d9f716d5fb0c9cd16f14cf6412c8f08fd393a | dhindustries/graal | /backup/core/inheritance.go | Go | go | 1,005 | no_license | package core
import (
"reflect"
"sync"
"unsafe"
"github.com/dhindustries/graal"
)
var parents map[uintptr]*sync.Pool
var parentsLock sync.Mutex
func objID(data interface{}) uintptr {
if data == nil {
return uintptr(unsafe.Pointer(nil))
}
var addr uintptr
v := reflect.ValueOf(data)
switch v.Type().Kind() ... |
8c52ab35abf681ff3bc62c7b1157750a51c49328 | 6822059d68301129aee8cf3e5866d399fd686f50 | zhuangel/gvisor | /pkg/tcpip/network/fragmentation/fragmentation.go | Go | go | 4,282 | permissive | // Copyright 2018 The gVisor 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 agree... |
500b1fcd0040cee48aa5d07e40862ebbf19284b2 | 48c50322e38f3dc3f3cc32971fb47d071a8f2dfa | openshift-online/ocm-sdk-go | /clustersmgmt/v1/add_on_installation_parameter_type_json.go | Go | go | 3,472 | permissive | /*
Copyright (c) 2020 Red Hat, 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, software... |
7d2a75a113399496cb0555449f53ca01f9f7f7aa | d42150c83f0e794f8a9576e96cb2c5d009fa84e4 | yangminzhu/playground | /ext_authz/server/main.go | Go | go | 4,968 | no_license | // 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... |
c082b2a4de87d684b3a37b93ef3c94df5962bd85 | 3d62b5725d3e762c6bfe76643119c72ad780f477 | sodafoundation/api | /vendor/github.com/prometheus/client_golang/prometheus/push/deprecated.go | Go | go | 6,483 | permissive | // Copyright 2018 The Prometheus 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... |
279f3fb07cc173fe9b587d309debe347e8b2b2e2 | dcc7960c3acc13908954daa5dbde4411e8c23edf | dablyo/wang | /common/flogging/httpadmin/spec.go | Go | go | 1,806 | no_license | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package httpadmin
import (
"encoding/json"
"fmt"
"net/http"
"wang/common/flogging"
)
//go:generate counterfeiter -o fakes/logging.go -fake-name Logging . Logging
type Logging interface {
ActivateSpec(spec string) error
Spec()... |
8673a6f7b9ce844424c2ff0103be70071dff9980 | 00d798c22c91cfd89c77460a35121e4ce21a7866 | sapcc/kubernetes-operators | /openstack-seeder/vendor/k8s.io/kubernetes/pkg/kubelet/eviction/types.go | Go | go | 6,243 | permissive | /*
Copyright 2016 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, ... |
a72aeaa01814f8f6007a353070e0cdae41c046e9 | e13af90a9c7e140673c89ba59eeb914c44e1d599 | bitum-project/bitumd | /bitumutil/example_test.go | Go | go | 1,679 | permissive | package bitumutil_test
import (
"fmt"
"math"
"github.com/bitum-project/bitumd/bitumutil"
)
func ExampleAmount() {
a := bitumutil.Amount(0)
fmt.Println("Zero Atom:", a)
a = bitumutil.Amount(1e8)
fmt.Println("100,000,000 Atoms:", a)
a = bitumutil.Amount(1e5)
fmt.Println("100,000 Atoms:", a)
// Output:
//... |
39b47b105290c79112d322b0ea0809926b1b66e4 | b53985a4cc11cadfe46f1acaf1afed3727293f84 | aquaprotocol/open-banking-api | /go/model_privilege_bundle_transfers.go | Go | go | 2,378 | no_license | /*
* PKO BP API 2.1.1
*
* Specyfikacja interfejsu dla usług świadczonych przez ASPSP w oparciu o dostęp do rachunków płatniczych. Opracowane przez Związek Banków Polskich i podmioty współpracujące / Interface specification for services provided by ASPSP based on access to payment accounts. Prepared by the Polish Ban... |
1e40317c82337d2888c2ace80f64f5bae6a1854a | 41be9d7bd80e91afe72880037c0c0f8835a3150b | rhtconsulting/installer | /vendor/github.com/openshift/api/config/v1/types_infrastructure.go | Go | go | 23,503 | permissive | package v1
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status
// Infrastructure holds cluster-wide information about Infrastructure. The canonical name is `cluster`
t... |
199ebb4f6d1dd309d59dccc719d7c430a7c0c566 | dfc91ee0889f611d689ad08dac09278fe1664b81 | pearl-truss/mymove | /cmd/prime-api-client/utils/shared.go | Go | go | 4,273 | permissive | package utils
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"log"
"net/url"
"os"
"path/filepath"
"strings"
openapi "github.com/go-openapi/runtime"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/transcom/mymove/pkg/cli"
)
const (
// FilenameFlag is the name of the file being passed in
... |
1db87bbeaceff40dd84f60dd1e6f244dc50134b6 | 3243464e2c0284bd5246b555a3dc84976f82b063 | iCodeIN/rivine | /types/currency_test.go | Go | go | 15,572 | permissive | package types
import (
"bytes"
"fmt"
"math"
"math/big"
"math/rand"
"testing"
"github.com/threefoldtech/rivine/pkg/encoding/rivbin"
"github.com/threefoldtech/rivine/pkg/encoding/siabin"
)
// TestNewCurrency initializes a standard new currency.
func TestNewCurrency(t *testing.T) {
b := big.NewInt(481)
c := N... |
634f1f4743f51287c45a8e29581a4c4d29c50931 | c516efc06ffaa0d6e16a20de48cfac3f845a2ef3 | menardorama/cert-manager | /pkg/util/version.go | Go | go | 275 | permissive | package util
import "fmt"
var (
AppGitState = ""
AppGitCommit = ""
AppVersion = "canary"
)
func version() string {
v := AppVersion
if AppGitCommit != "" {
v += "-" + AppGitCommit
}
if AppGitState != "" {
v += fmt.Sprintf(" (%v)", AppGitState)
}
return v
}
|
17299aa90a42b47dd61ea80575b1f0f5f7463b33 | c0e95d6753421d56e17ec4c54276d60b84a8c0d2 | deislabs/cnab-operator | /vendor/github.com/google/go-containerregistry/pkg/v1/google/options.go | Go | go | 1,606 | permissive | // Copyright 2018 Google LLC 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 l... |
aaa5224872097dcffbe8bbfebb76615450261edf | d72590a9cdfcf97cc7090a185689e4c9008480a7 | soipray/tabtoy | /v3/gen/bindata/struct.go | Go | go | 1,044 | permissive | package bindata
import (
"github.com/davyxu/tabtoy/v3/model"
)
// 写入表的一行
func writeStruct(globals *model.Globals, tab *model.DataTable, row int) (*BinaryWriter, error) {
structWriter := NewBinaryWriter()
// 一个结构体
for _, header := range tab.Headers {
if header == nil {
continue
}
if globals.CanDoActio... |
2bcdda67030ddad9f4768d0236757e84b060d449 | d7fc728dc511c2ae806ec8025c582d2d81105416 | Antaeseon/learngo | /main.go | Go | go | 587 | no_license | package main
import (
"os"
"strings"
"github.com/antaeseon/learngo/scrapper"
"github.com/labstack/echo"
)
const fileName string = "jobs.csv"
func handleHome(c echo.Context) error {
return c.File("home.html")
}
func handleScrape(c echo.Context) error {
defer os.Remove(fileName)
term := strings.ToLower(scrapp... |
5f59dc0b454d4634492a2f4c0e4ab9dba55e4756 | 99d3da5b33d3bf47f9e089263f5342111b6f52bc | jamieabc/base58-encode-decode | /base58_test.go | Go | go | 364 | no_license | package base58_test
import (
base58 "github.com/jamieabc/base58-encode-decode"
"github.com/stretchr/testify/assert"
"testing"
)
func TestEncode(t *testing.T) {
result := base58.Encode("Cat")
assert.Equal(t, "PdgX", result, "wrong encode")
}
func TestDecode(t *testing.T) {
result := base58.Decode("PdgX")
asser... |
b0a173ea53d3cabf946d3b42ccb18683a838f545 | 7098dda2ece68ae3cc261f850326c78ee6a6446d | a-thaler/control-plane | /components/kyma-environment-broker/internal/auditlog/templates/extra_conf_kyma_1_19.go | Go | go | 1,326 | permissive | package templates
const (
FluentBitExtraConfForKyma1_19 = `
[INPUT]
Name tail
Tag dex.*
Path /var/log/containers/*_dex-*.log
DB /var/log/flb_kube_dex.db
parser docker
Mem_Buf_Limit 5MB
Skip_Long_Lines On
Refresh_In... |
b799a98505d2e35acba7d98f83269c8671731c20 | 7298c725a5a5f3b0e259606ed7992990fbbf574c | qiuliangbin/channelzcli | /cmd/conn.go | Go | go | 562 | permissive | package cmd
import (
"context"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
)
func newGRPCConnection(ctx context.Context, addr string, insecure bool) (*grpc.ClientConn, error) {
var dialOpts []grpc.DialOption
if insecure {
dialOpts = append(dialOpts, grpc.WithInsecure())
} else {
d... |
a1d58217c75bbbaafd9ee4782dfa302f397182bc | 5e65666970f46b592e303ec5691d757337e52183 | f110/heimdallr | /pkg/auth/token/token_client_test.go | Go | go | 1,361 | permissive | package token
import (
"encoding/json"
"fmt"
"net"
"net/http"
"net/http/httptest"
"net/url"
"os"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestNewClient(t *testing.T) {
NewClient(net.DefaultResolver)
}
func TestClient_RequestToken(t *testing.T) {
... |
f21f7eed354c72745a92d0df86bd8a68247b5394 | 63662850ca899552b7070d7e2c2f82ba67d28b6d | tiaotiao00/hcashd | /blockchain/indexers/addrindex_test.go | Go | go | 7,835 | permissive | // Copyright (c) 2016 The btcsuite developers
// Copyright (c) 2016 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package indexers
import (
"bytes"
"fmt"
"testing"
"github.com/HcashOrg/hcashd/wire"
)
// addrIndexBucket provides a mock ad... |
815a1839ea590d77aa5491316a23ebdb6e88490a | 5f6c306fad63dabfe713d2e2b15a7fe5cfe700e8 | vicki-c/heapster | /version/version.go | Go | go | 987 | permissive | // Copyright 2014 Google Inc. 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... |
ec823bdb054b5b3cd9af55ecfda5a139492cef60 | bdd0682165ca340570cf5a9ceac6f536e2006931 | fujianbang/note-of-mastering-go | /10_concurrency_in_go_advanced_topics/forget_mutex.go | Go | go | 337 | no_license | package main
import (
"fmt"
"sync"
)
var m1 sync.Mutex
func function() {
// DON'T FORGET UNLOCK() MUTEX
// defer m1.Unlock()
m1.Lock()
fmt.Println("Locked!")
}
func main() {
var w sync.WaitGroup
go func() {
defer w.Done()
function()
}()
w.Add(1)
go func() {
defer w.Done()
function()
}()
w.Add... |
383794c08304d1a28369b88f94300ddbc90249e1 | 068d966002a766a0278a8a0fe382282038497801 | skuid/helm-value-store | /vendor/cloud.google.com/go/spanner/timestampbound.go | Go | go | 9,043 | permissive | /*
Copyright 2017 Google Inc. 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 law or agreed to in ... |
53dff2347c5aed3d36873f403f98cea9dbdafb10 | b3491f4eece00f5c1e883e15c017234107bce98b | aws/amazon-ecs-agent | /agent/api/statechange.go | Go | go | 13,881 | permissive | // Copyright Amazon.com Inc. 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. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" file acco... |
f34f90ae82446f382ed33323b05097b6dce999d5 | 0ae67af8810fa0b81c5c8d77d550d0f48a68b6d1 | gray1412/Homework_tfs02 | /LuongDuyAnh/lec-06/on-class-practice/class-list/handlers/create.go | Go | go | 645 | no_license | package handlers
import (
"encoding/json"
"net/http"
"tfs-02/lec-06/on-class-practice/class-list/pkg"
"tfs-02/lec-06/on-class-practice/class-list/storage"
)
func CreateData(w http.ResponseWriter, r *http.Request) {
//ket noi DB
db := *pkg.ConnectDB()
defer db.Close()
if (!db.HasTable(&storage.Data{})) {
db.... |
40a96b5f483a04e496c4fe67d806f92baef10bb9 | d7e069955b549af75fddc398bd30310448a0cc53 | gcash/neutrino | /blockntfns/manager_test.go | Go | go | 8,095 | permissive | package blockntfns_test
import (
"errors"
"testing"
"time"
"github.com/gcash/bchd/wire"
"github.com/gcash/neutrino/blockntfns"
)
var emptyHeader wire.BlockHeader
type mockNtfnSource struct {
blockChan chan blockntfns.BlockNtfn
blocksSinceHeight func(uint32) ([]blockntfns.BlockNtfn, uint32, error)
}
... |
38a690ccac69698dac1be4d693dbf6f355806c9a | 4586e6e6db5a56b5cc205b4fd0a3a22aefc219ac | pingcap/tidb | /kv/cachedb.go | Go | go | 2,713 | permissive | // Copyright 2020 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
f5710da334ae2ecda96c67fd0387b693aae1278d | c2b93ef6fc988e4553cca4e83e65c1816827019c | yangzhengxing/mongo-tools | /common/db/kerberos/gssapi.go | Go | go | 746 | permissive | // Package kerberos implements authentication to MongoDB using kerberos
package kerberos
// #cgo windows CFLAGS: -Ic:/sasl/include
// #cgo windows LDFLAGS: -Lc:/sasl/lib
import (
"github.com/mongodb/mongo-tools/common/options"
"gopkg.in/mgo.v2"
)
const authMechanism = "GSSAPI"
func AddKerberosOpts(opts options.To... |
921c35d4c767a96413e1a046a4f7a4e0ee6ac839 | d69643bb4d8d9790a0564ae95e914b6d257b9656 | xphyr/openshift-selfservice | /server/openshift/shared.go | Go | go | 5,464 | permissive | package openshift
import (
"crypto/tls"
"errors"
"fmt"
"io"
"log"
"net/http"
"os"
"strings"
"github.com/Jeffail/gabs"
"github.com/gin-gonic/gin"
"github.com/oscp/cloud-selfservice-portal/server/common"
)
const (
editQuotasURL = "editquotas.html"
newProjectURL = "newproject.html"
newTestPr... |
2f6a6fde22fcf4e121814f03efe74c4f3e147343 | c4709db1375577c2b4be41188ee79874362c0192 | zhangs-pg/leecode | /tree/isSubTree/is.go | Go | go | 1,047 | no_license | package main
import "fmt"
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func New(index int, data []int) *TreeNode {
node := &TreeNode{data[index], nil, nil}
// 设置完全二叉树左节点 其特征是深度 *2+1为左节点 +2为右节点
if index < len(data) && 2*index+1 < len(data) {
node.Left = New(index*2+1, data)
}
if inde... |
4370368d8f9623afff92ae115d9751f8ad0b883e | 0b044bcefca22f2a8018ea77c2177d59265e9f44 | gitter-badger/pick | /commands/sync.go | Go | go | 1,308 | permissive | package commands
import (
"github.com/bndw/pick/backends"
"github.com/bndw/pick/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
func init() {
rootCmd.AddCommand(&cobra.Command{
Use: "sync [other-pick-safe]",
Short: "Sync current safe with another pick safe",
Long: "The sync command is used t... |
54b9baa35758e48889a80dedfd201327e30e8858 | 70645a495bc7898bc2c0446feeb1e38fe8fcee5b | FrankWork/crawler | /download.go | Go | go | 2,250 | no_license | package main
import (
"bytes"
"io"
"io/ioutil"
"log"
"net/http"
"time"
"github.com/PuerkitoBio/goquery"
"golang.org/x/net/html/charset"
)
var client *http.Client
func init() {
client = &http.Client{
// CheckRedirect: redirectPolicyFunc,
Timeout: time.Second * 20}
}
func convertEncoding(encoding string... |
67d451ac6f11e83150f081b8675762439c3eeed5 | e437b9e4dc015ecaf7b71ce03af35b53daf7f5c0 | weaviate/weaviate | /adapters/repos/db/vector/ssdhelpers/tile_encoder.go | Go | go | 5,301 | permissive | // _ _
// __ _____ __ ___ ___ __ _| |_ ___
// \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
// \ V V / __/ (_| |\ V /| | (_| | || __/
// \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
//
// Copyright © 2016 - 2023 Weaviate B.V. All rights reserved.
//
// CONTACT: hello@weaviate.i... |
0f999fde40ef8a31ce897fb01529e7ba5580814f | 7f1efd878e94c31cacf925fe59e58fc919709b26 | gb-courses-28486a7201cc086f/gb-go-architecture | /lesson-5/structures/stack.go | Go | go | 612 | no_license | package structures
import (
"errors"
"gb-go-architecture/lesson-5/structures/list"
)
var ErrEmptyStack = errors.New("Stack is empty")
type Stack struct {
stack *list.DoubleLinkedList
}
func (s *Stack) Len() int {
return s.stack.Len()
}
func (s *Stack) Push(value interface{}) {
node := &list.DoubleListNode{Val... |
b3df469c52be898f0ebd7640f2ec14a1e4cbe8a7 | 888a7b11d161fa056d487a1be461e4a8611ceba0 | febelery/go-practice | /basic/time/timer.go | Go | go | 3,453 | no_license | // 探索Golang定时器的陷阱
// 当前一次的超时数据没有被读取,而设置了新的定时器,然后去通道读数据,
// 结果读到的是上次超时的超时事件,看似成功,实则失败,完全掉入陷阱
package main
import (
"fmt"
"time"
)
func test1() {
tm := time.NewTimer(time.Second)
quit := make(chan bool)
go func() {
time.Sleep(3 * time.Second)
quit <- true
}()
if tm.Reset(time.Second) {
fmt.Println("rese... |
c29e6ea44b3a04737cea1893f9e19671ef7f714f | fcbf80dbf49e93380aaf224a899642eb6523b460 | bozbalci/tick | /tick.go | Go | go | 2,747 | permissive | // Copyright (c) 2017, Berk Ozbalci
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions ... |
74c45372713b3522158778dabdb7dc79388bc3c4 | af7822fbea8b0685ee6f8bb24a65da4ed055fc53 | aaron-prindle/krmapiserver | /included/k8s.io/apiextensions-apiserver/pkg/apiserver/conversion/metrics.go | Go | go | 2,989 | no_license | /*
Copyright 2019 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, ... |
6489890544eea7413169d9320dcdd1b6c8b33b76 | 3874eaa2e7e8676bda72a18eda28be8f0d0e0f36 | morlay/aliyun-go | /clients/rds/modify_replica_description.go | Go | go | 1,169 | no_license | package rds
import (
"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
"github.com/morlay/aliyun-go/common"
)
type ModifyReplicaDescriptionRequest struct {
requests.RpcRequest
ReplicaDescription string `pos... |
e08bd7a1a88d549e0ed81f14ec61651dcb4d3f96 | a34ddb623e73473831b85aa97a933baa9bf66b38 | patrickpierson/lowprofile | /Godeps/_workspace/src/github.com/onsi/gomega/matchers/consist_of_test.go | Go | go | 3,163 | permissive | package matchers_test
import (
. "github.com/kellyp/lowprofile/Godeps/_workspace/src/github.com/onsi/ginkgo"
. "github.com/kellyp/lowprofile/Godeps/_workspace/src/github.com/onsi/gomega"
)
var _ = Describe("ConsistOf", func() {
Context("with a slice", func() {
It("should do the right thing", func() {
Ω([]stri... |
090daa4786bde3b4dd8909cd00597b926ebf6aa6 | 84cd86cc7351a05bb0f87a3b5d925f0c252f1284 | kameshsampath/kiali | /services/business/checkers/no_service_checker_test.go | Go | go | 6,496 | permissive | package checkers
import (
"testing"
"github.com/stretchr/testify/assert"
"k8s.io/api/core/v1"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/kiali/kiali/kubernetes"
"github.com/kiali/kiali/services/models"
)
func TestNoCrashOnNil(t *testing.T) {
assert := assert.New(t)
typeValidations := NoServ... |
e9a724799bceac46a4f67f8ce13b75533e6dab73 | f67ca9f7345cf0e779cf6c360e830cd49251df0d | GanillaGrace/excelize | /sheet.go | Go | go | 15,545 | permissive | package excelize
import (
"bytes"
"encoding/xml"
"errors"
"os"
"path"
"strconv"
"strings"
)
// NewSheet provides function to create a new sheet by given index, when
// creating a new XLSX file, the default sheet will be create, when you create a
// new file, you need to ensure that the index is continuous.
fun... |
22c0f5fa9775c951ca220b4c85f2c044367ab122 | 9cb008e10cb27f797b774bc70553d4343b98657e | sourya/go-sdk | /template/template_test.go | Go | go | 27,847 | permissive | package template
import (
"bytes"
"fmt"
"strings"
"testing"
"time"
"github.com/blend/go-sdk/assert"
"github.com/blend/go-sdk/env"
"github.com/blend/go-sdk/uuid"
)
func TestTemplateFromFile(t *testing.T) {
assert := assert.New(t)
temp, err := NewFromFile("testdata/test.template.yml")
assert.Nil(err)
tem... |
ae8525380cbc9119796323f1900a95edcb43bf30 | 6331192daa0851ee152676e21eed0e2db68d9739 | asdamwongmantap/grpcopentelemetry | /clientbck/main.go | Go | go | 3,651 | no_license | package main
import (
"context"
"encoding/json"
"fmt"
"log"
"os"
"time"
"tesprotogrpc/common/config"
"tesprotogrpc/common/model"
serviceusr "tesprotogrpc/lib"
"github.com/golang/protobuf/ptypes/empty"
"google.golang.org/grpc"
)
func serviceGarage() model.GaragesClient {
port := config.SERVICE_GARAGE_PO... |
60ec541c110d2f6beba10cd0f50d4ea22d56ec60 | 7479ac54b6345158f24ca74914d2cee5953093f2 | archisdi/warpin-messaging | /models/message.go | Go | go | 576 | no_license | package models
import (
"encoding/json"
"time"
"github.com/google/uuid"
)
// Message ...
type Message struct {
ID string `json:"id"`
Text string `json:"text"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// Serialize ...
func (m *Message) Serialize() str... |
ee22fbb0b294b0270cfa180df084326e4d1ae202 | 6c02d4a81a9c2c654f10120218063070bddc40b4 | fyuan1316/proxyserver | /cmd/option/options.go | Go | go | 956 | no_license | package option
import "net/url"
// Configuration Configuration for reserveproxy server
type Configuration struct {
Addr string
ModelName string
TargetURL string //*url.URL
ProxyPrefixURLCondition string
}
// SetAddr set Address
func (conf *Configuration) SetAddr(add... |
0b10c2fd6a8ad54bfaee4aaf0f8293e984de074a | b621d24009b027aaaf3bff7ae30df012af6da658 | martincyprus/waltonchain-gwtc | /contracts/ens/ens_test.go | Go | go | 2,096 | permissive | // Copyright 2016 The go-wtc Authors
// This file is part of the go-wtc library.
//
// The go-wtc 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, or
// (at you... |
6188c8f7a03941c96a7e949b7065483b153ab417 | 10ba0f9843fbd18503f1d684433d387ce3dc9c53 | stevenklar/ionos-hosting-api | /pkg/api_records.go | Go | go | 13,204 | no_license |
/*
* DNS API
*
* ## Working with the API Every endpoint uses the `X-API-Key` header for authorization, to obtain the key please see the [Official Documentation](/docs/getstarted). Please note that any zone or record updates might conflict with active services. In such cases, the DNS records belonging to the confli... |
30607486c21f733b1171aeb5b553655e9f6e7fa8 | f098a720dc0eb7c25bdb8571c07963ee8a0d9373 | ngenator/slack | /realtime.go | Go | go | 2,995 | no_license | package slack
import (
"encoding/json"
"time"
"golang.org/x/net/websocket"
)
// OutgoingMessage type
type OutgoingMessage struct {
ID int64 `json:"id"`
Type string `json:"type"`
}
// RealtimeClient is a client that uses the slack realtime api
type RealtimeClient struct {
done chan bool
ws *websocket.Con... |
f606f3a137cc5d72c47e9d880716063ddd271cff | 559c7b60b2bff04175ef58ca284c341afa4d899a | quoclm/kubernetes | /test/e2e/kubectl.go | Go | go | 6,705 | permissive | /*
Copyright 2015 Google Inc. 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 law or agreed to in ... |
be9afeb5e5d8b5a76cc01985425279accd7439d2 | 07c3edda1406751b91ca6f3e550007bc836e3061 | FR4NK-W/rains | /internal/pkg/object/object.go | Go | go | 15,345 | permissive | package object
import (
"bytes"
"encoding/hex"
"errors"
"fmt"
"net"
"sort"
"strconv"
cbor "github.com/britram/borat"
log "github.com/inconshreveable/log15"
"github.com/netsec-ethz/rains/internal/pkg/algorithmTypes"
"github.com/netsec-ethz/rains/internal/pkg/keys"
"golang.org/x/crypto/ed25519"
)
//Object ... |
05771b3b7f2608b303568e05d7e129f2314c8645 | ddf8e0e3964903eab9e13b08758becd809a63711 | evias/FactomCode | /wsapi/wsapi.go | Go | go | 14,536 | permissive | // Copyright 2015 Factom Foundation
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
package wsapi
import (
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"github.com/FactomProject/FactomCode/common"
"github.com/FactomProject/FactomCode/database"
"github.co... |
59871e03b68663b2bf469b7db112ca7577fb6035 | 5e0f3caad03c35ab96a25af6224e7e1c1cd7ead4 | yaosiang/fosite | /handler/oauth2/helper_test.go | Go | go | 2,739 | permissive | /*
* Copyright © 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io>
*
* 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... |
9dad6d38b6579762a3260c7d4db1700c00927b0f | f610547632c38ad318d9b213ef6e93d9e3b0054e | ZGeomantic/CodeShare | /controllers/default.go | Go | go | 1,087 | no_license | package controllers
import (
"bytes"
"code.google.com/p/go.text/encoding/simplifiedchinese"
"code.google.com/p/go.text/transform"
"github.com/astaxie/beego"
"io/ioutil"
"os"
"strings"
"time"
)
type MainController struct {
beego.Controller
}
func (this *MainController) Get() {
// this.Data["Website"] = "be... |
ca6b23b9ba967cf6efa96d5c5231adcfb891d4b1 | b23e5c0334eb168dcd5edd678b1c8d08038e0de1 | MylesBock/client-go | /kubernetes/typed/core/v1/service_expansion.go | Go | go | 1,348 | permissive | /*
Copyright 2016 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, ... |
b8a6b4e0a8af380628ae532ef68ba4c7db3ffd9e | 72e01ad7008fa2df342db9ddc69d5556951c0dec | Des1re7/clickhouse-bulk | /clickhouse.go | Go | go | 4,971 | permissive | package main
import (
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
"sync"
"time"
"github.com/nikepan/go-datastructures/queue"
)
// ClickhouseServer - clickhouse server instance object struct
type ClickhouseServer struct {
URL string
LastRequest time.Time
Bad bool
Client *ht... |
d025853edaad46b696177c455dd05127a7834036 | ce7432dbce71ac2dcbb47da6ed22dbe1d63c184b | divan/kalman | /example/car/car.go | Go | go | 1,861 | permissive | package main
import (
"fmt"
"math"
"math/rand"
"os"
"github.com/konimarti/kalman"
"gonum.org/v1/gonum/mat"
)
func main() {
// prepare output file
file, err := os.Create("car.csv")
if err != nil {
panic(err)
}
defer file.Close()
fmt.Fprintln(file, "Measured_v_x,Measured_v_y,Filtered_v_x,Filtered_v_y")
... |
9433d835448091cf5576b0689a9a7b103a80ef62 | 56efdf0eb852798e6c83324eed03b2cd5b48b46d | fkasper/sitrep-authentication | /services/httpd/handler.go | Go | go | 8,525 | permissive | package httpd
import (
"encoding/json"
"log"
"net/http"
"net/http/pprof"
"os"
"strings"
"github.com/bmizerany/pat"
"github.com/fkasper/sitrep-authentication/schema"
"github.com/gocql/gocql"
"github.com/mattbaird/elastigo/lib"
"github.com/rcrowley/go-metrics"
"gopkg.in/mgo.v2"
// "github.com/gorilla/webso... |
4ed97ecdce2f92768db5f1031f98f62c33e75072 | 37a9e2d44ddff7bef457a5aeb4ea8710f8b3b63c | micmegacomm/docker-machine-driver-scaleway | /driver/scaleway.go | Go | go | 8,712 | permissive | package scaleway
import (
"errors"
"fmt"
"io/ioutil"
"net"
"os"
"strings"
"time"
"github.com/Sirupsen/logrus"
"github.com/docker/machine/libmachine/drivers"
"github.com/docker/machine/libmachine/log"
"github.com/docker/machine/libmachine/mcnflag"
"github.com/docker/machine/libmachine/ssh"
"github.com/doc... |
22d32f2113fc52798ddc00c87005168eda36253a | e0e75b686424178394392ff5406c361f72e27188 | lukelafountaine/go-lisp | /lisp.go | Go | go | 1,015 | no_license | package main
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"github.com/lukelafountaine/go-lisp/eval"
"github.com/lukelafountaine/go-lisp/parse"
"github.com/lukelafountaine/go-lisp/types"
)
func Run(program string, scope *types.Scope) {
// read
exp, err := parse.Parse(program)
if err != nil {
fmt.Println(err)... |
6cc8ffbd521c11002e207afa4704f1a6e9a27354 | f56f3c99feff543f9108ffd2c72f4541936c45b9 | mownier/duyog | /auth/store/client.go | Go | go | 877 | permissive | package store
// ClientRepo interface
type ClientRepo interface {
Create(c Client) (Client, error)
GetByKey(k string) (Client, error)
GetByAPIKey(k string) (Client, error)
GetBySecretToken(t string) (Client, error)
GetByAccessToken(t string) (Client, error)
}
// CreateClient method
func CreateClient(r ClientRepo... |
b3579a422bcc73350dd227f20714acbc00cb6ca1 | b0dadbd74ded33b2494df9b3d2cf37910e557bee | kschiffer/lorawan-stack | /pkg/applicationserver/io/packages/loragls/v3/api/objects.go | Go | go | 8,658 | permissive | // Copyright © 2021 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Un... |
820b07e9dc4070c5b605531748788ed27afe084d | 70c96d3e70a0858d863715e965a43d6fdb04e3e5 | TomaAlexandru/sdkgo | /model_peer.go | Go | go | 1,071 | no_license | /*
* CLOUD API
*
* An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional servers, adding volume... |
7e2debe1f467f747a75bc22acdc840542154ef65 | 9a7d637d0f6c22d957f0acf97ecc1d7ed1a6d156 | liaogoudaner/gmc | /http/session/redisstore/redis_test.go | Go | go | 602 | permissive | package gmcredisstore
import (
"testing"
"time"
gmcsession "github.com/snail007/gmc/http/session"
"github.com/stretchr/testify/assert"
)
func TestNew(t *testing.T) {
assert := assert.New(t)
cfg := NewRedisStoreConfig()
cfg.TTL = 1
store, err := New(cfg)
assert.Nil(err)
sess := gmcsession.NewSession()
sid ... |
2812e4a56a5b72debc66b47b95a39c440f990d7a | 7254192115aa64baf527a3eb87636381aeeb5d24 | momchil-velikov/go-intro-algorithms | /Lecture 06- Order statistics; Median/weighted-median.go | Go | go | 1,869 | permissive | package main
import (
"fmt"
"sort"
"math/rand"
)
type Elt struct {
x float32
w float32
}
type ByX []Elt
func (a ByX) Len() int { return len(a) }
func (a ByX) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByX) Less(i, j int) bool { return a[i].x < a[j].x }
func partition(a[] ... |
b1e97e7562b6aca17a36cd714b5247531da64533 | 09958ef8a415a8f42d3ac299e4ec72a012c94878 | rchamorro/pulumi-azure-nextgen | /sdk/go/azure/customerinsights/latest/getPredictionTrainingResults.go | Go | go | 1,452 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package latest
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func GetPredictionTrainingResults(ctx *pulumi.Context, args *GetPredictionTrainingResultsAr... |
793aee8ead5d9741dbcc91e7680c68af3687d732 | e43321fcdf7af622d55a51996a464a755a8eca2b | pshail/keda | /pkg/scalers/redis_scaler.go | Go | go | 3,880 | permissive | package scalers
import (
"context"
"fmt"
"strconv"
log "github.com/Sirupsen/logrus"
"github.com/go-redis/redis"
v2beta1 "k8s.io/api/autoscaling/v2beta1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/metrics/pkg/apis/external_met... |
f92eb254ea928a242314df31a941802f940431aa | 4a6fe4a1cc4580d54bba4f9ebd7f8c394a1ac1f7 | YuqiTeng/personal-library-back | /internal/db/db.go | Go | go | 912 | no_license | package db
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
"github.com/spf13/viper"
)
var (
userName string
password string
host string
dbName string
)
var (
db *gorm.DB
err error
)
func Init() {
viper.SetConfigName("config")
viper.SetConfigType("json")
viper.A... |
ec3dbe278f001b56ee070ac429342a1ffc407eb7 | 368ed8b4ea788d2d772b98a13fc585388ada08eb | PaulMatencio/s3c | /sindexd/cmd/utils.go | Go | go | 2,827 | permissive | package cmd
import (
"errors"
"fmt"
"github.com/aws/aws-sdk-go/service/s3"
directory "github.com/paulmatencio/ring/directory/lib"
"github.com/paulmatencio/s3c/api"
"github.com/paulmatencio/s3c/datatype"
"github.com/paulmatencio/s3c/gLog"
"github.com/paulmatencio/s3c/utils"
"strings"
"sync"
)
// transform co... |
5e7233d9b03bce898e87b2dcc5d9152fb5542a07 | a435f375a91bca43dac0982e861d62b635c6b703 | SaKu2110/sign-server | /pkg/controller/authController.go | Go | go | 3,195 | no_license | package controller
import (
"fmt"
"net/http"
"github.com/SaKu2110/sign-server/pkg/model/dao/database"
"github.com/SaKu2110/sign-server/pkg/model/service/auth"
"github.com/SaKu2110/sign-server/pkg/model/service/jwt"
"github.com/SaKu2110/sign-server/pkg/model/service/log"
"github.com/SaKu2110/sign-server/pkg/vie... |
a3fdbef04a77381a12b3932f5a801ef7e0b88014 | ec4eef50448b9cbf2695ef15e8ee06d3069af402 | bbassingthwaite/cadence | /common/persistence/domainReplicationQueue.go | Go | go | 6,440 | permissive | // Copyright (c) 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
99cba5c86763783a629a46dc80658f4a8bd58cea | a4c16701bbbcee2ca62816cbe3b63b322797e6b5 | mahmoud422/kratos | /x/genutil/collect.go | Go | go | 4,291 | permissive | package genutil
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"sort"
"strings"
"github.com/KuChain-io/kuchain/chain/client/txutil"
"github.com/KuChain-io/kuchain/x/asset"
"github.com/KuChain-io/kuchain/x/genutil/types"
cfg "github.com/tendermint/tendermint/config"
tmtypes "git... |
80865a42ee0da7bd2ad4ea497f09c6932210098d | e000e3c5289be9894e997435b4b1c488b38bc0ef | ConorNevin/cert-manager | /test/e2e/suite/approval/approval.go | Go | go | 18,547 | permissive | /*
Copyright 2020 The cert-manager 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... |
3fe9eeae700ba1f28df71a211e4fccf5914af01b | fa9c9d575944769e3abe02238493c99be6c41d49 | kkasravi/cli-experimental | /internal/pkg/delete/delete.go | Go | go | 3,960 | permissive | /*
Copyright 2019 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, sof... |
db37c2f60ca36f95adeabc5e84f4753edcb85267 | 3d7bc5b28fee1822b062e165b3ac85cb127e9551 | rchamorro/pulumi-azure-nextgen | /sdk/go/azure/documentdb/v20151106/getDatabaseAccountMongoDBDatabase.go | Go | go | 1,913 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20151106
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func LookupDatabaseAccountMongoDBDatabase(ctx *pulumi.Context, args *LookupDatabaseAccou... |
9c695958ae46b85f6d5975762ee090e5d796f8cc | eaefa7b81983557847a8bd567dc958b00ebbc0a4 | Aavon/playground | /text_rank/text_rank_test.go | Go | go | 1,747 | no_license | package text_rank
import (
"fmt"
"github.com/DavidBelicza/TextRank"
"github.com/DavidBelicza/TextRank/convert"
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"
)
func Test_a(t *testing.T) {
rawText := "Go语言中文网,中国 Golang 社区,Go语言学习园地,致力于构建完善的 Golang 中文社区,Go语言爱好者的学习家园。分享 Go 语言知识,交流使用经验"
// TextRank object
... |
9bdc5be5839e4c427ad7ffe8b4c14cdbc963d846 | 381f237ceda94954b58ddf910137480c8b842cca | WinPooh32/giu | /Style.go | Go | go | 15,869 | permissive | package giu
import (
"image/color"
"github.com/AllenDang/imgui-go"
)
// PushFont sets font to "font"
// NOTE: PopFont has to be called
// NOTE: Don't use PushFont. use StyleSetter instead.
func PushFont(font *FontInfo) bool {
if font == nil {
return false
}
if f, ok := extraFontMap[font.String()]; ok {
img... |
387aca4397a988969ede91802d1efde48093f71f | 136312e65dd3c3c6e6b52bffcacec76643715550 | lkj01010/gocui | /doc.go | Go | go | 3,284 | permissive | // Copyright 2014 The gocui 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 gocui allows to create console user interfaces.
Create a new GUI:
g, err := gocui.NewGui(gocui.OutputNormal)
if err != nil {
// handle error... |
f4bcefafd1bf8eec76690624f91ee07e6a5f58c4 | 119c12061de81ad038fa31540c4ada1c99c0c9bf | sharovik/devbot | /internal/dto/slack_response_event_message.go | Go | go | 1,614 | permissive | package dto
// MessageBlock child struct of SlackResponseEventMessage
type MessageBlock struct {
BlockID string `json:"block_id"`
Elements []struct {
Elements []struct {
Type string `json:"type"`
UserID string `json:"user_id,omitempty"`
Text string `json:"text,omitempty"`
} `json:"elements"`
Type... |
a8bccd92b5535346b2f671b20bc70e6e58a8c449 | 23865bc3cecd56a62d27f3be05158631919df585 | sunx1ng/leetcode-go-1 | /11container-with-most-water/main.go | Go | go | 461 | permissive | package main
import "fmt"
func max(a,b int)int{
if a>b{
return a
}
return b
}
func maxArea(height []int) int {
left :=0
right := len(height)-1
area :=0
h :=0
for left<right{
w :=right-left
if height[left]<=height[right] {
h = height[left]
left++
}else {
h = heig... |
173b82ab8e366150a0e1c92e6811f136d1684833 | ad8a357cae135156cdc92087133d486dac66026c | lawtech0902/stream_video_server | /web/main.go | Go | go | 534 | no_license | package main
import (
"github.com/julienschmidt/httprouter"
"net/http"
)
func RegisterHandlers() *httprouter.Router {
router := httprouter.New()
router.GET("/", homeHandler)
router.POST("/", homeHandler)
router.GET("/userhome", userHomeHandler)
router.POST("/userhome", userHomeHandler)
router.POST("/api", ap... |
0ddb5a2bda0d1422c48036434acb6ba12a9c0398 | 40552fc1a7d704eea3a9ab66f2575ae87c3dc776 | munnerz/kubernetes | /contrib/mesos/pkg/scheduler/doc.go | Go | go | 673 | permissive | /*
Copyright 2015 The Kubernetes 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 law or ag... |
a320a573c0bba3c39e44780b6b51d00a479e5432 | f486ceb5c5a9694310ec43d1e99e9e7e046a4e6a | nonumber1989/voyager | /pkg/upload/image.go | Go | go | 1,813 | no_license | package upload
import (
"fmt"
"log"
"mime/multipart"
"os"
"path"
"strings"
"com.sevenup/falcon/go-gin-example/pkg/file"
"com.sevenup/falcon/go-gin-example/pkg/logging"
"com.sevenup/falcon/go-gin-example/pkg/setting"
"com.sevenup/falcon/go-gin-example/pkg/util"
)
// GetImageFullUrl get the full access path
... |
29f26487519b95f36114927c500570c9bc56a429 | 5d8b8ba0d084a65bda2d73ca11f0a0a510494e79 | bm-metamorph/MetaMorph | /tmp/metamorph-plugin/pkg/logger/logger.go | Go | go | 1,333 | no_license | package logger
import (
"github.com/natefinch/lumberjack"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"os"
"sync"
)
var (
Log *zap.Logger
onceInit sync.Once
)
func getLogWriter(filenamewithPath string) zapcore.WriteSyncer {
lumberJackLogger := &lumberjack.Logger{
Filename: filenamewithPath,
MaxSiz... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.