text stringlengths 11 4.05M |
|---|
package details1
var B = "Barcelona"
|
package value
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.starlark.net/starlark"
)
func TestImageListNone(t *testing.T) {
var v ImageList
err := v.Unpack(starlark.None)
require.NoError(t, err)
require.Nil(t, v)
}
func TestImageListValues(t *testing.T) {
... |
package pkg
import (
"fmt"
"github.com/go-resty/resty/v2"
"net/http"
)
func HandleResError(res *resty.Response, err error) (*resty.Response, error) {
errTmpl := "failed to get latest head, error: %v"
if err != nil {
return res, err
}
if res.IsError() {
return res, fmt.Errorf(errTmpl, res.Error())
}
if re... |
package main
// Byte standart sizes
const (
KB = 1024
MB = 1024 * KB
GB = 1024 * MB
)
func main() {
println(MB)
} |
/* An integer value identifying a Unicode code point.
A rune literal is expressed as one or more characters enclosed in single quotes, as in 'x' or '\n'.
*/
package main
import (
"fmt"
)
func main() {
const word = "世界"
bytes := []byte(word)
fmt.Println(bytes)
var x []rune
x = []rune{'世', '界'}
xBytes := [... |
package models
import (
"github.com/porter-dev/porter/internal/models/integrations"
"gorm.io/gorm"
)
// HelmRepo is an integration that can connect to a Helm repository via a
// set of auth mechanisms
type HelmRepo struct {
gorm.Model
// Name given to the Helm repository
Name string `json:"name"`
// The proje... |
package checkers
import (
"strconv"
)
type Space struct {
Rank int
File string
}
func NewSpace(coordinates string) Space {
file := string(coordinates[0])
rank, _ := strconv.Atoi(string(coordinates[1]))
return Space{File: file, Rank: rank}
}
// black squares
var A1 = NewSpace("a1")
var A3 = NewSpace("a3")
var... |
package main
import (
"flag"
"fmt"
"io"
"os"
"strings"
mb "github.com/multiformats/go-multibase"
senc "github.com/jbenet/go-simple-encrypt"
)
type options struct {
encrypt bool
decrypt bool
keygen bool
keyS string
key []byte
}
func onlyOne(cs ...bool) bool {
var c int
for _, a := range cs {
... |
package msig
import (
potato "github.com/rise-worlds/potato-go"
)
// NewApprove returns a `approve` action that lives on the
// `poc.msig` contract.
func NewApprove(proposer potato.AccountName, proposalName potato.Name, level potato.PermissionLevel) *potato.Action {
return &potato.Action{
Account: potato.Ac... |
package main
import (
"fmt"
"image"
"image/color"
"image/png"
"log"
"math/rand"
"os"
"strconv"
"time"
)
const argsImagePos = 1
const argsWidthPos = 2
const argsHeightPos = 3
const defaultPixels = 500
const fileExtension = ".png"
func main() {
start := time.Now()
//Set random Seed for generating Random Nu... |
package i18nformats
import (
"strings"
)
// based on golang reference date/time layout: "Mon Jan 2 15:04:05 MST 2006"
// hour 15
// minute 04
// second 05
// time zone MST
const (
// canada
time_en_ca = "3:04PM"
time_fr_ca = "3:04:05 PM"
// us
time_en_us = "3:04:05 PM"
// france
time_fr = "15:04:0... |
package leetcode
func majorityElement(nums []int) int {
nu := len(nums)
n := make(map[int]int, nu)
nu /= 2
for _, q := range nums {
n[q]++
if n[q] > nu {
return q
}
}
return -1
}
|
// Command mergeclears merges multiple .clear files produced from CANU's
// splitReads commands (run in parallel). CANU's code doesn't have a way to
// merge these files, and crashes for unknown reasons during splitReads.
//
// We externally parallelized canu's splitReads step to avoid the crash, so
// we needed this c... |
// 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 ui
import (
"context"
"time"
"chromiumos/tast/ctxutil"
"chromiumos/tast/local/audio"
"chromiumos/tast/local/audio/crastestclient"
"chromiumos/tast/local/chrom... |
// Copyright 2020 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 services
import (
"fmt"
"log"
"../models"
"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/helpers/mail"
)
const (
// Key for SendGrid
Key = "PUT_YOUR_SENDGRID_KEY_HERE"
)
// SendEmail function to send mail, will return true on success and false on failure
func SendEmail(recipients ... |
package main
import "fmt"
type s struct {
b []int
}
func change_slice(a []int) {
(a[2]) = 15;
}
func main() {
ss := s{}
ss.b = make([]int, 4)
fmt.Println(ss)
change_slice((ss.b))
fmt.Println(ss)
}
|
// Package init bootstraps an Apex project.
package init
import (
"github.com/spf13/cobra"
"github.com/apex/apex/boot"
"github.com/apex/apex/cmd/apex/root"
)
// example output.
const example = ` Initialize a project
$ apex init`
// Command config.
var Command = &cobra.Command{
Use: "init",
Shor... |
package usecase
import (
"errors"
"github.com/product/pkg/domain/entity"
"github.com/product/pkg/domain/repository"
"github.com/mitchellh/mapstructure"
)
type ProductInteractor struct {
repo repository.ProductRepository
out ProductOutputPort
}
func NewProductInteractor(db repository.ProductRepository, o Produ... |
package steps
import (
"errors"
"strings"
survey "github.com/AlecAivazis/survey/v2"
"github.com/guregu/null"
"github.com/pganalyze/collector/setup/state"
s "github.com/pganalyze/collector/setup/state"
"github.com/pganalyze/collector/setup/util"
)
var ConfirmSetUpAutoExplain = &s.Step{
ID: "li_confirm_set_up_... |
package bitfinex
import (
"encoding/json"
"github.com/go-trading/lightning/core"
)
func (b *Bitfinex) clientGetTickers() (map[string]*core.Symbol, error) {
body, err := b.clientGetPub("/v2/tickers?symbols=ALL")
if err != nil {
log.WithError(err).Error("can't get tickers")
return nil, err
}
tickers := make(... |
package metrics
import (
"fmt"
"net/http"
"github.com/adi/sketo/api"
"github.com/gorilla/mux"
)
// Init sets up the metrics HTTP endpoints
func Init(metricsMux *mux.Router) error {
metricsMux.HandleFunc("/metrics", func(rw http.ResponseWriter, r *http.Request) {
rw.Header().Set("Content-Type", "text/plain")
... |
package main
import "fmt"
func main() {
x := [5]float64{ // number of elements is required
98,
3,
7,
2,
83, // trailing comma is required
}
var total float64 = 0
for _, value := range x { // Here, '_' would be the index (iterator)
total += value
}
fmt.Println(total / float64(len(x)))
}
|
package generator
import (
"fmt"
"strings"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/protoc-gen-go/descriptor"
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
maia "github.com/grpc-custom/maia/proto"
maiaDesc "github.com/grpc-custom/maia/protoc-gen-maia/descriptor"
)
type Generat... |
package fuzz_test
import (
"testing"
"github.com/carv-ics-forth/frisbee/api/v1alpha1"
)
func TestFromTemplate_Validate(t1 *testing.T) {
type fields struct {
TemplateRef string
Instances int
Inputs []v1alpha1.UserInputs
}
type args struct {
allowMultipleInputs bool
}
tests := []struct {
name... |
package stl
import (
"bufio"
"bytes"
"encoding/binary"
"io"
"math"
"strconv"
"strings"
)
var asciiBytes = []byte("solid")
func Parse(file io.Reader) *Solid {
br := bufio.NewReader(file)
testBytes, _ := br.Peek(5)
if bytes.Equal(testBytes, asciiBytes) {
return parseASCII(br)
} else {
return parseBinar... |
// Copyright (c) KwanJunWen
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
package estemplate
import "fmt"
// NormalizerCustom custom normalizer which are similar to analyzers except that they may
// only emit a single token. As a consequ... |
/*
Copyright 2020 Docker Compose CLI 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 a... |
package middlewares
import (
"github.com/gin-gonic/gin"
)
func AuthRequired() gin.HandlerFunc {
return func(c *gin.Context) {
token := c.Request.Header.Get("Access-Token")
if token == "qwer123" {
c.Next()
} else {
c.AbortWithStatus(401)
}
}
}
|
package models
type Posts struct {}
func (p *Posts) Find() (posts []*Post, err error) {
_, err = dbSession().Select("*").From("posts").LoadStructs(&posts)
return
}
|
package main
import (
"fmt"
"log"
"jotham/database"
"jotham/handler"
"jotham/helper"
"jotham/utils"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/fiber/v2/middleware/recover"
)
func main() {
if err := helper... |
// Copyright 2020 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
// 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 inputs
import (
"context"
"strings"
"time"
"chromiumos/tast/ctxutil"
"chromiumos/tast/local/bundles/cros/inputs/fixture"
"chromiumos/tast/local/bundles/cros/i... |
package feed
import (
"encoding/xml"
"fmt"
"net/http"
"time"
)
func GetFeed(url string, isAtom bool, entries chan []Entry) {
resp, err := http.Get(url)
if err != nil {
fmt.Printf("Error GET: %v\n", err)
return
}
defer resp.Body.Close()
var feedEntries []Entry
decoder := xml.NewDecoder(resp.Body)
if is... |
package utils
import (
"fmt"
"time"
)
// Milliseconds return the milliseconds of time
func Milliseconds(t time.Time) int64 {
return t.UnixNano() / int64(time.Millisecond)
}
// TimeLocationOfUTCOffset return the time.Location of utc offset
func TimeLocationOfUTCOffset(utcOffset int) *time.Location {
zoneName := f... |
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
package oauth
import (
"net/url"
"tamnd/misc/gauth"
"github.com/mrjones/oauth"
)
type Endpoint struct {
AuthURL string
RequestURL string
AccessTokenURL string
}
type Provider struct {
Endpoint Endpoint
callbackURL string
consumer *oauth.Consumer
}
func (p *Provider) Init(clientId string, secret... |
// Copyright 2020 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Package arcappcompat will have tast tests for android apps on Chromebooks.
package arcappcompat
import (
"context"
"time"
"chromiumos/tast/common/android/ui"
"chromi... |
package main
import (
"fmt"
"net/http"
"os"
"github.com/joho/godotenv"
"github.com/ocoscope/face/routes"
)
func main() {
// load .env file
err := godotenv.Load()
if err != nil {
return
}
var (
port = os.Getenv("PORT")
http_port = os.Getenv("HTTP_PORT")
key = os.Getenv("KEY")
crt ... |
package store
import (
"github.com/tilt-dev/tilt/pkg/apis/core/v1alpha1"
"github.com/tilt-dev/tilt/pkg/model"
)
// We place a "hold" on a manifest if we can't build it
// because it's waiting on something.
type Hold struct {
Reason HoldReason
// Pointers to the internal data model we're holding for.
HoldOn []mo... |
package utility
import (
"math/rand"
"time"
)
const (
alphabetLower = "abcdefghijklmnopqrstuvwxyz"
alphabetUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
numeric = "0123456789"
)
// GetStringWithValidator ...
func GetStringWithValidator(length int, random func(int) string, validator func(string) (bool, error)) (str... |
package main
import (
"fmt"
"net"
"os"
"github.com/joho/godotenv"
"github.com/rareinator/Svendeprove/Backend/packages/mssql"
"github.com/rareinator/Svendeprove/Backend/packages/protocol"
"github.com/rareinator/Svendeprove/Backend/services/patientService/patient"
"google.golang.org/grpc"
)
func main() {
if e... |
package main
import (
"os"
"fmt"
"image/png"
"src.techknowlogick.com/mysteryperson-id"
)
func main() {
mp := mysteryperson_id.New(80)
f, err := os.OpenFile("mysteryperson.png", os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
fmt.Println(err)
return
}
defer f.Close()
png.Encode(f, ... |
package main
func main() {
var x struct {
x, y int
}
x.field = 0
}
|
package mtest
import . "github.com/onsi/ginkgo"
// FunctionsSuite is a test suite that tests all test cases
var FunctionsSuite = func() {
Context("assets", TestAssets)
Context("netboot", TestNetboot)
}
|
// Copyright (c) 2016-2019 Uber 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... |
package routes
import (
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/manoj-gupta/glance/internal/controllers"
)
// Init ... Initialize routes
func Init() (*gin.Engine, error) {
r := gin.Default()
config := cors.DefaultConfig()
// origin
config.AllowOrigins = []string{"http://localhos... |
package config
import (
"fmt"
"reflect"
"regexp"
"strings"
"github.com/golang/glog"
)
type logMsg func(string, ...interface{})
var mapregex = regexp.MustCompile(`mapstructure:"([^"]+)"`)
var blocklistregexp = []*regexp.Regexp{
regexp.MustCompile("password"),
}
// LogGeneral will log nearly any sort of value,... |
// Copyright 2020 Adobe. All rights reserved.
// This file is licensed to you under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicab... |
package filter
import "github.com/tapvanvn/go-chain-wrapper/entity"
type IFilter interface {
Match(transaction *entity.Transaction) bool
}
|
package lib
import "time"
type Event struct {
Device *Device `json:"device"`
Name string `json:"name"`
Data string `json:"data"`
Timestamp time.Time `json:"timestamp"`
}
|
//go:build tools
// +build tools
package tools
// see https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module
import (
_ "honnef.co/go/tools/cmd/staticcheck"
)
|
package main
import "fmt"
// クロージャを返す makeGen() 関数。
func makeGen() func() int {
prevNum := -1
return func() int {
prevNum += 2
return prevNum
}
}
func main() {
g1 := makeGen() // g1 にクロージャをセット。環境初期化。
g2 := makeGen() // g2 にクロージャをセット。環境を初期化。上の環境とは独立している。
for i := 0; i < 8; i++ {
fmt.Println(g1()) // クロージ... |
package main
import (
"encoding/json"
"fmt"
"os"
)
type person struct {
First string
Last string
Age int
}
func main() {
p1 := person{"James", "Bonds", 32}
p2 := person{"Bill", "Rogers", 56}
people := []person{p1, p2}
fmt.Println(people)
bs, err := json.Marshal(people)
if err != nil {
os.Exit(1)
... |
package main
import (
"compiler/src/app"
"flag"
)
func main() {
var inputFile string
flag.StringVar(&inputFile, "i", "data/source.src", "Specify input file. Defualt is data/source.src")
flag.Parse()
app.App(inputFile)
}
|
// +build linux
package aufs
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
"sync"
"syscall"
"github.com/hyperhq/hyper/utils"
"github.com/hyperhq/runv/lib/glog"
)
/*
|-- layers // Metadata of layers
| |---- 1
| |---- 2
| |---- 3
|-- diff // Content of the layer
| |---- 1
| |---- 2
... |
package udp
import (
"github.com/davyxu/cellnet"
"github.com/davyxu/cellnet/peer"
"net"
)
const MaxUDPRecvBuffer = 2048
type udpAcceptor struct {
peer.CoreSessionManager
peer.CorePeerProperty
peer.CoreContextSet
peer.CoreRunningTag
peer.CoreProcBundle
localAddr *net.UDPAddr
conn *net.UDPConn
}
func (sel... |
package main
import (
"fmt"
"os"
"../../../unimatrix"
)
func main() {
accessToken := "1234"
// new operation
unimatrix.SetURL("http://us-west-2.api.acceptance.unimatrix.io")
operation := unimatrix.NewRealmOperation(
"1e338862026376dd593425404a4f75c0",
"artifacts",
)
operation.SetAccessToken(accessToken... |
package tmpl
import (
"bufio"
"bytes"
"errors"
"fmt"
"html/template"
"path"
"path/filepath"
"reflect"
"strconv"
"strings"
"unicode"
gateway "github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/descriptor"
"github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/httprule"
descriptor "github.com/golang/pr... |
package main
import(
"os/signal"
"os"
"log"
"github.com/nealjc/ipreg/web"
"github.com/nealjc/ipreg/scanner"
"github.com/nealjc/ipreg/config"
)
func main() {
subnets, params, e := config.ParseConfig("/etc/ipreg.conf")
if e != nil {
log.Fatal(e.Error())
return
}
go scanner.StartScanner(subnets, params.Tim... |
package gocube
import (
"math/rand"
"testing"
)
func BenchmarkNewPhase1Heuristic(b *testing.B) {
moves := NewPhase1Moves()
b.ResetTimer()
for i := 0; i < b.N; i++ {
NewPhase1Heuristic(moves)
}
}
func BenchmarkPhase1Solver(b *testing.B) {
moves := NewPhase1Moves()
heuristic := NewPhase1Heuristic(moves)
b.... |
package main
import (
"fmt"
"time"
)
func main() {
var c <-chan int // 读取channel, 只能读取
select {
case <-c:
case <-time.After(1 * time.Second):
fmt.Println("channel time out")
}
}
|
package bdodb
import (
"github.com/blevesearch/bleve"
"github.com/blevesearch/bleve/mapping"
)
const (
// EngineName is the name of this engine in blevesearch
EngineName = "bdodb"
)
// BleveIndex a helper function that open (creates if not exists a new) bleve index
func BleveIndex(path string, mapping mapping.In... |
package main
import (
"fmt"
"math"
"math/rand"
"strconv"
"sync"
"time"
)
type Ville struct {
index int
x, y float64
}
func chooseCitie(tau [][]float64, etha [][]float64, alpha int, beta int, copyVilles []Ville, current Ville) (Ville, []Ville) {
var prob []float64 = make([]float64, len(copyVilles))
var i i... |
package main
import (
"github.com/gin-gonic/gin"
"github.com/nicolas-nannoni/fingy-gateway/events"
)
func SetupServiceSideGateway() {
r := gin.Default()
r.GET("/", index)
r.POST("/service/:serviceId/sendEvent/device/:deviceId/*path", sendEventToDevice)
r.Run(":8090")
}
func index(c *gin.Context) {
c.Status(... |
package main
import (
"bufio"
"context"
"fmt"
"io"
"os"
"strings"
"time"
"github.com/mylxsw/adanos-alert/internal/repository"
"github.com/mylxsw/adanos-alert/pkg/connector"
"github.com/mylxsw/adanos-alert/pkg/misc"
"github.com/mylxsw/asteria/log"
"github.com/urfave/cli"
)
var Version = "1.0"
var GitCommi... |
package main
import (
"fmt"
"time"
)
func firstMissingPositive(nums []int) int {
insertSort(nums) // 先排序
count := int(1)
for i := 0; i < len(nums); i++ {
if nums[i] > 0 {
if i > 0 && nums[i] == nums[i-1] {
continue
}
if nums[i] == count {
count++
} else {
return count
}
}
}
retur... |
// 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 Controllers
import (
"belajar-golang/app/Constant"
"belajar-golang/app/Helper"
"belajar-golang/app/Model"
"belajar-golang/database"
"encoding/json"
"log"
"net/http"
"strconv"
)
type MuridController struct{}
func (MuridController) GetAllMurid(res http.ResponseWriter, req *http.Request) {
var murid M... |
package twitchbot
import (
"github.com/gempir/go-twitch-irc/v2"
"strings"
)
// This interface defines the public API of the chat bot. The API is pretty slim, as most of the work is done
// internally.
type ChatBot interface {
// Joins a channel that is defined inside the passed channel configuration.
Join(channel... |
package chat
import (
"encoding/json"
"time"
"github.com/pkg/errors"
uuid "github.com/satori/go.uuid"
"github.com/sirupsen/logrus"
)
const (
WrapperMessageServiceProcessMethod = "MessageService.Process"
WrapperMessageServiceGetMessageCollectionMethod = "MessageService.GetMessageCollection"
)
typ... |
// Copyright (c) 2019-2021 Vasiliy Vasilyuk. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package golden
import (
"fmt"
"testing"
)
func Test_interceptor_Errorf(t *testing.T) {
t.Run("by-pointer", func(t *testing.T) {
i := new(inter... |
package main
import (
"github.com/aurumbot/lib/dat"
f "github.com/aurumbot/lib/foundation"
dsg "github.com/bwmarrin/discordgo"
)
var config struct {
myField string `json:"myfield"`
}
var Commands = make(map[string]*f.Command)
func init() {
Commands["commandname"] = &f.Command{
Name: "Somename",
Help: ... |
package model
import (
"time"
)
type MaterialType struct {
Id int64 `xorm:"pk autoincr" json:"type_id,string,omitempty"`
Name string `xorm:"varchar(50) index" json:"type_name,omitempty"`
Parentid int64 `xorm:"index" json:"type_parentid,string,omitempty"`
Sortid int `json:"type_sortid,string,omit... |
package main
import (
"github.com/kataras/iris"
"gopkg.in/asaskevich/govalidator.v4"
"fmt"
"strings"
"strconv"
)
func getUser(ctx *iris.Context) {
id, err := strconv.Atoi(ctx.Param("id"))
if err != nil {
ctx.JSON(iris.StatusBadRequest,iris.Map{"status":false,"message":MessageDevel{Devel:"failed",Prod:"Id mus... |
package states
import (
"testing"
"bytes"
"crypto/rand"
"github.com/stretchr/testify/assert"
"github.com/zhaohaijun/matrixchain/common"
)
func TestStorageKey_Deserialize_Serialize(t *testing.T) {
var addr common.Address
rand.Read(addr[:])
storage := StorageKey{
ContractAddress: addr,
Key: [... |
package data
import (
"fmt"
"github.com/jinzhu/gorm"
"log"
"os"
)
type ConnectionInfo struct {
User string
DB string
Password string
Host string
Port string
}
func GetDatabase(connInfo ConnectionInfo) (*gorm.DB, error) {
conn := fmt.Sprintf(
"user=%s dbname=%s password=%s host=%s port=%... |
package main
import (
"github.com/hashicorp/terraform/helper/schema"
)
func resourceLocalAuthConfig() *schema.Resource {
return &schema.Resource{
Create: resourceLocalAuthConfigCreate,
Read: resourceLocalAuthConfigRead,
Update: resourceLocalAuthConfigU... |
package tag
import (
"time"
)
const TBNTag = "tag"
type TblTag struct {
Id int64 `json:"id"`
CreateAt *time.Time `json:"createAt"`
Name string `json:"name"`
ProjectId int64 `json:"projectId"`
}
func (m *TblTag) TableName() string {
return TBNTag
}
|
package modals
import (
"github.com/gopherjs/jquery"
"github.com/winded/tyomaa/frontend/js/app"
"github.com/winded/tyomaa/frontend/js/dom"
"github.com/winded/tyomaa/frontend/js/templates"
"github.com/winded/tyomaa/frontend/js/ui/views/widgets"
"github.com/winded/tyomaa/frontend/js/views"
)
type projectNameModal... |
// Copyright (c) 2018-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"context"
"fmt"
"os"
"runtime"
"sync"
"time"
"github.com/raedahgroup/dcrextdata/exchanges"
"github.com/raedahgroup/dcrextdata/postgres"
"g... |
// 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 gadget
import (
"encoding/json"
"encoding/xml"
"github.com/redneckbeard/gadget/env"
)
// JsonBroker attempts to transform an interface{} value into a JSON string.
func JsonBroker(r *Request, status int, body interface{}, data *RouteData) (int, string) {
var (
serialized []byte
err error
)
if ... |
package lc
import "sort"
// Time: O(n^2)
// Benchmark: 0ms 3.3mb | 100%
func combinationSum2(candidates []int, target int) [][]int {
valid := [][]int{}
push := func(nums ...int) {
for _, v := range valid {
if len(v) != len(nums) {
continue
}
var matched int
for i := 0; i < len(v); i++ {
if v... |
package main
type Al struct {
executable string
path string
aliasCmd string
fullAlias string
}
|
package main
import (
"fmt"
"sort"
)
// map嵌套
func muiltMap() {
var c map[int]map[int]string
c = make(map[int]map[int]string)
c[1] = make(map[int]string)
c[1][1] = "heehe"
//修改之前先判断,不存在再初始化
_, ok := c[2]
if !ok {
c[2] = make(map[int]string)
}
//追加或修改
c[2][1] = "jajaa"
c[2][2] = "xxxx"
fmt.Println(c... |
package conf
import (
"fmt"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
// "github.com/naokij/gotalk/models"
"github.com/naokij/gotalk/setting"
"runtime"
// "time"
)
var DiscuzDb string
var Orm orm.Ormer
var OrmGotalk orm.Ormer
var Workers = runtime.NumCPU()
var WorkerLoad int = 30000
var AvatarP... |
package main
import (
"errors"
"fmt"
)
type employee struct {
id int
name string
age int
salary int
}
type storage interface {
insert(e employee) error
get(id int) (employee, error)
delete(id int) error
}
type memoryStorage struct {
data map[int]employee
}
func newMemoryStorage() *memoryStorage ... |
// Copyright 2020 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 packageGen
import (
"fmt"
"math"
"math/rand"
"os"
// "bufio"
"encoding/csv"
// "log"
// "io"
"strconv"
"gonum.org/v1/gonum/stat"
)
type Data struct {
Domainlen int `json:"domainlen"`
Seed int64 `json:"seed"`
Score float64 `json:"score"`
Payload [] Entry `json:"payload"`
}
type Entry struct {
... |
package LeetCode
func isMatch(s string, p string) bool {
return true
}
|
// Copyright 2017 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 dotslash
import (
"../github.com/golang/dep/gps"
)
var (
A = gps.Solver
)
|
package backoff
import (
"context"
"sync"
"time"
"github.com/cocher/internal/protobuf"
"github.com/cocher/network"
"github.com/cocher/utils/log"
)
const (
defaultComponentInitialDelay = 5 * time.Second
defaultComponentMaxAttempts = 100
defaultComponentPriority = 100
)
// Component is the backoff Comp... |
package conf
import (
"github.com/saxon134/go-utils/saData"
"github.com/saxon134/go-utils/saHttp"
"gopkg.in/yaml.v2"
"os"
"strings"
)
var Conf *ModelConf
var _conf map[string]interface{}
type ModelConf struct {
Name string
Mode string
Sysmain struct {
Url string
ClientRoot string
Secret str... |
package static
// sheetFileName: cfg_passive_effect.xlsx
const (
TriggerTypeSkillstart = 1 //
TriggerTypeSkillend = 2 //
TriggerTypeSkillcrt = 3 //
TriggerTypeSkillmiss = 4 //
TriggerTypeSkillhit = 5 //
TriggerTypeSkillkill = 6 //
TriggerTypeDamage = 7 //
T... |
/**
* Copyright (c) 2017 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ... |
/*
Copyright 2020 Docker Compose CLI 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 a... |
package token
import (
"os"
"github.com/google/uuid"
"github.com/tilt-dev/wmclient/pkg/dirs"
)
const tokenFileName = "token"
type Token string
func (t Token) String() string {
return string(t)
}
func GetOrCreateToken(dir *dirs.TiltDevDir) (Token, error) {
token, err := getExistingToken(dir)
if os.IsNotExis... |
package tool
import "io/ioutil"
func ReadText(src string) (string, error) {
b, err := ioutil.ReadFile(src)
if err != nil {
return "", err
}
return string(b), nil
}
|
package cli
import (
"fmt"
"oh-my-posh/color"
"oh-my-posh/platform"
"time"
color2 "github.com/gookit/color"
"github.com/spf13/cobra"
)
// getCmd represents the get command
var getCmd = &cobra.Command{
Use: "get [shell|millis|accent]",
Short: "Get a value from oh-my-posh",
Long: `Get a value from oh-my-pos... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.