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 |
|---|---|---|---|---|---|---|---|---|
d6a7a3758e197bcb8852a3c86aa6d09b5ce99b19 | b45d79ba30598ae34e93d53ca4ba1243c874b32f | DataDog/opentelemetry-collector-contrib | /internal/common/maps/maps.go | Go | go | 1,689 | permissive | // Copyright 2020, OpenTelemetry 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 ag... |
e345961e95d65dde95470716ac757c3e13d6e302 | f19a5854b8fd08110c6281f8a1d5d73d64777ce2 | obieq/eventnative | /metrics/events.go | Go | go | 1,299 | permissive | package metrics
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var eventLabels = []string{"api_key_id", "project_id", "destination_id"}
var (
successEvents *prometheus.CounterVec
errorsEvents *prometheus.CounterVec
)
func initEvents() {
su... |
72bcf5fc959b4bf86e281ec2941c163bcdac88a7 | dd747bd0400bed7bcef722a4a02f8a480fe38020 | zhangyelong/irishub | /app/v1/distribution/tags/tags.go | Go | go | 550 | permissive | // nolint
package tags
import (
sdk "github.com/irisnet/irishub/types"
)
var (
ActionModifyWithdrawAddress = []byte("modify-withdraw-address")
ActionWithdrawDelegatorRewardsAll = []byte("withdraw-delegator-rewards-all")
ActionWithdrawDelegatorReward = []byte("withdraw-delegator-reward")
ActionWithdrawV... |
dd6134668077760aef70f9e6e685df8caef9fa3b | b323dcc716091bd1cb971a8a8377422fcd1c1509 | stridentbean/lnd | /mock.go | Go | go | 8,743 | permissive | package main
import (
"crypto/sha256"
"fmt"
"sync"
"sync/atomic"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/lightningnetwork/... |
3aac03d02d25a3844675e084cef9074fc77964b4 | 3f898572d200c348e78fb3d036923966c08f185a | ZWE/marketing-api-go-sdk | /pkg/model/model_custom_tag_files_add_response.go | Go | go | 552 | permissive | /*
* Marketing API
*
* Marketing API
*
* API version: 1.3
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package model
type CustomTagFilesAddResponse struct {
Code int64 `json:"code,omitempty"`
Message string `js... |
ca3df7a4a900c7f941f12fe279a0e1bd2b66f623 | 54eebcb8a94cbabc1d0cf8f90dbcea8fca525bb3 | bonly/exercise | /2010/201009/20100919_switch_type.go | Go | go | 1,095 | no_license | package main
import (
"fmt"
"strconv"
)
type Element interface{}
type List [] Element
type Person struct {
name string
age int
}
//打印
func (p Person) String() string {
return "(name: " + p.name + " - age: "+strconv.Itoa(p.age)+ " years)"
}
func main() {
list := make(List, 3)
list[0] = 1... |
39f622a8b28da60dd124a64b9aac351d7f5bba49 | efaaeaece24e32e9347d912effb66ac6ef3d7160 | HashCash-Consultants/go | /tools/hcnet-hd-wallet/commands/accounts.go | Go | go | 2,252 | permissive | package commands
import (
"encoding/hex"
"fmt"
"regexp"
"strings"
"github.com/spf13/cobra"
"github.com/hcnet/go/exp/crypto/derivation"
"github.com/hcnet/go/keypair"
"github.com/hcnet/go/support/errors"
"github.com/tyler-smith/go-bip39"
)
var wordsRegexp = regexp.MustCompile(`^[a-z]+$`)
var count, startID ui... |
33fbea00e0d7b7a00c40325a8182071e8a7be184 | 375d9aea75c9220489e9e6f4036cb38426f51428 | os-fun/eirini-logging | /loggregator/main.go | Go | go | 1,682 | no_license | package main
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
"syscall"
)
func main() {
test, err := FileDescriptors(os.Args[1])
fmt.Println(err)
// fmt.Println("/proc/" + os.Args[1] + "/fd/1")
f := os.NewFile(uintptr(syscall.Stdout), "/proc/"+os.Args[1]+"/fd/1")
//test, err := FileDescriptors(os.Args[1])
de... |
24d521b7e65cb3e8d598c944d6dd84ef84ef2296 | 5c9ed2c0b79626a571981100ea315084e933653e | awinlei/engine | /core/raycaster.go | Go | go | 3,822 | permissive | // Copyright 2016 The G3N 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 core
import (
"github.com/g3n/engine/math32"
"sort"
)
// Raycaster represents an empty object that can cast rays and check for ray intersections.
t... |
6a80f0d5249590bb5b5c203ed6c57f5de4d69fc9 | 3605ea109664062260ce295d3b33b5bb2f5f1ef4 | marineghandevosyan/wavefront-kubernetes-collector | /internal/kubernetes/configs.go | Go | go | 5,240 | permissive | // Based on https://github.com/kubernetes-retired/heapster/blob/master/common/kubernetes/configs.go
// Diff against master for changes to the original code.
// 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 co... |
0e86d7447c3d66c069351a7c4a34e5af236c0103 | 86b30a9bba1939a1710d151a6848a8d0e2e0d1c4 | AlexandreBRUXELLE/andon-webapp-in-go | /webapp/src/admin/http.go | Go | go | 5,173 | no_license | package admin
import (
"context"
"log"
"net/http"
"time"
"github.com/user/andon-webapp-in-go/src/middleware"
"github.com/user/andon-webapp-in-go/src/view"
"github.com/user/andon-webapp-in-go/src/wc"
)
type viewHandler struct{}
// NewViewHandler returns a handler that manages requests to the admin page.
func... |
196c1890cd92dd82e3e775173e0fea81e3a0554a | 600375c1b78b201d49e1cfe28fc970aa8952f3dd | sekulicd/summer | /cmd/summer-server/main.go | Go | go | 1,207 | no_license | package main
import (
"context"
"fmt"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
"net"
summer "summer/pkg/grpc-schema"
summerservice "summer/pkg/summer-server"
)
const (
grpcPort = ":3000"
)
type SummerServer struct{
SummerService summerservice.SummerService
}
func (s *SummerServer)AddTuple(... |
4b1f6464e0cffc581388f1c11d0dcdb2c052d6cd | 793d6d58e85d6ae643e15fb5e2b6d3b4f5926cb6 | rishabh625/socketprblm | /auctioner/cmd/main/main.go | Go | go | 1,350 | no_license | package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
"github.com/rishabh625/socketprblm/auctioner/libs/handlers"
. "github.com/rishabh625/socketprblm/middleware"
"strconv"
)
var (
port int
logfile string
ver bool
)
func init() {
flag.IntVar(&port, "port", 8080, "The port to listen on.")
flag.... |
c34aa0c21ddd1659c217bca48464e6c8af17569f | 7bd66b1aad65aabc01d78d6555d13d8afb0a7947 | Jeanpigi/promedioSem | /main_test.go | Go | go | 1,156 | permissive | package main
import "testing"
func TestTotalLending(t *testing.T) {
pedro := Student{
subjects: []Subject{
{ academicCredits: 5 },
{ academicCredits: 1 },
{ academicCredits: 3 },
{ academicCredits: 3 },
{ academicCredits: 3 },
},
}
result := 15
total := TotalLending(&pedro)
if total != result... |
13dff56dc933d4328f31563d6f9e573d16e9858b | 2f676d2b630c1419d96caed1324246cbbb0823f8 | cloudfoundry/cli | /integration/helpers/token.go | Go | go | 922 | permissive | package helpers
import (
"strings"
"time"
"github.com/SermoDigital/jose/crypto"
"github.com/SermoDigital/jose/jws"
"github.com/SermoDigital/jose/jwt"
. "github.com/onsi/gomega"
)
// BuildTokenString returns a string typed JSON web token with the specified expiration time
func BuildTokenString(expiration time.T... |
1117a40b09da6ed9bdc0c5ca79f86b16052dd6bd | 6158a01dc99403567f52445adad97ee7b5d1be14 | Jennal/goplay | /transfer/base/server_base.go | Go | go | 4,028 | permissive | // Copyright (C) 2017 Jennal(jennalcn@gmail.com). All rights reserved.
//
// Licensed under the MIT License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://opensource.org/licenses/MIT
//
// Unless required by applicable law or agr... |
1404d2db8a822c130a918e9fef45daaceb70c159 | 239962a74a6370fbe366878f15aaab09a53df46f | toluschr/gitnotify-rss | /main.go | Go | go | 3,299 | no_license | package main
import (
"encoding/json"
"encoding/xml"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strings"
"time"
"./gh"
)
type Link struct {
Href string `xml:"href,attr"`
}
type Entry struct {
Title string `xml:"title"`
Link Link `xml:"link"`
Updated string `xml:"updated"`
Published string `xml:"publishe... |
533cfe94cebffd588d69e5b2c73d3dc27c5ce934 | b610a2ee51536e8e23714c2da320b5b86c10d329 | yongjun823/hyperlook | /vendor/github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/channel/txn.go | Go | go | 8,052 | permissive | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package channel
import (
"github.com/golang/protobuf/proto"
"github.com/pkg/errors"
"github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common"
pb "github.com/hyperledger/fabri... |
7d754629d28d390d40a8cb13043cd2746657c4af | 5edcd5439df32cc9b84c58b3dcbc0282ea61d692 | zgfzgf/lotus | /chain/gen/slashfilter/slashfilter.go | Go | go | 3,085 | permissive | package slashfilter
import (
"fmt"
"github.com/filecoin-project/lotus/build"
"golang.org/x/xerrors"
"github.com/ipfs/go-cid"
ds "github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/types"
)
type Sl... |
d449e730153a65d02366f721f69327714c2efbce | f69ebac3311c9380768140b4708f6024006f6f08 | flytofly/justledger | /core/ledger/kvledger/txmgmt/statedb/statemongodb/statemongodb_test_export.go | Go | go | 1,148 | permissive | /*
Copyright IBM Corp. 2016 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 wri... |
17d012799ae18fd4a4574e4fd685bfd704ecea23 | 80e2dc22cb8412bbdb0533f672594212939134e9 | alflang/yq | /cmd/version.go | Go | go | 1,224 | permissive | package cmd
import (
"fmt"
"strings"
)
// The git commit that was compiled. This will be filled in by the compiler.
var (
GitCommit string
GitDescribe string
// Version is main version number that is being run at the moment.
Version = "4.9.1"
// VersionPrerelease is a pre-release marker for the version. If... |
4b09f5f050a2ab48fbbe7d7afcf7b5d0e7a69ec4 | 97a5d50ee0f325d6a55d565869ea073c0ebf68fb | ilya-mezentsev/mini-roles-manager | /backend/source/config/repository.go | Go | go | 1,255 | no_license | package config
type Repository struct {
s settings
}
func MustNew(settingsFilePath string) Repository {
return Repository{
s: mustParse(settingsFilePath),
}
}
func Default() Repository {
return Repository{s: settings{
Server: server{
Port: 8080,
Domain: "localhost",
},
DB: db{
Host: "local... |
bc5e13bd35dac0d6e9c153ecfd28e60fc4ec7fbd | 9dec8f3d534217780d5dd956b732bb24d08d1f97 | luci/luci-go | /gae/impl/memory/datastore_index.go | Go | go | 8,499 | permissive | // Copyright 2015 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... |
50a7f3362747b93cea8735f514272aa730849faa | d30f0494e4c08cd9263907bd786cd94b85eb881e | arthaslll/kubernetes | /pkg/genericapiserver/mux/container.go | Go | go | 3,183 | 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, ... |
b1643a1685e030087ac2eec0c95b5cb6954f391a | 7ff650124fa56001ab017f6bd9d6f0781c6d899a | chedom/go_prog_lang | /ch8/ex8.14/main.go | Go | go | 1,704 | no_license | package main
import (
"bufio"
"fmt"
"log"
"net"
"time"
)
var (
entering = make(chan client)
leaving = make(chan client)
messages = make(chan string)
)
type client struct {
out chan<- string
name string
}
func main() {
listener, err := net.Listen("tcp", "localhost:8000")
if err != nil {
log.Fatal(err... |
e0f64fdcc0ece72903a27e7bf415223138d4b12c | 4273c242e182aaaa17678fe77c25d1df2782a3dc | zaquestion/aws-sdk-go-v2 | /feature/cloudfront/sign/policy_test.go | Go | go | 4,027 | permissive | package sign
import (
"bytes"
"crypto"
"crypto/rsa"
"crypto/sha1"
"encoding/base64"
"encoding/json"
"fmt"
"math/rand"
"strings"
"testing"
"time"
)
func TestEpochTimeMarshal(t *testing.T) {
v := AWSEpochTime{time.Now()}
b, err := v.MarshalJSON()
if err != nil {
t.Fatalf("Unexpected error, %#v", err)
}... |
2778573ba87f54a665ce9e5dce163ae9975b042c | b631df626c9600ff6635d4e6a99f37156987c2f0 | goalbook/easyroute | /router_test.go | Go | go | 969 | permissive | package easyroute
import (
"testing"
"github.com/gorilla/mux"
"github.com/stretchr/testify/assert"
)
func TestNewRouter(t *testing.T) {
beforeHandler := func(req *Request) bool {
return false
}
t.Run("basic creation and route registering", func(t *testing.T) {
// setup a router and register a test route
... |
510243eb1b3c14771dbd847cf8014448a8505204 | 3bdcd1be26fced65983dcc8a1e0898cb67e70af6 | grpc/test-infra | /kubehelpers/pods.go | Go | go | 1,021 | permissive | /*
Copyright 2020 gRPC 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, software
d... |
33d25315bbf6eb2444ed09bbe6a60d6e0bbbc2f9 | 46f219e45087dccf5a3cbc453b9edef0bfedabf9 | zr-hebo/utils | /ezflag/string.go | Go | go | 664 | no_license | package ezflag
import (
"fmt"
)
type StringVar struct {
Var
val string
}
// NewStringVar build new string var
func NewStringVar(name, defaultVal, usage string, required bool) *StringVar {
sv := &StringVar{Var: createVar(name, usage, required), val: defaultVal}
continueCommandLine.StringVar(&sv.val, name, defaul... |
7bebc2458d669279756b5a4a8162750781527514 | c167b254e52124702179206fef92ebfb39b806a7 | edhere/aardvark-cli | /aardvark/aardvark.go | Go | go | 560 | no_license | package aardvark
type AardvarkConfig struct {
Aardvark struct {
Assets []string `json:"assets"`
Envs []string `json:"envs"`
} `json:"aardvark"`
}
type Asset struct {
Name string `json:"asset"`
Status string `json:"status"`
Envs []Env `json:"envs"`
}
type Env struct {
Href string `json:"href"`
S... |
c1b5aa857fbef5864071000c4c05edeee6da8c8b | a48a73443474950e95a49565edc40f7e1d4c86fe | redsnapper2006/leetcode-cn | /S/877-stone-game/main.go | Go | go | 1,393 | no_license | package main
import "fmt"
func stoneGame(piles []int) bool {
buf := make([][]int, len(piles))
for i := 0; i < len(piles); i++ {
buf[i] = make([]int, len(piles))
buf[i][i] = piles[i]
}
for i := len(piles) - 2; i >= 0; i-- {
for j := i + 1; j < len(piles); j++ {
c := piles[i] - buf[i+1][j]
if c < piles[... |
c6bb7abccd1a533b9093f9e7f4787130346eb26b | 04ceb867b5499b22a777a717dffd7da44c629f14 | pombredanne/depm | /main.go | Go | go | 875 | permissive | package main
import (
"os"
"github.com/spiegel-im-spiegel/depm/facade"
"github.com/spiegel-im-spiegel/gocli/rwi"
)
func main() {
facade.Execute(
rwi.New(
rwi.WithReader(os.Stdin),
rwi.WithWriter(os.Stdout),
rwi.WithErrorWriter(os.Stderr),
),
os.Args[1:],
).Exit()
}
/* Copyright 2020 Spiegel
*
... |
8a3da892ac465af35dd6cfc86e53410a6572a8f3 | 3000b11d4a8c8d31d597282f8b12a30c68542f49 | AdalDiazFarina/gin-gorm-example | /model/cliente.go | Go | go | 530 | no_license | package model
import (
"time"
)
type Cliente struct {
DNI string `gorm:"type:varchar(9);primaryKey"`
Apellidos string `gorm:"apellidos;type:varchar(50)"`
Nombre string `gorm:"nombre;type:varchar(50)"`
Datos string `gorm:"datos;type:varchar(50)"`
Nacimient... |
439fb530c44a0a8b3cf973d965fc887e1afe53a6 | 19c242f6fda121e32d8bc9b5aea83dd4197c3885 | meisasin/go-algorithm | /_20200720/main.go | Go | go | 311 | no_license | package main
func main() {
}
func twoSum(numbers []int, target int) []int {
low, high := 0, len(numbers)-1
for low < high {
sum := numbers[low] + numbers[high]
if sum == target {
return []int{low + 1, high + 1}
} else if sum < target {
low++
} else {
high--
}
}
return []int{-1, -1}
}
|
d13829534d91246aa5429ca639fd4f2de64abe33 | f950327ba39e7569a1436975df682d311cc9b7de | inkyblackness/hacked | /ss1/content/movie/internal/format/DataType.go | Go | go | 925 | permissive | package format
// DataType classifies entries.
type DataType byte
const (
// DataTypeEndOfMedia marks the last entry.
DataTypeEndOfMedia = DataType(0)
// DataTypeLowResVideo for low resolution (low compression) video.
DataTypeLowResVideo = DataType(0x21)
// DataTypeHighResVideo for high resolution (high compress... |
2b432b4485194ed4d3c086926be760e0286a509a | 015c9e68dbcb1820e88ffb43441fc544ec3411c6 | Jakatut/IoT-Final-Project | /pub_sub_service/main.go | Go | go | 338 | no_license | package main
import (
"os"
"pub_sub_service/routes"
"github.com/gin-gonic/gin"
)
var router *gin.Engine
func init() {
router = gin.Default()
}
func main() {
// Set the timezone to UTC so incoming datetimes can be compared to the log file's datetimes which do not have a timezone.
os.Setenv("TZ", "UTC")
route... |
88fb02bfe594335a26333af89b93433c2125f0fa | b819e8ab3d56cb564f10e53b10efbe52a75ab4f9 | kataras/iris-cli | /project/project.go | Go | go | 26,916 | permissive | package project
import (
"archive/zip"
"bytes"
"context"
"crypto/md5"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path"
"path/filepath"
"runtime"
"strings"
"github.com/kataras/iris-cli/parser"
"github.com/kataras/iris-cli/utils"
"github.com/kataras/golog"
"golang.org/x/sync/err... |
03c760f5f69c7f90e5ba0d56bd9cc7b3d1592412 | 7d31bc5a68952b74342171f49e3703f92a20a4e3 | AmosWang0626/awesome | /src/main/application/im/client/cprocess/user_online.go | Go | go | 992 | no_license | package cprocess
import (
"amos.wang/awesome/src/main/application/im/common/module"
)
var (
MyClientUserInfoMgr *ClientUserInfoMgr
MyCurrentUser *module.CurrentUser // 登录成功后初始化
)
type ClientUserInfoMgr struct {
OnlineUsers map[uint64]*module.UserInfo
}
func init() {
MyClientUserInfoMgr = &ClientUserInfoM... |
53b9a839d18350b18e57758f8cb64cb48098f394 | 964d22fc2d3b96811298fc8c153f1d6a86579f44 | SpivEgin/hugot-handlers | /prometheus/query.go | Go | go | 4,824 | no_license | package prometheus
import (
"bytes"
"fmt"
"image"
"image/color"
"image/png"
"math"
"net/http"
"sort"
"strconv"
"strings"
"time"
"context"
"github.com/golang/glog"
"github.com/tcolgate/hugot"
"github.com/vdobler/chart"
"github.com/vdobler/chart/imgg"
prom "github.com/prometheus/client_golang/api/pro... |
8d895ad6dde5944ad4366493ed3ecd5adada30dc | 38d6eb832efa8aa67a3e08be9c406ba98f272628 | lazypic/castflow | /castflow.go | Go | go | 2,431 | no_license | package main
import (
"flag"
"fmt"
"log"
"os"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/dynamodb"
)
var (
now = time.Now()
// db setting
flagRegion = flag.String("region", "ap-northeast-2", "AWS region name")
flagProfile = flag.Stri... |
a76fcc68548adcfb3b884948c11f8578d1c2a05d | fc440c803cff5a4b169c4833dd13c55ddbf3bbe5 | Gouplook/kc | /rpcinterface/client/task/reservation/reservation.go | Go | go | 945 | permissive | package reservation
import (
"context"
"git.900sui.cn/kc/rpcinterface/client"
"git.900sui.cn/kc/rpcinterface/interface/task/reservation"
)
type Reservation struct {
client.Baseclient
}
func (r *Reservation) Init() *Reservation {
r.ServiceName = "rpc_task"
r.ServicePath = "Reservation/Reservation"
return r
}
... |
f7b724e9ee4c86202f328c6ba474b06d2308b2b2 | f00965fc8fff14a9015662c9289cdb23dd67ded6 | hraban/s3iface | /backend_fs_test.go | Go | go | 1,818 | permissive | // Copyright © 2012 Hraban Luyat <hraban@0brg.net>
//
// 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, ... |
928c07690b74dca24aaaf9231972abd1a761c83c | d760976a942c3e237b81ad672a2ebfc3a1cdeab4 | cdurf1/daos | /src/control/server/test_utils.go | Go | go | 4,386 | permissive | //
// (C) Copyright 2019 Intel Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ... |
8f9b9e6f419c6894f24905997a7d28eaf699401c | 2796d49598900732ef6dafa3b188eea21c8e690b | samj7792/t1cgcode | /GO/Practice/dataLoad/main.go | Go | go | 2,288 | no_license | package main
import (
"database/sql"
"log"
_ "github.com/go-sql-driver/mysql"
)
func main() {
db, err := sql.Open("mysql", "samuel:password@tcp(127.0.0.1:3306)/practice")
db.Ping()
if err != nil {
log.Fatal("sql.Open: ", err)
}
defer db.Close()
var (
Customerid int
FirstName string
LastName stri... |
f246eee09d05681c24bfab27921998193752b6c4 | d7914df8cfd0a5e7dbc3f4d9cdbee8117290d3f8 | smagill-secdev/gen | /help.go | Go | go | 1,051 | permissive | package main
import (
"os"
"path/filepath"
"strings"
"text/template"
)
func help(c config) error {
cmd := filepath.Base(os.Args[0])
spacer := strings.Repeat(" ", len(cmd))
info := helpInfo{
Name: cmd,
CustomName: c.customName,
Spacer: spacer,
}
if err := helpTmpl.Execute(c.out, info); err !... |
63f41eb4eb7191d3747df29c30c33760bc5156fc | 20fbfcaf2c2d284382a898ecfdd2fcf875a01dc3 | flowdev/gosamples | /presentation3/outputText.go | Go | go | 318 | permissive | package main
import (
"fmt"
"os"
)
type OutputText struct {
getText func(string)string // <1>
}
func NewOutputText(getText func(string)string) *OutputText { // <2>
return &OutputText{ getText }
}
func (ot *OutputText) InPort(data string) {
fmt.Fprintln(os.Stderr, ot.getText(data)) // <3>
}
|
94df1911ca71b6a12124490b1a96325225a80b47 | 6f73e4677cf9c09190c3599cfb3e72e909ebd099 | pddg/moco | /api/v1beta1/mysqlcluster_webhook.go | Go | go | 2,587 | permissive | package v1beta1
import (
"crypto/rand"
"encoding/binary"
"math"
"github.com/cybozu-go/moco/pkg/constants"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/control... |
237e718de35f1a1f5d2a73143c6a8d7df7708ba5 | e59da8a350eda3c960a58e1cae516999b9d452b4 | Ladicle/ghctl | /pkg/github/github.go | Go | go | 3,072 | permissive | package github
import (
"context"
"fmt"
"github.com/shurcooL/githubql"
"golang.org/x/oauth2"
)
const maxNode = 100
// NewClient creates githubql client.
func NewClient(token string) *Client {
src := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
c := oauth2.NewClient(context.Background(), src)
r... |
5dc460b2134528095bff915037e123186194e95d | fbb831826c1f02d7cd26c189113c0b5378ac164b | feng-tao/airflow-operator | /pkg/client/clientset/versioned/typed/airflow/v1alpha1/airflow_client.go | Go | go | 2,695 | permissive | /*
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... |
0480e9024f2d2b24d9ac92a95afbbc1b7dcace08 | d211bd2929a1ed12d17267a1e07afce632022192 | 00mjk/rapi | /backend/sftp/config.go | Go | go | 2,360 | permissive | package sftp
import (
"net/url"
"path"
"strings"
"github.com/rubiojr/rapi/internal/errors"
"github.com/rubiojr/rapi/internal/options"
)
// Config collects all information required to connect to an sftp server.
type Config struct {
User, Host, Port, Path string
Layout string `option:"layout" help:"use this b... |
686ef68d6a60ebaf5423e091ddf62e98ee9e22a4 | 42c97244957c005df1c867e0fb4a8ed46254fa62 | DAGfans/AnticoneSize | /main.go | Go | go | 1,282 | permissive | package main
import (
"math"
"flag"
"log"
"os"
)
var myLog = log.New(os.Stdout, "", 0)
func main() {
delay := flag.Float64("delay", 15, "Max propagation delay, unit is second")
rate := flag.Float64("rate", 1.0/30, "Block rate, unit is blocks/second")
level := flag.Float64("level", 0.01, "Security level, the ... |
9eeaae06278dac2bae8ed1ba01db4b169d0e2407 | 7a4b7759cad05dec5faccbc7b7e5dc77478a67b3 | aslhiryu/proyecto01 | /banwire/src/accesodatos/tipoServicioDAO.go | Go | go | 4,484 | no_license | //Definicion del DAO para el manejo de Tipos de servicio
package accesodatos
import (
"database/sql"
"entidades"
"fmt"
_ "github.com/lib/pq"
)
//Estrucutra que representa un DAO para Tipos de Servicio
type TipoServicioDAO struct{
*GenericDAO
}
//Metodo que genera un DAO de estado de Notificacion
func NewTipoSer... |
03497ee4bb2c48c169a75e27265f38ffada6f172 | 6ae9c9a799fd3e1f1baf28b6c2dc6e744df66950 | Alexander-r/gosrvmon | /ping.go | Go | go | 1,430 | permissive | package main
import (
"errors"
"log"
"net"
"strings"
"sync"
)
type PingCheckResult struct {
rtt int64
up bool
err error
}
func IsIPv4(ad string) bool {
return len(ad) > 0 && !strings.Contains(ad, ":")
}
func PingCheck(host string) (rtt int64, up bool, err error) {
var addr []net.IP
addr, err = net.Looku... |
f6ccfe38b92495dd1f41c08b91bb103d4ce0cb49 | 1ee7d7a808b08b296279b65281b33346ee7611ee | jessfraz/docker | /profiles/seccomp/default_linux.go | Go | go | 15,585 | permissive | package seccomp // import "github.com/docker/docker/profiles/seccomp"
import (
"github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/sys/unix"
)
func arches() []Architecture {
return []Architecture{
{
Arch: specs.ArchX86_64,
SubArches: []specs.Arch{specs.ArchX86, specs.ArchX32},
},
{
... |
f11caa46d011ea34fadb6c9e35a4858741652abf | c5a52b729eaea061d73b71292bebb480b0597205 | master-pfa-info/2019 | /m1/02-prog/_code/read-file-floats-bufio.go | Go | go | 422 | no_license | package main
import (
"bufio"
"fmt"
"os"
)
func main() {
f, err := os.Open("data.txt")
if err != nil {
panic(err)
}
sum := 0.0
n := 0
scan := bufio.NewScanner(f)
for scan.Scan() {
var v float64
var txt = scan.Text()
_, err = fmt.Sscanf(txt, "%f", &v)
if err != nil {
panic(err)
}
sum += v
... |
6350d1a886855efc5963f7f4bc124c69a0d48276 | e90bfbc1ef3cf05d39641c1954fca0f0fc5f51e5 | fabric8io/docker-gogs | /vendor/github.com/pingcap/tidb/evaluator/builtin_control.go | Go | go | 2,037 | permissive | // Copyright 2015 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... |
b1d414d387067328dabe7a993469f00b37da7494 | 736b47cec383ebaeb9cef448ccc1465986fcea06 | fraternities/DCParser | /test_driver/test_driver_datum.go | Go | go | 12,373 | permissive | // Copyright 2019 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... |
8e45dfecce055fe5f2fb8f0c989301f5879705fe | a6baf1b4c159c36cfaee98285e21b07fc0edd11f | webninjasi/go-steam | /_internal/packet.go | Go | go | 2,770 | permissive | package _internal
import (
"bytes"
"encoding/binary"
"fmt"
"github.com/golang/protobuf/proto"
. "github.com/softashell/go-steam/_internal/steamlang"
)
// TODO: Headers are always deserialized twice.
// Represents an incoming, partially unread message.
type Packet struct {
EMsg EMsg
IsProto bool
T... |
94cf5512fca45aa1cb8ec684169f7141f639d750 | 5f623bce009e61bae25d025e13c904458a1e3c28 | ICKelin/opennotr | /opennotrd/core/udpforward.go | Go | go | 7,135 | permissive | package core
import (
"bytes"
"encoding/binary"
"fmt"
"io"
"net"
"sync"
"syscall"
"time"
"unsafe"
"github.com/ICKelin/opennotr/internal/logs"
"github.com/xtaci/smux"
)
var (
// default udp timeout(read, write)(seconds)
defaultUDPTimeout = 10
// default udp session timeout(seconds)
defaultUDPSessionTi... |
4e1b0a547b42dcda710ca3df9901f22a3b9f1c1f | afe98c786c4f4d4ccc253e02b0e8fac25226eec1 | slooppe/sonarbyte | /main.go | Go | go | 1,572 | no_license | package main
import(
"fmt"
"net/http"
"io/ioutil"
"encoding/json"
"bufio"
"flag"
"os"
"sync"
)
func scan(domain string) ([]string, error) {
resp, err := http.Get(fmt.Sprintf("https://sonar.omnisint.io/subdomains/%s", domain))
if err != nil {
fmt.Println(nil)
}
defer resp.Body.Close()
... |
be32c41e85eb0853b38a97e821afc0d072d26ec2 | df5b21daf8e6a2d700ae41b90bef1e4597dd3d93 | ar3s3ru/exocortex | /wiki/wiki.go | Go | go | 2,852 | no_license | package wiki
import (
"context"
"encoding/json"
"io"
"io/ioutil"
"net/http"
"path/filepath"
"github.com/apex/log"
"github.com/gorilla/mux"
"github.com/spf13/viper"
"github.com/spencercdixon/exocortex/exo"
"github.com/spencercdixon/exocortex/git"
)
type wiki struct {
router *mux.Router
store *git.Store... |
2a55a6fa03ad8e1122ba4206d141c7c487b20e32 | 6db44f2139a9c07dc52dbfe9182d9853996fd054 | Kuman-ux/chainlink | /core/services/webhook/delegate.go | Go | go | 4,091 | permissive | package webhook
import (
"context"
"sync"
uuid "github.com/satori/go.uuid"
"github.com/pkg/errors"
"github.com/smartcontractkit/chainlink/core/logger"
"github.com/smartcontractkit/chainlink/core/services/job"
"github.com/smartcontractkit/chainlink/core/services/pipeline"
"github.com/smartcontractkit/chainli... |
12e8659ada1beff57689ecbd077eee34e0e9ca2a | 7b121b708ea1be8a9a6f2bc9c3f9478a841c5223 | jamsonzan/go-micro | /server/server.go | Go | go | 6,137 | permissive | // Package server is an interface for a micro server
package server
import (
"context"
"os"
"os/signal"
"syscall"
"time"
"github.com/google/uuid"
"github.com/micro/go-micro/v2/codec"
"github.com/micro/go-micro/v2/logger"
"github.com/micro/go-micro/v2/registry"
)
// Server is a simple micro server abstractio... |
d0cde75489f74042b406d23e69a61095fe1dff99 | 92cbb2c5c14876a12552811d7f18bf658265caac | jfinken/gobot | /platforms/bebop/bebop_driver.go | Go | go | 3,859 | permissive | package bebop
import (
"github.com/hybridgroup/gobot"
)
// BebopDriver is gobot.Driver representation for the Bebop
type BebopDriver struct {
name string
connection gobot.Connection
gobot.Eventer
}
// NewBebopDriver creates an BebopDriver with specified name.
func NewBebopDriver(connection *BebopAdaptor, n... |
1bba5f8eb41bc8fa7de4a47cb36124994e4968fa | e3d3d0d52e521a90e63bf77bc08fe4414d56cb7a | cossth/grafana | /pkg/services/ngalert/state/cache.go | Go | go | 8,424 | permissive | package state
import (
"context"
"fmt"
"math"
"net/url"
"strings"
"sync"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/ngalert/eval"
"github.com/grafana/grafana/pkg/services/ngalert/metrics"
ngModels "github.com/grafana/... |
9f4c209b49d20524a6728307b2574e614b8d554b | fd9492723236eede43cf07fda43f2facf9ae7b66 | mikesbrown/zq | /cmd/zqd/logger/logger.go | Go | go | 2,167 | permissive | package logger
import (
"fmt"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
const (
TypeFile Type = "file"
TypeWaterfall = "waterfall"
TypeTee = "tee"
)
type Type string
type Config struct {
Path string `yaml:"path"`
// If Path is a file, Mode will determine how the log file is managed... |
c4f1bd2f97e6523f753a3a27dd4b014d32036daa | 958ecd3fee6111edce748db2d085368e19a390d0 | ankitbansal82/abot | /shared/datatypes/state_machine.go | Go | go | 12,266 | permissive | package dt
import "encoding/json"
// StateKey is a reserved key in the state of a plugin that tracks which state
// the plugin is currently in for each user.
const StateKey string = "__state"
// StateKeyEntered keeps track of whether the current state has already been
// "entered", which determines whether the OnEnt... |
cf003041fd803b38baec7e041eae047f12d0d585 | f17f710fe877ef16fa804791b1e87e38920c22b7 | prakriti07/kops | /cmd/kops/integration_test.go | Go | go | 25,982 | 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, ... |
c841e552b9f7db1bc7e9eb11b556bdf336b99f79 | 29f9397673adaf3247a88c507dc3cead99a7ed4a | vx-labs/nest | /nest/messages_test.go | Go | go | 909 | no_license | package nest
import (
"testing"
"github.com/stretchr/testify/require"
)
func Test_match(t *testing.T) {
require.True(t, match([]byte("#"), []byte("a/a")))
require.True(t, match([]byte("a/a"), []byte("a/a")))
require.False(t, match([]byte("a/b"), []byte("a/a")))
require.False(t, match([]byte("a/b"), []byte("a/a... |
07bdd9936a41b20820dd5d3f0a85b10825f5d2ab | a98affc6dcf89f2bcb7e24cf83f756e437e39330 | openshift/installer | /terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_listkeys_autorest.go | Go | go | 2,358 | permissive | package communicationservice
import (
"context"
"fmt"
"net/http"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
)
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
ty... |
b46e860098eda8b5816d28189b4da6dff7e52409 | 08ce67c4587ca482ecf5c2b426d29af2ffd91631 | mikaelaTar/canis | /pkg/datastore/mongodb/store.go | Go | go | 6,173 | permissive | /*
Copyright Scoir Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package mongodb
import (
"context"
"fmt"
"github.com/pkg/errors"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
... |
7430c0d10548a58ffb60f18964caaaefbd6235f9 | 73c7229735670a8c221b2e347f176c295010c556 | DrawGun/thinknetica_golang | /task_6/cmd/main.go | Go | go | 1,207 | no_license | package main
import (
"bufio"
"fmt"
"os"
"pkg/crawler/spider"
"pkg/engine"
"pkg/index"
"pkg/storage/file"
"strings"
)
const url = "https://yandex.ru/"
const depth = 2
func main() {
spid := spider.New()
file := file.New()
ind := index.New()
eng := engine.New(spid, file, ind)
go backgroundUpdates(eng)
... |
d9114efbf467fd2a3f5292fe59281b20412f30bc | 8800530f762f2d5f754bf7ddfdf97e41747d4d18 | keks/oasis-core | /go/upgrade/migrations/dummy.go | Go | go | 2,528 | permissive | package migrations
import (
"fmt"
"github.com/oasisprotocol/oasis-core/go/common/cbor"
"github.com/oasisprotocol/oasis-core/go/common/crypto/signature"
"github.com/oasisprotocol/oasis-core/go/common/crypto/signature/signers/memory"
"github.com/oasisprotocol/oasis-core/go/common/entity"
abciAPI "github.com/oasis... |
d992959d0b6a88a98c52c8db74a1bab66f2938e1 | 1cb5dbeb5e0cfb26d481f778f0e1494567357ac6 | Badyanchik/go-first-steps | /func/func.go | Go | go | 1,032 | no_license | package main
import (
"fmt"
"strings"
)
func average(arr []float64) float64 {
total := 0.0
for _, v := range arr {
total += v
}
return total / float64(len(arr))
}
func add(arguments ...int) int {
total := 0
for _, i := range arguments {
total += i
}
return total
}
func joinStringsArr(arguments ...stri... |
3464219ade6e4981cf591d6b0a41961ba765bad7 | 0339aa05a1bcf50d499f2df00f45571625115149 | DiDiDaDiDiDa/AES_base64 | /main.go | Go | go | 317 | no_license | package main
import (
"AES_base64/aes_base64"
"fmt"
)
func main() {
pass := "mypassword"
xpass := aes_base64.AesEncrypt(pass)
fmt.Printf("加密后:%v\n", xpass)
tpass := aes_base64.AesDecrypt(xpass)
if pass == tpass {
fmt.Println("加解密成功!")
} else {
fmt.Println("加解密失败!")
}
}
|
ba0037322861fa2965fc7849e42839a93488e6e3 | b0e13770774afc1ecbac3cf4c3c3cabbd81a2750 | chaostreff-flensburg/moc-telegram | /config/config.go | Go | go | 1,169 | permissive | package config
import (
env "github.com/Netflix/go-env"
log "github.com/sirupsen/logrus"
)
type Text struct {
Subscribe string `env:"TEXT_SUBSCRIBE"`
Unsubscribe string `env:"TEXT_UNSUBSCRIBE"`
Hello string `env:"TEXT_HELLO"`
Subscribed string `env:"TEXT_SUBSCRIBED"`
Unsubscribed string `env:"TEXT... |
be887dc41768f3b3929cb8e5e8c40a4a21448530 | d0039a8d7233af915a39cd40edab0169ce72b721 | RainbowMango/huaweicloud-sdk-go-v3 | /services/projectman/v4/model/model_batch_delete_members_v4_request_body.go | Go | go | 383 | permissive | /*
* ProjectMan
*
* devcloud projectman api
*
*/
package model
import (
"encoding/json"
"strings"
)
type BatchDeleteMembersV4RequestBody struct {
// 用户id
UserIds []string `json:"user_ids"`
}
func (o BatchDeleteMembersV4RequestBody) String() string {
data, _ := json.Marshal(o)
return strings.Join([]strin... |
da28bdd7fcedcfe0a0752628343abc4c068b6df6 | 69e40dd32b78b4cd096276559aed7b52c1709bd2 | ctdk/goiardi | /report/postgres_funcs.go | Go | go | 2,148 | permissive | /*
* Copyright (c) 2013-2017, Jeremy Bingham (<jeremy@goiardi.gl>)
*
* 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 requi... |
5ed068b6d2cdf3a5ddd6ba042b9485b68a15c9ed | 498c1b961fa1825e25da21042e66f13bb8a7474c | mjaysonnn/DeathStarBench | /hotelReservation/tls/options.go | Go | go | 5,033 | permissive | package tls
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"log"
"os"
"strings"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
)
var (
dialopt grpc.DialOption
serveropt grpc.ServerOption
httpsopt *tls.Config
cipherSuites = map[string]uint16 ... |
e2dc26023f3accaf296a6d5e5d8861bc14ff79a2 | 2f239f7a111f2e9ecbffd4db593f1cc41f358c32 | just-nilux/gocryptotrader | /ntpclient/ntpclient.go | Go | go | 1,682 | permissive | package ntpclient
import (
"encoding/binary"
"errors"
"net"
"time"
log "github.com/thrasher-corp/gocryptotrader/logger"
)
type ntppacket struct {
Settings uint8 // leap yr indicator, ver number, and mode
Stratum uint8 // stratum of local clock
Poll int8 // poll exponent
Precision ... |
2f9d35b633da003493bd741733ca78a773fadfde | 79375e72e8f28c37bb7122220b6ea9d1b9fcf10f | domonda/pdfcpu | /pkg/pdfcpu/pages.go | Go | go | 3,770 | permissive | /*
Copyright 2020 The pdfcpu 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, softwar... |
52a21e376518e4679738983bb2a7be0ba7e5330f | 38ddaa5b3793b514ef7941c29c58d2a0b0181502 | gburanov/kapacitor | /udf/server_test.go | Go | go | 12,413 | permissive | package udf_test
import (
"errors"
"log"
"os"
"reflect"
"testing"
"time"
"github.com/influxdata/kapacitor/edge"
"github.com/influxdata/kapacitor/models"
"github.com/influxdata/kapacitor/udf"
"github.com/influxdata/kapacitor/udf/agent"
udf_test "github.com/influxdata/kapacitor/udf/test"
)
func TestUDF_Star... |
d11cd6c8724ca8c1ccaa511a237a68f83219d5cb | 7768763fb22f41166b5c94e04df715ba28a3443c | mishudark/credstore | /client/api.go | Go | go | 3,792 | permissive | /*
Copyright 2017 Google 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
di... |
ad4b305224755507b9a97654ff0924161f497188 | 89b8546c4fc051d2a0b585408f7ca121302ee324 | kevinconaway/google-api-go-client | /cloudscheduler/v1/cloudscheduler-gen.go | Go | go | 96,727 | permissive | // Copyright 2019 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package cloudscheduler provides access to the Cloud Scheduler API.
//
// For product documentation, see: https://cloud.google.com/scheduler/
//
... |
0d7cad9f3e58a8fbf5f3babd7354c6189f456d56 | 1aff11ab1916325bef491f3f1fc243df96f00807 | ialqwaiz/putio-sync | /vendor/github.com/igungor/go-putio/putio/account.go | Go | go | 1,052 | permissive | package putio
import "context"
// AccountService is the service to gather information about user account.
type AccountService struct {
client *Client
}
// Info retrieves user account information.
func (a *AccountService) Info(ctx context.Context) (AccountInfo, error) {
req, err := a.client.NewRequest(ctx, "GET", "... |
33aa651c80428d00bbfd8e29b589338bd6e15bad | 62dbee9f0fda986dc02128763c112138b916c961 | huangjiahua/tempdesk | /file.go | Go | go | 1,094 | no_license | package tempdesk
import "io"
const (
FileNotExist = "file not exists"
)
type FilePermission interface {
AllowUser(name string)
BlockUser(name string)
AllowUserMeta(key, value string)
BlockUserMeta(key, value string)
AllowAllUser()
BlockAllUser()
AllowPublic(code string)
AllowCode(code string)
BlockPublic()... |
792988cdbb11d16c6e383f137c22a1370894e51d | a39bff045fa6b27547dbcedda75fd7a6ebb6e7c4 | gqlxj1987/logs | /file_provider.go | Go | go | 4,022 | no_license | package logs
import (
"fmt"
"os"
"path/filepath"
"sync"
"time"
)
type HourClock struct {
stop chan struct{}
}
func NewHourTicker() <-chan time.Time {
hourClock := &HourClock{stop: make(chan struct{})}
return hourClock.C()
}
func (hc *HourClock) C() <-chan time.Time {
ch := make(chan time.Time)
go func() {... |
70bf817b5df4eb3f4a81a1de0683a69dbd803df0 | 68c1a4e5b4fe987fee3baae6c3b0113aebad8710 | morika-t/cnb2cf | /packager/packager.go | Go | go | 3,808 | no_license | package packager
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"io"
"log"
"os"
"os/user"
"path/filepath"
"strings"
"code.cloudfoundry.org/lager"
"github.com/cloudfoundry/cnb2cf/cloudnative"
"github.com/cloudfoundry/libbuildpack"
"github.com/cloudfoundry/libcfbuildpack/packager/cnbpackager"
"github.com/c... |
a0dc410dad80c76d95a1ab44afbfd5a9f5bcc03b | fbb80862ac8c5dd15dcf658478e376de003bbd48 | aquasecurity/harbor-scanner-aqua | /pkg/http/api/server.go | Go | go | 2,299 | permissive | package api
import (
"context"
"crypto/tls"
"net/http"
"github.com/aquasecurity/harbor-scanner-aqua/pkg/etc"
log "github.com/sirupsen/logrus"
)
type Server struct {
config etc.API
server *http.Server
}
func NewServer(config etc.API, handler http.Handler) (server *Server) {
server = &Server{
config: config... |
abe1667c139940f27a6e8f56427cce0601bdbd12 | acb9a948bb8169d0137d3a1918e5d21602c1204d | you1996/zitadel | /operator/database/kinds/backups/bucket/desired_test.go | Go | go | 2,992 | permissive | package bucket
import (
"github.com/caos/orbos/pkg/secret"
"github.com/caos/orbos/pkg/tree"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
"testing"
)
const (
masterkey = "testMk"
cron = "testCron"
bucketName = "testBucket"
saJson = "testSa"
yamlFile = `kind: databases.caos.ch/BucketBa... |
68a718021cd66785e5926d0697df4313cc818e29 | bb19c6ea069787bc0e0f11749b98a20e33803d30 | watercraft/vertica-sql-go | /msgs/fepasswordmsg.go | Go | go | 1,987 | permissive | package msgs
// Copyright (c) 2019 Micro Focus or one of its affiliates.
//
// 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 ... |
0b03d4eb5ebd0fdfd864b646dee01cf9c5ae0482 | 158ba2d85aee0b375c0b3f5237a3666bf2c1ee5c | suhanyujie/goStudy | /src/lesson/findLink.go | Go | go | 846 | permissive | package main
import (
"fmt"
"github.com/PuerkitoBio/goquery"
// "io/ioutil"
iconv "github.com/djimenez/iconv-go"
"net/http"
)
const (
baseUrl = "http://www.biquzi.com"
)
func main() {
url := "http://www.biquzi.com/14_14297/"
resp, err := http.Get(url)
if err != nil {
fmt.Println(err)
return
}
defer re... |
3e631e5dea31d02796e7a48f78058d8854acee9d | 0817478ec3a688119f94074c4e76db879fbaf2a6 | matteo107/EasyCash | /actions/users.go | Go | go | 5,367 | no_license | package actions
import (
"github.com/gobuffalo/buffalo"
"github.com/markbates/pop"
"github.com/matteo107/easycash/models"
)
// This file is generated by Buffalo. It offers a basic structure for
// adding, editing and deleting a page. If your model is more
// complex or you need more than the basic implementation y... |
adc73eec006d3ae5b4f09493ba85bb389ba97587 | e06ce70ff4d42411e79d37f3f9f5b329cf3f94f3 | sejacksonlee/avo-cardio | /main.go | Go | go | 534 | no_license | package main
import "fmt"
func main() {
w := workout{
name: "Stuff",
typeOfWorkout: Cardio,
weekday: Monday,
}
fmt.Println(w.name)
}
type Weekday int
type TypeofWorkout int
type workout struct {
name string
typeOfWorkout TypeofWorkout
weekday Weekday
}
const (
Monday Weekday = 1
Tuesday Weekday... |
8b98e8de9ceedd03a5f826e3eedfcdae970e1873 | 1ecbe506383de5ef2777558b91696b1a13ae52e9 | svenfuchs/jq | /op_dot_test.go | Go | go | 1,645 | permissive | // Copyright (c) 2016 Matt Ho <matt.ho@gmail.com>
//
// 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 ... |
0dd35a8205439639aa995a75326fe4d5f6b50b5b | 6721191bed4f674b5acaea52ea8bee782fdde310 | tecracer/cdk-templates | /go/alb_ec2/alb_ec2.go | Go | go | 3,319 | permissive | package alb_ec2
import (
"io/ioutil"
// CDK
awscdk "github.com/aws/aws-cdk-go/awscdk/v2"
autoscaling "github.com/aws/aws-cdk-go/awscdk/v2/awsautoscaling"
ec2 "github.com/aws/aws-cdk-go/awscdk/v2/awsec2"
elasticloadbalancingv2 "github.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancingv2"
iam "github.com/aws/aw... |
87f83989b3684ea6541e4faeb970913b73e200c2 | c68f84e2094bce3e34985423e881cd32cf500f02 | silviosaczuck/news-api | /models/company.go | Go | go | 609 | no_license | package models
import (
"github.com/jmcvetta/neoism"
)
/*
Company model
*/
type Company struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
// ---------------------------------------------------------------------------
/*
GetCompanies returns collection of news
*/
func GetCompanies(db *neoism.Database) ... |
2289b2de1ffb5e06275fea6b1e6b71fb5618f4f4 | a4f6c80d7bbc3317a76a69fc2466afecf51fbd83 | argoproj/argo-events | /eventsources/sources/calendar/validate_test.go | Go | go | 1,582 | permissive | /*
Copyright 2018 BlackRock, 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
di... |
e54224422bd729392d6a0fc04e404739523e134e | e18ba471c083c24fecae6901cb5d3af9fbb5b052 | NeoCN/go-cloud | /docstore/mongodocstore/mongo.go | Go | go | 21,989 | permissive | // Copyright 2019 The Go Cloud Development Kit 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appli... |
83a9a9ed7792e0555261eb7f15fafb1bee062fc9 | 2703be0a4e1f2ed32f6f0444148f9d0298355129 | dmitri-at-next/flux | /cmd/fluxd/main.go | Go | go | 29,752 | permissive | package main
import (
"flag"
"fmt"
"io/ioutil"
"net/http"
_ "net/http/pprof"
"net/url"
"os"
"os/exec"
"os/signal"
"path/filepath"
"runtime"
"strconv"
"strings"
"sync"
"syscall"
"time"
helmopclient "github.com/fluxcd/helm-operator/pkg/client/clientset/versioned"
"github.com/go-kit/kit/log"
"github.c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.