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 |
|---|---|---|---|---|---|---|---|---|
36a9e10347df595fd431e456163b6f6bf2361300 | ff572ca51ffe15df0ec891b1004430aecd6198a8 | wheatj/ipfs-cluster | /cluster_config.go | Go | go | 11,554 | permissive | package ipfscluster
import (
"bytes"
crand "crypto/rand"
"encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"os"
"sync"
"time"
"github.com/ipfs/ipfs-cluster/config"
crypto "github.com/libp2p/go-libp2p-crypto"
peer "github.com/libp2p/go-libp2p-peer"
ma "github.com/multiformats/go-multiaddr"... |
352b24494d4ce5adbf08ac679a5c121d83ac51ba | 943020e3064908eb14559c2c08f28bee9737ea72 | nelsonken/gopressblog | /models/user.go | Go | go | 1,898 | no_license | package models
import (
"github.com/jinzhu/gorm"
"golang.org/x/crypto/bcrypt"
"time"
)
// User table
type User struct {
gorm.Model
Name string `gorm:"not null;type:varchar(20);unique"`
Nick string `gorm:"type:varchar(20)"`
Password string `gorm:"not null;type:varchar(100)"`
Avatar string `gorm:"... |
af07cbeadfe8409417f1848065b85a2ee0043867 | f3b7d31aafd447268c4503e7a2a30fd4a67e2b95 | jyaw/medtronic | /crc16.go | Go | go | 246 | permissive | package medtronic
//go:generate crcgen -size 16 -poly 0x1021
// Compute CRC-16 using CCITT polynomial.
func Crc16(msg []byte) uint16 {
res := uint16(0xFFFF)
for _, b := range msg {
res = res<<8 ^ crc16Table[byte(res>>8)^b]
}
return res
}
|
85640668eac63d0831684793f38c3235b6448a4b | e3f86fe0c0944f4aaeca14e99d95ab19c417c319 | toxxin/go-ptp | /syncmsg.go | Go | go | 1,341 | permissive | package ptp
import (
"io"
"time"
)
// SyncMsg ...
type SyncMsg struct {
Header
OriginTimestamp time.Time
}
// MarshalBinary allocates a byte slice and marshals a Frame into binary form.
func (t *SyncMsg) MarshalBinary() ([]byte, error) {
if t.Header.MessageType != SyncMsgType {
return nil, ErrInvalidMsgType
... |
fecf61889d265af10d34451e385b4faa622a2f33 | 6eb0758b0e2d74b3aa49a84db165ed397cf88b41 | karlseguin/lazycache | /missguard_test.go | Go | go | 1,400 | permissive | package lazycache
import (
"fmt"
. "github.com/karlseguin/expect"
"testing"
"time"
)
type MissGuardTests struct{}
func Test_MissGuard(t *testing.T) {
Expectify(new(MissGuardTests), t)
}
func (_ *MissGuardTests) UsesFetcherIfNotGuarded() {
m := NewMissGuard(cloneFetcher, 100, time.Minute)
Expect(m.Fetch("spic... |
8cf805b5f51204fb53c9de0ee1222f8f721289c4 | 513caefe2c552725fcc72df489dc5872bf612416 | deniseschannon/rke | /k8s/k8s.go | Go | go | 2,600 | permissive | package k8s
import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/clientcmd"
)
func NewClient(kubeConfigPath string) (*kubernetes.Clientset, error) {
// use the current admin kubec... |
4ff6ef005bf01e46de650b19d0574714ca52fa63 | 8f2b5966389d1a3c9066c5611e016fec227c4ce8 | styk-tv/terraform-provider-contrail | /contrail/resources/type_qos_queue.go | Go | go | 9,209 | permissive | //
// Automatically generated. DO NOT EDIT.
//
package resources
import (
"encoding/json"
"math/big"
"github.com/Juniper/contrail-go-api"
)
const (
qos_queue_min_bandwidth int = iota
qos_queue_max_bandwidth
qos_queue_qos_queue_identifier
qos_queue_id_perms
qos_queue_perms2
qos_queue_annotations
qos_queue_... |
28024fa2f6f57da6f21a1c37c2572bc05d46ab8f | f8b5f27aaec26335d02f102b2cb8276b11e86f3e | linuxmap/mediathirdparty | /mserver1_71625/src/github.com/deepglint/dgmf/mserver/protocols/rtmp/server.go | Go | go | 4,905 | no_license | package rtmp
import (
"fmt"
"net"
"strings"
"time"
"github.com/deepglint/dgmf/mserver/core"
"github.com/deepglint/dgmf/mserver/protocols/rtmp/av"
"github.com/deepglint/dgmf/mserver/protocols/rtsp"
"github.com/deepglint/dgmf/mserver/protocols/dmi"
uuid "github.com/satori/go.uuid"
)
type RTMPServer struct {
... |
8e465aabd5339f8a8d198a39840ff7de835a5370 | 50a9f6989f0dcbab2b10082c3d30a901a277b93d | shreegowtham27/goHackTools | /28_webChecker/main.go | Go | go | 1,030 | permissive | // if you need check web resource - use it
package main
import (
"fmt"
"log"
"net/http"
"net/url"
"os"
"time"
)
func main() {
// usage
if len(os.Args) == 1 || os.Args[1] == "-h" {
fmt.Fprintf(os.Stdout, "Usage:\t%v url\n", os.Args[0])
fmt.Printf("Output format: write to url.log\n")
os.Exit(1)
}
// v... |
755085a408307f791c31ab95b2429c04b0c7b948 | a04c3a2c5dce08c4161a46aee25b045f719ad1b7 | cheesegrits/assetto-server-manager | /race_control_test.go | Go | go | 36,734 | permissive | package servermanager
import (
"math/rand"
"testing"
"time"
"github.com/cj123/assetto-server-manager/pkg/udp"
)
var (
drivers = []udp.SessionCarInfo{
{
CarID: 1,
DriverName: "Test 1",
DriverGUID: "7827162738272615",
CarModel: "ford_gt",
CarSkin: "red_01",
EventType: udp.EventNewCo... |
931243cb886c3bb9f71546d7d2e076a9ed18e555 | 0a070cfda5ce7bb62fd02202a629ef52ee0a7956 | fluidfractal/activitypub | /ordered_collection_page.go | Go | go | 11,691 | permissive | package activitypub
import (
"errors"
"time"
)
// OrderedCollectionPage type extends from both CollectionPage and OrderedCollection.
// In addition to the properties inherited from each of those, the OrderedCollectionPage
// may contain an additional startIndex property whose value indicates the relative index posi... |
9e4bfbbc22234554a8a558b39e1f0137fee89ebd | 4287637d7bae15a7e44fda3bf7f0023930996602 | eahrend/chester-api | /main.go | Go | go | 29,678 | permissive | package main
import (
"cloud.google.com/go/datastore"
kms "cloud.google.com/go/kms/apiv1"
"cloud.google.com/go/pubsub"
"context"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
models "github.com/eahrend/chestermodels"
log "github.com/sirupsen/logrus"
"google.golang.org/api/idtoken"
"google.golang.org/api/... |
a8684a5eeb4d4436826f0ccde5ed5f8c871d5f19 | 3ebae1154133509e42777d9eca8093a974c25070 | sickhye/hazelcast-go-client | /internal/error.go | Go | go | 1,800 | permissive | // Copyright (c) 2008-2018, Hazelcast, 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 a... |
b253304adfee91734f087ea923667422b8eb41b0 | be1d124f6bc34d06456177139a3f5b7fb18ed862 | aishwaryabk/jaeger | /cmd/opentelemetry/app/defaults/defaults.go | Go | go | 5,424 | permissive | // Copyright (c) 2020 The Jaeger 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... |
f18bf76de97767682c4f4ae000dc0bb500d52c19 | d77c2ce1f79b854f4393a4c39037bf619c147d45 | wenzi1/gf | /database/gredis/gredis_z_unit_conn_test.go | Go | go | 1,519 | permissive | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gredis_test
import (
"context"
"testing"
"github.c... |
eccedc823cdc45699374d6734eeb53a11fbf2128 | 5ccce8519854b63d85296e10fde1c4a39442eb50 | jstrachan/opencomposition | /vendor/k8s.io/client-go/kubernetes/typed/batch/v1/batch_client.go | Go | go | 2,697 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
c5f180e24a087a67a3aea2c67fc415301e32e9d0 | 9dea8d5fdc73ca69a0011f622e5a50ad11ef850a | sxn0508/logit | /encoder.go | Go | go | 4,770 | permissive | // Copyright 2020 Ye Zi Jie. 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 ... |
39e09e611db3aaf04bc71e1eb830c796ec7707f8 | 19a719c04d3ab5d0daae2fe661755c702088470a | dynport/dgtk | /aws-sts/main_test.go | Go | go | 406 | permissive | package main
import "testing"
func TestValidToken(t *testing.T) {
valid := []string{
"123456",
"112233",
}
for _, tok := range valid {
if !validToken(tok) {
t.Errorf("expected token %q to be valid", tok)
}
}
notValid := []string{
"123 456",
"12345",
"12345a",
}
for _, tok := range notValid {
... |
55fd62746f24945794c74333ab42cee5bc02acc8 | fd69be08681f750ca2ea99dd74f1a1dc5bfa2666 | asecurityteam/httplog | /mocks_logger_test.go | Go | go | 2,076 | permissive | // Automatically generated by MockGen. DO NOT EDIT!
// Source: github.com/asecurityteam/logevent (interfaces: Logger)
// nolint
package httplog
import (
logevent "github.com/asecurityteam/logevent"
gomock "github.com/golang/mock/gomock"
)
// Mock of Logger interface
type MockLogger struct {
ctrl *gomock.Contr... |
57c3f10d809284100b648e4d946a5d164c179128 | e6218fb7672a4eee947575160216d47ad8f33fe2 | nikvkov/json_encoding | /server.go | Go | go | 2,979 | no_license | package main
import (
"database/sql"
"encoding/json"
"fmt"
"log"
"net/http"
_ "github.com/go-sql-driver/mysql"
"github.com/gorilla/mux"
)
var database *sql.DB
type API struct {
Message string "json:message"
}
type User struct {
ID int "json:id"
Name string "json:username"
Email string "json:email... |
41a73394a3afe94e6249aed3f42530fd1c233cdf | ec7149fa2c483356b3fdcc37e429182cbea448ae | raid-codex/tools | /cmd/raid-codex-cli/status_effects_rebuild_index/status_effects_rebuild_index.go | Go | go | 1,605 | permissive | package status_effects_rebuild_index
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/juju/errors"
"github.com/raid-codex/tools/common"
"github.com/raid-codex/tools/utils"
"gopkg.in/alecthomas/kingpin.v2"
)
type Command struct {
StatusEffectsDirectory *string
}
func New(cmd *kingpin.C... |
72ccb5d9c77ccc332aa5f729bbd9915291d43302 | d90bd33910cfec50327962d32e7d84588e8e5e27 | anwyho/gophercises | /urlshort/handler.go | Go | go | 2,044 | no_license | package urlshort
import (
"net/http"
"gopkg.in/yaml.v2"
)
// MapHandler will return an http.HandlerFunc (which also
// implements http.Handler) that will attempt to map any
// paths (keys in the map) to their corresponding URL (values
// that each key in the map points to, in string format).
// If the path is not ... |
e2ac2b79fcd4e612afa1962b83d0ac60bd8a059d | f4da4354bfe619cee434e82a9515b52aa999947a | raxbit/ndarray | /ndarray.go | Go | go | 2,112 | permissive | package ndarray
type Array struct {
dims *Shape
Data []float64
Length int
}
// ---------------------------------------------------------------
func (this *Array) DataCopy() []float64 {
d := make([]float64, len(this.Data))
copy(d, this.Data)
return d
}
func (this Array) Dims() (rows, columns int) {
return ... |
eed3173d6fd43c3b3155fc58bfe7552aedead168 | 9cbb8c063ca54233f970dc2b4b805b646e7d5fb7 | cdrx/faktory_cron | /vendor/github.com/contribsys/faktory/storage/rocksdb.go | Go | go | 6,883 | permissive | package storage
import (
"encoding/binary"
"fmt"
"os"
"sort"
"sync"
"sync/atomic"
"regexp"
"github.com/contribsys/faktory/storage/brodal"
"github.com/contribsys/faktory/util"
"github.com/contribsys/gorocksdb"
)
type rocksStore struct {
Name string
db *gorocksdb.DB
opts *gorocksdb.Optio... |
994b91a885bbbfd50beafba053c0353e0de67d06 | 0e7ad595ca97c448c4e5978d07aa14cf790f0bb8 | coma-toast/ResumAPI | /internal/utils/utils.go | Go | go | 1,477 | no_license | package utils
import (
"crypto/sha256"
"fmt"
"math/rand"
"strings"
"github.com/shirou/gopsutil/host"
log "github.com/sirupsen/logrus"
)
type Logger struct {
Log *log.Logger
}
type HealthData struct {
Uptime uint64
}
// HandleErr is to handle general errors with logging
func HandleErr(field string, value st... |
2364fc7d5f430ac8b4ebffe72e6aa2a024f17e37 | a1a68ff89a63e77fc4f585c8e7430687892b44b1 | Saumay-Agrawal/go-livepeer | /cmd/livepeer_cli/wizard.go | Go | go | 7,048 | permissive | package main
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"math/big"
"net/http"
"net/url"
"strconv"
"strings"
"github.com/ethereum/go-ethereum/log"
lpcommon "github.com/livepeer/go-livepeer/common"
"github.com/livepeer/go-livepeer/eth"
)
// // read reads a single line from stdin, trimming if from spaces.
... |
8af54e7cafded104ea5ad021bfbe7cd3f6ec64af | 59c6eacc0a8ea386e07f5bae81c7ab1c3c2f6e40 | fanyang01/rbtree | /walk_test.go | Go | go | 1,406 | no_license | package rbtree
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestWalk(t *testing.T) {
n := 1 << 10
tr := New(CompareInt)
for i := 0; i < n; i++ {
tr.Insert(i)
}
var i int
fn := func(x *Node) bool {
assert.Equal(t, i, x.Value())
i++
return true
}
tr.Walk(VisitFunc(fn))
i = n - 1
... |
38d32de88c4282adaa39892ef0ca9dd0b4e553f2 | d05e17cd6a5c58d3fd5f1debd1ad5e4ea3bf0ca4 | matzhouse/gcloud-golang | /datastore/keys.go | Go | go | 3,287 | 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 applicabl... |
ac14c8019cc0c9b55bf5281ba82d2e0b295b764b | 41143a012f6175dea379b74c0b51c0ccab62141b | timpointer/golang-demo | /web/chat/room.go | Go | go | 2,139 | no_license | // Package main provides ...
package main
import (
"log"
"net/http"
"github.com/gorilla/websocket"
"github.com/stretchr/objx"
"github.com/timpointer/golang-demo/web/trace"
)
const (
socketBufferSize = 1024
messageBufferSize = 256
)
func newRoom() *room {
return &room{
forward: make(chan *message),
join... |
9dd56168c4d7584082654f3a10038d2965ceff48 | b4b8dbd5f7db8c74ef34085c3396a5edeff36d5f | icloudland/starchain | /net/httprestful/common/oauth.go | Go | go | 3,288 | permissive | package common
import (
. "github.com/icloudland/starchain/common/config"
"github.com/icloudland/starchain/common/log"
Err "github.com/icloudland/starchain/net/httprestful/ErrorCode"
"bytes"
"encoding/json"
"io/ioutil"
"net"
"net/http"
"regexp"
"time"
"github.com/icloudland/starchain/errors"
)
var oauthCli... |
39ce8aaf18b3b435999a6ddec678d2d0edde489e | 81b5ad210656ab10b2f001a14b2b0e73e8d77cb4 | maguroguma/go-competitive | /sho-jin/past_contests/codeforces/other/1326C/main.go | Go | go | 6,952 | permissive | /*
URL:
https://codeforces.com/problemset/problem/1326/C
*/
package main
import (
"bufio"
"errors"
"fmt"
"io"
"math"
"os"
"strconv"
)
/********** FAU standard libraries **********/
//fmt.Sprintf("%b\n", 255) // binary expression
/********** I/O usage **********/
//str := ReadString()
//i := ReadInt()
//X ... |
79d281d4d9f8d90aee3210d5687c7af7740c843a | 8f9856e6057924517dcc01f1610f86ee72f2a72d | asauber/cilium | /pkg/k8s/service_cache.go | Go | go | 13,981 | permissive | // Copyright 2018 Authors of Cilium
//
// 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 ... |
ff64e428fc89772ac92542b227ec9b56c18ce92c | a1ea4b97ddfb8123772440d49fbf96553e9f0bcf | waldirborbajr/telegrambot-golang-fsm-example | /callbacks/cmds.go | Go | go | 1,478 | no_license | // handler for slash-commands
// btw, that's a bad idea to store text messages in code
package callbacks
import (
"fmt"
"log"
"strconv"
"strings"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
"fsmExample/consts"
"fsmExample/database"
)
// process /start
func CmdStart(api tgbotapi.BotAPI, updat... |
954b588d62ed48dbfc312e9cabec8de27c6a928d | d3d213d1b2e82d8539b95c12a1b0396f47ce564e | surajrana93/cluster-api-provider-azure | /test/e2e/conformance_test.go | Go | go | 5,240 | permissive | // +build e2e
/*
Copyright 2020 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 ... |
d02d15748c06da55b5ad7b4de6d6015d3285a96c | 3ddffaa4ac7c1106766e0565839b2197aa192bf7 | heping945/gin-demo | /dao/blog.go | Go | go | 1,716 | permissive | package dao
import (
"github.com/jinzhu/gorm"
)
type Post struct {
gorm.Model
Title string `json:"title" gorm:"not null;unique;comment:'标题'"`
Content string `json:"content" gorm:"type:longtext;comment:'内容'"`
MdContent string `json:"md_content" gorm:"not null;type:longtext;comment:'md内容'"`... |
60833c2baae220a0d6c1b3d5722c96baa1674b8f | 68e9c0e73a7f7d5316b369bfcbed5acc5c612a81 | haerong22/bobbycoin | /db/db.go | Go | go | 2,050 | no_license | package db
import (
"fmt"
"os"
"github.com/haerong22/bobbycoin/utils"
bolt "go.etcd.io/bbolt"
)
const (
dbName = "blockchain"
dataBucket = "data"
blockBucket = "blocks"
checkpoint = "checkpoint"
)
var db *bolt.DB
type DB struct{}
func (DB) FindBlock(hash string) []byte {
return findBlock(hash)
}
f... |
c4a8a6b1c52bdf85dacca981657a9dc56e3587bc | 364462b4f237a9ed277507520de2b284d37c4dbe | podhmo/individual-sandbox | /daily/20180406/example_gomvpkg/04highspeed/main.go | Go | go | 4,174 | no_license | package main
import (
"fmt"
"go/ast"
"go/build"
"go/importer"
"go/parser"
"go/token"
"go/types"
"log"
"strconv"
"strings"
"github.com/k0kubun/pp"
"golang.org/x/tools/go/buildutil"
)
func main() {
if err := run(); err != nil {
log.Fatalf("%+v", err)
}
}
func run() error {
ctxt := &build.Default
inp... |
cf9ad81137139716bf47dcf8785c46d8a423048d | a60022c73228b7cd8d6e250affbdb8b257914c15 | test-wiz-sec/pulumi-azure-nextgen | /sdk/go/azure/consumption/v20181001/pulumiTypes.go | Go | go | 43,953 | 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 v20181001
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// The start and end date for a budget.
type BudgetTimePeriod str... |
b66e6eb924011ce521e92204dde459964c6a81e1 | ebbf1ae2232fbc3a86d6fa724693410e24e874b7 | ferdousulhaque/go-basics | /07_loops/main.go | Go | go | 423 | no_license | package main
import "fmt"
func main() {
// fmt.Println("Hello World 222")
i := 1
for i <= 10 {
fmt.Println(i)
i++
}
// Short method
for i := 1; i <= 10; i++ {
fmt.Printf("Number %d\n", i)
}
// FizzBuzz
for i := 1; i <= 100; i++ {
if i%15 == 0 {
fmt.Println("FizzBuzz")
} else if i%3 == 0 {
f... |
453723e1856650c2c57e938a4319e31d5426d546 | 7ae22de1ba5b29f060bd4036302cc9d564b35cb8 | fabiodcorreia/wg-concierge | /internal/wg/serializer/server.go | Go | go | 1,420 | permissive | package serializer
import (
"fmt"
"io"
"io/ioutil"
"regexp"
"github.com/fabiodcorreia/wg-concierge/internal/wg"
)
// Server Interface Properties
var regexServerAddresss = regexp.MustCompile(`Address\s*=\s*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{2})`)
var regexServerPrivKey = regexp.MustCompile(`PrivateKey\s*=\s... |
99745068c31806180d278dd6abccb5bb4d8c30c4 | 857d7415cd9cb4486e05052afb1a7ebdb5820fde | curratore/dockership | /http/handle_status.go | Go | go | 1,093 | permissive | package http
import (
"github.com/mcuadros/dockership/core"
"gopkg.in/igm/sockjs-go.v2/sockjs"
)
type StatusResult struct {
Project *core.Project
Status map[string]*StatusRecord
Error []error
}
type StatusRecord struct {
LastRevisionLabel string
*core.ProjectStatus
}
func (s *server) HandleStatus(msg Mes... |
bfc98a370e27a1cf2e2658dd3ca2bb55398dfae9 | 378a94c992e6340ce93768382739dfb5ce2c26fb | mnezerka/piot-mosquitto-auth | /service/log.go | Go | go | 634 | permissive | package service
import (
"github.com/op/go-logging"
"os"
)
func NewLogger(log_format string, level string) (*logging.Logger, error) {
backend := logging.NewLogBackend(os.Stderr, "", 0)
format := logging.MustStringFormatter(log_format)
backendFormatter := logging.NewBackendFormatter(backend, format... |
568ffce5af23156d02636244808908597ab43793 | 208c191a28c2bf59cc3329a3cbe4ca5f68510094 | jerrywgray/go-spew | /spew/dump.go | Go | go | 13,900 | permissive | /*
* Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" A... |
15113869bc1c6d2a78e0bccd6042f499118fbdf7 | d38fad5a29a90ca2c580b940f58ee0b45378d272 | mauriciocm9/gotch | /vision/aug/sharpness.go | Go | go | 1,824 | permissive | package aug
import (
ts "github.com/sugarme/gotch/tensor"
)
// Adjust the sharpness of the image randomly with a given probability. If the image is torch Tensor,
// it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
// Args:
// sharpness_factor (float): How ... |
8749242e4e11f947a511b332dca1736efcddd1f0 | bd1fd378ececa78d64f6568fee1e6860068a3ade | amolabs/tendermint-amo | /rpc/lib/server/handlers.go | Go | go | 26,128 | permissive | package rpcserver
import (
"bytes"
"context"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"reflect"
"runtime/debug"
"sort"
"strings"
"time"
"github.com/gorilla/websocket"
"github.com/pkg/errors"
amino "github.com/tendermint/go-amino"
cmn "github.com/amolabs/tendermint-amo/libs/common"
... |
480073f1142471bedf9ae063f613a33406d8fa9c | f92b7d49315c90d4fd947f56da07a89ef98be5d5 | weaveworks-experiments/multicast-demo | /main.go | Go | go | 4,257 | no_license | // mweb is a program to demo multicast.
// Run it multiple times on different machines/containers and each
// instance will learn about the others through multicast.
// Hit it via http on port 8080 and it will return a list of instances.
// Flag --iface makes it use (and wait for) a particular interface (e.g. ethwe)
//... |
df4107eadef2080c42dc5ba9e7432ebdd6d213d4 | f4da598e4f2a2b1ac5ef7be8805033e7d265d588 | trizko/linear | /scalardiv.go | Go | go | 669 | permissive | // Copyright 20015 Tony Rizko. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// Package linear contains functions that perform
// linear algebra operations
package linear
import "errors"
// ScalarDiv divides a matrix by a scalar value and... |
d523a9cc577c0105a4300172d1f85d1fdb592048 | 85795efabb05a2573d7adaef068e24eb60d290df | JeanLouiseFinch/otus27 | /calendar/internal/config/app.go | Go | go | 535 | no_license | package config
import (
"github.com/caarlos0/env/v6"
"go.uber.org/zap"
"log"
)
// Additional conf
type AppConf struct {
Build string `env:"APP_BUILD" envDefault:"dev"`
}
func NewAppConf() *AppConf {
c := &AppConf{}
if err := env.Parse(c); err != nil {
log.Fatalf("%+v\n", err)
}
return c
}
// CreateLogger ... |
342827433dc5ae99f9bbb4f2ca2dbf76a2ade8e7 | e26a9f4ccc7b323f1727fd1d95e107b366a10d43 | B5871803/team08 | /backend/controllers/Disease_controller.go | Go | go | 5,353 | no_license | package controllers
import (
"context"
"fmt"
"strconv"
"github.com/dhetporn/team08/ent"
"github.com/dhetporn/team08/ent/disease"
"github.com/gin-gonic/gin"
)
// DiseaseController defines the struct for the disease controller
type DiseaseController struct {
client *ent.Client
router gin.IRout... |
45899508291a287ba8802c2c6838362055b9ab9d | 9909a13bc3257bb652f125105803e550e4cdea6e | modulor/golang_course | /13.metodos/metodos.go | Go | go | 547 | no_license | package main
import (
"fmt"
)
type User struct {
edad int
nombre, apellido string
}
func (this *User) nombre_completo() string {
return this.nombre + " " + " " + this.apellido
}
func (this *User) cambiar_nombre(nuevo_nombre string) {
this.nombre = nuevo_nombre
}
func main() {
mario := new(User)
... |
847e8263e0a4526b4ebe2f90e8fe680c55f28390 | 52b3b83195dcfffd1396720375ebe30212e0d625 | owncloud-ci/drone-cli | /drone/repo/repo_update.go | Go | go | 3,160 | permissive | package repo
import (
"fmt"
"time"
"github.com/drone/drone-cli/drone/internal"
"github.com/owncloud-ci/drone-go/drone"
"github.com/urfave/cli"
)
var repoUpdateCmd = cli.Command{
Name: "update",
Usage: "update a repository",
ArgsUsage: "<repo/name>",
Action: repoUpdate,
Flags: []cli.Flag{
cli... |
0f7ad48e8911020986376fd21b5e9df50902af44 | 3f4bf1bdceb52e833d4e6e33e0ae81428e4c43b7 | JakyriSong/go-learn | /interface/empty-interface.go | Go | go | 337 | no_license | package main
import (
"fmt"
)
func main() {
var i interface{}
describe(i)
s, ok := i.(int)
fmt.Println(s, ok)
i = 42
describe(i)
s, ok = i.(int)
fmt.Println(s, ok)
i = "hello"
describe(i)
f, ok := i.(string)
fmt.Println(f, ok)
}
// describe 接口描述
func describe(i interface{}) {
fmt.Printf("(%v, %T)\n",... |
73d135413724ecb9fd9d197b8cc06a81b31970de | ee8dc4c81fe58721a6c1e1b21bf501968e97d9fa | openshift/openshift-azure | /vendor/k8s.io/kubernetes/pkg/kubelet/kuberuntime/kuberuntime_logs.go | Go | go | 1,189 | 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, ... |
9c09ec2d4a3e68061a42e51064b894fe5cc72460 | 9eea8d954d7bfc4471fd60478b518d2bf21dfc07 | versus/rel | /query.go | Go | go | 7,947 | permissive | package rel
// Querier interface defines contract to be used for query builder.
type Querier interface {
Build(*Query)
}
// Build for given table using given queriers.
func Build(table string, queriers ...Querier) Query {
var (
query Query
)
if len(queriers) > 0 {
_, query.empty = queriers[0].(Query)
}
fo... |
ca900c1baf598896cb0a8bcd9db47c7264c82519 | 0b9b01f2ab22712400560533cd98f7a7ec749082 | wsdl-king/golang-base | /main/jk11.go | Go | go | 4,290 | no_license | package main
import (
"fmt"
"math/rand"
"time"
)
//极客时间第11章,选择器练习
func main() {
//strings := make(chan string, 1)
//单纯的入门选择器
//Selector(strings)
//goToLoopSelector 使用的是 goto var 的关键字 退出外层的for循环
//goToLoopSelector(strings)
//这里测试的是 break loop 退出外层的for循环
//BreakLoopSelector(strings)
//example测试了 for-select-c... |
3d6592830b3b00b9a0e045c18f39ac0f16cbcfe3 | 83317a49b4313a2c252b981d3e640e8559d7b866 | polar9527/leetcode | /leetcode-go/go_case/346.数据流中的移动平均值.go | Go | go | 1,203 | no_license | package go_case
/*
* @lc app=leetcode.cn id=346 lang=golang
* 示例:
*
* 输入:
* ["MovingAverage", "next", "next", "next", "next"]
* [[3], [1], [10], [3], [5]]
* 输出:
* [null, 1.0, 5.5, 4.66667, 6.0]
*
* 解释:
* MovingAverage movingAverage = new MovingAverage(3);
* movingAverage.next(1); // 返回 1.0 = 1 / 1
* movin... |
eba8cbbe22185135cbdec72e8f2a38e0a7d85ef0 | a971519b04e84c340f65f4f3a7abd87cb94ef0fc | d4n13l-4lf4/concurrency-in-go | /chapter03/using_pool.go | Go | go | 354 | no_license | package main
import (
"fmt"
"sync"
)
func main() {
myPool := &sync.Pool{
New: func() interface{} {
fmt.Println("Creating a new instance")
return struct{}{}
},
}
myPool.Get()
instance := myPool.Get()
/* You should put the new instance back in the pool, otherwise the pool does not make sense */
myP... |
6b4659ae4cbf3841834d3ff992cb6f6702dc748c | d1f3e9d9af1a7a0f00972ca866a0543be1aa43d9 | TonyPythoneer/FrameworkBenchmarks | /frameworks/Go/gnet/src/main.go | Go | go | 1,665 | permissive | package main
import (
"bytes"
"flag"
"fmt"
"log"
"runtime"
"time"
"github.com/panjf2000/gnet"
)
type httpServer struct {
*gnet.EventServer
}
type httpCodec struct {
delimiter []byte
}
func (hc *httpCodec) Encode(c gnet.Conn, buf []byte) (out []byte, err error) {
return buf, nil
}
func (hc *httpCodec) De... |
911e3dd31172e19a7b6e86b3861a4168ed0a09ec | 19a23e01232dbef4669cd0b9229d1af41d41f7d3 | corbmr/unit-bot | /unit.go | Go | go | 2,138 | no_license | package convert
import (
"fmt"
"strings"
"sync"
"time"
"github.com/patrickmn/go-cache"
)
var (
// InitCurrency registers a callback to retrieve the apiKey for registering currencies
// Currencies are lazily loaded only when needed
CurrencyInit func() (string, error)
)
var (
unitMap map[string]UnitType
un... |
f2adebf98b7f07efd95b8406b8195057a4231ef4 | c8943cf781792f71d8ce86a90861815063a8acd6 | pinelli/module-golang | /ex07-container/container_test.go | Go | go | 1,472 | no_license | package main
import (
"io"
"strings"
"testing"
"github.com/rendon/testcli"
)
//If the test doesn't compile on your machine try to run 'go get github.com/rendon/testcli' first
func TestBuild(t *testing.T) {
c := testcli.Command("go", "build", "-o", "container")
c.Run()
if !c.Success() {
t.Fatalf("[ERROR]: T... |
8f16edf3d9593e61e4d1c10956001bfa29a39371 | 07999ec455493455a84673eb2a61f9bd7582cbd7 | Tenbagger/clash | /rule/ipset.go | Go | go | 986 | permissive | package rules
import (
"github.com/Dreamacro/clash/component/ipset"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/log"
)
type IPSet struct {
name string
adapter string
noResolveIP bool
}
func (f *IPSet) RuleType() C.RuleType {
return C.IPSet
}
func (f *IPSet) Match(metadata *... |
03c0e60576712f6c5feeb2eb60529b1099cc0d05 | 5796f825dae80aee4ad131e98cbc38e592e3fcb8 | peter-c-larsson/istio | /pkg/test/framework/components/istio/istio.go | Go | go | 2,484 | permissive | // Copyright 2019 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 i... |
af1140f29988bed9c9bad8651cbfca8fa0f5315f | da9397002fd72be70743bdaa8702aa9c65dee2a5 | isabella232/bosh-deployment-resource | /vendor/google.golang.org/api/adexchangebuyer/v1.3/adexchangebuyer-gen.go | Go | go | 161,470 | permissive | // Copyright 2020 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 adexchangebuyer provides access to the Ad Exchange Buyer API.
//
// For product documentation, see: https://developers.google.com/ad-exc... |
edc4cd78d38694947148bd9c8425595fa9c76525 | 365cf7938fb0a00c167628c77ab6e3ec1e8f745e | tarantool/cartridge-cli | /cli/failover/setup.go | Go | go | 1,832 | permissive | package failover
import (
"fmt"
"os"
"path/filepath"
"github.com/apex/log"
"github.com/tarantool/cartridge-cli/cli/common"
"github.com/tarantool/cartridge-cli/cli/context"
"github.com/tarantool/cartridge-cli/cli/project"
"gopkg.in/yaml.v2"
)
const (
defaultFailoverParamsFile = "failover.yml"
)
func Setup(c... |
c36d82bd281b81e712a39275a73ecd31803168b4 | 0014b7e8a3c98f2e65040fdc17432d4a966d2bcd | otomato-gh/supergloo | /pkg/util/getters.go | Go | go | 1,282 | permissive | package util
import (
v1 "github.com/solo-io/supergloo/pkg/api/v1"
)
func getLinkerdMeshForInstall(install *v1.LinkerdInstall, meshes v1.MeshList, namespace string) *v1.Mesh {
for _, mesh := range meshes {
linkerdMesh := mesh.GetLinkerd()
if linkerdMesh == nil {
continue
}
if linkerdMesh.InstallationNam... |
3c9e205e43d70fc9561fe27025fe823f3c97ac93 | 67bf956e5b68eb392c02d46f24ec0c821110a29d | alien01/onecloud | /pkg/multicloud/huawei/bucket.go | Go | go | 5,357 | permissive | // Copyright 2019 Yunion
//
// 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 writi... |
882373b0dcad1e78bc85806f85e3ff2a7b207491 | b366671af179a6ed5c94d8f9c39b4c14cca96f08 | lijiangbo/easyagent | /internal/server/api/impl/ssh.go | Go | go | 4,393 | permissive | package impl
import (
apibase "easyagent/go-common/api-base"
"easyagent/internal/server/log"
sshs "easyagent/internal/server/ssh"
. "easyagent/internal/server/tracy"
"github.com/kataras/iris/context"
)
func CheckByUserPwd(ctx context.Context) apibase.Result {
InstallProgressLog("[INSTALL] CheckByUserPwd ...%v"... |
c04e34f1d9cdfcba2a7afbf74ce1f50afb07a4d4 | 79e62fec1ef9353785921e159508a0f93f1ffabb | outprog/gozx | /client/weth_test.go | Go | go | 532 | no_license | package client
import (
"testing"
)
func TestWethDeposit(t *testing.T) {
// nonce, err := TestClient.Nonce()
// require.NoError(t, err)
// txHash, err := TestClient.WethDeposit(big.NewInt(100000000000000000),
// big.NewInt(100000), nonce)
// fmt.Println(txHash.Hex(), err)
}
func TestWethWithdraw(t *testing.T)... |
0ffdb42358f0e7a756c8ed720e8e81bfa857f83a | f0a19727649e6b4061d9d212a195d1afe1f231a9 | cookieY/tidb | /table/tables/tables_test.go | Go | go | 13,100 | 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... |
2ade5f2bbe080bdceb74aa278560e73303806c22 | 2f2627e35f33dd3c4a75a742b7e1aa3212407d22 | hchenxa/cluster-api-provider-openstack | /pkg/cloud/openstack/services/userdata/kubeadm.go | Go | go | 6,927 | permissive | package userdata
import (
"fmt"
"k8s.io/klog"
kubeadmv1beta1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
providerv1 "sigs.k8s.io/cluster-api-provider-openstack/pkg/apis/openstackproviderconfig/v1alpha1"
"sigs.k8s.io/cluster-api-provider-openstack/pkg/cloud/openstack/services/certificates"
"sigs.k8s.... |
e589af124b394e1556262f7b199554e70b653a03 | a6f370872618dd23d627d7107c4064bbca80265b | sosomaziro/leetcode-go | /zConvert.go | Go | go | 821 | no_license | package main
/*
将一个给定字符串根据给定的行数,以从上往下、从左到右进行 Z 字形排列。
*/
func main() {
println(reverse(1534236469))
println(convert("abcdef", 2))
}
func reverse(x int) int {
if x > 2147483647 || x < -2147483648 {return 0}
result := 0
for x != 0 {
result = result*10 + x%10
x = x / 10
}
if result > 2147483647 || result < -21... |
f66f0b8f31949d54ebfe702099703eeaa746b307 | 00de2e1ef267a096a290b32e4128e29bfc49b62a | jknostman3/pinniped | /internal/controller/authenticator/authncache/cache.go | Go | go | 2,991 | permissive | // Copyright 2020 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Package authncache implements a cache of active authenticators.
package authncache
import (
"context"
"fmt"
"sort"
"sync"
"k8s.io/apiserver/pkg/authentication/authenticator"
"k8s.io/apiserver/pkg/authent... |
614b6006e8b5a73b0d12031acefd41d4b52ccb3b | d5e7f5f10c2abc5b340b318e37cd91d1d52d966a | Laisky/go-fluentd | /internal/controller/acceptor.go | Go | go | 3,048 | permissive | package controller
import (
"context"
"fmt"
"sync"
"gofluentd/internal/recvs"
"gofluentd/library"
"gofluentd/library/log"
utils "github.com/Laisky/go-utils"
"github.com/Laisky/zap"
)
// AcceptorCfg is the configuation of Acceptor
type AcceptorCfg struct {
MsgPool *sync.Pool
Journ... |
cfe860ef02108928bf7a62d6589ac3abb422fd55 | 42cda2021a382bf1d32c94fbb8cffdf5955949e2 | thanosKontos/gravelmap | /kml/kml_test.go | Go | go | 1,556 | no_license | package kml
import (
"bytes"
"testing"
"github.com/stretchr/testify/assert"
"github.com/thanosKontos/gravelmap"
)
func TestEmptyLegError(t *testing.T) {
b := new(bytes.Buffer)
routingLegs := []gravelmap.RoutingLeg{}
kml := NewKml()
err := kml.Write(b, routingLegs)
assert.NotNil(t, err)
}
func TestKmlGene... |
d760b54b2ade1636b15db2c12b78adbc31b504dd | c93361ffb0602ee2c13d6040b1be574fab5b7ebd | joshuaquek/fabric | /orderer/consensus/etcdraft/node.go | Go | go | 6,647 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package etcdraft
import (
"context"
"crypto/sha256"
"sync"
"sync/atomic"
"time"
"code.cloudfoundry.org/clock"
"github.com/gogo/protobuf/proto"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/pr... |
fbc895044d3c91cf5f1c2094587e4ae55bba090a | 9e22233cb632cf7c437a0c91722c9afffb3e4738 | hectorj2f/multi-tenancy | /incubator/virtualcluster/pkg/syncer/resources/namespace/dws_test.go | Go | go | 7,853 | permissive | /*
Copyright 2020 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, ... |
6c86811d37b25bc00f2cbbebf759b48d1223a1ae | eca7196ac30a7e05ee43d6ec081e6b5f3cbe409c | idoshveki/magma | /symphony/graph/ent/project_query.go | Go | go | 29,255 | permissive | // Copyright (c) 2004-present Facebook All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated (@generated) by entc, DO NOT EDIT.
package ent
import (
"context"
"database/sql/driver"
"errors"
"fmt"
"math"
"github.com/facebo... |
958e3df3ac0154b834e5860e3096dbf721395730 | daaacdbc37ce6c69358403d5345110e5686391c6 | jess2020github/homenet-1 | /pkg/presence/client.go | Go | go | 4,682 | permissive | // Package presence provides a client for a ./cmd/wifi-presence
// server.
// https://github.com/awilliams/homenet/tree/master/cmd/wifi-presence
package presence
import (
"context"
"encoding/json"
"errors"
"path"
"sync"
"time"
"github.com/awilliams/homenet/cmd/wifi-presence/api"
"github.com/awilliams/homenet/... |
47281834eb16951b7080b8c00df603b5d9fa4933 | 5b35b175781a77fe9aa6cd660c7d398758a05d39 | m3db/m3 | /src/x/watch/watch.go | Go | go | 4,100 | permissive | // Copyright (c) 2016 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... |
a049da8a0ace8a7c7e4d41d18d6d1b6fb848fae4 | a8a200ff91255520451dc4a1a0ed0c759adee8aa | milhamh95/golang-clean-code-v2 | /domain/department.go | Go | go | 1,467 | no_license | package domain
import (
"context"
"time"
)
// DepartmentFilter represent query filter
type DepartmentFilter struct {
IDs []string
Keyword string
Num int
Cursor string
}
// Department represent department data
type Department struct {
ID string `json:"id"`
Name string `json:"nam... |
0c64947ab2c93b4c530e69e28bf21492d8384ccc | a5345fa6502bd09bcddf1abc1a2825c94898cd39 | williamhgough/go-admin | /main.go | Go | go | 339 | no_license | package main
import (
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
_ "github.com/mattn/go-sqlite3"
"github.com/williamhgough/go-admin/helpers"
)
func main() {
// Create new database instance
helpers.InitDB("storage.db")
e := echo.New()
e.Use(middleware.Logger())
e.Static("/", "build")
... |
3544c6ccbccdd3c41740188c6dd90f509ee3f11b | e1f95915be8fd675c9171ec4c528b7912dbe2694 | XuanMaoSecLab/DolphinChain | /libs/test/mutate.go | Go | go | 701 | permissive | package test
import (
cmn "github.com/XuanMaoSecLab/DolphinChain/libs/common"
)
// Contract: !bytes.Equal(input, output) && len(input) >= len(output)
func MutateByteSlice(bytez []byte) []byte {
// If bytez is empty, panic
if len(bytez) == 0 {
panic("Cannot mutate an empty bytez")
}
// Copy bytez
... |
9e93f16de0d4c01058cc5beec7a67b5902f15cbd | a376356a86614128ca1960a8fc3f1591d8cba820 | CodeLingoBot/gocryptfs | /main.go | Go | go | 9,636 | permissive | package main
import (
"fmt"
"log"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"github.com/hanwen/go-fuse/fuse"
"github.com/rfjakob/gocryptfs/internal/configfile"
"github.com/rfjakob/gocryptfs/internal/contentenc"
"github.com/rfjakob/gocryptfs/internal/exitcodes"
"github.com/rfjakob/gocryptfs/inter... |
c20810fef639a5b77330f049b3e84b356fb52ee4 | 0b862cff5c991b17115b43ac675b348881163e69 | tony2001/prometheus | /tsdb/db_test.go | Go | go | 97,100 | permissive | // Copyright 2017 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... |
84f6a8ba9895a237713e0bda1230015a58528f93 | 1f1e130b8468a9e83f32b02ce44566b9b0ece9be | simar7/gokv | /dynamodb/dynamodb_bench_test.go | Go | go | 7,296 | no_license | package dynamodb_test
import (
"context"
"errors"
"fmt"
"math/rand"
"sync"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/endpoints"
awsdynamodb "... |
770ed3a37f565ad0d0d6f440da77548ca7141a8b | 2d4553b9261aa18f6c11f47a361bf506aa18d1f8 | LinMAD/BitAccretion | /vendor/github.com/mum4k/termdash/internal/segdisp/segment/segment.go | Go | go | 13,733 | permissive | // Copyright 2019 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... |
a241cccb4c4599266d81cecc7586f90dc93288b7 | 40da1b5d2f9c206526598df4038a43ec3faafbb5 | jcimafranca/platform-client-sdk-cli | /build/gc/models/webmessagingchannel.go | Go | go | 1,416 | permissive | package models
import (
"time"
"encoding/json"
"strconv"
"strings"
)
var (
WebmessagingchannelMarshalled = false
)
// This struct is here to use the useless readonly properties so that their required imports don't throw an unused error (time, etc.)
type WebmessagingchannelDud struct {
From We... |
e7c6def2dc9971654c575703d95f8e7c96476a0a | 0b79c955090c9cb230b14ea3496faf8f77647324 | jjdevbiz/factomd | /btcd/addrmgr/addrmanager.go | Go | go | 29,130 | permissive | // Copyright (c) 2013-2014 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package addrmgr
import (
"container/list"
crand "crypto/rand" // for seeding
"encoding/base32"
"encoding/binary"
"encoding/json"
"fmt"
"io"
"math/rand"
"net"
... |
35a383532212b80bd735d2fcdebbc342121c6a4e | 8d08dd20ed7c98de5d72ee3c7aae7ae2fcb5620c | AccelByte/accelbyte-go-sdk | /social-sdk/pkg/socialclient/user_statistic/bulk_create_user_stat_items_responses.go | Go | go | 4,843 | permissive | // Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.
// Code generated; DO NOT EDIT.
package user_statistic
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"strings"
"github.com/go-... |
c22da8f582ef59c19f380e5edf43f49a83930817 | 49e30cfdf268b31bc010dd43e2b530a387fa9cc3 | kubernetes/kops | /vendor/github.com/digitalocean/godo/storage_actions.go | Go | go | 4,144 | permissive | package godo
import (
"context"
"fmt"
"net/http"
)
// StorageActionsService is an interface for interfacing with the
// storage actions endpoints of the Digital Ocean API.
// See: https://docs.digitalocean.com/reference/api/api-reference/#tag/Block-Storage-Actions
type StorageActionsService interface {
Attach(ctx... |
600cda85586ccc8acd39d056bb88080726f06a0d | 2a2dc33c756831e67b4ff02f18ff3d466d6d4d93 | datafordevelopment/brog | /brogger/post.go | Go | go | 3,606 | permissive | package brogger
import (
"bytes"
"encoding/json"
"fmt"
"github.com/russross/blackfriday"
"io/ioutil"
"net/url"
"os"
"strings"
"time"
)
type post struct {
filename string
id string
Title string `json:"title"`
Date time.Time `json:"date"`
Author string `json:"author"`
Invisible b... |
b2fbd1415b3b72696607139fb5b456db9013b6c3 | e4401de272f685937c74c606f26ac46538aa8754 | tarkalabs/pgdboperator | /cmd/pgdboperator/main.go | Go | go | 958 | no_license | package main
import (
"context"
"runtime"
stub "github.com/tarkalabs/pgdboperator/pkg/stub"
sdk "github.com/operator-framework/operator-sdk/pkg/sdk"
k8sutil "github.com/operator-framework/operator-sdk/pkg/util/k8sutil"
sdkVersion "github.com/operator-framework/operator-sdk/version"
"github.com/sirupsen/logrus... |
d4fb2ed571af409a0a062503bd24b8146f3ab31e | d840d90658520ed658fffb6f2c9ffc1443a67896 | paulfantom/argo-cd | /util/kustomize/kustomize.go | Go | go | 9,481 | permissive | package kustomize
import (
"fmt"
"net/url"
"os"
"os/exec"
"path/filepath"
"regexp"
"sort"
"strings"
"sync"
"github.com/Masterminds/semver"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"g... |
f5f35f65988b08371b6173a454574d5c3aefb64c | 56e80d1e793e7ffd3d0662adb51e508f435172be | tarekbadrshalaan/modelgen | /modelgen-concept/concept-api/bll/CategoryBLL.go | Go | go | 1,569 | permissive | package bll
import (
"strconv"
"github.com/tarekbadrshalaan/modelgen/modelgen-concept/concept-api/dal"
"github.com/tarekbadrshalaan/modelgen/modelgen-concept/concept-api/dto"
)
// ConvertCategoryID : covnert CategoryID string to CategoryID int32.
func ConvertCategoryID(str string) (int32, error) {
pram, err := ... |
5fb94725f3530769babee2f7157d2da836608505 | b94be8a5e1ecf649ca17dadea3efef53755817f4 | h2atecnologia/clusterlint | /checks/doks/admission_controller_webhook_timeout.go | Go | go | 3,670 | permissive | /*
Copyright 2020 DigitalOcean
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... |
640ab840db424fbc760a2ce4f4e166706fd0fc43 | 2c3946bceda07099fd804b35dab558313dbb9b80 | darrylwest/cassava-logger | /socket-logger/main.go | Go | go | 1,321 | permissive | package main
import (
"flag"
"fmt"
"github.com/darrylwest/cassava-logger/logger"
"os"
)
var logFile = flag.String("logfile", "./logd.log", "file to log")
var logType = flag.String("logtype", "common", "log file handler type: common, rotating, timerotating")
var rotatingMaxSize = flag.Int("size", 1024*1024*1024, "... |
63ed9eaf8afb27bc7d03af448f8444a3a7325df9 | b5875069663701375613268309fa9edd87bf48ef | elvinchan/rpcx | /share/context.go | Go | go | 1,198 | permissive | package share
import (
"context"
"fmt"
"reflect"
)
// var _ context.Context = &Context{}
// Context is a rpcx customized Context that can contains multiple values.
type Context struct {
tags map[interface{}]interface{}
context.Context
}
func NewContext(ctx context.Context) *Context {
return &Context{
Contex... |
1c7fb70e8d077e89187b68231052be10debe4960 | 1b9239065d3a886d55ee6593ada4be030751554e | succi0303/gopl.io | /ch2/boiling/boiling.go | Go | go | 218 | no_license | // Boiling prints hte boiling boint of water
package main
import "fmt"
const boilingF = 212.0
func main() {
var f = boilingF
var c = (f - 32) * 5 / 9
fmt.Printf("boiling point = %g F or %g C\n", f, c)
}
|
448f16d23a8ad81930cc942bfaa6c85f113b0a1f | 9ef1199e488f191d514ee575139aafeac6faaa1e | mayflower/unifi_exporter | /devicecollector.go | Go | go | 10,947 | permissive | package unifiexporter
import (
"log"
"time"
"github.com/mdlayher/unifi"
"github.com/prometheus/client_golang/prometheus"
)
// A DeviceCollector is a Prometheus collector for metrics regarding Ubiquiti
// UniFi devices.
type DeviceCollector struct {
Devices *prometheus.Desc
AdoptedDevices *prometheus... |
7882fb6eaf4d411971236700b72a43c08f468ccc | 319a390cad3151c51e0911a23acf9d80b46bc47e | rezacsedu/bbmri-fhir-gen | /gen/bodyHeight_test.go | Go | go | 1,718 | permissive | // Copyright © 2019 The Samply Development Community
//
// 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 applicab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.