text stringlengths 3.08k 10.4k |
|---|
package http
import (
"context"
"github.com/firmeve/firmeve/kernel/contract"
"github.com/fsnotify/fsnotify"
"github.com/spf13/cobra"
"os"
"os/signal"
"syscall"
"time"
)
type (
Command struct {
}
)
var (
host string
readTimeout time.Duration
writeTimeout... |
package proxy
import (
"context"
"errors"
"expvar"
"io"
"net"
"strings"
"sync"
"github.com/chenen3/yeager/config"
"github.com/chenen3/yeager/log"
"github.com/chenen3/yeager/proxy/common"
"github.com/chenen3/yeager/proxy/direct"
"github.com/chenen3/yeager/proxy/http"
"github.com/chenen3/yeager/proxy/rejec... |
package collector
import (
"bytes"
"encoding/json"
"io/ioutil"
"os"
"testing"
"time"
fsutil "github.com/banyanops/collector/fsutil"
blog "github.com/ccpaging/log4go"
)
// TestWriteImageAllData tests writing different types of image data to files
func TestWriteImageAllData(t *testing.T) {
cases := []struct {... |
package main
import (
"fmt"
"os"
"strings"
"github.com/Catofes/RAIT/v4/pkg/misc"
"github.com/Catofes/RAIT/v4/pkg/rait"
"github.com/hashicorp/hcl/v2"
"github.com/urfave/cli/v2"
"go.uber.org/zap"
)
var Version string
var r *rait.RAIT
var commonFlags = []cli.Flag{
&cli.StringFlag{
Name: "config",
Usag... |
package handler
import (
"bytes"
"crypto"
"crypto/rand"
"crypto/rsa"
"fmt"
"time"
"github.com/nsmithuk/local-kms/src/cmk"
)
// Using custom struct to be able to decode ValidTo
// as simple Int64. Alternative would be custom
// type and marshal/unmarshal functions (again not
// possible using the type from the... |
package leaderboard
import (
"fmt"
"github.com/qvistgaard/openrms/internal/config/application"
"github.com/qvistgaard/openrms/internal/implement"
"github.com/qvistgaard/openrms/internal/plugins/rules/pit"
"github.com/qvistgaard/openrms/internal/types"
"github.com/qvistgaard/openrms/internal/types/annotations"
"... |
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
type segment struct {
segments [7]int
}
var digits = [10]segment{
{[7]int{1, 1, 1, 0, 1, 1, 1}}, // 0
{[7]int{0, 0, 1, 0, 1, 0, 0}}, // 1
{[7]int{1, 0, 1, 1, 1, 0, 1}}, // 2
{[7]int{1, 0, 1, 1, 0, 1, 1}}, // 3
{[7]int{0, 1, 1, 1, 0, 1, 0}}, // 4
{[7]int... |
/*
* Copyright 2020 Devtron Labs
*
* 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 utils
import (
"bytes"
"context"
"encoding/base64"
"fmt"
"io/ioutil"
"math"
"net/http"
"os"
"path/filepath"
"strconv"
"time"
"github.com/aymerick/raymond"
jwt "github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
"github.com/tidwall/gjson"
)
// EncodeAuthTo... |
package spec
import (
"encoding/json"
"github.com/imulab/go-scim/pkg/v2/annotation"
"github.com/imulab/go-scim/pkg/v2/spec/internal"
)
// Resource type models the SCIM resource type. It is a collection of one main schema and zero or more schema extensions
// to describe a single type of SCIM resource.
//
// To acc... |
package methods
import (
"fmt"
"math"
"math/rand"
"time"
)
type float64Data []float64
type float64Mat [][]float64
// Parameter holds the parameters for population, individual and DE
type Parameter struct {
NumI int // Population size (number of individuals for each generation)
NumG int // N... |
package arrgo
import (
"fmt"
"strings"
)
type Arrb struct {
shape []int
strides []int
data []bool
}
//通过[]bool,形状来创建多维数组。
//输入参数1:data []bool,以·C· 顺序存储,作为多维数组的输入数据,内部复制一份新的internalData,不改变data。
//输入参数2:shape ...int,指定多维数组的形状,多维,类似numpy中的shape。
// 如果某一个(仅支持一个维度)维度为负数,则根据len(data)推断该维度的大小。
//情... |
package main
import (
"flag"
"fmt"
"github.com/gatherstars-com/jwz"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
"log"
"os"
"sort"
"strings"
)
func main() {
var testData string
var sizeHint int
flag.StringVar(&testData, "emldir", "./eml", "base directory beneath which the test can find .eml file... |
// Copyright (C) 2018 IOTech Ltd
//
// SPDX-License-Identifier: Apache-2.0
package fulcro
import (
"container/list"
"fmt"
"net/http"
"strconv"
"strings"
"github.com/gin-gonic/gin"
"github.com/russolsen/transit"
)
type QueryFunc func(params []interface{}, args map[interface{}]interface{}) interface{}
type Mu... |
package processor
import (
"errors"
"git"
"log"
"regexp"
"sort"
"strings"
"time"
"user"
)
// A Query to the Backend
type Query struct {
Commit string
Authors []string
Repos []string
Since time.Time
UseRegex bool
}
// SendCommits sends all commits matching the query to a supplied channel
func Se... |
// Copyright Contributors to the Open Cluster Management project
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"time"
"github.com/ghodss/yaml"
"github.com/open-cluster-management/library-go/pkg/applier"
libgoclient "github.com/open-cluster-management/library-go/pkg/client"
"github.com... |
package service_core
import (
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
"time"
"github.com/anden007/afocus-godf/src/interfaces/interface_core"
"github.com/anden007/afocus-godf/src/lib"
"github.com/anden007/afocus-godf/src/types"
jsoniter "github.com/json-iterator/go"
"github.com/kataras/iris/v12"
jsonT... |
package app
import (
"context"
"path"
"github.com/puppetlabs/leg/k8sutil/pkg/controller/obj/lifecycle"
relayv1beta1 "github.com/puppetlabs/relay-core/pkg/apis/relay.sh/v1beta1"
"github.com/puppetlabs/relay-core/pkg/entrypoint"
"github.com/puppetlabs/relay-core/pkg/model"
"github.com/puppetlabs/relay-core/pkg/o... |
package run
import (
"fmt"
"log"
"path/filepath"
"strings"
"sync"
"time"
"github.com/marcsauter/single"
"github.com/orange-lightsaber/pretty-safe-backup/rsync"
"github.com/orange-lightsaber/pretty-safe-backup/ssh"
"github.com/orange-lightsaber/psb-rotatord/rotator"
"gopkg.in/natefinch/lumberjack.v2"
)
var... |
package transaction
import (
"encoding/json"
"encoding/hex"
"bytes"
"strings"
"net/url"
"github.com/go-interledger/cryptoconditions"
"github.com/kalaspuffar/base64url"
"github.com/mr-tron/base58/base58"
"github.com/pkg/errors"
"golang.org/x/crypto/ed25519"
"golang.org/x/crypto/sha3"
)
func New(
opera... |
package main
import (
"bufio"
"fmt"
"log"
"math"
"os"
"sort"
"strings"
)
type item struct {
id, value, weight int64
}
type items []item
func (slice items) Len() int { return len(slice) }
func (slice items) Less(i, j int) bool {
return (float64(slice[i].value) / float64(slice[i].weight)) > (float64(slice[j].... |
package main
import (
"fmt"
"github.com/mbark/advent-of-code-2021/util"
"strconv"
"strings"
)
func main() {
fmt.Printf("first: %d\n", solve(largeToSmall))
fmt.Printf("first: %d\n", solve(smallToLarge))
}
var (
largeToSmall = []int{9, 8, 7, 6, 5, 4, 3, 2, 1}
smallToLarge = []int{1, 2, 3, 4, 5, 6, 7, 8, 9}
)
... |
package ci
import (
"errors"
"fmt"
"regexp"
"strings"
"time"
"go.borchero.com/cuckoo/providers"
)
var (
semVer2Pattern = regexp.MustCompile("^([0-9]+)\\.([0-9]+)\\.([0-9]+)$")
relaxedSemVer2Pattern = regexp.MustCompile("^.*([0-9]+\\.[0-9]+\\.[0-9]+).*$")
)
// Manager exposes methods providing common ... |
package modules
import (
"fmt"
"strings"
"unicode/utf8"
"github.com/jojomi/calm-defusor/communication"
"github.com/jojomi/calm-defusor/state"
)
// How to improve?
// entropy analysis to skip a character or even optimize the order by entropy completely
type PasswordModule struct {
words []string
wordList m... |
package hippo
import (
"time"
"github.com/lindsaygelle/nook"
"github.com/lindsaygelle/nook/animal"
"github.com/lindsaygelle/nook/character"
"github.com/lindsaygelle/nook/gender"
"github.com/lindsaygelle/nook/personality"
"golang.org/x/text/language"
)
var (
hippeuxBirthday = nook.Birthday{
Day: 15,
Mon... |
// Package termesc abstracts terminal ANSI escape codes.
//
// For keys which always produce the same sequence on all terminals, a constant is provided. For other keys, functions
// of the form IsXXKey() are available.
package termesc
import (
"bufio"
"errors"
"fmt"
"io"
"time"
)
const (
csi = "\x1B["
osc = "\... |
// Copyright 2021 The Chromium OS 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 autoupdate
import (
"context"
"io/ioutil"
"os"
"path/filepath"
"syscall"
"time"
"github.com/golang/protobuf/ptypes/empty"
"google.gol... |
// Code generated by protoc-gen-go.
// source: encrypted_app_ticket.proto
// DO NOT EDIT!
package protobuf
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.... |
// Copyright (C) 2017 Nexedi SA and Contributors.
// <NAME> <<EMAIL>>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Found... |
package main
import (
"bufio"
"fmt"
"math"
"os"
"sort"
)
func readInt(bytes []byte, from int, val *int) int {
i := from
sign := 1
if bytes[i] == '-' {
sign = -1
i++
}
tmp := 0
for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
tmp = tmp*10 + int(bytes[i]-'0')
i++
}
*val = tmp * sign
retu... |
/*
Copyright 2022 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, ... |
package metrics
import (
"log"
"net/http"
"fmt"
"strconv"
"strings"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
// ServeHTTPRequests starts http service for handle metrics
func ServeHTTPRequests(addr string, path string) {
log.Printf("Start se... |
package bandit
import (
"encoding/json"
"errors"
"fmt"
"math/rand"
"strings"
"sync"
"time"
wabbit "github.com/recoilme/go-vowpal-wabbit"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
type Bandit struct {
sync.Mutex
VW *wabbit.VW
}
type Cntxt struct {
Prop map[string]string
}
type Action struct {
... |
package main
import (
"fmt"
"log"
"math"
"strings"
"time"
)
// Joint probability P(a,t,f)
func (m *model) Joint(t *Type, f *Func, attrs []string) float64 {
// P(a|t)
pa := 1.
for _, attr := range attrs {
pa *= t.Attrs[attr]
}
// P(f) * P(t|f) * P(a|t)
pr := f.Return[t]
p := f.Prob * pr * pa
logf(logLe... |
// Copyright 2019 Anapaya Systems
//
// 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... |
package main
import (
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"os/signal"
"runtime"
"strings"
"time"
"github.com/ryanking8215/go-wrk/loader"
"github.com/ryanking8215/go-wrk/util"
)
const APP_VERSION = "0.10"
//default that can be overridden from the command line
var versionFlag bool = false
var helpFlag bool ... |
package exchange
import (
"errors"
"fmt"
"github.com/json-iterator/go"
"strings"
"sync"
"time"
. "wisp/common"
"wisp/log"
. "wisp/utils"
"wisp/ws"
)
var json = jsoniter.ConfigCompatibleWithStandardLibrary
type binanceExchange struct {
*ws.WebsocketBuilder
sync.Once
*ws.WebsocketConnection
baseUrl ... |
package dblog
import (
"errors"
"sync"
"time"
"github.com/rueian/pgcapture/pkg/pb"
)
type OnSchedule func(response *pb.DumpInfoResponse) error
type AfterSchedule func()
type CancelFunc func()
var ErrAlreadyScheduled = errors.New("already scheduled")
var ErrAlreadyRegistered = errors.New("already registered")
t... |
package server
import (
"dvr-protocol/client"
"strconv"
"strings"
"time"
"github.com/pkg/errors"
)
// Loopy sends the routing updates at the specified time interval
func (s *Server) Loopy() error {
// Basic tracking ticker, set to tick at the same time interval
// as update interval
tick := time.NewTicker(s.... |
package hanami
import (
"errors"
"testing"
"time"
"github.com/dgrijalva/jwt-go"
"github.com/stretchr/testify/require"
)
func TestOnlyLetters(t *testing.T) {
require.Equal(t, false, onlyLetters("123a3245238.,/?ERQWE{}{}#@_)"))
require.Equal(t, true, onlyLetters("asdasddfsad"))
require.Equal(t, false, onlyLet... |
//go:build !js
// +build !js
package main
import (
"context"
"fmt"
"io"
"os"
"time"
"github.com/atotto/clipboard"
"github.com/pion/webrtc/v3"
"github.com/pion/webrtc/v3/pkg/media"
"github.com/pion/webrtc/v3/pkg/media/h264reader"
)
const (
h264FrameDuration = time.Millisecond * 33
)
func main() { //nolint... |
package jsonrpc
import (
"context"
"encoding/json"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/gorilla/websocket"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
var upgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 10... |
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... |
// Copyright 2021 The churrodata 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,... |
// Copyright (c) 2020-2021 C4 Project
//
// This file is part of c4t.
// Licenced under the MIT licence; see `LICENSE`.
// Package setc contains the app definition for c4t-setc.
package setc
// TODO(@MattWindsor91): make this work more orthogonally with perturber, or merge the two.
import (
"context"
"fmt"
"io"
... |
/*
Copyright 2019 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, ... |
package dfp
import (
"bytes"
"errors"
"fmt"
"io"
"strconv"
"strings"
"unicode"
)
const (
delim = '.'
)
var (
manyZeros = bytes.Repeat([]byte{'0'}, 256)
)
type posError struct {
pos int
err string
}
func newPosError(err string, pos int) *posError {
return &posError{err: err, pos: pos}
}
func (pe posErr... |
package container
import (
"context"
"encoding/json"
"io"
"net/http"
"strconv"
"github.com/cpuguy83/go-docker/httputil"
"github.com/cpuguy83/go-docker/version"
"github.com/pkg/errors"
"github.com/cpuguy83/go-docker/transport"
)
// DefaultExecDecodeLimitBytes is the default max size that will be read from... |
package main
import (
"log"
"math/rand"
"runtime"
"time"
"github.com/go-gl/gl/all-core/gl"
"github.com/go-gl/glfw/v3.1/glfw"
"github.com/go-gl/mathgl/mgl32"
)
const (
screenWidth = 1280
screenHeight = 1024
)
type ObjectType int
const (
ObjectRocket ObjectType = iota + 1
ObjectMoon
ObjectSatellite
Obj... |
package datetime
import (
"errors"
"regexp"
"strconv"
"strings"
)
type timeParams struct {
hour, min, sec, nsec int
}
// regexp Time
var regTime01 = regexp.MustCompile(`(0?[1-9]|1[0-2])\.([0-5][0-9])\.([0-5][0-9])[ \t]?([ap]\.?m\.?)`) // hh.MM.II[ \t]?meridian
var regTime02 = regexp.MustCompile(`(0?[1-9]|1[0-2]... |
package workflow
import (
"fmt"
"log"
"os"
"os/exec"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws/session"
aw "github.com/deanishe/awgo"
"github.com/rkoval/alfred-aws-console-services-workflow/awsworkflow"
"github.com/rkoval/alfred-aws-console-services-workflow/parsers"
"github.com/rkoval/alfred-aws-con... |
package cfg
import (
"log"
"os"
"strconv"
"gopkg.in/yaml.v2"
)
type ConfigCamera struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
Pass string `yaml:"pass"`
}
type ConfigFTP struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
Pass s... |
package output
import (
"bytes"
"encoding/json"
"fmt"
"strings"
"text/template"
"time"
plugin "github.com/golang/protobuf/protoc-gen-go/plugin"
"github.com/yoozoo/protoapi/generator/data"
"github.com/yoozoo/protoapi/generator/data/tpl"
"github.com/yoozoo/protoapi/util"
)
// create template data struct
type... |
package main
import (
"encoding/csv"
"encoding/json"
"fmt"
"github.com/jessevdk/go-flags"
"io"
"io/ioutil"
"log"
"os"
)
type Options struct {
Pks []string `long:"pk" description:"primary keys"`
Output string `short:"o" long:"output" description:"file path where output json i... |
package main
import (
"encoding/json"
"flag"
"fmt"
r "github.com/dancannon/gorethink"
"github.com/jeffail/tunny"
"io"
"log"
"os"
"runtime"
"strings"
)
const BMO_ART = `
▄██████████████████████▄
█ █
█ ▄██████████████████▄ █
█ █ █ █
█ █ ... |
/*
* Copyright 2020 F5 Networks
*
* 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 chanute
import (
"fmt"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/support"
"github.com/richardwilkes/toolbox/errs"
"golang.org/x/text/language"
"golang.org/x/text/message"
)
var printer = message.NewPrinter(language.English)
f... |
// Copyright 2020 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
package main
import (
"context"
"fmt"
"os/signal"
"strconv"
"syscall"
"time"
"firebase.google.com/go/db"
"github.com/Masterminds/sprig"
"github.com/frustra/bbcode"
"github.com/gin-gonic/gin"
"github.com/gorilla/sessions"
"github.com/joho/godotenv"
"github.com/markbates/goth"
"github.com/markbates/goth/g... |
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
"path/filepath"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/se... |
// Copyright (c) 2014 Couchbase, 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 w... |
package main
import (
"bufio"
"fmt"
"math"
"os"
"strconv"
"strings"
)
type point struct {
x, y int
}
type ventLine struct {
from, to point
}
func (vl *ventLine) horizontal() bool {
return vl.from.y == vl.to.y
}
func (vl *ventLine) vertical() bool {
return vl.from.x == vl.to.x
}
func (vl *ventLine) diago... |
package contractapi
import (
"encoding/json"
guuid "github.com/google/uuid"
"github.com/ravengit/ravenpod-cc-dc-go/config"
"github.com/ravengit/ravenpod-cc-dc-go/datapublisher"
"github.com/ravengit/ravenpod-cc-dc-go/model"
"github.com/ravengit/ravenpod-cc-dc-go/runtime"
"log"
"net/http"
"os"
"strconv"
)
typ... |
package kubernetes
import (
"context"
"crypto/tls"
_ "embed"
"errors"
"fmt"
"github.com/datadog/stratus-red-team/internal/providers"
"github.com/datadog/stratus-red-team/pkg/stratus"
"github.com/datadog/stratus-red-team/pkg/stratus/mitreattack"
"io"
authenticationv1 "k8s.io/api/authentication/v1"
metav1 "k8... |
package calcwkr
import (
"context"
"net/http"
"time"
"github.com/avast/retry-go/v3"
"github.com/pkg/errors"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"go.uber.org/fx"
"github.com/penguin-statistics/backend-next/internal/config"
"github.com/penguin-statistics/backend-next/internal/constant"
"gith... |
package main
import (
"bufio"
"bytes"
"encoding/json"
"log"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"sync"
"time"
"github.com/aws/aws-sdk-go/service/polly"
"github.com/bamchoh/nagome-polly/player"
)
var (
logger *log.Logger
save_dir string = "mp3"
pc ... |
package main
import (
"fmt"
"io"
"log"
"os"
"runtime"
"time"
"github.com/go-gl/gl/v4.1-core/gl"
"github.com/go-gl/glfw/v3.2/glfw"
"github.com/libretro/ludo/libretro"
"github.com/pion/webrtc/pkg/media"
"github.com/pion/webrtc/pkg/media/ivfreader"
)
func init() {
runtime.LockOSThread()
}
func checkNoError... |
// Copyright © 2017 grafiti/predator 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 o... |
package event
import (
"fmt"
"github.com/choerodon/choerodon-cluster-agent/manager"
"time"
"encoding/json"
"github.com/choerodon/choerodon-cluster-agent/pkg/model"
"github.com/golang/glog"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimac... |
package objectbind
import (
"encoding/json"
"reflect"
"strconv"
"strings"
)
//mapData the key value of a interface
type mapData struct {
// the path of the file
Key string `json:"key,omitempty"`
Value string `json:"value,omitempty"`
}
type fieldKind struct {
Field string
Kind reflect.Kind
}
// marshal u... |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package containerservice
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to retrieve the ve... |
//
//Copyright [2016] [SnapRoute 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 seqmgr
// Created by Teocci.
// Author: <EMAIL> on 2021-Aug-28
package seqmgr
import (
"fmt"
"sync"
)
// state represents a Manager's state. It's either:
// 1. doing nothing (stateIdle),
// 2. in the startup sequence (stateUp),
// 3. in the shutdown sequence (stateDown).
type state uint8
const (
stateI... |
/*
Copyright 2017 <NAME>
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,... |
/*
* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
package setup
import (
"flag"
"fmt"
cos "intel/isecl/lib/common/v4/os"
csetup "intel/isecl/lib/common/v4/setup"
"intel/isecl/lib/common/v4/validation"
"intel/isecl/workload-service/v4/config"
"intel/isecl/workload-service/v4... |
package levels
// File Constants
const (
FileName = "Levels.txt"
NumColumns = 185
)
// Header Indexes
const (
Name = 0
Id = 1
Pal = 2
Act = 3
QuestFlag = 4
QuestFlagEx = 5
Layer = 6
SizeX = 7
SizeY = 8
SizeXN = 9
SizeYN = 10
Size... |
package docker
import (
"context"
_ "embed"
"encoding/json"
"fmt"
"log"
"os"
"os/exec"
"os/signal"
"strings"
"syscall"
"time"
"github.com/mengelbart/bwe-test-runner/common"
)
type testcase struct {
Name string `json:"name"`
Description string `json:"description"`
URL ... |
package game
import (
"fmt"
)
type Colour int32
const (
None Colour = iota
Black
White
)
func (cl Colour) Format(s fmt.State, c rune) {
switch c {
case 'v': // used in debug
switch cl {
case None:
fmt.Fprint(s, "None")
case Black:
fmt.Fprint(s, "Black")
case White:
fmt.Fprint(s, "White")
}
... |
package num2words
import (
"fmt"
"math"
"strings"
)
const negword = "moins "
func pluralizeCents(n int64) string {
if n == 1 {
return "centime"
}
return "centimes"
}
func pluralizeEuros(n int64) string {
if n == 1 {
return "euro"
}
return "euros"
}
func parse_currency_parts(value float64) (int64, int6... |
/*
Copyright 2020 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
package expreduce
import (
"math/big"
"github.com/corywalker/expreduce/expreduce/atoms"
"github.com/corywalker/expreduce/pkg/expreduceapi"
)
func dimensions(ex expreduceapi.ExpressionInterface, level int, cl expreduceapi.LoggingInterface) []int64 {
head := ex.GetParts()[0]
dims := []int64{int64(len(ex.GetParts(... |
/*
* Copyright (c) 2019 Huawei Technologies Co., Ltd.
* A-Tune is licensed under the Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS... |
package connectionpool
import (
"crypto/tls"
"crypto/x509"
"encoding/gob"
"fmt"
"github.com/TrevorAron/ReliableBroadcast/config"
"io"
"io/ioutil"
"log"
)
type DataMessage struct {
Message []byte
}
// Channel to a particular connection
type client chan<- DataMessage // an outgoing message channel
// What we... |
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package iottwinmaker
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource schema for AWS::IoTTwinMaker::... |
package derivation
import (
"crypto/ed25519"
"encoding/base64"
"encoding/binary"
"errors"
"fmt"
"io"
)
// Attahced Signature derivations must provide a signer function
func attachedSignatureDeriver(c Code) (d deriver) {
return func(data []byte) ([]byte, error) {
return nil, errors.New("For attached signature... |
package tivoli
import (
"adapter/pkg/common"
"adapter/pkg/export"
"bytes"
"context"
"flag"
"fmt"
"io/ioutil"
"net"
"strings"
"sync"
"time"
"github.com/golang/glog"
"github.com/prometheus/common/model"
"golang.org/x/text/encoding/simplifiedchinese"
"golang.org/x/text/transform"
)
const (
AlertUnknown ... |
/*
GoLang code created by <NAME> https://github.com/kazekim
*/
package promptpayqr
import (
"fmt"
"github.com/kazekim/promptpay-qr-go/crc16"
"regexp"
"strconv"
"strings"
)
const (
ID_PAYLOAD_FORMAT = "00"
ID_POI_METHOD = "01"
ID_MERCHANT_INFORMATION_BOT ... |
package convert
import (
"github.com/ShugetsuSoft/pixivel-back/common/utils"
"strings"
"time"
"github.com/ShugetsuSoft/pixivel-back/common/models"
)
var banTagList = map[string]bool{
"+18": true,
"nude": true,
"r18": true,
"r-18": true,
}
func ParseImgTime(url string) time.Time {
date_str := url[strings.... |
package appsflyer
import (
"fmt"
"strings"
"time"
)
type Report struct {
AttributedTouchType string `json:"attributed_touch_type" csv:"Attributed Touch Type"`
AttributedTouchTime CustomTimestamp `json:"attributed_touch_time" csv:"Attributed Touch Time"`
InstallTime CustomTimestamp `json:"ins... |
package smbnego
import (
"strconv"
"strings"
"github.com/gentlemanautomaton/smb/smbcap"
"github.com/gentlemanautomaton/smb/smbdialect"
"github.com/gentlemanautomaton/smb/smbid"
"github.com/gentlemanautomaton/smb/smbsecmode"
"github.com/gentlemanautomaton/smb/smbtype"
)
// RequestSize is the number of bytes re... |
// Copyright 2012 <NAME>. All Rights Reserved.
// Author: <EMAIL> (<NAME>)
//
// 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
//
// Unles... |
//
// (C) Copyright 2019 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 ... |
package logrus
import (
"io"
"os"
"sync"
"github.com/albertwidi/go-project-example/internal/pkg/log/logger"
"github.com/sirupsen/logrus"
)
var _ logger.Logger = (*Logger)(nil)
// Logger struct
type Logger struct {
logger *logrus.Logger
config logger.Config
mu *sync.Mutex
}
// DefaultLogger return defau... |
// Copyright 2021 Zenauth Ltd.
// SPDX-License-Identifier: Apache-2.0
package compile
import (
"errors"
"fmt"
"strings"
"time"
"github.com/open-policy-agent/opa/ast"
policyv1 "github.com/cerbos/cerbos/api/genpb/cerbos/policy/v1"
"github.com/cerbos/cerbos/internal/codegen"
"github.com/cerbos/cerbos/internal/... |
// Package wiringplugin provides the wiring-related types surrounding "WiringPlugin"
package wiringplugin
import (
smith_v1 "github.com/atlassian/smith/pkg/apis/smith/v1"
"github.com/atlassian/voyager"
orch_meta "github.com/atlassian/voyager/pkg/apis/orchestration/meta"
orch_v1 "github.com/atlassian/voyager/pkg/ap... |
// Copyright 2019 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.
package search
import (
"github.com/blevesearch/bleve/index/store"
"github.com/keybase/client/go/kbfs/libfs"
"github.com/pkg/errors"
"github.com/syndtr/goleveldb/le... |
/*
* Copyright 2020 The Knative Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
// Copyright (c) 2018 Cisco and/or its affiliates.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicabl... |
package metrics
import (
"context"
"crypto/tls"
"net/http"
"strconv"
"strings"
"time"
"unicode/utf8"
"github.com/containous/alice"
"github.com/containous/traefik/v2/pkg/log"
"github.com/containous/traefik/v2/pkg/metrics"
"github.com/containous/traefik/v2/pkg/middlewares"
"github.com/containous/traefik/v2/... |
package system
import (
"context"
"database/sql"
"errors"
"fmt"
"kubespace/server/global"
"kubespace/server/model/system/request"
"gorm.io/gorm"
"sort"
)
const (
Mysql = "mysql"
Pgsql = "pgsql"
InitSuccess = "\n[%v] --> 初始数据成功!\n"
InitDataExist = "\n[%v] --> %v 的初始数据已存在!\n"
Init... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.