text stringlengths 11 4.05M |
|---|
package conf
//Kafaka 定义结构体
type Kafaka struct {
Ipaddr string `ini:"ipaddr"`
Topic string `ini:"topic"`
}
//Tailf 定义路径
type Tailf struct {
Path string `ini:"path"`
}
//LogConf 定义配置文件信息
type LogConf struct {
Kafaka `ini:"kafaka"`
Tailf `ini:"tailf"`
}
|
package model
import (
"github.com/guregu/null"
)
// Subscription represents user's notification settings.
type Subscription struct {
ID int `json:"id"`
UserID null.Int `json:"user_id"`
ProjectUUID string `json:"project_uuid" gorm:"ForeignKey:UUID"`
Email string `json:"email"`
DeletedA... |
package workflows
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/codepipeline"
"github.com/olekukonko/tablewriter"
"github.com/stelligent/mu/common"
"io"
)
// NewServiceViewer create a new workflow for showing an environment
func NewServiceViewer(ctx *common.Context, serviceNa... |
package main
import "fmt"
func distributeCandies(candies []int) int {
vis := make(map[int]bool)
for _, v := range candies {
vis[v] = true
}
if len(vis) >= len(candies)/2 {
return len(candies) / 2
} else {
return len(vis)
}
}
func main() {
fmt.Println(distributeCandies([]int{1, 1, 2, 2, 3, 3}))
fmt.Print... |
// SPDX-License-Identifier: MIT
package mock
import (
"strconv"
"github.com/caixw/apidoc/v7/internal/ast"
)
// GenOptions 生成随机数据的函数
type GenOptions struct {
// 返回一个随机的数值
//
// 可以是浮点和整数类型。
Number func(p *ast.Param) any
// 返回一个随机长度的字符串
String func(p *ast.Param) string
// 返回一个随机的布尔值
Bool func() bool
// 返... |
package settings
import (
"fmt"
"log"
"os"
"strings"
)
const (
// The base url of the host for constructing callback urls
HostUrlEnvVar string = "HOST_URL"
// Heroku injects the exposed port via environment variable
HostPortEnvVar string = "PORT"
// Heroku injects the attached database host via environment... |
package app
import (
"net/http"
)
//IContext 定义一个接口
type IContext interface {
Config(w http.ResponseWriter, r *http.Request)
}
//Context 结构体
type Context struct {
w http.ResponseWriter
r *http.Request
}
//Config 配置ResponseWriter和Request
func (c *Context) Config(w http.ResponseWriter, r *http.Request) {
c.w = w... |
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package rpc
import (
"crypto/tls"
"net"
"time"
"github.com/spacemonkeygo/monkit/v3"
"github.com/zeebo/errs"
"storj.io/common/memory"
)
const (
// IsDRPC is true if drpc is being used.
IsDRPC = true
)
var mon = monkit.Package()
... |
package connection
import (
"github.com/Iteam1337/go-protobuf-wejay/message"
"github.com/Iteam1337/go-udp-wejay/rooms"
)
func (c *Connection) handleQueryRooms() {
msg := c.msg.(*message.QueryRooms)
res := message.QueryRoomsResponse{Ok: false}
if msg == nil {
res.Error = "could not parse input"
c.send(&res)
... |
// Copyright 2018-present The Yumcoder Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// Author: yumcoder (omid.jn@gmail.com)
//
package datatype
import (
"fmt"
"testing"
)
type sss struct {
}
func f1(f interface{}) {
if nam... |
// Copyright 2014 The DevMine 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 main
import (
"bytes"
"database/sql"
"encoding/binary"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"re... |
package model_test
import (
"github.com/Lunchr/luncher-api/db/model"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("RegistrationAccessToken", func() {
Describe("Token", func() {
Describe("NewToken", func() {
It("doesn't return duplicate items", func() {
t1, err := model.NewTok... |
package server
import (
"context"
"io"
"testing"
"github.com/dhaifley/dlib"
"github.com/dhaifley/dlib/ptypes"
"github.com/dhaifley/dlib/dauth"
"github.com/sirupsen/logrus/hooks/test"
"google.golang.org/grpc"
)
type MockUserAccess struct {
DBS dlib.SQLExecutor
}
func (m *MockUserAccess) GetUsers(opt *dauth.... |
package main
import (
"bytes"
"html/template"
"os"
"strings"
)
// Template options.
type Template struct {
Name string
Data map[string]string
}
// Render returns string markup for a template.
func (t *Template) Render() string {
var markup bytes.Buffer
data := make(map[string]template.HTML)
wd, wdErr := o... |
package httpexpect
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestDurationFailed(t *testing.T) {
chain := makeChain(newMockReporter(t))
chain.fail("fail")
ts := time.Second
value := &Duration{chain, &ts}
value.chain.assertFailed(t)
value.Equal(ts)
value.NotEqual(ts)
value.G... |
package utils
import (
"strings"
"unicode"
)
// ToSnake converts a given string to snake case
func ToSnake(s string) string {
var result string
var words []string
var lastPos int
rs := []rune(s)
for i := 0; i < len(rs); i++ {
if i > 0 {
switch {
case unicode.IsUpper(rs[i]):
words = append(words, s... |
// Copyright 2021 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package wifi
import (
"bytes"
"context"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"chromiumos/tast/errors"
"chromiumos/tast/remote/bundles/cro... |
package dataStruct
type Stact struct {
ll *LinkedList
}
func NewStack() *Stact {
return &Stact{ll: &LinkedList{}}
}
func (s *Stact) Push(val int) {
s.ll.AddNode(val)
}
func (s *Stact) Pop() int {
back := s.ll.Back()
s.ll.PopBack()
return back
}
func (s *Stact) Empty() bool {
return s.ll.Empty()
}
|
package app
import "html/template"
// Tag ..
type Tag struct {
ID int `json:"id"`
Name string `json:"name"`
Level int `json:"level"`
Order int `json:"order"`
Logo string `json:"logo"`
ParentID int `json:"parentid"`
Children TagArr `json:"children"`
}
// TagArr ..
type TagArr []... |
package main
import (
"fmt"
"github.com/c2technology/tiny-wasteland-tools/vehicle"
)
// Generates a vehicle
func main() {
vehicle := vehicle.Generate()
//TODO: Pull name from input or a name generator
fmt.Println(fmt.Sprintf("Chassis: %s", vehicle.Chassis.Name))
fmt.Println(fmt.Sprintf("Capacity: %d", vehicle.C... |
package user
import (
"github.com/gin-gonic/gin"
//"net/http"
"fmt"
"go-antd-admin/utils/result"
"go-antd-admin/utils/e"
"go-antd-admin/models"
"go-antd-admin/middleware/jwt"
)
func Index(c *gin.Context) {
c.String(200, "Hello World2")
}
// 注册信息
type RegistInfo struct {
Name string `form:"name" binding:"requir... |
package paxos
import (
"errors"
"fmt"
"github.com/cmu440-F15/paxosapp/rpc/paxosrpc"
"net"
"net/http"
"net/rpc"
"strings"
"sync"
"time"
"encoding/gob"
"bytes"
)
type proposal struct {
N int
V interface{}
}
type paxosNode struct {
id int
nodes map[int]*rpc.Client
storage map[strin... |
package sequencing
// Align byte arrays x and y into z and w.
// Example :ABCDEF and ABCCDEF can be aligned in AB-CDEF and ABCCDEF
// https://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algorithm
func NeedlemanWunsch(x []byte, y []byte, gap int, similarity func(byte, byte) int, f [][]int) (z []byte, w []byte) {
//... |
package sgml
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = DescribeTable("predefined attributes",
func(code, rendered string) {
Expect(predefinedAttribute(code)).To(Equal(rendered))
},
Entry("sp", "sp", " "),
Entry("blank", "blank", ""),
Entry("empty", "empty", ""),
Entry("nbsp... |
package types
import (
"github.com/caos/zitadel/internal/config/systemdefaults"
"github.com/caos/zitadel/internal/crypto"
iam_model "github.com/caos/zitadel/internal/iam/model"
"github.com/caos/zitadel/internal/notification/templates"
es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model"... |
package main
import (
"strconv"
"testing"
)
func TestStringConcat(t *testing.T) {
start := "hello"
start += " there"
if start != "hello there" {
t.Errorf("string concat doesn't behave as you expect, got %v", start)
}
}
func TestStringConversion(t *testing.T) {
conversion, _ := strconv.Atoi("39")
if conver... |
package video
import (
"github.com/pokemium/worldwide/pkg/util"
)
// GBVideoRenderer & GBVideoSoftwareRenderer
type Renderer struct {
// GBVideoRenderer
g *Video
disableBG, disableOBJ, disableWIN bool
highlightBG bool
highlightOBJ [MAX_O... |
// Copyright (c) 2018-present, MultiVAC Foundation.
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
// Copyright (c) 2013-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICEN... |
package cmd
import (
"fmt"
"io"
"net/http"
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/Recime/recime-cli/util"
"github.com/howeyc/fsnotify"
"github.com/mitchellh/go-homedir"
)
//WatchForChanges watch file for changes
func WatchForChanges(dir string, targetDir string) {
watcher, err := fsnotify.Ne... |
package main
import "fmt"
/*
Let's call any (contiguous) subarray B (of A) a mountain if the following properties hold:
B.length >= 3
There exists some 0 < i < B.length - 1 such that B[0] < B[1] < ... B[i-1] < B[i] > B[i+1] > ... > B[B.length - 1]
(Note that B could be any subarray of A, including the entire array A.... |
package main
import (
"net/http"
"fmt"
"encoding/json"
"bytes"
)
type twilText struct {
MessageSid string `json:"MessageSid"`
SmsSid string `json:"SmsSid"`
AccountSid string `json:"AccountSid"`
From string `json:"From"`
To string `json:"To"`
Body string `json:"Body"`
NumMedia string `jso... |
package main
import (
"log"
"net/http"
_ "github.com/go-sql-driver/mysql"
"github.com/ksbeasle/GoLang/api"
"github.com/ksbeasle/GoLang/application"
"github.com/ksbeasle/GoLang/database"
)
func main() {
/* Start a Connection to the Database - mysql */
db, err := application.StartDB()
if err != nil {
log.F... |
package main
import (
"context"
"encoding/json"
"flag"
"fmt"
"log"
"os"
"strings"
"time"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/getsentry/sentry-go"
"github.com/carlmjohnson/flagext"
"github.com/spotlightpa/almanack/internal/db"
"github.com/spotlightpa/a... |
/*
Copyright 2021 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... |
package model
import (
"errors"
"shared/utility/number"
"shared/utility/rand"
)
type Drop map[int32]*number.BitNumber
func NewDrop() *Drop {
return (*Drop)(&map[int32]*number.BitNumber{})
}
// 给定长度, 随机下标,不会随机到标记过的
func (d *Drop) RandIndex(rewardID int32, length int) (int, error) {
if length <= 0 {
return 0,... |
// +build js
package math4g
import (
"github.com/gopherjs/gopherjs/js"
)
var (
sin = js.Global.Get("Math").Get("sin")
cos = js.Global.Get("Math").Get("cos")
tan = js.Global.Get("Math").Get("tan")
)
func Sin(x Scala) Scala {
return Scala(sin.Invoke(x).Float())
}
func Cos(x Scala) Scala {
return Scala(cos.Invo... |
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
//
package main
import (
"embed"
"fmt"
"log"
"net/http"
"os"
cloud "github.com/mattermost/mattermost-cloud/model"
"github.com/0xAX/notificator"
)
const (
// DefaultPort is default listening port ... |
/**
序列最长递增子序列及其长度
*/
package dynamicProgramming
import "fmt"
type SubqueryMax struct {
arr []int
cnt int
}
func newSubqueryMax(arr []int, cnt int) *SubqueryMax {
return &SubqueryMax{
arr: arr,
cnt: cnt,
}
}
func (sm *SubqueryMax) getMaxNum() int {
var states = make([]int, sm.cnt)
states[0] = 1 // 第一个节点状态长... |
package account
type TransferPointRequest struct {
FromUid string `json:"fromUid"`
ToUid string `json:"toUid"`
GroupId int64 `json:"groupId"`
Amount string `json:"amount"`
} |
// SPDX-License-Identifier: ISC
// Copyright (c) 2014-2020 Bitmark Inc.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package bitmark_test
import (
"crypto/ed25519"
"testing"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/bi... |
package syncer
import (
"fmt"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
"k8s.io/klog"
"github.com/baidu/ote-stack/pkg/util"
)
// PodSyncer is responsible for synchronizing pod from apiserver.
type PodSyncer struct {
ctx *SyncContext
Informer cache.Shared... |
package generate
import (
"encoding/xml"
"os"
)
const namespace = "http://www.sitemaps.org/schemas/sitemap/0.9"
type XmlLoc struct {
Value string `xml:"loc"`
}
type UrlSet struct {
Urls []XmlLoc `xml:"url"`
XNamespace string `xml:"xmlns,attr"`
}
func ConvertXml(convert UrlSet, filename string) {
f, e... |
/*
Copyright 2021 github.com/moizalicious
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 agre... |
package main
import (
"fmt"
"math"
)
func main() {
a := 42.5
b := 43.5
fmt.Println(math.Round(a), math.Round(b))
fmt.Println(math.RoundToEven(a), math.RoundToEven(b))
}
|
package router
import (
"log"
"net/http"
"time"
jwt "github.com/appleboy/gin-jwt"
"github.com/filiponegrao/desafio-globo.com/controllers"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/cookie"
csrf "github.com/utrack/gin-csrf"
"github.com/gin-gonic/gin"
)
func Initialize(r *gin.Engine) ... |
package main
import (
"fmt"
"os"
"github.com/wenkesj/genexp"
)
func main() {
if len(os.Args) < 3 {
panic("Expected 2 sequences as part of the command. \n For example: genexpa ATG GTG")
}
a := os.Args[1]
b := os.Args[2]
alignedAs, alignedBs, score := genexp.Align(a, b, genexp.LocalAlignmentCost)
fmt.Printl... |
package main
import (
"fmt" //package implementing formatted I/O
// "math"
// "strings"
// "myAnonymous"
// "myClosure"
// "myErrorhandling"
// "myMap"
// "myVarargs"
"slice"
// "myOOP"
// "myGoRoutine"
// "myString"
// "myTime"
)
func test_multi_assign() {
var v1 string = "chenxi"
var v2 string = "zha... |
// Copyright 2019 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, ... |
package main
import "fmt"
type People interface {
run()
read()
}
type xhaoge struct {
name string
sport string
book string
}
func (x *xhaoge) run() {
fmt.Println("%s 开始跑步...", x.name)
}
func (x *xhaoge) read() {
fmt.Println("%s 喜欢读%s", x.name, x.book)
}
func findType(xxx interface{}) {
switch xxx.(type)... |
// Copyright (C) 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
package delete
import (
"encoding/json"
"net/http"
"os"
"github.com/ocoscope/face/db"
"github.com/ocoscope/face/utils"
"github.com/ocoscope/face/utils/answer"
"github.com/ocoscope/face/utils/recognition"
)
func UserPhoto(w http.ResponseWriter, r *http.Request) {
type tbody struct {
CompanyID, UserID int64... |
package main
import (
"bufio"
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"regexp"
)
const configFile = ".vim/vim-modules.conf"
type cmdFunc func() error
type cmd map[string]cmdFunc
type config struct {
lines []string
}
var commands = cmd{
"install": cmdInstall,
"clean": cmdClean,
}
var d... |
package main
import "math"
//
//在 x 轴上有一个一维的花园。花园长度为 n,从点 0 开始,到点 n 结束。
//
//花园里总共有 n + 1 个水龙头,分别位于 [0, 1, ..., n] 。
//
//给你一个整数 n 和一个长度为 n + 1 的整数数组 ranges ,其中 ranges[i] (下标从 0 开始)表示:如果打开点 i 处的水龙头,可以灌溉的区域为 [i - ranges[i], i + ranges[i]] 。
//
//请你返回可以灌溉整个花园的 最少水龙头数目 。如果花园始终存在无法灌溉到的地方,请你返回 -1 。
//
//
//
//示例 1:
//输入:... |
// 微信公众号支付参数服务列表
// 1. 支付证书上传
// 2. 支付参数修改
// 3. 通过公众号ID,获取公众号支付参数记录
package models
import (
"fmt"
"io"
"net/http"
"os"
"strings"
"time"
"github.com/1046102779/common/consts"
"github.com/1046102779/official_account/conf"
. "github.com/1046102779/official_account/logger"
"github.com/pkg/errors"
"github.com... |
package function
import (
"bytes"
"encoding/json"
"errors"
"github.com/hecatoncheir/Storage"
"log"
"os"
"text/template"
)
type Storage interface {
Query(string) ([]byte, error)
}
type Executor struct {
Store Storage
}
var ExecutorLogger = log.New(os.Stdout, "Executor: ", log.Lshortfile)
var (
// ErrPageI... |
package main
import (
"bufio"
"crypto/md5"
"crypto/sha1"
"encoding/base64"
"encoding/hex"
"fmt"
"io"
"os"
"strings"
)
func main() {
//testStr := "abcdefg"
reader := bufio.NewReader(os.Stdin)
text, _ := reader.ReadString('\n')
fmt.Println(toMd5(strings.NewReader(text)))
//fmt.Fprintln(os.Stdout, "test")
... |
// Copyright 2018 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, ... |
package main
import (
"fmt"
"time"
)
var currentId int
var todos Todos
// Give us some seed data
func init() {
RepoCreateTodo(Todo{Name: "Write presentation", Due: time.Now()})
RepoCreateTodo(Todo{Name: "Host meetup", Due: time.Now()})
}
func RepoFindTodo(id int) Todo {
for _, todo := range todos {
if todo.... |
package main
import (
"os"
"text/scanner"
"github.com/davecgh/go-spew/spew"
)
// scanner 用の構造体を定義し、以下のようなフィールドを持たせておいた方がよい。
type lex struct {
scanner.Scanner
token rune
}
func newLex() *lex {
l := new(lex)
return l
}
func (l *lex) getToken() {
l.token = l.Scan()
}
func main() {
lex := newLex()
lex.Init(... |
package publisher
import (
"testing"
vaultapi "github.com/hashicorp/vault/api"
)
type secretsStoreStub struct {
data map[string]string
}
func (s *secretsStoreStub) Keys() []string {
keys := make([]string, 0, len(s.data))
for k := range s.data {
keys = append(keys, k)
}
return keys
}
func (s *secretsStoreStu... |
// Copyright 2022 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package typecutils
import (
"bufio"
"context"
"crypto/sha256"
"io"
"io/ioutil"
"os"
"regexp"
"strings"
"chromiumos/tast/common/testexec"
"chromiumos/tast/errors"
... |
package core_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
ww "github.com/wetware/ww/pkg"
"github.com/wetware/ww/pkg/lang/core"
capnp "zombiezen.com/go/capnproto2"
)
func TestEmptyList(t *testing.T) {
t.Parallel()
t.Run("New", func(t *testing.T) {
t.Par... |
package application
import (
"github.com/jsm/gode/env"
)
// Env contains stored environment information
var Env = env.Initialize()
|
package main
import "fmt"
import "sync"
func main() {
//a varaible wg to tell this parent go-routine to wait for the child go-routine to finishes
var wg sync.WaitGroup
sayHola := func() {
//adding relevent code on child side for stopping parent
defer wg.Done()
fmt.Println("Hi IN Spanish")
}
wg.Add(1)
g... |
package cmd
import (
e "github.com/cloudposse/atmos/internal/exec"
u "github.com/cloudposse/atmos/pkg/utils"
"github.com/spf13/cobra"
)
// helmfileCmd represents the base command for all helmfile sub-commands
var helmfileCmd = &cobra.Command{
Use: "helmfile",
Short: "Execute 'helmfile... |
/*
Copyright 2022 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... |
package digitsum
import (
"strconv"
"strings"
)
/*
We define super digit of an integer
using the following rules:
Given an integer x, we need to find the super digit of the integer.
If x has only digit, then its super digit is x
.
Otherwise, the super digit of x
is equal to the super digit of the sum of the... |
package connection
import (
"time"
)
// Config represents the configuration used to create a new connection.
type Config struct {
// Settings.
Created time.Time
ID string
PeerAID string
PeerBID string
Weight float64
}
// DefaultConfig provides a default configuration to create a new connection by
// bes... |
// FIXME: Remove unnessesary table-driven tests (and simplifize tests)
package dynamicstruct_test
import (
"reflect"
"testing"
"github.com/google/go-cmp/cmp"
. "github.com/goldeneggg/structil/dynamicstruct"
)
type (
DynamicTestStruct struct {
Byte byte
Bytes []byte
Int int
Int64 ... |
package db
import (
"errors"
"log"
dbConf "github.com/product/internal/config/db"
)
var (
errorInvalidDbInstance = errors.New("Invalid db instance")
ErrEmptyRequest = errors.New("request is mandatory")
instanceDb = make(map[string]DbDriver)
)
const (
MySql string = "mysql"
)
// DbDriver is object DB
type Db... |
package channel
import (
"net"
"onlinejudgeForward/slflog"
)
type status uint8
var judgeList []JudgeInfo
func init() {
judgeList = make([]JudgeInfo, 5)
}
func GetJudgeList() []JudgeInfo {
return judgeList
}
func StartCatch() {
catch("127.0.0.1:5588")
}
type JudgeInfo struct {
Host string
Port int
Status... |
package interaction
import (
"fmt"
"github.com/hlandau/xlog"
)
var log, Log = xlog.New("acme.interactor")
var NonInteractive = false
type autoInteractor struct{}
var Auto Interactor = autoInteractor{}
var Interceptor Interactor
var NoDialog = false
func (autoInteractor) Prompt(c *Challenge) (*Response, error)... |
package main
import (
"fmt"
"learngo/book/closure/recursionClosure"
)
func main() {
//closureBase.Test01()
fmt.Println(
recursionClosure.FibonacciPre(8),
)
}
|
package openrtb_ext
type ExtImpTappx struct {
Host string `json:"host,omitempty"` //DEPRECATED
TappxKey string `json:"tappxkey"`
Endpoint string `json:"endpoint"`
BidFloor float64 `json:"bidfloor,omitempty"`
Mktag string `json:"mktag,omitempty"`
Bcid []string `json:"bcid,omitempty"`
Bcrid ... |
package core
import (
"net/http"
"time"
"github.com/jzaikovs/core/loggy"
"github.com/jzaikovs/t"
)
// Router is interface for implement specific routing engines,
// for example we have module user which handles users, we can then port
// module across other projects that uses core
type Router interface {
Get(st... |
package internal
import (
"fmt"
"io"
"os"
"os/exec"
"time"
)
func createFile(filePath, content string) (err error) {
var f *os.File
if f, err = os.Create(filePath); err != nil {
return
}
defer func() { _ = f.Close() }()
_, err = f.WriteString(content)
return
}
var execCommand = exec.Command
func run... |
package img
import (
"github.com/urfave/cli/v2"
"os"
"github.com/768bit/promethium/api/client/images"
"github.com/go-openapi/runtime"
)
var PullImageCommand = cli.Command{
Name: "pull",
Usage: "Pull images from remote to local",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "target-storage",
Aliases: ... |
package main
import (
"crypto/hmac"
"fmt"
"io"
"log"
"math/rand"
"net/http"
"os"
"path"
"path/filepath"
"strings"
"time"
"github.com/cwillia9/ez-ftp/authentication"
"github.com/cwillia9/ez-ftp/datastore"
"github.com/cwillia9/ez-ftp/domain"
)
/*
This whole file needs to be refactored to not have all of ... |
package pkg
import (
"errors"
"github.com/divoc/portal-api/swagger_gen/models"
log "github.com/sirupsen/logrus"
)
func GetFacilityUsers(authHeader string) ([]*models.FacilityUser, error) {
bearerToken, err := getToken(authHeader)
claimBody, err := getClaimBody(bearerToken)
if err != nil {
log.Errorf("Error wh... |
package ga
import (
"encoding/gob"
"github.com/pasqualesalza/amqpga/util"
)
// byte
type ByteFitnessValue int
func (fitnessValue ByteFitnessValue) Less(other FitnessValue) bool {
return fitnessValue < other.(ByteFitnessValue)
}
type ByteVectorChromosome []byte
func ByteVectorChromosomeInitia... |
// Copyright 2019 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, ... |
package main
import (
"encoding/json"
"fmt"
"reflect"
"time"
"github.com/vanhtuan0409/copperhead"
)
type Config struct {
HttpPort int `mapstructure:"http_port" cli:"port" default:"8080" description:"HTTP binding port"`
Timeout time.Duration `mapstructure:"timeout" default:"5s" description:"HTTP req... |
package genconfig
import (
"bytes"
"encoding/base64"
"text/template"
uuid "github.com/satori/go.uuid"
)
func GenerateAppleConfig(ip, name, password, privateKey, caCert, serverCert string) (string, error) {
tmpl := template.Must(template.New("mobileconfig").Parse(mobileConfigTemplate))
tmplData := struct {
IP... |
// Copyright 2018 The Cacophony Project
//
// 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 agr... |
package cmd
import (
"errors"
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/spf13/cobra"
"github.com/tinyzimmer/k3p/pkg/types"
"github.com/tinyzimmer/k3p/pkg/util"
)
var generatedTokenLength int
func init() {
tokenGenerateCmd.Flags().IntVarP(&generatedTokenLength, "length", "l", 128, "The length of the toke... |
// Copyright 2021 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package dlp
import (
"context"
"net/http"
"net/http/httptest"
"net/url"
"time"
"chromiumos/tast/common/fixture"
"chromiumos/tast/common/policy/fakedms"
"chromiumos/... |
// 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... |
// Copyright 2021 Dataptive SAS.
//
// 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 ... |
package database
import (
"encoding/json"
"fmt"
"io/ioutil"
"github.com/janithl/paataka/entities"
)
// SQLPublicationRepository is an implementation of Posts repository currently using an in-memory store
type SQLPublicationRepository struct {
version string
publications map[string]entities.Publication
fi... |
// Copyright (C) 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
/*
Copyright 2021 The DbunderFS Contributors.
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 ... |
package support
type JsonResult struct {
Error bool `jsonp:""`
Message string `jsonp:""`
Results interface{} `jsonp:""`
Result interface{} `jsonp:""`
Errors map[string]string `jsonp:""`
TotalCount int64 `jsonp:""`
CurrentUnixTime int64 `jsonp:""`
} |
// Copyright 2018 The Terraformer 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... |
package cherryDataConfig
import jsoniter "github.com/json-iterator/go"
type JsonParser struct {
}
func (j *JsonParser) TypeName() string {
return "json"
}
func (j *JsonParser) Unmarshal(data []byte, v interface{}) error {
return jsoniter.Unmarshal(data, v)
}
|
package json
import (
"bytes"
"encoding/json"
"fmt"
"github.com/project-flogo/core/data"
"github.com/project-flogo/core/data/expression/function"
)
func init() {
_ = function.Register(&fnNumbersToString{})
}
type fnNumbersToString struct {
}
// Name returns the name of the function
func (fnNumbersToString) N... |
/**
*
* By So http://sooo.site
* -----
* Don't panic.
* -----
*
*/
package conf
import (
"fmt"
"github.com/Git-So/blog-api/utils/helper"
)
var configYaml = fmt.Sprintf(`#开发相关
dev:
run_mode: debug # release debug
#页数配置
page:
article: 8
hot_article: 15
comment: 10
subject: 8
tag: 200
link: ... |
package rbtree
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_New(t *testing.T) {
// given
tree := New()
// when, then
assert.NotNil(t, tree)
}
func Test_Insert_Inorder(t *testing.T) {
assert := assert.New(t)
// given
tree := New()
tree.Insert(5)
tree.Insert(2)
tree.Insert(1)
tre... |
package main
import (
"context"
"fmt"
"sync"
"time"
"cloud.google.com/go/pubsub"
)
const PROJECT_ID = "chiper-poc"
func main() {
duplication := make(map[string]bool)
go receive_message("my-first-sub", 1*time.Second, duplication)
receive_message("my-first-sub", 15*time.Second, duplication)
}
func receive_me... |
/*
* Npcf_SMPolicyControl API
*
* Session Management Policy Control Service © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* API version: 1.0.4
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
// AnGwAddress - describ... |
package main
var colorSets = [...]string{
"#2980B9", // blue
"#C0392B", // red
"#F39C12", // yellow
"#8E44AD", // WISTERIA
"#16A085", // green
"#2C3E50", // black
}
func GetColorValue(i int) string {
if i >= len(colorSets) {
return colorSets[0]
}
return colorSets[i]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.