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 |
|---|---|---|---|---|---|---|---|---|
1d3ccd91c3134f3d72bf89e04b97340febe49ac7 | 745938e93bedde7581ac447672f6db9b790b245b | moooyo/GoJudgeWeb | /common/socket.go | Go | go | 1,861 | no_license | package common
import (
"bufio"
"io"
"net"
"time"
)
type Socket struct {
wbuf *bufio.Writer
rbuf *bufio.Reader
conn net.Conn
}
func Dial(addr string) (*Socket, error) {
conn, err := net.Dial("tcp", addr)
if err != nil {
return nil, err
}
return &Socket{
conn: conn,
wbuf: bufio.NewWriterSize(conn, 4... |
ada47ce26d1ff324cc5880189ff0ec39b14269d9 | 12a5c408e56da7207585031f733d9118d794c54f | VonRosenchild/arktos | /staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/virtualmachine.go | Go | go | 17,107 | 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, ... |
08cdbeb869ce95cb33ec61074a6b0f93fb31df53 | ac35ef4b73fa94d6076256ccdc01cf8a4fab35cb | rchamorro/pulumi-azure-nextgen | /sdk/go/azure/network/v20170301/getNetworkSecurityGroup.go | Go | go | 2,130 | 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 v20170301
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func LookupNetworkSecurityGroup(ctx *pulumi.Context, args *LookupNetworkSecurityGroupArg... |
13074ee393cd52d5fed7e55f1f333f9045577b15 | ab6b13a62892fd2b1873886ca76edf02339e19d6 | BenLampson/iris | /_examples/http_request/read-yaml/main_test.go | Go | go | 628 | permissive | package main
import (
"testing"
"github.com/kataras/iris/httptest"
)
func TestReadYAML(t *testing.T) {
app := newApp()
e := httptest.New(t, app)
expectedResponse := `Received: main.product{Invoice:34843, Tax:251.42, Total:4443.52, Comments:"Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338."}... |
3ddb353db3b738dd1daa0f05584ba7ff7edf2371 | de35e193cbecbd3f6dce26694b9e562d83cd0d9d | suzuki-shunsuke/github-pr-prometheus-exporter | /main.go | Go | go | 4,378 | permissive | package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"strconv"
"strings"
"time"
"github.com/google/go-github/github"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"golang.org/x/oauth2"
)
type PR struct {
Number *int
Labels ... |
8c2da987917be1c8cd1d45f12be6233c83792141 | 2c7ba08a9d6642c8312e87680ddbc40074aeec95 | StephanRP/RestSql | /pkg/api/api.go | Go | go | 4,256 | no_license | package api
import (
"RestSQL/pkg/config"
"RestSQL/pkg/connLog"
"RestSQL/routes"
"database/sql"
"encoding/json"
"fmt"
"log"
"net/http"
"strconv"
"time"
_ "github.com/go-sql-driver/mysql"
"github.com/gorilla/mux"
)
var memberResponse []routes.Member
//Write to use route to determine which call to make
fu... |
83eab3f110e2e7f7c50cf815365d8fc348abb1e1 | e56d2d725bb66273c0ef856c81e25d97f2399c0d | CenturyLinkLabs/docker-reg-client | /registry/doc.go | Go | go | 1,895 | permissive | /*
Package registry is an API wrapper for the Docker Registry v1 API and supports
all of the documented operations, including: getting/putting images, retrieving
repository tags, and executing searches.
Full documentation for the Docker Registry API can be found here:
https://docs.docker.com/reference/api/registry_ap... |
d6a991f27d4a55b31ace61cc241102065c77a91b | 4da185d25cd9a1c46a37f28308075cca755d2346 | niranjanative/osm | /pkg/endpoint/providers/kube/client.go | Go | go | 7,862 | permissive | package kube
import (
"net"
mapset "github.com/deckarep/golang-set"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/kubernetes"
"github.com/openservicemesh/osm/pkg/configurator"
"github.com/openservicemesh/osm/pkg/endpoint"
"github.com/openservicemesh/o... |
60390fcea6a0a1de902bcd2b92b40dd9ffe4805b | cbf018f27895af4a0d067293775a243acbe19f91 | onflow/cadence | /runtime/ast/argument.go | Go | go | 2,304 | permissive | /*
* Cadence - The resource-oriented smart contract programming language
*
* Copyright Dapper Labs, 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/l... |
0cf790b74c597f9e6cb18136ec06a6e60a731758 | 5bf4dd7b1c6a10d32cc3b14bc2bcc0e686f90cf5 | GERey/yarpc-go | /serialize/serialize_test.go | Go | go | 4,814 | permissive | // Copyright (c) 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
9b7d7b6ab50a7a14ecda679a969a52477844a680 | 1631f400fc5130c065a75e70dff64e26749eea47 | hattaya92/finalexam | /database/database.go | Go | go | 307 | no_license | package database
import (
"database/sql"
"log"
"os"
_ "github.com/lib/pq"
)
var db *sql.DB
func ConnDB() *sql.DB {
if db != nil {
return db
}
var err error
db, err = sql.Open("postgres", os.Getenv("DATABASE_URL"))
if err != nil {
log.Fatal("connect database error : ", err)
}
return db
}
|
136288cc0ef13564c2385397298033b5d308175e | 9b2bee5da54f1e3c97f43c09c181f52986d4fd9a | ishibashi-futos/tacos | /post.go | Go | go | 902 | permissive | package main
import (
"fmt"
"log"
mm "github.com/mattermost/mattermost-server/model"
)
func ephemeralPost(destination string) Response {
model := new(Response)
model.ResponseType = "ephemeral"
model.UserName = "お令和"
model.Text = fmt.Sprintf("了解トク! %s さんに感謝を伝えたトク!", destination)
return *model
}
func thanksMe... |
db118aa3424978f7ec9d8848b60db78ac49145b9 | 5ad28aaf6883aa89b7c114427f15538fcc1756fb | jfktrey/minimega | /src/ron/ron.go | Go | go | 4,152 | no_license | // Copyright (2015) Sandia Corporation.
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
package ron
import (
"io"
log "minilog"
"minitunnel"
"net"
"sync"
"time"
)
// Ron message types to inform the mux on either end how t... |
ffba7f01ed523159a1f4d104a7cc14acf978555f | 83ef2a5bc6829e24813ec6b37d2592b072476855 | Anuj16091996/Go_Language | /Ex5/Ex5.27.go | Go | go | 726 | no_license | package main
import (
"fmt"
)
func main() {
var accident int
var oldpremium float64
fmt.Print("Enter The Number of accident- ")
fmt.Scan(&accident)
fmt.Print("Enter The Old premium- ")
fmt.Scan(&oldpremium)
NewPremimum:=PermiumAmount(accident,oldpremium)
fmt.Println("New Premium is ", NewPremimum)
}
... |
91ce5f5b5a896fca4f1dd0eb9df8bc080931b604 | 3155dc6e7e914643a03ad02293609e79ee305d98 | dimagv/gorets | /util/metadata_incremental.go | Go | go | 2,409 | no_license | package util
import (
"context"
"errors"
"strings"
"github.com/jpfielding/gorets/metadata"
"github.com/jpfielding/gorets/rets"
)
// IncrementalCompact loads rets.CompcatMetadata in pieces
type IncrementalCompact rets.CompactMetadata
type cmgetter func(string, string) (*rets.CompactMetadata, error)
// GetCompa... |
6e64d0bbd27f1cea8d96cd7b9eb130240eab00ba | 0c213781ebc21cbfd59958edc57d7dd6e4b0549f | jeepli/demo | /util/util.go | Go | go | 244 | no_license | package util
func Sub(slice1, slice2 []int64) []int64 {
m := make(map[int64]bool)
for _, val := range slice2 {
m[val] = true
}
r := make([]int64, 0)
for _, val := range slice1 {
if !m[val] {
r = append(r, val)
}
}
return r
}
|
9f8a37cc88c2d66f9a3312fdda11324ae3f3dcf9 | 5cf2d01690da6887fdad80b84285b3e72963d1e8 | mostlylikeable/server | /database/sqlite/worker.go | Go | go | 2,941 | permissive | // Copyright (c) 2021 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
package sqlite
import (
"errors"
"github.com/go-vela/server/database/sqlite/dml"
"github.com/go-vela/types/constants"
"github.com/go-vela/types/database"
"github.com/g... |
7196dc515b7e8eac834777dccad0de89e20e59cb | f70781e0328ccd7d376a92dead2d5a116a0f39e3 | sangwoo310/go_blockchain | /main.go | Go | go | 237 | no_license | package main
import (
"fmt"
"go_blockchain/factory"
"log"
)
func main() {
fmt.Println("This is the blockchain")
c, err := factory.GetCoinInstance("btc")
if err != nil {
log.Fatalln(err)
}
c.PublicKeyToAddress()
c.Sign()
}
|
88e337efb3b61cca8646cde4516e49a66fb451c7 | 4cceef374bce6929ebf9002e38bc3dda9a8abb7a | fgehrlicher/reddit-comments | /pkg/prompt/prompt.go | Go | go | 1,395 | no_license | package prompt
import (
"fmt"
"github.com/AlecAivazis/survey/v2"
"github.com/fgehrlicher/reddit-comments/pkg/io"
)
type Result struct {
DataDir string
InputFiles []string `survey:"input files"`
OutputFile string `survey:"output io"`
chunkSize int64 `survey:"chunk size"`
workerCount int `survey:"worker... |
4f108925ee4d0c60ee6c4dfcc02c7f4e5863f6b2 | 0747b6b56463f3a35c899333dcc48dcc1130e163 | sosiouxme/coreos-assembler | /mantle/vendor/github.com/coreos/butane/config/openshift/v4_9_exp/result/schema.go | Go | go | 1,536 | permissive | // Copyright 2021 Red Hat, Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... |
a439894a45c4eb34a0f2624bc543e7ceb295bec9 | d9ad319de2882f9f418f3e5d03c0b044b66c69c9 | loomnetwork/blockatlas | /platform/nebulas/client.go | Go | go | 1,166 | permissive | package nebulas
import (
"github.com/trustwallet/blockatlas/pkg/blockatlas"
"net/url"
"strconv"
)
const TxTypeBinary = "binary"
type Client struct {
blockatlas.Request
}
func (c *Client) GetTxs(address string, page int) ([]Transaction, error) {
values := url.Values{
"a": {address},
"p": {strconv.Itoa(page)... |
2d01f0433ab9096dcb1545787174fec628efbf85 | 6f38a306fbf127ffcd5a4d09a3da9e9b58f7cd3f | Gravity-Tech/gravity-node-api | /migrations/16_sign_new_consuls_transactions.go | Go | go | 1,025 | no_license | package main
import (
"fmt"
"github.com/Gravity-Tech/gravity-node-api/migrations/common"
"github.com/Gravity-Tech/gravity-node-api/model"
"github.com/go-pg/migrations"
)
func init () {
tableName := model.DefaultExtendedDBTableNames.SignNewConsulsTable
migrations.MustRegisterTx(
func(db migrations.DB) error {... |
add7a9c54039612f4787000f894a80400083fa96 | 1693d522c278f01f076d5699d6f2d0b0a3fed305 | QPC-database/amazon-ecs-cluster-state-service | /handler/regex/extract.go | Go | go | 1,649 | permissive | // Copyright 2016-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "lic... |
68ec50192a527afb035ec6524be94a89c44f7fe2 | 2d820d786e10f07ffb5eb8629263caed7b3f23da | stevenwilkin/soa-ruby-go | /Godeps/_workspace/src/github.com/pilu/traffic/route_test.go | Go | go | 2,956 | permissive | package traffic
import (
"testing"
"regexp"
"net/url"
"reflect"
assert "github.com/pilu/miniassert"
)
func httpHandlerExample(r ResponseWriter, req *Request) {}
func httpHandlerExample2(r ResponseWriter, req *Request) {}
func TestNewRoute(t *testing.T) {
path := "/categories/:category_id/posts/:id"
rou... |
4c3295480031be95010ada0732b08a01a0825b52 | 3096e9285d58f14fcb95ace9301a98f520d3f9e3 | jhump/google-cloud-go | /internal/generated/snippets/automl/apiv1/Client/GetAnnotationSpec/main.go | Go | go | 1,274 | permissive | // Copyright 2021 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 ... |
f1ebd8fd63dbde5503f792006a677b845e455b17 | 08070f9a11d98567bf6f499e971f43dad059063b | Qesy/go-framework | /websocket/websocket.go | Go | go | 4,688 | no_license | package websocket
import (
"fmt"
"net"
"reflect"
"strings"
"time"
"github.com/Qesy/qesygo"
"golang.org/x/net/websocket"
)
// Entry 结构
type Entry struct {
Conn *websocket.Conn
UID string
Act string
Data map[string]string
}
// MsgStr 消息结构体
type MsgStr struct {
Act string
Data map[string]string
}
// S... |
534ec0a76c655d80a97900fb3dbbfed55566ca52 | 7234243beea9e1bb8bf5f74b868eb0cd37c0e463 | 5l1v3r1/fuzz-monkey | /monkey.go | Go | go | 3,246 | permissive | package main
import (
"fmt"
"math/rand"
"time"
"os"
)
// MaxTimeBetweenAttacks is max time in seconds between two attacks when running in the background.
var MaxTimeBetweenAttacks = 60
// AttacksStrategy is a map of attack names to attacks for use as a strategy pattern.
var AttacksStrategy = map[string](func(end... |
5e05fe924d49c8ccb3f23849cff3c37283009b06 | 092df5ac4884c72c0204b2ec1340574febb4e0d1 | ervitis/govalidate | /check/checkgo.go | Go | go | 1,813 | permissive | // Copyright 2020 The Go 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 check
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"os/exec"
"strings"
)
const versionsURL = "https://raw.githubusercontent.com/rakyll/govalidate/... |
5ad24275e9f6e093c48ba489237b0f11dbc70dd1 | 40c97aeb4f873639385057f7ca86cd1d36380dd1 | hyperledger-labs/fabric-block-archiving | /integration/sbe/sbe_test.go | Go | go | 15,855 | permissive | /*
Copyright IBM Corp All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package sbe
import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"strings"
"syscall"
docker "github.com/fsouza/go-dockerclient"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric/integration/... |
3108ec02c38f9abef1a4218bfcb57bf69f9c7496 | 9d6ae1f5797f16653db306cac37d0b284e2ad25c | TheStarBoys/implement-algorithms-with-golang | /practice/interview_question/剑指offer/05替换空格.go | Go | go | 214 | no_license | package offer
func replaceSpace(s string) string {
ans := []byte{}
for i := range s {
if s[i] == ' ' {
ans = append(ans, []byte("%20")...)
} else {
ans = append(ans, s[i])
}
}
return string(ans)
}
|
8bceb5c475929cb6c06bf0cb74f6b7b6b60d57a8 | ca0518aa115597ae867eceba837c443bd7a07d60 | haasn/ColorPlus | /calculations.go | Go | go | 6,233 | no_license | package colorplus
// Determine the luminance (brightness) of a color triple
func Luminance(in Triple) float64 {
switch x := in.(type) {
case XYZ: return x.Y
case Yxy: return x.Y
case RGB: return 0.2126 * x.R + 0.0722 * x.B + 0.7152 * x.G
default: panic("[Luminance] Unsupported color... |
8ce644e1c03f7943605a3cdd55074f05594ed13c | 6179b78c2e7cfda175b55b66318e9e925c642fcd | wardbekker/loki | /vendor/github.com/minio/minio-go/v7/api.go | Go | go | 29,561 | permissive | /*
* MinIO Go Library for Amazon S3 Compatible Cloud Storage
* Copyright 2015-2023 MinIO, 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/L... |
59fade4222bfa18eb0cc685bbb2445edfd89feac | 202b5b20191b3ed06eff67bc661ca377da9cfc3c | VKTRS2/finance-messaging | /iso20022/seev/CorporateActionMovementPreliminaryAdviceCancellationAdviceV06.go | Go | go | 7,667 | permissive | package seev
import (
"encoding/xml"
"github.com/fairxio/finance-messaging/iso20022"
)
type Document04400106 struct {
XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:seev.044.001.06 Document"`
Message *CorporateActionMovementPreliminaryAdviceCancellatio... |
bb49f4b42f5c992165c7826bb145fe9c48d67f26 | 019d1e23245b6f2097c1f985f25cfa928eeb96d0 | kchatr/EXP | /cmd/done.go | Go | go | 2,714 | permissive | /*
Copyright © 2020 Kaushik Chatterjee <kchatr1729@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 or ag... |
bd46d1b2ae446c29269d96375476bb1d17fb09e3 | 4194027847e19f2fa11945e6fd437a1ab184c7c0 | Sean0124/gostudy | /Program Structure/Declarations/ftoc.go | Go | go | 263 | no_license | package 声明
import "fmt"
func main() {
const freezingF, boilingF = 32.0, 212.0
fmt.Printf("%g°F = %g°C\n", freezingF, fToC(freezingF))
fmt.Printf("%g°F = %g°C\n", boilingF, fToC(boilingF))
}
func fToC(f float64) float64 {
return (f - 32) * 5 / 9
}
|
50a4b60331cc17acdc472e673d4bdb971cb6a9a0 | eb2fea416c9aa624607b0bdd3caae94705ff772f | wuxb09/goLang | /bubbleMerge.go | Go | go | 1,512 | no_license | package main
import "fmt"
import "strconv"
import "sync"
var wg sync.WaitGroup
func Swap(sli []int, i int) {
var tmp int = sli[i]
sli[i] = sli[i+1]
sli[i+1] = tmp
}
func BubbleSort(sli []int) {
fmt.Println(sli)
var size int = len(sli)
for i := size-1; i >= 1; i-- {
for j := 0; j <= i-1; j++ {
if sli[j] >... |
7e30488f3230ea24e5489055846bee78dae1a6d5 | 7ee16187fe932e6f01e9eae534acd05073e56370 | uyga/leetcode | /SpiralMatrix.go | Go | go | 824 | no_license | package leetcode
func spiralOrder(matrix [][]int) []int {
var res []int
if len(matrix) > 0 {
sw := 0
w := len(matrix[sw])-1
sh := 0
h := len(matrix)-1
for sw<=w && sh<=h {
//top row
for i:=sw;i<=w;i++ {
res = append(res, matrix[sw]... |
d04fe3635ea56a55f2cb7e112afdbbc25c52470a | 5f22519d773768147f691173b6954b8c886056c6 | yandex-cloud/ydb-go-sdk | /connect/connect.go | Go | go | 1,147 | permissive | package connect
import (
"context"
"crypto/tls"
"github.com/yandex-cloud/ydb-go-sdk/v2"
"github.com/yandex-cloud/ydb-go-sdk/v2/auth"
)
// New connects to database and return database connection
func New(ctx context.Context, params ConnectParams, opts ...ConnectOption) (c *Connection, err error) {
c = &Connectio... |
87a599614b5550995d2ce1c83f7f036f1477e255 | 2370121558c3e185baa46f94bb40ab2fad9cf549 | paydex-core/paydex-go | /services/horizon/internal/actions/offer_test.go | Go | go | 10,800 | permissive | package actions
import (
"database/sql"
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/paydex-core/paydex-go/protocols/horizon"
"github.com/paydex-core/paydex-go/services/horizon/internal/db2/core"
"github.com/paydex-core/paydex-go/services/horizon/internal/db2/history"
"github.com/paydex-core/p... |
98f05275cee4d5a6a1396d5a515d794e7317cf3c | 435feb8149977c777f03330143f1891fa633e388 | soerenschneider/adventofcode2019 | /day16/fft.go | Go | go | 2,068 | no_license | package day16
import (
"fmt"
"github.com/soerenschneider/adventofcode2019/util"
"regexp"
"strconv"
"strings"
)
const (
phases = 100
repeat = 10000
offsetStart = 7
)
var (
pattern = []int{0, 1, 0, -1}
numbersOnlyRegex = regexp.MustCompile("^[0-9]+$")
)
func Convert(input string) []int {
if ! numb... |
33cbc694aa94a15a114cc1194b33dbbba2a8f722 | 2176b56fd2e8db20d9ecd126fa2d05a7558c0efe | owen-d/beacon-api | /api/controllers/oauth/google.go | Go | go | 6,438 | no_license | package oauth
import (
"bytes"
"encoding/binary"
"encoding/hex"
"encoding/json"
"errors"
"github.com/owen-d/beacon-api/config"
"github.com/owen-d/beacon-api/lib/auth/jwt"
"github.com/owen-d/beacon-api/lib/cass"
"github.com/owen-d/beacon-api/lib/crypt"
"github.com/owen-d/beacon-api/lib/route"
"github.com/owe... |
dbfb88bd7c3c13bb69517b16f9b1fe2ab1bcd36c | d1088b70c8fc23c8a03789c49c1fdac161331f69 | woremacx/kocha | /param.go | Go | go | 5,231 | permissive | package kocha
import (
"database/sql"
"errors"
"fmt"
"net/url"
"path/filepath"
"reflect"
"runtime"
"strconv"
"strings"
"sync"
"time"
"github.com/woremacx/kocha/util"
)
var (
ErrInvalidFormat = errors.New("invalid format")
ErrUnsupportedFieldType = errors.New("unsupported field type")
paramsPoo... |
79fdc4287cb91f2d252f7f813ac8db463122adf6 | c3b4ef306873990642ef9630cedae365fe10115c | insequent/examples_go | /errors/main.go | Go | go | 469 | no_license | package main
import (
"errors"
"fmt"
)
type CustomError struct {
Message string
}
func (cerr *CustomError) Error() string {
return cerr.Message
}
func main() {
err := errors.New("This is a test error")
fmt.Println("Test error:", err)
err = fmt.Errorf("This is another test error")
fmt.Printf("%%s formatted ... |
45c5c6f66dca87b528665f8e345b4c99eec87f8a | ad03d73ccd989c2a1252bd20fbb32abf32e970c0 | impimp/promqueen | /model/writer.go | Go | go | 532 | permissive | package model
import (
"encoding/binary"
"io"
"sync"
"github.com/Sirupsen/logrus"
)
var mutex = &sync.Mutex{}
// WriteFrame writes the frame with the given uri to the WriteSeeker
func WriteFrame(w io.Writer, frame *Frame) error {
mutex.Lock()
defer mutex.Unlock()
err := binary.Write(w, binary.BigEndian, fra... |
728cf274f5d838afa05749972d7e9b4fd2c4540d | 1e26ef7dd6857164bbffda1a3d61becc69e9df35 | brnv/hastur | /storage_overlayfs.go | Go | go | 2,036 | permissive | package main
import (
"fmt"
"path/filepath"
"strings"
)
const defaultOverlayFSSize = "1G"
type overlayFSStorage struct {
tmpfsSize string
rootDir string
}
func NewOverlayFSStorage(rootDir, spec string) (storage, error) {
args := strings.Split(spec, ":")
size := defaultOverlayFSSize
// TODO: validate size... |
480a16a0c8559bf4ffbe97af74246f6bb7ff868b | 9989843e8ca302af86e1cc8d2df7103a9f9146e6 | hea9549/bifrost | /vendor/github.com/it-chain/heimdall/sample/heimdall-ecdsa-sample.go | Go | go | 2,059 | permissive | package main
import (
"fmt"
"log"
"os"
"reflect"
"github.com/it-chain/heimdall/auth"
"github.com/it-chain/heimdall/hashing"
"github.com/it-chain/heimdall/key"
)
/*
This sample shows data to be transmitted
is signed and verified by ECDSA Key.
*/
func main() {
keyManager, err := key.NewKeyManager("")
error... |
697c545ac73999286fd11925ee4541aa46eca091 | 5aa6e06fed36f16067b570ac3933e27060c7819e | hellower/orascope_golib | /orascopeLogger/backup/orascopeLogger.go | Go | go | 3,961 | no_license | package orascopeLogger
import (
"fmt"
"os"
"runtime"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
type ClsLogger struct {
fs *os.File
seq uint32
fileName string
fullLogDir string
fullLogFilePath string
console bool
debug bool
Version ... |
9cc7fc0317da5576ceb2b376c4a0d9625607e666 | 0ee47e78a8bc5d0edc87333e6b721aaf9155cd35 | image-server/image-server | /request/upload_file.go | Go | go | 1,037 | permissive | package request
import (
"io"
"os"
"path/filepath"
"github.com/image-server/image-server/mime"
"github.com/image-server/image-server/uploader"
)
func (r *Request) UploadFile(filename string) error {
localDirectory := r.Paths.LocalImageDirectory(r.Namespace, r.Hash)
os.MkdirAll(localDirectory, 0700)
localPat... |
7d795fb23613d62f894fb124a0d8e4883edfb1c5 | 355412888ac7f1e4a7004817a443edb73ece895a | YoungsoonLee/study_leetcode | /SymmetricTree/main.go | Go | go | 1,676 | no_license | package main
import "fmt"
/**
* Definition for a binary tree node.
* type TreeNode struct {
* Val int
* Left *TreeNode
* Right *TreeNode
* }
*/
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func isSymmetric(root *TreeNode) bool {
return isMirror(root, root)
}
// recursio... |
89ed6ba68406eee7db6001911e6d103f76462a8e | 802f405f5bd5cb3445597d79f1cf767df34fa130 | Cricle/Chating | /data/loginmgr.go | Go | go | 2,648 | no_license | package data
import (
"fmt"
"math/rand"
"sync"
"sync/atomic"
"time"
uuid "github.com/satori/go.uuid"
)
const (
MIN_DURATION_TIME = 10 * time.Second
)
type LoginInfo struct {
Uid int64
Name string
CreateTime time.Time
}
type LoginManager struct {
conc sync.Map
expTimeMs time.Duration
c... |
8407b0680a3223eecdbb25d1aa0d49f4a5c906e5 | 0982231edbbe662ae8a45a8077749feb2fc184ea | rokoucha/cloudflare-ddns | /cf.go | Go | go | 843 | permissive | package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
)
var (
DNSRecordNotFoundErr = fmt.Errorf("DNSRecord not found")
ZoneNotFoundErr = fmt.Errorf("Zone not found")
)
func GetZoneFromName(api *cloudflare.API, ctx context.Context, name string) (*cloudflare.Zone, error) {
zones, err ... |
61b486f90afeb9d8d944b7dea73b6dd4a67b63c0 | 509503f587365a73564bb0ba3cb44352501ba64c | liamoneill/prom-k8s-image-security-exporter | /image.go | Go | go | 1,252 | no_license | package main
import (
"fmt"
"regexp"
"strings"
"github.com/distribution/distribution/reference"
)
type Image = reference.Reference
type ImageParser interface {
ParseK8SImageID(imageID string) (Image, error)
MatchesECRFilter(image Image) bool
}
type imageParser struct {
ecrFilter *regexp.Regexp
}
func newIm... |
1c86f97430dd42181ceb587f6d4764c0bf562929 | a244aab0b488a1e1df8f3e6bbb74d1ccf1d5131c | miguelbemartin/vat | /examples/example_vat.go | Go | go | 380 | permissive | package main
import (
"fmt"
"github.com/miguelbemartin/vat"
)
func main() {
client := vat.NewClient()
exist, err := client.Validate("ESXX")
if err != nil {
fmt.Println("Error: ", err.Error())
}
fmt.Println("The result is ", exist)
rate, err := client.GetRate("ES")
if err != nil {
fmt.Println("Error: ... |
31c3b98fc26ce6c780306408bb26d63abedcf33b | 7170b1d9b8cdc00de9d3cccae0849e796c568412 | ArangoGutierrez/salad | /cmd/fork.go | Go | go | 3,940 | no_license | // Copyright 2018 Vanessa Sochat. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package cmd
import (
"fmt"
"github.com/urfave/cli"
"math/rand"
"os"
"time"
)
// -------------------------------------------------------------------------... |
444ef48cb42600451c93e0c5b0fd2d0accfc0247 | 0411902c07b5912dac42cd4fb90a3135fad44fc0 | bediger4000/squava | /sns.go | Go | go | 15,426 | permissive | package main
import (
"flag"
"fmt"
"io"
"math/rand"
"os"
"time"
)
type Board [5][5]int
const (
WIN = 10000
LOSS = -10000
MAXIMIZER = 1
MINIMIZER = -1
UNSET = 0
)
var leafNodeCount int = 0
var maxDepth int = 10 // initializing to 10 not a mistake
// Arrays of losing triplets and winning qu... |
55cd4abe8fbc03844682538f6d2f63985d567508 | d61abb74574d575167d852c534f4f2d205e20e59 | google/knative-gcp | /vendor/cloud.google.com/go/iam/admin/apiv1/policy_methods.go | Go | go | 1,690 | permissive | // Copyright 2016 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 ... |
98d4453f4ffe4de46a60da99adc77bc6a84d2e34 | 478c5822d73656ff09184a8ae7ec67b972ccd401 | dgageot/skaffold-ci | /pkg/skaffold/color/formatter.go | Go | go | 4,804 | permissive | /*
Copyright 2019 The Skaffold Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... |
b9556e050ac688f590dc3bfdf3e4b6373a560a70 | 0822b06fb760d0a1a0d82aac77d17fc1d3bc7879 | NoSkillGuy/0chain | /code/go/0chain.net/smartcontract/storagesc/blobber_integration_tests.go | Go | go | 1,573 | permissive | // +build integration_tests
package storagesc
import (
"fmt"
cstate "0chain.net/chaincore/chain/state"
"0chain.net/chaincore/node"
"0chain.net/chaincore/transaction"
"0chain.net/core/util"
crpc "0chain.net/conductor/conductrpc"
)
// insert new blobber, filling its stake pool
func (sc *StorageSmartContract) i... |
dfa4c229ae96f8c9a9d679e7f49418d3871f9407 | 3986b3a1ffaf1a85754e9a2a243bf3c641040316 | newadays/cli | /cf/commands/space/disallow_space_ssh.go | Go | go | 2,169 | permissive | package space
import (
"fmt"
"github.com/cloudfoundry/cli/cf/api/spaces"
"github.com/cloudfoundry/cli/cf/command_registry"
"github.com/cloudfoundry/cli/cf/configuration/core_config"
. "github.com/cloudfoundry/cli/cf/i18n"
"github.com/cloudfoundry/cli/cf/requirements"
"github.com/cloudfoundry/cli/cf/terminal"
... |
cf09a7ab8125f03f07aa644c9ae8fe306da67036 | 75fca9f1d239173694a49354f1ba2d6796d29b22 | morlay/aliyun-go | /clients/ecs/delete_snapshot.go | Go | go | 1,028 | no_license | package ecs
import (
"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
"github.com/morlay/aliyun-go/common"
)
type DeleteSnapshotRequest struct {
requests.RpcRequest
ResourceOwnerId int64 `position:"Que... |
de5842e3e99b439c7f399ddef13e257b45382d74 | 0c9267f02ad0184038673a4001cf1ae29f46a56a | blockchyp/blockchyp-go | /cli.go | Go | go | 9,290 | permissive | package blockchyp
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"os/user"
"path/filepath"
"runtime"
)
// ConfigSettings contains configuration options for the CLI.
type ConfigSettings struct {
APIKey string `json:"apiKey"`
BearerToken string `json:"bearerToken"`
SigningKey stri... |
9e57dadbab7247c39ab8fb49b4acb428e4c75e91 | f146d54f774109174a59697a12582d77f9a514e7 | erikcai/oci-go-sdk | /loganalytics/pause_scheduled_task_request_response.go | Go | go | 3,320 | permissive | // Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
c9adddd297e6becdb744a48c80a01d9ad40c7f93 | 42f38e8bad74009fbcf1ef879c19e32c398a7d76 | SataQiu/serving | /pkg/apis/serving/v1alpha1/service_defaults_test.go | Go | go | 5,972 | permissive | /*
Copyright 2018 The Knative 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, soft... |
badb9d02217b297216ea0ac0f8589a709ce1f561 | d9b30e5a1d24f4714d1392770c7665415231978f | inside-the-mirror/kratos | /pkg/net/http/blademaster/context.go | Go | go | 7,990 | permissive | package blademaster
import (
"context"
"math"
"net/http"
"strconv"
"text/template"
"github.com/inside-the-mirror/kratos/pkg/ecode"
"github.com/inside-the-mirror/kratos/pkg/net/http/blademaster/binding"
"github.com/inside-the-mirror/kratos/pkg/net/http/blademaster/render"
"github.com/gogo/protobuf/proto"
"g... |
ec49b664d317a6c7ccb4285b0e7883980c0284f9 | d9d85a4425f2e42b9b19b5ac3b7a8e96ba57c55c | branohricardo/workshop-category-microservice | /main_test.go | Go | go | 1,586 | no_license | package main
import (
"encoding/json"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"
. "github.com/branohricardo/workshop-category-microservice/models"
)
func insertTestCategory() {
// Insert a category if it doesn't not exists
categoryId := 533
cnt, err := DB.Where("cat_id = ?", categoryId).Cou... |
62dc24fda8e052c1defe76c0d58f7ddca99b4fdd | 7d30b684d72f2447a4f83e823c2ea6cd71fe475f | Tiger66639/skia-buildbot | /ct/go/util/gs.go | Go | go | 12,951 | permissive | // Google Storage utility that contains methods for both CT master and worker
// scripts.
package util
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"strings"
"sync"
"time"
"github.com/skia-dev/glog"
"go.skia.org/infra/go/auth"
"go.skia.org/infra/go/gs"
"go.skia.org/infra/go/util"
sto... |
97485bce141fe212c23089e9df028c8eff93519b | 5647d1d429ce509792c85a7c3ae84aafa615bf5c | sudeepgoyal75/terraform-provider-nuagenetworks | /4.0.1/nuagenetworks/resource_nuagenetworks_infrastructureportprofile.go | Go | go | 6,150 | no_license | package nuagenetworks
import (
"github.com/hashicorp/terraform/helper/schema"
vspk "github.com/tpretz/vspk-go/vspk/4.0.1"
)
func resourceInfrastructurePortProfile() *schema.Resource {
return &schema.Resource{
Create: resourceInfrastructurePortProfileCreate,
Read: resourceInfrastructurePo... |
07e912555d454b37ecd4118a5b966cb005c9e8e5 | de493721bf7106184937ba20d33ff3e3bcc8eb70 | tuteng/beat-ouput-pulsar | /vendor/github.com/elastic/beats/libbeat/idxmgmt/ilm/eshandler.go | Go | go | 5,642 | permissive | // Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
0223216adf9f670c0999e71404befd79d7a0fe20 | d89fe60aac3cf473a83bf6d578fbfb2f2af313f8 | PrahathessRengasamy/PackageIndexer | /Solution/IndexController.go | Go | go | 1,252 | no_license | package main
import (
"net"
)
//A separate controller to keep the operations on the Package Index and respond to client
//using the same names as the user commands for the funcions
// Index updates the package
func Index(conn net.Conn, p Package, resp Response) bool {
indexed := false
if len(p.Dependencies) == 0 ... |
8812289a74ae2402dc966d16a5e0dc0f434212e7 | 4d63ac519756b3d199522d3d24ae6698efc01906 | waybeams/waybeams | /pkg/views/views.go | Go | go | 1,225 | permissive | package views
import (
"github.com/waybeams/waybeams/pkg/spec"
)
var DefaultRectangleRadius = 3.0
func RectangleView(s spec.Surface, r spec.Reader) {
// fmt.Println("Rectangle with:", spec.Path(r), "x:", r.X(), "y:", r.Y(), "w:", r.Width(), "h:", r.Height())
s.BeginPath()
s.Rect(r.X(), r.Y(), r.Width(), r.Height... |
ab1ca8537131ffc18032a250ec44895f505f7c79 | 9c318c2e92df8e59d74c197375737d945dd37d21 | fever0/mongoCRUD_golang | /delete.go | Go | go | 529 | no_license | package main
import (
"context"
"fmt"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
)
func delete(client *mongo.Client, collection *mongo.Collection) {
var objID string
var person user
fmt.Print("Enter the _id: ")
fmt.Scan(... |
1588e9de78e71071efc08ac17295d6330f08f9c1 | d0ebde2e5c4d106f92e7a15ef01b1835937b0859 | Gabe-Dalessandro/microservice_template | /server/server.go | Go | go | 2,823 | no_license | package server
import (
"context"
"database/sql"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"time"
_ "github.com/jackc/pgx/stdlib"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagg... |
59c713cf56e15d66a560348acf231faaac58a0ee | 9e0dd317d87289c908fd7895a1a7fb70ee8bf386 | sillyhatxu/go-utils | /verify/Verify_test.go | Go | go | 665 | no_license | package verify
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestVerify_Valid(t *testing.T) {
type User struct {
ID int
TestRequiredAndLength string `valid:"Required;Length(20)"`
TestRangeRange int64 `valid:"Range(20, 80)"`
TestMax int32 `valid:"Ma... |
4df8dff56e647c30332e4cf1d2defcc3927dec10 | 9d3e5c09be0d506d29a884770378aa4cc9192314 | coderbradlee/ethereum-p2p | /src/ethereum/core/vm/logger_test.go | Go | go | 2,522 | no_license | // Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
43ab65c6c24ae00d9f763570fc51e2cbaed52456 | 60e162de8f46cac4caf6a0623c27b976396f7a55 | getbread/stripe-go | /balance/client_test.go | Go | go | 2,899 | permissive | package balance
import (
"testing"
stripe "github.com/getbread/stripe-go"
"github.com/getbread/stripe-go/charge"
"github.com/getbread/stripe-go/currency"
. "github.com/getbread/stripe-go/utils"
)
func init() {
stripe.Key = GetTestKey()
}
func TestBalanceGet(t *testing.T) {
target, err := Get(nil)
if err !=... |
2f5409995660cb39f3e42eb0445e420d434d812e | 3bb54c2fdc00b1aa16965fc79f42adff56746476 | herrkong/leetcode | /src/1115/main.go | Go | go | 1,041 | no_license | // class FooBar {
// public void foo() {
// for (int i = 0; i < n; i++) {
// print("foo");
// }
// }
// public void bar() {
// for (int i = 0; i < n; i++) {
// print("bar");
// }
// }
// }
// 两个不同的线程将会共用一个 FooBar 实例。其中一个线程将会调用 foo() 方法,另一个线程将会调用 bar() 方法。
// 请设计修改程序,以... |
543bdb68fd3c23a8c350060f2e54d86daa71da67 | ffdd74484d19e1b8a5c873ac27ecd27ce7e4da63 | vmware/vsphere-automation-sdk-go | /services/nsxt/infra/LbVirtualServersClient.go | Go | go | 14,264 | permissive | // Copyright © 2019-2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: BSD-2-Clause
// Auto generated code. DO NOT EDIT.
// Interface file for service: LbVirtualServers
// Used by client-side stubs.
package infra
import (
vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/erro... |
8aaab8bc9286a54d4e730f6206441d61d1650ae1 | 43c0da53ad1978659e9525ed7599725f208b1275 | rvkubiak/pilot | /proxy/envoy/discovery_test.go | Go | go | 18,619 | permissive | // Copyright 2017 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... |
3acec1ca6f1338aaba71e3b158f89393211489c9 | d7ca8c1a833f4771acd781cd00eeae47717e0277 | marcospaulosss/DevOps | /apps/severino/src/rpc/shelf.client.go | Go | go | 2,619 | no_license | package rpc
import (
"context"
"backend/apps/severino/src/adapters"
"backend/apps/severino/src/interfaces"
"backend/apps/severino/src/structs"
"backend/libs/errors"
log "backend/libs/logger"
pb "backend/proto"
)
type ShelfClientImpl struct {
service pb.ShelfServiceClient
ctx context.Context
}
func NewS... |
5388d597c3b35c8c96b8ee7803e7c7db1b839f2f | be410e2082e6fd570f07349173d5a28b5879cc82 | OlegLoewen/test-infra-1 | /pkg/testmachinery/metadata/metadata.go | Go | go | 3,013 | permissive | // Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in complian... |
4170d998a50c676c853ff8f2102c7d92248af73d | 6f36dea6bbfad33b86c362c184ce99bc4d556d8c | GalSagie/okteto | /pkg/linguist/dev.go | Go | go | 7,141 | permissive | // Copyright 2020 The Okteto 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 ... |
accad66e8e120204aa8948899a7fe18343cebf9a | a332e4d080ddf7866ab09c8cfc0d842fbd7bd04e | 2dadsgn/LWN-Simulator | /simulator/components/gateway/receiver.go | Go | go | 2,550 | permissive | package gateway
import (
"errors"
"fmt"
"time"
pkt "github.com/arslab/lwnsimulator/simulator/resources/communication/packets"
"github.com/arslab/lwnsimulator/simulator/resources/communication/udp"
"github.com/arslab/lwnsimulator/simulator/util"
)
func (g *Gateway) Receiver() {
ReceiveBuffer := make([]byte, 1... |
cd8eb0752620f288d3b44c23dbfff26d46e4e0d3 | 1fd74c7befd06d0b9b5a10cf972a94b03084751b | zhoushuaime/GolangTraining | /sync/goroutineAdd.go | Go | go | 514 | no_license | package main
import (
"fmt"
"sync"
)
//var mutex = sync.RWMutex{}
func main() {
wg := sync.WaitGroup{}
for i := 0; i < 10; i++ {
wg.Add(1)
go func(x int) {
res := Gohead(1)
sum = append(sum, res)
wg.Done()
}(i)
}
wg.Wait()
fmt.Println("\n===============================")
amount := 0
for _, v ... |
7c5fddcbc9d9168b24639215243638e908eefea7 | 60ae919d04db6ac6516f14759bebc4f5cb14cd71 | digitalbitbox/bitbox-wallet-app | /vendor/github.com/ethereum/go-ethereum/metrics/meter.go | Go | go | 8,012 | permissive | package metrics
import (
"sync"
"sync/atomic"
"time"
)
// Meters count events to produce exponentially-weighted moving average rates
// at one-, five-, and fifteen-minutes and a mean rate.
type Meter interface {
Count() int64
Mark(int64)
Rate1() float64
Rate5() float64
Rate15() float64
RateMean() float64
Sn... |
a222e42be6894e36e68b2c9602a43bbdbacb6be5 | 3bcfb30b2b4be53e8fe81ff7c365017b3a5c2d81 | hackdou/Stowaway | /node/iptables_reuse.go | Go | go | 6,512 | permissive | package node
import (
"Stowaway/common"
"fmt"
"log"
"net"
"os"
"os/exec"
"os/signal"
"strings"
"syscall"
)
const CHAIN_NAME = "STOWAWAY"
const START_FORWARDING = "stowawaycoming"
const STOP_FORWARDING = "stowawayleaving"
/*-------------------------Iptable复用模式功能代码--------------------------*/
//以下大致与SO_REUSEP... |
4e47aa2c2c99e73025fe01765f9fd1a621a7bf39 | bc3a2f5bcf88d3ae1f16fb281a0aa9709f2513b5 | jrgensen/version | /src/version/docker/compose.go | Go | go | 1,696 | no_license | package docker
import (
"fmt"
"net/http"
"golang.org/x/net/context"
"github.com/docker/libcompose/docker"
"github.com/docker/libcompose/docker/ctx"
"github.com/docker/libcompose/project"
"github.com/docker/libcompose/project/options"
)
func (api *Api) ComposeHandler(w http.ResponseWriter, r *http.Request) {
... |
0ace0e693ce0570fad81e6d59116d41079568d6d | ed485939dd407feae5d78240af78456d8f6349fd | bonly/exercise | /2015/201504/20150406_game/src/cli/scene/scene.go | Go | go | 1,587 | no_license | package scene
import "C"
import (
"proto"
"golang.org/x/net/context"
"log"
// "reflect"
srv "cli"
"encoding/json"
)
type Q_KV struct{
Sn uint32;
Key string `json:"Key"`;
Data string `json:"Data"`;
};
func init(){
log.Printf("Scene Lib init\n");
//注册类到清单中
proto.Proto["Q_KV"] = func() interface{}{return ... |
fb65cd7fcfa6753f6f824be6b5ffc3d90285c3bc | 4867ced80322a2677f81b9e46286be6c24fe3f4f | jchrisfay/ds-operator | /controllers/backup.go | Go | go | 2,056 | permissive | /*
Copyright 2020 ForgeRock AS.
*/
package controllers
import (
"context"
directoryv1alpha1 "github.com/ForgeRock/ds-operator/api/v1alpha1"
ldap "github.com/ForgeRock/ds-operator/pkg/ldap"
)
/// Update the backup and purge schedules, and get backup status
func (r *DirectoryServiceReconciler) updateBackup(ctx c... |
ede5191c6e0fd6f5d9d857ce7fbafdae4fe22bad | 8db9d0cfbc9273fad0f2882ee8f076fa8b19c571 | qsupremacy/huaweicloud-sdk-go-v3 | /services/gaussdbfornosql/v3/model/model_list_dedicated_resources_request.go | Go | go | 934 | permissive | package model
import (
"encoding/json"
"strings"
)
// Request Object
type ListDedicatedResourcesRequest struct {
// 索引位置偏移量。 - 索引位置偏移量,表示从指定project ID下最新的专属资源创建时间开始,按时间的先后顺序偏移offset条数据后查询对应的专属资源信息。 - 取值大于或等于0。 - 不传该参数时,查询偏移量默认为0,表示从最新的创建时间对应的专属资源开始查询。
Offset *int32 `json:"offset,omitempty"`
// 查询专属资源个数上限... |
e610e6b923b6ed4be242bfee06bfd988d8dbdfdf | 15c4fec97d8d9a84628897bf72f275318e61d9d1 | dhduvall/aptly | /s3/public.go | Go | go | 12,439 | permissive | package s3
import (
"fmt"
"io"
"os"
"path/filepath"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/corehandlers"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"git... |
1a142dd01a238c8a0b443d5721b5049b44531ddb | 9c70c0a59d5902f532cb7a68e6e3bc982b84a3d6 | ProsperousLi/golang-erp | /models/vehicle.go | Go | go | 4,170 | no_license | package models
import (
"erpweb/util"
"github.com/astaxie/beego"
)
// DROP TABLE IF EXISTS `vehicle`;
// CREATE TABLE `vehicle` (
// `id` bigint(20) NOT NULL AUTO_INCREMENT,
// `custcode` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '客户编码',
// `vehiclecode` varchar(20) CHARACTER SET utf8mb4 DEFAULT... |
55504c93de17dd9db17496d577f184bd986f1993 | aa057eb0a4d4a8a0020766c08e0160b0a741303d | nodtem66/USBINT1 | /cmd/usbint/main_test.go | Go | go | 3,544 | no_license | package main
import (
. "github.com/nodtem66/usbint1"
. "github.com/nodtem66/usbint1/db"
"testing"
)
func TestMain_CommandLine(t *testing.T) {
// Test suit 1
c := &CommandLine{
PatientId: "T123",
VidPid: "1-1",
}
if err := c.ParseOption(); err == nil {
t.Fatalf("This is not valid ", c)
}
// Test sui... |
8f6aeea2f29ff7aa468a2817416374d3d8b1e0b3 | 9f1a884fa24f667e9782899ed6c804a71b128b4d | chargen/ninep | /protocol/genout.go | Go | go | 48,592 | no_license |
package protocol
import (
"bytes"
"fmt"
_ "log"
)
func MarshalRerrorPkt (b *bytes.Buffer, t Tag, Error string) {
var l uint64
b.Reset()
b.Write([]byte{0,0,0,0,
uint8(Rerror),
byte(t), byte(t>>8),
uint8(len(Error)),uint8(len(Error)>>8),
})
b.Write([]byte(Error))
{
l = uint64(b.Len())
copy(b.Bytes(), []byte{uint8(l)... |
e4291e62291ff897bb6c36973fd1a26ba3930c50 | ffd6321757d8f45a4723b3929530d30f058a3923 | duckpuppy/algolia-hugo | /vendor/github.com/algolia/algoliasearch-client-go/algoliasearch/client.go | Go | go | 7,628 | permissive | package algoliasearch
import (
"encoding/json"
"net/http"
"net/url"
"time"
)
type client struct {
transport *Transport
}
// NewClient instantiates a new `Client` from the provided `appID` and
// `apiKey`. Default hosts are used for the transport layer.
func NewClient(appID, apiKey string) Client {
return &clie... |
a6df20d890b2f079a683cef9c20c1bc80655820a | d03538e7b2cb4cab960227a7919e7e91ffcbb744 | isabella232/gql | /gql/builtin_filter.go | Go | go | 1,613 | permissive | package gql
import (
"context"
"github.com/grailbio/gql/symbol"
)
func init() {
RegisterBuiltinFunc("filter",
`
tbl | filter(expr [,map:=mapexpr] [,shards:=nshards])
Arg types:
- _expr_: one-arg boolean function
- _mapexpr_: one-arg function (default: ::|row|row::)
- _nshards_: int (default: 0)
Functions... |
58b266953172fa511e94dd17a1954873eda00210 | a54538565e1e84fccb6222c91ab49c13a171cbc6 | beaufrusetta/gozwave | /cmd/serialrecordingtohex/serialrecordingtohex.go | Go | go | 2,702 | permissive | package main
import (
"encoding/gob"
"flag"
"fmt"
"io"
"log"
"os"
"sort"
"time"
"github.com/stampzilla/gozwave/serialrecorder"
)
var file string
var short bool
var read bool
var write bool
func main() {
flag.StringVar(&file, "file", "", "File to decode")
flag.BoolVar(&short, "short", false, "Exclude time... |
58e864f267b750d938abb1fcb07e49b692d6c62c | 7fbba70a9ec96771c84a206fc455241630a28337 | cganey/skia-buildbot | /pulld/go/pulld/main.go | Go | go | 8,753 | permissive | package main
import (
"encoding/json"
"flag"
"fmt"
"html/template"
"net/http"
"os"
"path/filepath"
"runtime"
"sort"
"strings"
"time"
"github.com/gorilla/mux"
"github.com/skia-dev/glog"
"github.com/skia-dev/go-systemd/dbus"
"go.skia.org/infra/go/common"
"go.skia.org/infra/go/httputils"
"go.skia.org/in... |
2ee2a68420623cd524ed45c4ddfc7194e2f39440 | 4e30b8bbdfc04fac9ea160668fda4dff3c6ef0e8 | sgtest/monorepo-test-3 | /kubernetes-15/federation/pkg/federation-controller/util/eventsink/eventsink.go | Go | go | 3,734 | 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, ... |
7303c55653823e99d6e191fa331396c42927e17e | 73096c4dbebbaaf81357d78b01fe8473fcfac334 | zhouruisong/gosocket | /go-socket.io/helper_test.go | Go | go | 901 | no_license | package socketio
import (
"bytes"
"io"
"io/ioutil"
"github.com/zhouruisong/gosocket/go-engine.io"
)
type WriterNopCloser struct {
io.Writer
}
func NewWriterNopCloser(w io.Writer) io.WriteCloser {
return WriterNopCloser{
Writer: w,
}
}
func (w WriterNopCloser) Close() error {
return nil
}
type FrameData ... |
7a568cd23998c76a11974eeba4f66aa14bc67a77 | 3bdc62377b1b21aff5996ef64434cc967cdfd765 | pyshx/akita-cli | /cmd/internal/get/timeline.go | Go | go | 4,314 | permissive | package get
import (
"container/heap"
"context"
"fmt"
"time"
"github.com/akitasoftware/akita-cli/cmd/internal/akiflag"
"github.com/akitasoftware/akita-cli/cmd/internal/cmderr"
"github.com/akitasoftware/akita-cli/printer"
"github.com/akitasoftware/akita-cli/rest"
"github.com/akitasoftware/akita-cli/util"
"gi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.