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 |
|---|---|---|---|---|---|---|---|---|
0164201ca44c39ba6c3f3d489e3f124ed9c7c582 | 51738addb7ad046849524829cf1be3177b6cbcb9 | goodloop/beego | /tree.go | Go | go | 14,819 | permissive | // Copyright 2014 beego Author. 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 applica... |
1022765cd85da983720fddf6761d7fa525fe0e11 | c5e7143c7e5a616f6d666d8ae92528d7a4641f9c | rickchangch/go-chatroom | /controllers/api/users.go | Go | go | 1,635 | no_license | package api
import (
"fmt"
"log"
"net/http"
"github.com/labstack/echo/v4"
"github.com/medo972283/go-chatroom/models"
"github.com/medo972283/go-chatroom/utils"
)
func IndexUser(c echo.Context) error {
return nil
}
func ViewUser(c echo.Context) error {
return nil
}
func CreateUser(c echo.Context) error {
//... |
c491884bf95458b1805b6dff5bd12488fca4b5a7 | 4460a23b60ea52dd5b15d5f4919d7434d95c0e72 | DataDog/opentelemetry-collector-contrib | /receiver/awscloudwatchreceiver/config_test.go | Go | go | 7,179 | permissive | // Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
f275932bab4b55d9b256dd090843461720772f48 | e31dd310309d2fadd7efbf81f37eb3266382f09b | go-numb/go-exchanges | /api/bitflyer/v1/private/balance/balance.go | Go | go | 917 | permissive | package balance
import (
"fmt"
"net/http"
"github.com/go-numb/go-exchanges/api/bitflyer/v1/types"
"github.com/google/go-querystring/query"
)
const PATH = "/v1/me/getbalance"
type Request struct{}
type Response []Asset
type Asset struct {
ProductCode types.ProductCode `json:"currency_code"`
Amount float... |
8dbcaf3fff7b2f5625ee55edbc7a89526b84f6cc | 91cee1c5e31ad186ec6877a79685e0ece746fb2f | peterzhangbo/hashgard | /x/issue/msgs/msg_issue.go | Go | go | 2,046 | permissive | package msgs
import (
"fmt"
"github.com/hashgard/hashgard/x/issue/utils"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/hashgard/hashgard/x/issue/errors"
"github.com/hashgard/hashgard/x/issue/types"
)
// MsgIssue to allow a registered issuer
// to issue new coins.
type MsgIssue struct {
*types.CoinIssu... |
24f939da48327a4a84e45f527bd5ae95dc4bd02b | eee8f7c31cbb341e068410e0ae8dabc7185b0157 | rameshthoomu/fabric | /common/configtx/tool/configtxgen/main.go | Go | go | 7,663 | permissive | /*
Copyright IBM Corp. 2017 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... |
f09fab7644e6971c60180c941bdc03cce5dc79fb | e387fb0188bdaf086593a2e8bd95e6f75c892312 | fossabot/incubator-servicecomb-service-center | /server/service/instances.go | Go | go | 33,134 | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
b717ea32bac8eab91306cde769ec28e38e0c9000 | 45c263d8fe5ba7151944ad6643208caddf28d15f | StupidTAO/astraia | /version/version.go | Go | go | 1,057 | permissive | // Copyright(c) 2019 walterkangluo Group. 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... |
ee773ff181a750ad7e779c630b59a1314df511c6 | c6f9a393c01e389f6c697fb0604fc5d9d46759c5 | feng-ge/go_video | /video_server/api/main.go | Go | go | 1,073 | no_license | package main
import (
"github.com/julienschmidt/httprouter"
"go_video/video_server/api/session"
"net/http"
)
type middleWareHandler struct {
r *httprouter.Router
}
func NewMiddleWareHandler(r *httprouter.Router) http.Handler {
m := middleWareHandler{}
m.r = r
return m
}
func (m middleWareHandler) ServeHTTP(w... |
230b8c65b8add6e3141cca8b4a84125cc24c410d | 2f4d5a66c9c4f1f53c2ba4cfb2b1d6b306d7b470 | johnbelamaric/atlas-db | /pkg/server/rds/rds.go | Go | go | 814 | permissive | package rds
import (
"strings"
atlas "github.com/infobloxopen/atlas-db/pkg/apis/db/v1alpha1"
"github.com/infobloxopen/atlas-db/pkg/server/mysql"
"github.com/infobloxopen/atlas-db/pkg/server/plugin"
"github.com/infobloxopen/atlas-db/pkg/server/postgres"
)
type RDSPlugin atlas.RDSPlugin
func Convert(a *atlas.RDS... |
e72aeef6ae5febd14abd8088e9185d0864ebbeae | 690262a45524c2e59cfbd822b29ed43cef81bc1b | triggermesh/triggermesh | /pkg/sources/adapter/awscloudwatchsource/adapter.go | Go | go | 8,517 | permissive | /*
Copyright 2022 TriggerMesh Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwar... |
7240e55da8f45921e5f0fbc3a7f3cc06835bb673 | 74db0422ab0ce3b85501d3320a422c4502368fc6 | Abirdcfly/containerized-data-importer | /tests/import_proxy_test.go | Go | go | 15,379 | permissive | package tests
import (
"context"
"fmt"
"net/url"
"reflect"
"strings"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/types"
configclient "github.com/openshift/client-go/config/clientset/versioned"
corev1 "k8s.io/api/core/v1"... |
a937bea573fec252b3a99d8b17e68116d3d17d3f | f9035392dd76385ce545ae39b26217328b332c51 | sciarrilli/terraform-provider-nuagenetworks | /nuagenetworks/resource_nuagenetworks_bfdsession.go | Go | go | 4,393 | no_license | package nuagenetworks
import (
"github.com/hashicorp/terraform/helper/schema"
"github.com/rvichery/vspk-go/vspk"
)
func resourceBFDSession() *schema.Resource {
return &schema.Resource{
Create: resourceBFDSessionCreate,
Read: resourceBFDSessionRead,
Update: resourceBFDSessionUpdate,
Delete: resourceBFDSes... |
f24ade85ba6f6c43aaffa2e96bf9208063070754 | 1ded368fb71831d24f061fa5e009f274cc023440 | joeyparsons/opsgenie-go-sdk-v2 | /heartbeat/heartbeat_test.go | Go | go | 1,441 | permissive | package heartbeat
import (
"github.com/joeyparsons/opsgenie-go-sdk-v2/og"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"testing"
)
func TestAddRequest_Validate(t *testing.T) {
enabled := true
request := &AddRequest{Description: "Descriptio2", Interval: 2, IntervalUnit: Minutes, Enabled: &enabled... |
ace16f6e20ec2981a9d2e494f938f6c4b7b04386 | e795ea03def13e1782880699ff18df4a24a29b6e | caohui123/ms_novel | /repository/category.go | Go | go | 3,711 | permissive | package repository
import (
"github.com/chenhg5/collection"
"ms_novel/global"
"ms_novel/model"
"ms_novel/utils"
)
// 定义小说导航栏目的仓储接口,便于查看所有方法
type NovelCategoryRepositoryInterface interface {
// 创建
Create(categoryName, categoryIcon string, isDisplayIndex, sortNum int, novelNavigation *model.NovelNavigation) error... |
49daa43280a9c0cae2a0a388fc95710230a97f4a | 462921c5a7629e5cb00a2baad1b45b276fce60ae | zhujq/free5gc-stage-3 | /src/amf/amf_consumer/SubscriberDataManagement.go | Go | go | 5,697 | permissive | package amf_consumer
import (
"context"
"github.com/antihax/optional"
"free5gc/lib/Nudm_SubscriberDataManagement"
"free5gc/lib/openapi/common"
"free5gc/lib/openapi/models"
"free5gc/src/amf/amf_context"
)
func PutUpuAck(ue *amf_context.AmfUe, upuMacIue string) error {
configuration := Nudm_SubscriberDataManage... |
6c3f76c2fec47928aaba53394635e5814281def5 | f17dfeda526833f89b157ec9cc081c2bd3ffbe44 | gsanchezgavier/nri-vsphere | /internal/performance/performance.go | Go | go | 10,392 | permissive | // Copyright 2020 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package performance
import (
"context"
"errors"
"fmt"
"os"
"strconv"
"gopkg.in/yaml.v2"
logrus "github.com/sirupsen/logrus"
"github.com/vmware/govmomi"
"github.com/vmware/govmomi/performance"
"github.com/v... |
6b015d9fe17cb0fddeca427bf72eb08c60f07484 | bbc968fec79f34ee8f5b2868df99009ab69bc4b7 | hamadakafu/slack-notify | /api/v1/groupversion_info.go | Go | go | 1,234 | permissive | /*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License ... |
58bfb25e4829da4fbdf51f236e41956e7abb3628 | 8b7eb1c1362fa4463acaa086f56dbcc2658dadfd | meispi/cookiemonster | /pkg/monster/cookie_test.go | Go | go | 4,736 | permissive | package monster
import (
"encoding/base64"
"testing"
)
func TestNewCookie(t *testing.T) {
c := NewCookie("abc")
if c.raw != "abc" {
t.Errorf("raw malformed")
}
if c.decodedBy == nil {
t.Errorf("decodedBy malformed")
}
}
func TestDecodeDjango(t *testing.T) {
validCookie := NewCookie("gAJ9cQFVBV9uZXh0cQJ... |
15398bf1afdca5ced648e5298aface3da887023c | 3cd085022de3ac20e01fa27e2c36e8c9ff8c5e81 | RepentantGopher/surgemq | /service/examples_test.go | Go | go | 2,813 | permissive | // Copyright (c) 2014 The SurgeMQ Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required ... |
256776a800cf5943d5e92c44d5c7046829758815 | f46f003cbb82ee6283199b048d6804a8f832df8b | Carolusian/leetcode | /weekly-contest-177/validate-binary-tree-nodes.go | Go | go | 1,676 | no_license | /**
5170. Validate Binary Tree Nodes
User Accepted:1750
User Tried:1860
Total Accepted:1771
Total Submissions:2294
Difficulty:Medium
You have n binary tree nodes numbered from 0 to n - 1 where node i has two children leftChild[i] and rightChild[i], return true if and only if all the given nodes form exactly one valid b... |
d068e647bf0eccced816566085e3248f413a8be3 | c2901e2135296fa378ebd02ba27df4aa5aa32cb2 | Comcast/sheens | /cmd/spectool/js.go | Go | go | 2,335 | permissive | /* Copyright 2018 Comcast Cable Communications Management, 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 ... |
a18ab33a5821d79c8955e5a694615df3a02b1316 | 1d86583b7287a3572ee0c99c8d3d221d2313bb5f | craigdfrench/event | /daemon/daemon.go | Go | go | 2,078 | no_license | package daemon
import (
"context"
"database/sql"
"log"
"time"
pb "github.com/craigdfrench/event/daemon/grpc"
"github.com/craigdfrench/event/storage"
)
const (
port = ":50051"
// EventDatabaseBackend type
EventDatabaseBackend = "postgres"
// EventTableDefinition for definition of event table
EventTableDefi... |
4701b273fe8f7b79cb4e8b6150981fe8186dc1ec | c1bfb248e0ce35ac72e24945ce1f0a8c228e0761 | wuxuejie/go-substrate-rpc-client | /rpc/state/get_storage_hash_test.go | Go | go | 1,504 | permissive | // Go Substrate RPC Client (GSRPC) provides APIs and types around Polkadot and any Substrate-based chain RPC calls
//
// Copyright 2019 Centrifuge GmbH
//
// 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 th... |
772cb97576b5b29674fa472a68719ddc4e3c53d2 | 2fa3223edde4a37c03d132fcb1966f537972f090 | tonidy/okteto | /cmd/pipeline/deploy.go | Go | go | 10,077 | permissive | // Copyright 2022 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 ... |
1bc6fdee9829be3a4293f5dbfd02f0ff11a8f739 | 7970b7e77a6286f3c8dd43a6be1cff5d665073b5 | minderjan/jwx | /internal/jose/jose.go | Go | go | 4,912 | permissive | package jose
import (
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"os/exec"
"strings"
"sync"
"testing"
"github.com/lestrrat-go/jwx/internal/jwxtest"
"github.com/lestrrat-go/pdebug"
"github.com/pkg/errors"
)
var executablePath string
var muExecutablePath sync.RWMutex
func init() {
findExecutable()
}
func ... |
ec4b24ab87b2dc1f1a5269a9d6bede33b644e878 | 5f3464bb2551bc3c533ee0f8209395c762dd4869 | INFURA/eth2-comply | /pkg/eth2spec/response.go | Go | go | 1,506 | permissive | /*
* Eth2 Beacon Node API
*
* API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain.
*
* API version: Dev - Eth2Spec v0.12.2
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package eth2spec
import (
"net/http"
)
// APIRe... |
53b1440b91e32bc34760c8c6c9f5b206f542e76c | 3c6f0c472d938d22711423dac94a91ad4b7aea8e | resios/subify | /subtitles/languages/languages.go | Go | go | 24,093 | permissive | package lang
import (
"os"
"sort"
"strings"
"github.com/olekukonko/tablewriter"
)
// ByName implements sort.Interface for []Language based on
// the Description field.
type ByName []Language
func (a ByName) Len() int { return len(a) }
func (a ByName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
fun... |
e6cd400c7cd84879d54c02ab97aa35c1a9ae17a6 | 2fed60dd6e918546307dcd7cf2b2bd75b9d6c53f | spg7484/anna | /factory/id/id.go | Go | go | 371 | permissive | // Package id provides a simple ID generating factory using pseudo random
// strings.
package id
import (
"github.com/xh3b4sd/anna/spec"
)
// MustNew returns a new spec.ObjectID of type Hex128. In case of any error
// this method panics.
func MustNew() spec.ObjectID {
newID, err := MustNewFactory().WithType(Hex128)... |
d6b34c72a4e5303afb6d18aa53f2b718e1109fed | a07782a127b89d7550826e103c6ac94d5e7eefad | the-dan/kubernetes-ingress | /nginx-plus-controller/nginx/nginx.go | Go | go | 7,720 | permissive | package nginx
import (
"bytes"
"fmt"
"os"
"os/exec"
"path"
"text/template"
"github.com/golang/glog"
)
const dhparamFilename = "dhparam.pem"
// NginxController Updates NGINX configuration, starts and reloads NGINX
type NginxController struct {
nginxConfdPath string
nginxCertsPath string
local bool... |
f2051f57b0be99b902df05c1d13cc1d4d5457874 | 07f835a0509f5e57a648ded1f231203833574716 | mihaimelonari/azure-operator | /pkg/tenantcluster/cached.go | Go | go | 1,783 | permissive | package tenantcluster
import (
"context"
"time"
"github.com/giantswarm/microerror"
"github.com/giantswarm/micrologger"
gocache "github.com/patrickmn/go-cache"
capiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/giantswarm/azure-operator/v5/service/contr... |
437d7b59f9159e6f3ad4f5ea3990892b8f9db596 | 8fea55e2eeb3f5886c6b9ff0f2ce6e59c9e75062 | wsq1220/rpc-grpc-etcd-consul-micro | /rpc/demo3_protobuf/server/server.go | Go | go | 1,272 | no_license | package main
import (
"errors"
"fmt"
"net"
"net/http"
"net/rpc"
"time"
message "github.com/wsq1220/rpc-grpc-etcd-consul-micro/rpc/demo3_protobuf/proto"
)
type OrderService struct {
}
func (os *OrderService) GetOrderInfo(request message.OrderRequest, response *message.OrderInfo) error {
orderMap := map[stri... |
9ae6e53c90a0168de9ae358d3211cca3ee0983c3 | 0a2a375aeb52dcc9475ea48c5fb06bd69e643f17 | pingzha/podman | /libpod/image/docker_registry_options.go | Go | go | 3,287 | permissive | package image
import (
"fmt"
"github.com/containers/buildah/pkg/parse"
"github.com/containers/image/v5/docker/reference"
"github.com/containers/image/v5/types"
podmanVersion "github.com/containers/podman/v3/version"
)
// DockerRegistryOptions encapsulates settings that affect how we connect or
// authenticate t... |
9adf94700db130c233d2b8f326eedd1ce31a4bb0 | 0dcf2a0c5d6bf77daadd4546159b637a4f108571 | MichaelMure/go-datastore | /autobatch/autobatch_test.go | Go | go | 1,797 | permissive | package autobatch
import (
"bytes"
"fmt"
"testing"
ds "github.com/ipfs/go-datastore"
dstest "github.com/ipfs/go-datastore/test"
)
func TestAutobatch(t *testing.T) {
dstest.SubtestAll(t, NewAutoBatching(ds.NewMapDatastore(), 16))
}
func TestFlushing(t *testing.T) {
child := ds.NewMapDatastore()
d := NewAutoB... |
e1f8b29888735e3ec1f88d8d6d8b9b30a48c3825 | 2834c748b8a297e374d08123acb6429360ddba17 | Dk2014/GoTools | /src/github.com/lightpaw/male71/module/equipment/equipment_test.go | Go | go | 2,876 | no_license | package equipment
import (
"testing"
"github.com/lightpaw/male7/entity"
"github.com/lightpaw/male7/mock"
"github.com/lightpaw/male7/config/goods"
"github.com/lightpaw/male7/pb/shared_proto"
"github.com/lightpaw/male7/config/data"
. "github.com/onsi/gomega"
"github.com/lightpaw/male7/service/conflict/heroservic... |
ce1a62d9977aad46de2796aa6eca7426a8f9798e | ada31f4d03d74790f8d9ac1cd31d3e5583d8fbf3 | ifzz/match | /match_exec.go | Go | go | 7,433 | no_license | package match
import (
"github.com/shopspring/decimal"
)
//执行结构体
type exec struct {
symbol Symbol
dispatch *dispatcher
}
func newExec(sym Symbol, d *dispatcher) *exec {
return &exec{
symbol: sym,
dispatch: d,
}
}
//撮合
//在同一币对中是串行化
func (m *exec) matching() {
buyOrder := book.pop(m.symbol, BUY)
sellOr... |
12f14a62677b32cbe48e3fe4777e3ec164289042 | e2e9fd8f52a08ef3132b624477469ca2600320bf | faceair/carbonapi | /vendor/github.com/circonus-labs/gosnowth/stats.go | Go | go | 2,307 | permissive | package gosnowth
import (
"context"
"fmt"
)
// GetStats retrieves the metrics about the status of an IRONdb node.
func (sc *SnowthClient) GetStats(nodes ...*SnowthNode) (*Stats, error) {
return sc.GetStatsContext(context.Background(), nodes...)
}
// GetStatsContext is the context aware version of GetStats.
func (... |
2ceb02ba53142b20976ef09f901406f662b13844 | 9d977cc83b8deb1d0e7b0086947136d2b1066b28 | cli/cli | /pkg/cmd/search/shared/shared_test.go | Go | go | 7,258 | permissive | package shared
import (
"fmt"
"testing"
"time"
"github.com/cli/cli/v2/internal/browser"
"github.com/cli/cli/v2/internal/config"
"github.com/cli/cli/v2/pkg/cmd/factory"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/cli/cli/v2/pkg/search"
"github.com/stretchr/testify/assert"
)
func TestSearcher(t *testing... |
4e5d4aa6c59719a73ca7c0c930db905b2525e4e5 | 133b1242fb9e7492b6d71b384d6cca54b6ae002c | scriptsboy/origin | /vendor/github.com/openshift/library-go/pkg/operator/certrotation/target_test.go | Go | go | 11,898 | permissive | package certrotation
import (
"crypto/x509/pkix"
"strings"
"testing"
"time"
"github.com/davecgh/go-spew/spew"
"github.com/openshift/library-go/pkg/crypto"
"github.com/openshift/library-go/pkg/operator/events"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubefake "k8s.io/client... |
713ef474da7d89513557656f870f2f7034c2ef81 | eaba994e6169a5402e4cee40c9f5bc1cced22373 | cgxeiji/crossref | /crossref.go | Go | go | 280 | permissive | package crossref
import (
log "github.com/sirupsen/logrus"
)
const api string = "https://api.crossref.org/works"
// Debug checks the communication between the library and the API in detail.
func Debug() {
log.SetLevel(log.DebugLevel)
log.Info("Changed to debugging mode")
}
|
a8c415c0d773df69e2808b1413d8d73e814180ac | b7593e08855069d0cac480b4f721189db418c0f6 | aspenmesh/istio | /mixer/adapter/svcctrl/reportbuilder.go | Go | go | 10,533 | 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... |
9eb04bcf79886c370b0d5544c7616586795007b0 | b16de53bd1290d99aadefaa6976f64d6c316416e | morrell/pulumi-azure-native | /sdk/go/azure/streamanalytics/v20160301/output.go | Go | go | 5,980 | 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 v20160301
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// An output object, containing all info... |
ea61142622471a40443e7841a3b6ac0092f0b4e4 | e7d9eb1f138f19a3c9c357f7a71589de68ae1331 | openshift/installer | /terraform/providers/azurestack/vendor/github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/validate/uuid.go | Go | go | 585 | permissive | package validate
import (
"fmt"
"regexp"
"github.com/hashicorp/go-uuid"
)
//uuid regex helper
var UUIDRegExp = regexp.MustCompile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$")
func UUID(i interface{}, k string) (warnings []string, errors []error) {
v, ok := i.(stri... |
442321781e629ea3be2a4af7ed8f8915e06427d3 | fed3b059b1a1d703db3c8a6ac3e2c649750138d2 | wevnasc/baby-guess | /tables/models.go | Go | go | 3,088 | no_license | package tables
import (
"errors"
"fmt"
"math/rand"
"time"
"github.com/google/uuid"
)
type Status int
const (
None Status = 0
Selected = 1
Approved = 2
)
const (
MaxItems = 500
MinItems = 30
)
type owner struct {
id uuid.NullUUID
name string
email string
}
func newOwner(id uuid.... |
f6883ae0d038555a87349facd8500962e1df3c13 | 2a97826e710d00be37ad179d2d31f4ffd84e73e8 | dangxiaobin123/leetcodeAC | /leetcode/0108. 将有序数组转换为二叉搜索树/go/sorted-array-to-binary-search-tree.go | Go | go | 301 | no_license | package problem0108
import (
"github.com/GoKit"
)
type TreeNode = GoKit.TreeNode
func sortedArrayToBST(nums []int) *TreeNode {
if len(nums) == 0 {
return nil
}
m := len(nums)/2
return &TreeNode{
Val: nums[m],
Left: sortedArrayToBST(nums[:m]),
Right: sortedArrayToBST(nums[m+1:]),
}
}
|
69df4981617dec068d515680a77e676023a84577 | 116a7b8b3913b1df2ba3b3a43bd31f40f53634ad | VannAtApollo/apollo-demo-1 | /proxy/proxy.go | Go | go | 2,196 | no_license | package main
import (
"crypto/tls"
"flag"
"fmt"
"io"
"log"
"net"
"net/http"
"time"
)
func handleTunneling(w http.ResponseWriter, r *http.Request) {
dest_conn, err := net.DialTimeout("tcp", r.Host, 10*time.Second)
if err != nil {
http.Error(w, err.Error(), http.StatusServiceUnavailable)
return
}
w.Writ... |
3d00227c0ca429b4012243166d4b9ad3ab4b7c84 | 8f1eb64c5174a5a65c97177200a28c6955389063 | mongodb/mongodb-kubernetes-operator | /api/v1/groupversion_info.go | Go | go | 1,237 | permissive | /*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed un... |
0b489df63052ae8704e81613edff9d555b009aec | 228f32cd002642b9a7b72ad89c195737612c52ba | damilarelana/goGravatar | /hasher/hasher.go | Go | go | 998 | no_license | package hasher
import (
"crypto/md5"
"encoding/hex"
"fmt"
)
// EmailHasher takes an email string and returns it's MD5 hash value
func EmailHasher(email string) string {
hasher := md5.New() // instantiate a new hasher from the md5 package
data := []byte(email) ... |
dac7c5fe54ff151238a357abcd7ceb7c099d196c | 17c278f611c9fca18819ef4704cff59f9a9ff585 | christian-posta/mixer | /pkg/adapter/quotas.go | Go | go | 4,012 | 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... |
fc7ca850778a16bb6e4060e1aaa9cf5cb70ec197 | e7e9b1e7d3b4478c7ea03f47b742d903d4a68a3b | inatonix/ishocon8 | /vote.go | Go | go | 1,186 | no_license | package main
import (
"fmt"
"strings"
)
// Vote Model
type Vote struct {
ID int
UserID int
CandidateID int
Keyword string
}
func getVoteCountByCandidateID(candidateID int) (count int) {
row := db.QueryRow("SELECT COUNT(*) AS count FROM votes WHERE candidate_id = ?", candidateID)
row.Scan(&c... |
294f6be471acee3db4b4cc59657ef51e7367488e | 599866521106c81b2cc4c1286b1b616a26148571 | dino10bit/kleister-api | /main.go | Go | go | 1,180 | permissive | package main
import (
"os"
"runtime"
"github.com/Sirupsen/logrus"
"github.com/kleister/kleister-api/cmd"
"github.com/kleister/kleister-api/config"
"github.com/urfave/cli"
_ "github.com/joho/godotenv/autoload"
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
app := cli.NewApp()
app.Name = "kleister"
... |
c4a6fc75fbe40bdc70a3a6e68e60f34a4e61b9d2 | 2cef72c1e81bfedf945e725193f0e6d258ffa89c | linguohua/sloth-servers | /gosrc/lobbyserver/lobby/room/handler_club_delete_room.go | Go | go | 4,561 | no_license | package room
import (
"gconst"
"gpubsub"
"lobbyserver/config"
"lobbyserver/lobby"
"net/http"
"strconv"
"time"
"github.com/garyburd/redigo/redis"
"github.com/julienschmidt/httprouter"
log "github.com/sirupsen/logrus"
"github.com/golang/protobuf/proto"
)
func deleteRoomReply(w http.ResponseWriter, errCode... |
3d8c466bd8278b468f7c11f5048fbaa5344e30d3 | 083e728b7a5891844e5fefe0a2b80ebf36a092df | kubesphere/kubesphere | /vendor/github.com/projectcalico/calico/libcalico-go/lib/backend/model/block_affinity.go | Go | go | 3,327 | permissive | // Copyright (c) 2016-2019 Tigera, 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 ap... |
e7e530b4619e8ac9d72f64fe0b49cc894cd394a3 | 217fac9f9759f4bd007b39f887236a06fa9799ce | VKTRS2/finance-messaging | /iso20022/ClosingBalance1Choice.go | Go | go | 699 | permissive | package iso20022
// Choice of closing balance.
type ClosingBalance1Choice struct {
// Sum of the opening balance and all entries booked to the account at the close of the statement period.
Final *BalanceQuantity5Choice `xml:"Fnl"`
// Closing balance of this page only. This balance must be the intermediary opening... |
792b317f9e4e56ec3a31245faf40263abe4220d9 | c851b92db82ad57cef21a04da35a9aba70872089 | plimble/goes | /event_gen.go | Go | go | 4,596 | permissive | package goes
// NOTE: THIS FILE WAS PRODUCED BY THE
// MSGP CODE GENERATION TOOL (github.com/tinylib/msgp)
// DO NOT EDIT
import (
"github.com/tinylib/msgp/msgp"
)
// DecodeMsg implements msgp.Decodable
func (z *Event) DecodeMsg(dc *msgp.Reader) (err error) {
var field []byte
_ = field
var zxvk uint32
zxvk, err... |
f3190b850d62620287feae3378ecf88d0d064e0c | 6cc764b827d400ea22c2be638b7913e73bab052c | gamapedro77/he4rtoberfest-2020 | /challenges/5-frequencia-das-letras/go/murilosrg/main.go | Go | go | 1,268 | no_license | package main
import (
"bufio"
"fmt"
"os"
"regexp"
"sort"
"strings"
)
func main() {
var numCasos int
fmt.Printf("Digite quantos casos de teste: ")
fmt.Scan(&numCasos)
for i := 0; i < numCasos; i++ {
entrada := bufio.NewReader(os.Stdin)
fmt.Print("\n Digite texto de entrada: ")
texto, _ := entrada.Read... |
195d84cb2d0a7b52ad8dc9984755aec2c623819f | e14bb7e01551187e0ecd18bb6a7a1181bef8f3b1 | Dreamheart/terraform-provider | /alicloud/resource_alicloud_dns_test.go | Go | go | 2,117 | permissive | package alicloud
import (
"fmt"
"log"
"testing"
"github.com/denverdino/aliyungo/dns"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
func TestAccAlicloudDns_basic(t *testing.T) {
var v dns.DomainType
resource.Test(t, resource.TestCase{
PreCheck: func() {
te... |
11d019038d351f606be64a250ebb1baf00aef991 | 54c7ed21430c450c9ce96a9f5c10e76298fe1e23 | sokkojohnny1/certigo | /starttls/starttls.go | Go | go | 6,251 | permissive | /*-
* Copyright 2017 Square 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... |
53267cdd63de9eb3d945ba4f605a753515ba70f0 | ef4393f48935b6505d2c42b5f463392d2e183421 | ddipankargogoi/cloud-build-samples | /go-rest-main/src/cmd/link/internal/ppc64/obj.go | Go | go | 3,296 | permissive | // Inferno utils/5l/obj.c
// https://bitbucket.org/inferno-os/inferno-os/src/master/utils/5l/obj.c
//
// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
// Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
// Portions Copyright © 1997-1999 Vita Nuova Limited
// Portions Copyright ©... |
56ea73f629697d95ac88205eb12a19e7f5a3a277 | 958c86cf21af05cf5642c407e170d7d89f594c87 | blamdemo/asdionefgb | /cmd/version.go | Go | go | 661 | no_license | package cmd
import (
"fmt"
"github.com/backstage/adasdasd/version"
"github.com/spf13/cobra"
)
// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of generated code example",
Long: `All software has versions. This is generated code exa... |
9ea5c36f196cbaafaac34e44993b587288e0a8d5 | f1c1938fe9969d48d24672012ec85a1ca1ffbae5 | mhale/gridserver-exporter | /sqlclient.go | Go | go | 5,911 | permissive | package main
import (
"database/sql"
"fmt"
"net/url"
"strconv"
"strings"
"time"
_ "github.com/denisenkom/go-mssqldb"
_ "github.com/godror/godror"
_ "github.com/lib/pq"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
const (
queryTmpl = `
WITH latest AS (
SELECT
broker_id,
MAX(time... |
26440bb56f010fb1893600ec7508d774559369e5 | 819399783b4c1fe2e8f2ae8aa117f49e3a1975e9 | sreev/optimize-controller | /internal/experiment/generation/transformer.go | Go | go | 8,309 | permissive | /*
Copyright 2020 GramLabs, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... |
9db7ba84f651a118b0753ea6b010df8e6f5b38b1 | 7fb01f12834d4ddb94b1d44f704b0ba1f022367b | palantir/go-githubapp | /example/config.go | Go | go | 1,435 | permissive | // Copyright 2018 Palantir Technologies, 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 ... |
843f294fe554afc425bab55f20d64570f446c28e | c0a2e1ef9a845f516e10b0456f710469dfd9de33 | dkyaorui/DosMq | /utils/utils.go | Go | go | 363 | no_license | package utils
import (
"fmt"
"github.com/spf13/viper"
)
// United return data format
type RequestResult struct {
Code int // http's status code
Data interface{}
}
func CheckRegisterTopicKey(key string) (err error) {
if key != viper.Get("topic.key") {
return fmt.Errorf("the key with regist... |
7b6af737d4473654e6800390a1bfb58403da943b | f5af150c2551c8274b2e60f36d2bfa35b86b2614 | ssimpl/algo | /math/decbin.go | Go | go | 217 | no_license | package math
import "strconv"
func DecimalToBinary(n int) string {
if n == 0 {
return "0"
}
var binary string
for n > 0 {
rem := n % 2
binary = strconv.Itoa(rem) + binary
n = n / 2
}
return binary
}
|
aae7a5da1a661d69e96b021b8ce3f694bf57d7e2 | d611d677d46ee2d9109822c9d1d6cebae48a4b5f | fadeAce/dendrite | /src/github.com/matrix-org/dendrite/typingserver/typingserver.go | Go | go | 1,148 | permissive | // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed ... |
3e61330ed099a7e038a2ba850ee5a14fcfba6674 | 8e34b75b4580f595ea30bcc815fdbced479b97a5 | microsoftgraph/msgraph-beta-sdk-go | /approleassignments/count_request_builder.go | Go | go | 4,239 | permissive | package approleassignments
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459 "github.com/microsoftgraph/msgraph-beta-sdk-go/models/odataerrors"
)
// CountReques... |
03345766dc3dd645385c079ef0bdb971ac1a653e | f064d47933b995360cfa7deca46655a255646454 | suisenkotoba/weatherit | /drivers/domain_factory.go | Go | go | 1,622 | no_license | package drivers
import (
userDB "weatherit/drivers/databases/users"
userDomain "weatherit/usecases/users"
eventDB "weatherit/drivers/databases/events"
eventDomain "weatherit/usecases/events"
weatherForecasterSource "weatherit/drivers/thirdparties/weather"
weatherForecasterDomain "weatherit/usecases/weatherfore... |
bbd073a397b92bc3978d5b314653f6b04eff249f | 368e1cba33de7f1d4dab879551def4396318466a | mayson/nginx-sso | /main.go | Go | go | 11,508 | permissive | package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"os/signal"
"path"
"strings"
"syscall"
"github.com/flosch/pongo2"
"github.com/gorilla/context"
"github.com/gorilla/sessions"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
yaml "gopkg.in/yaml.v2"
"github.com/Luzifer/nginx-sso... |
8d8c5c76af573f51fb012257152f2397df6bb912 | 8cd9302402ff8809c3fe225088a5c403bae869fb | inkel/gedis-cli | /main.go | Go | go | 2,469 | no_license | package main
import (
"flag"
"fmt"
"github.com/inkel/gedis/client"
"github.com/kless/term/readline"
"os"
"strings"
)
const (
red = "\033[1;33m"
yellow = "\033[1;33m"
blue = "\033[1;34m"
cyan = "\033[0;36m"
reset = "\033[0m"
cnil = cyan + "nil" + reset
)
func perror(err error) {
fmt.Println(cerr... |
e5a92c833002e26c6b842368658b518ddd9a92a8 | 68ea5a4afbaaf3e86338a9f961cb54652145c1e0 | salamantos/Web_MIPT | /task4/solve.go | Go | go | 1,122 | no_license | package main
import "fmt"
import "unicode"
func RemoveEven(array []int) (result []int) {
for _, elem := range array {
if elem%2 == 1 {
result = append(result, elem)
}
}
return
}
func PowerGenerator(n int) (func() int) {
var previousRes = 1
return func() (res int) {
res = previousRes * n
previousRes =... |
6b9d1f485b967c3378a2b49007d3d2afe4ecff22 | 68d35b1309f463e61d8a2ac2f23f160ba16f2731 | yyf330/gophercloud | /openstack/networking/v2/extensions/subnetpools/results.go | Go | go | 7,409 | permissive | package subnetpools
import (
"encoding/json"
"fmt"
"strconv"
"time"
"github.com/yyf330/gophercloud"
"github.com/yyf330/gophercloud/pagination"
)
type commonResult struct {
gophercloud.Result
}
// Extract is a function that accepts a result and extracts a subnetpool resource.
func (r commonResult) Extract() (... |
0d99eb61ae4a1f215c3bc11a1a40a20f20576c91 | cf34cc3661b3dfe8f05e9bb8001cf588089fcbc4 | skyformat99/gfast | /app/model/admin/sys_config/sys_config.go | Go | go | 5,016 | permissive | package sys_config
import (
"gfast/library/service"
"gfast/library/utils"
"github.com/gogf/gf/errors/gerror"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/os/gtime"
"github.com/gogf/gf/util/gconv"
)
// Fill with you ideas below.
//新增页面请求参数
type AddReq struct {
ConfigName string `p:"configName" v:"required... |
823cf795866b4d883eed8151152ce14a7ae5ce30 | e885514e32adf3490e68f5f65edddd2c9a7f8229 | PI-Victor/origin | /pkg/configconversion/kubecontrolplane_refs.go | Go | go | 1,800 | permissive | package configconversion
import (
kubecontrolplanev1 "github.com/openshift/api/kubecontrolplane/v1"
"github.com/openshift/library-go/pkg/config/helpers"
)
func GetKubeAPIServerConfigFileReferences(config *kubecontrolplanev1.KubeAPIServerConfig) []*string {
if config == nil {
return []*string{}
}
refs := []*st... |
706f45e068cb174e57aa6ddaff957107e2333fb1 | 2b919161c29b88d9e8b849d10cd244fc0b16d509 | kubernetes-sigs/scheduler-plugins | /vendor/github.com/k8stopologyawareschedwg/podfingerprint/notify.go | Go | go | 1,499 | permissive | /*
* Copyright 2023 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 t... |
7327bf097a942e4048f3440d708ee181db4ed97e | 8b2590418bbb69dd19ba484c4f72d122a1877fe8 | iotaledger/goshimmer | /packages/protocol/engine/tsc/testframework_test.go | Go | go | 1,980 | permissive | package tsc_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/iotaledger/goshimmer/packages/protocol/engine/consensus/blockgadget"
"github.com/iotaledger/goshimmer/packages/protocol/engine/tangle"
"github.com/iotaledger/goshimmer/packages/protocol/engine/tangle/blockdag"
"github.com/iot... |
19b714c0bb0bba250fef8dccf94e9ea05a6c49ad | 08c018aafb7e53309451fa2e780e421c2ca67a00 | bitwalker/luar | /luar.go | Go | go | 32,043 | permissive | // Copyright Steve Donovan 2013
//
package luar
import lua "github.com/bitwalker/golua/lua"
import "strings"
import "reflect"
import "unsafe"
import "fmt"
import "sync"
// raise a Lua error from Go code
func RaiseError(L *lua.State, msg string) {
L.Where(1)
pos := L.ToString(-1)
L.Pop(1)
panic(L.NewError(pos + " ... |
179877189cd1aad34d51f933dfcab1ce82cfb6f9 | 25f1d430844ba6f4ff828b168bdfbd05b95d2f14 | commitmoji/gardener | /pkg/apis/core/v1beta1/helper/helper_suite_test.go | Go | go | 955 | permissive | // 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 compliance with the Lice... |
7970209fa7decadf4c05a0e81afcef7705364b64 | 180a596738a8ffa1f436db065ed2165679b812c1 | Abhishek-Preman1/anax | /cli/unregister/unregister.go | Go | go | 1,501 | permissive | package unregister
import (
"fmt"
"github.com/open-horizon/anax/cli/cliutils"
)
type ApiAttribute struct {
Id string `json:"id"`
}
type ApiAttributes struct {
Attributes []ApiAttribute `json:"attributes"`
}
// DoIt unregisters this Horizon edge node and resets it so it can be registered again
func DoIt(forceUnr... |
9ededc820fbdca5741287ff54a5458408b28b890 | 2f19ff57a12ba1d2e9ae09eee0a771a3848bb19d | chenminhua/R2D2 | /main.go | Go | go | 6,528 | no_license | package main
import (
"log"
"os"
"time"
"github.com/tucnak/telebot"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
"R2D2/model"
"fmt"
"strings"
"strconv"
)
func NotifyAll(db *gorm.DB, bot *telebot.Bot) {
//从周一到周六的早上八点,给所有人发送点餐信息
flag := true
fo... |
24bf08dc847ded07a356ffbf86931e020765d2f6 | d446311e7a43080933745bae0e8f04374114d5f7 | kubemq-io/kubemqctl | /cmd/events_store/receive.go | Go | go | 6,706 | permissive | package events_store
import (
"context"
"fmt"
"github.com/AlecAivazis/survey/v2"
kubemq2 "github.com/kubemq-io/kubemq-go"
"github.com/kubemq-io/kubemqctl/pkg/config"
"github.com/kubemq-io/kubemqctl/pkg/k8s"
"github.com/kubemq-io/kubemqctl/pkg/kubemq"
"github.com/kubemq-io/kubemqctl/pkg/utils"
"github.com/spf1... |
7cd8ec8a7f2b6a30d4a5c5b777dca1ea6e1ed47e | c4e6d73970a9efac47d156e6ee4c99958d51cf69 | uber/zanzibar | /benchmarks/benchserver/main.go | Go | go | 3,195 | permissive | // Copyright (c) 2023 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... |
8fe6e9cbfafeb1bacd95006967b940767db17a1f | 553a7cec901fc3e458eaee5c2698c92f51c45740 | DotDashPay/braintree-go | /transaction.go | Go | go | 5,334 | permissive | package braintree
import (
"github.com/DotDashPay/braintree-go/nullable"
"time"
)
type Transaction struct {
XMLName string `xml:"transaction"`
Id string `xml:"id,omitempty"`
CustomerID string `xml:"customer-id,om... |
0ef0f2c4079575f3c72f62410793b4b4d26c6b35 | a62db02eac047fb1c0682d4a58cd8e6e3610bcab | djmaze/do-api-proxy | /main.go | Go | go | 2,225 | no_license | package main
import (
"fmt"
"log"
"net/http"
"net/http/httputil"
"net/url"
"strings"
)
type Message struct {
Droplet_ID int64
Type string
}
var config EnvConfig
// Serve a reverse proxy for a given url
func serveReverseProxy(target string, res http.ResponseWriter, req *http.Request) {
// parse the ... |
d5a78b51fbab51ef875da405c231b2cf3bff01e0 | 71999b0d6fb2ec2ac95dfe2e51bf0f0c2f310583 | dean2021/relimit | /_example/main.go | Go | go | 777 | no_license | package main
import (
"github.com/dean2021/relimit"
"log"
"time"
)
// WorkerMain Subprocess entry function
func WorkerMain() {
var memory []string
for {
// Dead loop, simulating CPU usage increase
// Allocate memory, resulting in process OOM
memory = append(memory, "AAAAAAA")
}
}
func main() {
control... |
3e3d43052e2d5c3228a2a218010a69d369e85dc6 | 7c838a908ab5d4be4e59655bc1d4f8328fafdac0 | puxin71/advanced-cloud-native-go | /Frameworks/Gin-Web/service/inmemService.go | Go | go | 1,268 | no_license | package service
import (
"github.com/puxin71/advanced-cloudnative-go/Frameworks/Gin-Web/datastore"
"github.com/puxin71/advanced-cloudnative-go/Frameworks/Gin-Web/model"
)
// Collections of books stored in memory
type InMemBookService struct {
store *datastore.InMemStore
}
// Initialize a memBookService with a col... |
9c5a3506d650a91b2b4e3721c4efbbfb33f4a7ec | 0672dc9569a0527a44483fb2f855a4c4adac3feb | sharpevo/synthesis | /internal/instruction/led.go | Go | go | 534 | no_license | package instruction
import (
"fmt"
"synthesis/internal/dao/alientek"
)
type InstructionLed struct {
Instruction
}
func (i *InstructionLed) Execute(args ...string) (resp interface{}, err error) {
if len(args) != 1 {
return resp, fmt.Errorf("not enough arguments")
}
alientekDao := *alientek.Instance(string(0x... |
dee863c7df78cf9ba9431e788914cd940d15e23f | 68ffaf197066d8c2d958a880eddde213beb7a114 | yudaprama/iso20022 | /model/CancelledReason11Choice.go | Go | go | 707 | permissive | package model
// Choice between a standard code or proprietary code to specify the reason why the instruction or cancellation request is cancelled.
type CancelledReason11Choice struct {
// Standard code to specify the reason why the instruction is cancelled.
Code *CancelledStatusReason6Code `xml:"Cd"`
// Propriet... |
0c5ab5473520a125ec3add73c6e99b46420b78aa | c8bc1d4aa859ed55653cf03e870ca41f7fc33382 | Dev-JamesR/go-ipfs | /gxlibs/github.com/polydawn/refmt/json/jsonFixtures_bool_test.go | Go | go | 352 | permissive | package json
import (
"testing"
"github.com/ipsn/go-ipfs/gxlibs/github.com/polydawn/refmt/tok/fixtures"
)
func testBool(t *testing.T) {
t.Run("bool true", func(t *testing.T) {
checkCanonical(t, fixtures.SequenceMap["true"], `true`)
})
t.Run("bool false", func(t *testing.T) {
checkCanonical(t, fixtures.Seque... |
c7252a5bfa05f71be5e607ffe29b495e844f9d46 | 4b37e98c7bf6db8af051f26451c75184bc5fed78 | Prashanth684/coreos-assembler | /tools/vendor/github.com/minio/direct-csi/pkg/sys/sys_utils.go | Go | go | 4,251 | permissive | // This file is part of MinIO Direct CSI
// Copyright (c) 2021 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) an... |
d5a9070e69d194b766bdd3081a320dcaf6d92762 | 2e635ce5a826849c7768d6cd6cfec3e626504369 | Necmttn/chainlink | /core/internal/cltest/client.go | Go | go | 10,976 | permissive | package cltest
import (
"bytes"
"context"
"fmt"
"math/big"
"strings"
"testing"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexut... |
7301e162712f0b90099dad28a045b5c1f86c0436 | 35795c9ac5dcfb9e7c52a8a07c36457160363012 | lysandroc/learning-go | /functions/go-flag.go | Go | go | 262 | no_license | package functions
import (
"flag"
"fmt"
"strings"
)
var n = flag.Bool("n", false, "omit trailing newline")
var sep = flag.String("s", " ", "separator")
func Flags() {
flag.Parse()
fmt.Print(strings.Join(flag.Args(), *sep))
if !*n {
fmt.Println()
}
}
|
78ac6168252fa999aa9ee4b2870d7e8d5d5ad7e8 | 575562b36406414160441624ff296d707a7cb1a0 | nammi31/100daysOfCode | /day1/1108/Defanging an IP Address.go | Go | go | 224 | no_license |
package main
import (
"fmt"
"strings"
)
func defangIPaddr(address string) string {
return strings.Replace(address, ".", "[.]",len(address)/2)
}
func main( ){
address:="255.100.50.0"
fmt.Println(defangIPaddr(address))
} |
c285be1405235324b0b3785fce4d97e6da03031c | 4e73d30a4da9af4190291af5caebe680f96a0e73 | ksunhokim/kubernetes | /pkg/volume/vsphere_volume/vsphere_volume_test.go | Go | go | 7,730 | 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, ... |
dc697380c4a588bfa34a030fb4a5f3a9a0414c43 | 95d1279b07092e834def458d77add4ebac9d69f8 | stellarproject/gatekeeper | /main.go | Go | go | 2,995 | no_license | /*
Copyright 2019 Stellar Project
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, publish, distribute,... |
b342043208e03ddc7d7929f5a8303961f61bb38c | 945287845316184b7cefbe10366dd90bcc6cb78b | mohamedattahri/freeway | /bucket.go | Go | go | 10,046 | permissive | package freeway
/*
When a Kademlia node received any message (request or reply) from another
node, it updates the appropriate k-bucket for the sender's node ID. If the
sending node already exists in the recipient's k-bucket, the recipient moves
it to the tail of the list. If the node is not already in the appropri... |
92bad88382a8ef88ff16b87cc34b583ef58d0ff4 | ab1bb411f3525dfb6bb0b4340dfca2c796872658 | FlorianBergmann/gosoline | /pkg/apiserver/auth/config_google.go | Go | go | 4,949 | no_license | package auth
import (
"context"
"fmt"
"github.com/applike/gosoline/pkg/cfg"
"github.com/applike/gosoline/pkg/log"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
"google.golang.org/api/oauth2/v2"
"google.golang.org/api/option"
"net/http"
"regexp"
"sync"
)
const ByGoogle = "google"
//go:generate mockery... |
f5b73b2ae033be9333b1b9dc5ec63576ff4f8868 | 2b712ba13ce4e6e794da3fe4aacf040886a339f3 | 119Vik/magma-1 | /orc8r/cloud/go/serde/registry_internal_test.go | Go | go | 5,375 | permissive | /*
* Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
package serde
import (
"testing"
"magma/orc8r/cloud/go/serde/mocks"
"github.com/stretchr/testif... |
65ad84a7c0020ad98a76832d65dcd61232413e8f | a47a698553e2773a43c8b7e91196c743df86e3fc | golint-fixer/bmutil | /hash/sha.go | Go | go | 2,700 | permissive | // Originally derived from: btcsuite/btcd/wire/shahash.go
// Copyright (c) 2013-2015 Conformal Systems LLC.
// Copyright (c) 2015 Monetas
// Copyright 2016 Daniel Krawisz.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package hash
import (
"bytes"
"encoding/hex"... |
9222e7b2b37637f451d55a8f702cf77696f4e24e | 0180dbea3b8c583ca9b3ff44fe6a349d38a8eb7b | sgtest/monorepo-test-3 | /kubernetes-13/federation/client/clientset_generated/federation_internalclientset/typed/extensions/internalversion/fake/fake_daemonset.go | Go | go | 4,133 | 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, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.