text stringlengths 3.08k 10.4k |
|---|
// Copyright © 2020 by PACE Telematics GmbH. All rights reserved.
// Created at 2020/02/20 by <NAME>
package routine_test
import (
"bytes"
"context"
"os"
"os/exec"
"sync"
"syscall"
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/pace/bricks/http/security"
"github.com/pace/bricks/locale... |
package openapi
import (
"errors"
"fmt"
"go/types"
"net/http"
"reflect"
"strings"
"github.com/RussellLuo/kun/pkg/caseconv"
)
const (
InPath = "path"
InQuery = "query"
InHeader = "header"
InCookie = "cookie"
InBody = "body"
// This flag indicates that the parameter is located in *http.Request.
InR... |
package lm
import (
"fmt"
"github.com/barnex/fmath"
)
type Vec3 [3]float32
func (v *Vec3) Pointer() *[3]float32 { return (*[3]float32)(v) }
func (v *Vec3) Slice() []float32 { return v[:] }
func (v Vec3) X() float32 { return v[0] }
func (v Vec3) Y() float32 ... |
package api
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"strings"
"time"
"github.com/danesparza/daydash/urlhelp"
log "github.com/sirupsen/logrus"
)
// AlertRequest represents a request to get weather alert information for the given coordiates
type AlertRequest struct {
Latitude string `json:"lat"`
L... |
// Banker's Algorithm implementation
//
// For more info, see:
// - [EN] https://en.wikipedia.org/wiki/Banker%27s_algorithm
// - [IT] https://it.wikipedia.org/wiki/Algoritmo_del_banchiere
//
// Made with ♥ by Simone (https://github.com/BuriedInTheGround)
package main
import (
"errors"
"flag"
"fmt"
"math/rand"
"o... |
/*
Package traq implements helper methods for time tracking.
*/
package traq
import (
"fmt"
"io/ioutil"
"os"
"path"
"regexp"
"strings"
"time"
)
// FilePath returns the path to a traq tracking file, taking the current
// env into account.
func FilePath(project string, date time.Time) (path string) {
return fmt... |
/*
Copyright 2018 The OpenEBS Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
// Copyright 2016 The Prometheus Authors
//
//
//
//
//
package promhttp
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"net/http"
"strings"
"sync"
"time"
"github.com/prometheus/common/expfmt"
"github.com/prometheus/client_golang/prometheus"
)
const (
contentTypeHeader = "Content-Type"
contentLengthHe... |
package bitbot
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"regexp"
"strings"
"time"
"github.com/whyrusleeping/hellabot"
bolt "go.etcd.io/bbolt"
"golang.org/x/net/html"
"mvdan.cc/xurls/v2"
)
var URLReaderTrigger = NamedTrigger{ //nolint:gochecknoglobals,golint
ID: "urls",
Help: "Looks up URL... |
// Code generated by entc, DO NOT EDIT.
package ent
import (
"context"
"errors"
"github.com/facebookincubator/ent/dialect/sql/sqlgraph"
"github.com/facebookincubator/ent/schema/field"
"github.com/knabben/ggql/ent/argument"
"github.com/knabben/ggql/ent/fieldtype"
)
// FieldTypeCreate is the builder for creatin... |
/*
Copyright 2016 <NAME> <www.webx.top>
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... |
package commands
import (
"fmt"
"github.com/premkit/premkit/certs"
"github.com/premkit/premkit/log"
"github.com/premkit/premkit/server"
"github.com/premkit/premkit/version"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
const (
defaultHTTPPort = 2080
defaultHTTPSPort = 2443
... |
package model
import (
"database/sql"
"fmt"
"log"
"math/rand"
"time"
"github.com/lib/pq"
)
//Create Create table Host for struct Host
func Create(db *sql.DB, tablename string) {
sStmt := cSQL()
if _, err := db.Exec(sStmt); err != nil {
log.Fatal(err)
}
}
//Drop drop table public."VcState"
func Drop(db *... |
package sqltest
import (
"context"
"database/sql"
"errors"
"fmt"
"os"
"strings"
"sync"
"sync/atomic"
"time"
"go.uber.org/multierr"
)
// Database is a database created for the purposes of testing.
type Database struct {
Driver Driver
Product Product
DataSource DataSource
m sync.Mutex
open... |
// Copyright ©2014 The gonum 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 search
import (
"container/heap"
"math"
"github.com/gonum/graph"
"github.com/gonum/graph/concrete"
)
var inf = math.Inf(1)
type searchFuncs ... |
/**
* SPDX-License-Identifier: Apache-2.0
* Copyright 2020 vorteil.io Pty Ltd
*/
package vorteil
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"
"unsafe"
"github.com/vorteil/vorteil/pkg/vcfg"
"golang.org/x/sys/unix"
)
const (
fluentbitApp = "/vorteil/fluent-bit"
inputString = "[IN... |
/*
Copyright 2020 Gravitational, 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, soft... |
package main
import (
"fmt"
"io"
"log"
"net/http"
"strconv"
"time"
"github.com/kelseyhightower/envconfig"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
var (
ResponseCodeInternalServerE... |
package pubnub
import (
"encoding/json"
"fmt"
"os"
"github.com/kelseyhightower/envconfig"
pubnub "github.com/pubnub/go"
"github.com/pubnub/go/utils"
"github.com/retgits/webhook-bridge/common"
"github.com/rs/zerolog/log"
)
// Register is the function that creates a new instance of the PubNub agent.
func Regis... |
package c2s
import (
"context"
"log"
"strconv"
"time"
"github.com/m-lab/go/warnonerror"
"github.com/m-lab/ndt-server/ndt5/metrics"
"github.com/m-lab/ndt-server/ndt5/ndt"
"github.com/m-lab/ndt-server/ndt5/protocol"
"github.com/m-lab/ndt-server/ndt5/web100"
)
// ArchivalData is the data saved by the C2S test.... |
package main
import (
"net/http"
"os"
"strings"
"time"
"github.com/Financial-Times/concept-rw-elasticsearch/health"
"github.com/Financial-Times/concept-rw-elasticsearch/resources"
"github.com/Financial-Times/concept-rw-elasticsearch/service"
"github.com/Financial-Times/go-logger"
"github.com/Financial-Times/... |
package main
import (
"fmt"
"io"
"net"
"net/http"
neturl "net/url"
"os"
"os/signal"
"runtime"
"strconv"
"strings"
"sync"
"syscall"
"github.com/fatih/color"
pb "gopkg.in/cheggaaa/pb.v1"
)
var (
client http.Client
err error
)
var (
acceptRangeHeader = "Accept-Ranges"
contentLengthHeader = "Cont... |
package main
import (
"fmt"
"testing"
"time"
cv "github.com/glycerine/goconvey/convey"
)
func TestMicroverseEchoWorks043(t *testing.T) {
dn := NewBoundary("downstream")
ab2lp := make(chan *tunnelPacket)
lp2ab := make(chan *tunnelPacket)
lp := NewLittlePoll(5*time.Second, dn, ab2lp, lp2ab)
up := NewBound... |
package main
import (
"fmt"
"html/template"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"path/filepath"
"time"
"gopkg.in/authboss.v0"
_ "gopkg.in/authboss.v0/auth"
_ "gopkg.in/authboss.v0/confirm"
_ "gopkg.in/authboss.v0/lock"
_ "gopkg.in/authboss.v0/recover"
_ "gopkg.in/authboss.v0/register"
_ "gopkg.in/a... |
package main
import (
"bufio"
"encoding/csv"
"flag"
"fmt"
"io"
"log"
"os"
"os/exec"
"os/signal"
"regexp"
"strconv"
"strings"
"syscall"
"time"
"github.com/tarm/serial"
)
var debug bool
func readOlimexSerial(serialNumber chan<- string, port string, singleRun bool) {
buf := make([]byte, 128)
c := &se... |
package day6
import (
"AoC2021/common"
"io"
"math/big"
"strconv"
"strings"
)
func parseInput(input []string) ([]int, error) {
result := make([]int, 0)
for _, v := range strings.Split(input[0], ",") {
i, err := strconv.Atoi(v)
if err != nil {
return nil, err
}
result = append(result, i)
}
return ... |
package main
import (
"fmt"
"io"
"os"
"os/signal"
"strings"
"syscall"
"time"
"github.com/chzyer/readline"
"github.com/spf13/pflag"
"awesome-dragon.science/go/goGoGameBot/internal/config/tomlconf"
"awesome-dragon.science/go/goGoGameBot/internal/game"
"awesome-dragon.science/go/goGoGameBot/internal/interfa... |
package humanci
import (
"fmt"
"os"
"sync"
"github.com/xlab/treeprint"
)
// ValueFunc describes any function which recevies some data
// from the current node it gets exectuted on.
// Example:
// -> RegexNode, matches regex: ValueFunc(matched_regex_value)
// -> ValueNode, passed the node's token into the Valu... |
package main
import (
"context"
"errors"
"net"
"time"
plogger "github.com/heytribe/go-plogger"
"github.com/heytribe/live-webrtcsignaling/dtls"
"github.com/heytribe/live-webrtcsignaling/my"
"github.com/heytribe/live-webrtcsignaling/packet"
"github.com/heytribe/live-webrtcsignaling/srtp"
)
type DtlsState int
... |
package kubedb
import (
"fmt"
"strings"
jsonTypes "github.com/appscode/go/encoding/json/types"
"github.com/appscode/go/types"
"github.com/golang/glog"
api "github.com/kubedb/apimachinery/apis/kubedb/v1alpha1"
cs "github.com/kubedb/apimachinery/client/clientset/versioned/typed/kubedb/v1alpha1"
"github.com/pkg/... |
// Copyright 2014 pendo.io
//
// 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 writ... |
// Code generated by go-swagger; DO NOT EDIT.
package oauth2
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/g... |
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"github.com/go-ozzo/ozzo-validation"
ex "github.com/me-io/go-swap/pkg/exchanger"
"github.com/me-io/go-swap/pkg/swap"
"io/ioutil"
"math"
"net/http"
"time"
)
// Validate ... Validation function for convertReqObj
func (c *convertReqObj) Validate... |
//
// Copyright © 2021 Uncharted Software 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 ap... |
package debug
import (
"debug/dwarf"
"io/ioutil"
"os"
"path"
"path/filepath"
"sort"
"strings"
"github.com/lunixbochs/usercorn/go/models"
)
type SourceLine struct {
dwarf.LineEntry
Start uint64
End uint64
Source string
}
func (s *SourceLine) Contains(addr uint64) bool {
return s.Start <= addr && s.E... |
package main
import (
"fmt"
"io/ioutil"
"net/http"
"time"
//"github.com/tryor/trygo"
//"github.com/tryor/trygo-bridge/fasthttp"
//"github.com/tryor/trygo-bridge/graceful"
"tryor/trygo"
)
/**
* 演示所有监听模式或自定义监听模式
*/
func main() {
go ListenAndServe(7086) //Default http
//go ListenAndServe(9081, &trygo.Htt... |
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/url"
"os"
"strings"
)
func intSeq() func() int {
i := 0
return func() int {
i += 1
return i
}
}
func main() {
nextInt := intSeq()
fmt.Println(nextInt())
fmt.Println(nextInt())
newInts := intSeq()
fmt.Println(newInts())
fmt.Println(nextIn... |
// This files contains schema for Paris TraceRoute tests.
package schema
import (
"time"
"cloud.google.com/go/bigquery"
"github.com/m-lab/annotation-service/api"
v2as "github.com/m-lab/annotation-service/api/v2"
"github.com/m-lab/go/cloud/bqx"
"github.com/m-lab/traceroute-caller/hopannotation"
"github.com/m-l... |
package hcloverlay
import (
"fmt"
"github.com/hashicorp/hcl/v2"
)
// An Overlay is an object that can be applied to a body using the OverlayBody
// function, in which case it will get an opportunity to modify the result of
// decoding that body, usually by adding or replacing attributes or blocks.
type Overlay int... |
/* *
* Ping++ Server SDK
* 说明:
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写, 并非一定要使用该代码。
* 该代码仅供学习和研究 Ping++ SDK 使用,只是提供一个参考。
*/
package main
import (
//"encoding/base64"
"encoding/json"
"fmt"
"log"
"math/rand"
"strconv"
"time"
pingpp "github.com/pingplusplus/pingpp-go/pingpp"
"github.com/pingplusplu... |
package main
import (
"bytes"
"fmt"
"io"
"math/rand"
"strings"
"text/template"
"time"
"github.com/mschneider82/go-smtp/smtpclient"
"github.com/sirupsen/logrus"
prefixed "github.com/x-cray/logrus-prefixed-formatter"
"gopkg.in/alecthomas/kingpin.v2"
)
var log = logrus.New()
func init() {
customFormatter :... |
package rpcclient
import (
"encoding/json"
"errors"
"fmt"
"reflect"
)
// RPCErrorCode represents an error code to be used as a part of an RPCError
// which is in turn used in a JSON-RPC Response object.
//
// A specific type is used to help ensure the wrong errors aren't used.
type RPCErrorCode int
// RPCError r... |
package subscriber
import (
"errors"
"log"
"os"
"sync"
"sync/atomic"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sqs"
"github.com/jpillora/backoff"
)
const (
// defaultNumConsumers is the number of consumers per subscriber
defaultNumCo... |
package view
import (
"fmt"
"github.com/jroimartin/gocui"
"github.com/sirupsen/logrus"
"github.com/wagoodman/dive/runtime/ui/format"
"github.com/wagoodman/dive/utils"
"strings"
)
type FilterEditListener func(string) error
// Filter holds the UI objects and data models for populating the bottom row. Specificall... |
package bw
import (
"io/ioutil"
"log"
"os"
"os/user"
"path/filepath"
"strings"
"github.com/james-lawrence/bw/internal/x/envx"
"github.com/james-lawrence/bw/internal/x/systemx"
yaml "gopkg.in/yaml.v2"
"github.com/pkg/errors"
)
const (
// DefaultDir agent and client configuration directory, relative to a ... |
// Copyright (c) 2020, HuguesGuilleus. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package db
import (
"bytes"
"encoding/gob"
"github.com/prologic/bitcask"
"log"
"reflect"
"sort"
)
// DB is a data base
type DB struct {
intern *... |
// contract packages APIs of smart contracts
package contract
import (
"math/big"
"github.com/bcbchain/bcbchain/abciapp_v1.0/bcerrors"
"github.com/bcbchain/bcbchain/abciapp_v1.0/contract/stubapi"
"github.com/bcbchain/bcbchain/abciapp_v1.0/smc"
"github.com/bcbchain/bclib/algorithm"
"github.com/bcbchain/bclib/te... |
package subscription
import (
"context"
"database/sql"
"fmt"
"time"
_ "github.com/lawrencejones/pgsink/internal/dbschema/information_schema/model"
isv "github.com/lawrencejones/pgsink/internal/dbschema/information_schema/view"
"github.com/lawrencejones/pgsink/internal/telem"
"github.com/lawrencejones/pgsink/p... |
package service
import (
"encoding/json"
"errors"
"gin-myboot/global"
system "gin-myboot/modules/system/model"
"gin-myboot/modules/system/model/request"
"gorm.io/gorm"
)
type ConfigService struct{}
// Create
// @function: Create
// @description: 创建字典数据
// @param: sysConfig model.Config
// @return: err error
fu... |
package cmd
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
"github.com/dennys-bd/goals/core"
errs "github.com/dennys-bd/goals/shortcuts/errors"
oss "github.com/dennys-bd/goals/shortcuts/os"
"github.com/spf13/cobra"
)
var initCmd = &cobra.Command{
Use: "init name",
Aliases: []string{"i... |
// copied from lock_js.go
package runtime
const (
mutex_unlocked = 0
mutex_locked = 1
note_cleared = 0
note_woken = 1
note_timeout = 2
active_spin = 4
active_spin_cnt = 30
passive_spin = 1
)
func lock(l *mutex) {
if l.key == mutex_locked {
// js/wasm is single-threaded so we should never
//... |
package rsa
/**
* Created by <NAME>
* (i [dot] tsantilis [at] yahoo [dot] com A.K.A lumi) on 7/9/2017.
*/
import (
"fmt"
"time"
"bytes"
"strings"
"net/http"
"os/user"
"io/ioutil"
"crypto/rsa"
"encoding/json"
"github.com/codegangsta/negroni"
"github.com/dgrijalva/jwt-go"
"github.com/dgrijalva/jwt-go/req... |
package jira
import (
"fmt"
"strconv"
"strings"
"time"
"github.com/qarea/jirams/entities"
"github.com/qarea/jirams/store"
)
const (
dueDateLayout = "2006-01-02"
)
// Project - JIRA project structure
type Project struct {
ID string `json:"id"`
Title string `json:"name"`
Description str... |
package main
import (
"flag"
"fmt"
"log"
"os"
"runtime"
"time"
"github.com/athom/nightwatcher"
"github.com/jinzhu/configor"
)
var (
showVersion bool
silence bool
outputFile string
configFile string
httpMethod string
httpPostBody string
elasticsearchURL ... |
package main
import (
"errors"
"fmt"
"math/rand"
"os"
"regexp"
"strings"
"time"
"github.com/nlopes/slack"
rpio "github.com/sabhiram/go-rpio"
)
const (
cFreqMultiplier = 200 // 50hz but in 200 increments to get 10
cCenterAngleDegrees = 90.0
cAngleDelta = 180.0 / (20.0 - 10.0)
cInterpDuration ... |
package main
import (
"encoding/json"
"errors"
"io"
"os"
"os/exec"
"strconv"
"strings"
"syscall"
"time"
"github.com/ProgrammingLab/koneko-online-judge/server/modules/workers"
"github.com/labstack/gommon/log"
)
var (
errOutputLimitExceeded = errors.New("output limit exceeded")
errNotSupportedOS = er... |
package main
import (
"fmt"
"io/ioutil"
"math/rand"
"net"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"strings"
"github.com/govm-project/govm/pkg/optparser"
uuid "github.com/nu7hatch/gouuid"
cli "gopkg.in/urfave/cli.v2"
)
func runVM(c *cli.Context) error {
exe := getExecutable()
rootDir := c.St... |
package services
import (
"fmt"
"strconv"
"github.com/labbsr0x/githunter-data-feed/infra/env"
"github.com/labbsr0x/githunter-data-feed/services/github"
"github.com/sirupsen/logrus"
)
type IssuesResponseContract struct {
Issues []issue `json:"data"`
}
type issue struct {
Number int `json:"numbe... |
/*
* 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 ... |
package main
import (
"log"
"math"
"os"
"github.com/unixpickle/model3d/model3d"
"github.com/unixpickle/model3d/render3d"
"github.com/unixpickle/model3d/toolbox3d"
)
const (
HolderSize = 0.5
TrackSize = HolderSize / math.Sqrt2
PieceSize = HolderSize + TrackSize - 0.04
PieceTh... |
package main // import "github.com/boivie/lovebeat"
import (
"flag"
"fmt"
"github.com/boivie/lovebeat/alert"
"github.com/boivie/lovebeat/algorithms"
"github.com/boivie/lovebeat/api"
"github.com/boivie/lovebeat/backend"
"github.com/boivie/lovebeat/config"
"github.com/boivie/lovebeat/dashboard"
"github.com/boiv... |
// +build linux
package input
import (
"time"
"unsafe"
"syscall"
"unicode"
"strconv"
"errors"
"log"
"github.com/nathanaelle/syslog5424"
)
// linux kernel constants for klogctl()
const (
KLOG_CLOSE int = iota
KLOG_OPEN
KLOG_READ
KLOG_READ_ALL
KLOG_READ_CLEAR
KLOG_CLEAR
KLOG_CONSOLE_OFF
KLOG_CONSOLE_... |
package proxy
import (
"encoding/json"
"fmt"
"net/http"
"strings"
"sync"
"k8s.io/client-go/kubernetes"
"github.com/matt-deboer/kuill/pkg/auth"
"github.com/matt-deboer/kuill/pkg/clients"
"github.com/matt-deboer/kuill/pkg/types"
log "github.com/sirupsen/logrus"
authorizationapi "k8s.io/api/authorization/v1"... |
package runes
import (
"fmt"
)
var (
closer = map[rune]rune{
'(': ')',
'[': ']',
'{': '}',
'\'': '\'',
'"': '"',
}
opener = (func(m map[rune]rune) map[rune]rune {
out := make(map[rune]rune)
for k, v := range m {
out[v] = k
}
return out
})(closer)
)
//Delimiter is a structure which
//sto... |
package account
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"time"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/go-logr/logr"
awsv1alpha1 "github.com/openshift/aws-account-operator/pkg/apis/aws/v1alpha1"
"github.com/openshift/aws-... |
// Copyright 2020 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 ... |
package thumb
import "github.com/disintegration/imaging"
var (
Size = 2048
SizeUncached = 7680
Filter = ResampleLanczos
JpegQuality = 95
JpegQualitySmall = 80
)
func MaxSize() int {
if Size > SizeUncached {
return Size
}
return SizeUncached
}
func InvalidSize(size int) bool... |
package common
import (
"bytes"
"encoding/json"
"fmt"
base "github.com/omegaup/go-base"
"github.com/pkg/errors"
"math/big"
"time"
)
// LimitsSettings represents runtime limits for the Input.
type LimitsSettings struct {
ExtraWallTime base.Duration
MemoryLimit base.Byte
OutputLimit b... |
package kontainerdrivermetadata
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strings"
"time"
"github.com/rancher/norman/types/convert"
"github.com/rancher/rancher/pkg/catalog/git"
"k8s.io/apimachinery/pkg/runtime"
"github.com/rancher/rancher/pkg/settings"
"github.com/rancher/rancher... |
// Copyright (c) 2015 <NAME>
// Copyright 2020 Schibsted
//
// 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, mo... |
package dynamic
import (
"fmt"
"domino/common"
)
// Fast Paxos shard consensus instance manager
type FpConsManager struct {
consMap map[int64]*FpCons
consQueue *common.PriorityQueueInt64
slowConsMap map[int64]*FpCons
}
func NewFpConsManager(initSize int) *FpConsManager {
return &FpConsManager{
consMap: ... |
// Copyright (c) 2014-2017 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package client
import (
"encoding/hex"
"encoding/json"
"strconv"
"strings"
"github.com/kaspanet/kaspad/domainmessage"
"github.com/kaspanet/kaspad/rpc/model"
"gi... |
package utils
import (
"crypto/md5"
"encoding/hex"
"net/url"
"regexp"
"strings"
)
// TruncateString truncates a string and adds ellipsis
func TruncateString(str string, num int) string {
bnoden := str
if len(str) > num {
if num > 3 {
num -= 3
}
bnoden = str[0:num] + "..."
}
return bnoden
}
// Strin... |
package testdata
import (
"time"
"github.com/grokify/go-idmef"
)
// ExamplePortScanningDisallowedService provides the sample file from
// https://datatracker.ietf.org/doc/html/rfc4765#section-7.2.1
func ExamplePortScanningDisallowedService() *idmef.Message {
dt, err := time.Parse(time.RFC3339, "2000-03-09T18:47:2... |
/***
Copyright 2014 Cisco Systems 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 applicable law or agreed to... |
/*
Author :zaniu(<EMAIL>)
Time :2022/2/28 14:17
Desc :
......................我佛慈悲......................
_oo0oo_
o8888888o
88" . "88
(| -_- |)
0\ = /0
___... |
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 <NAME>
*
* 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... |
// 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 refactorspaces
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Definition of AWS::RefactorSpaces::Se... |
// Copyright (c) 2016 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 appli... |
package main
import (
"bufio"
"context"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/signal"
"path"
// "plugin"
plugin "github.com/hashicorp/go-plugin"
_ "github.com/hashicorp/go-plugin/examples/grpc/shared"
"regexp"
"strings"
"syscall"
"github.com/ROMSDEV/xsh/api"
)
var (
reCmd = regexp.MustCompile(`\S+... |
package duck
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 (
drakeBirthday = nook.Birthday{
Day: 25,
Month:... |
// Package stringtemplate provides string expansion by pre-compiled templates, for example:
//
// vehicle1 := map[string]string{"type": "Car", "color": "Red", "model": "X001"}
// tag := NewStringMapExpander("${color[:1]}-$type").Expand(vehicle1)
// // tag == "R-Car"
//
// Only named fields are supported
pac... |
package mxdisk
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
)
// UdevadmInfo for mapping from:
// /sbin/udevadm info -q all -n /dev/sda1 (old and new Linux OS supports these format)
// newer Linux OS must works with: /sbin/udevadm info -p /sys/class/block/devXX
type UdevadmInfo struct {
//... |
// Code generated by entc, DO NOT EDIT.
package ent
import (
"fmt"
"strings"
"entgo.io/ent/dialect/sql"
"github.com/godcong/telebot/database/ent/message"
)
// Message is the model entity for the Message schema.
type Message struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// Type ho... |
package mgr
import (
"context"
"crypto/hmac"
"crypto/sha1"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"gokins/comm"
"gokins/model"
"gokins/service/dbService"
"net/http"
"net/url"
"strings"
"time"
"github.com/dop251/goja"
ruisUtil "github.com/mgr9525/go-ruisutil"
)
type confHookBean struct {
Plug... |
/*
* Tencent is pleased to support the open source community by making Blueking Container Service available.
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obta... |
/*
* Copyright © 2020 Dell Inc. or its subsidiaries. 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
*
* ... |
/*
Copyright 2022 Mondoo, 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
di... |
package model
import (
"database/sql"
"time"
"github.com/guregu/null"
"github.com/satori/go.uuid"
)
var (
_ = time.Second
_ = sql.LevelDefault
_ = null.Bool{}
_ = uuid.UUID{}
)
/*
DB Table Details
-------------------------------------
CREATE TABLE `veteran_reward_templates` (
`claim_id` int(10) unsigned... |
// Some of the code in the file is adapted from Prometheus source code, which
// contained the following license header:
// Copyright 2016 The Prometheus 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 co... |
/*
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 not use this fi... |
package task
import (
"fmt"
"strings"
"github.com/jkandasa/autoeasy/pkg/utils"
funcUtils "github.com/jkandasa/autoeasy/pkg/utils/function"
csAPI "github.com/jkandasa/autoeasy/plugin/provider/openshift/api/catalog_source"
openshiftTY "github.com/jkandasa/autoeasy/plugin/provider/openshift/types"
corsosv1alpha1 ... |
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"strconv"
"github.com/gorilla/mux"
)
// error response contains everything we need to use http.Error
type handlerError struct {
Error error
Message string
Code int
}
// book model
type book struct {
Title string `json:... |
package powershell
import (
// "bufio"
"fmt"
"bytes"
"github.com/mitchellh/packer/packer"
"io"
// "io/ioutil"
"log"
"path/filepath"
"os/exec"
"os"
"strings"
"container/list"
)
type comm struct {
config *Config
}
type Config struct {
Username string
Password string
RemoteHostIP string
VmName string
U... |
package config
import (
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"strconv"
"strings"
)
var (
defCfg map[string]string
initialized = false
)
// initialize this configuration
func initialize() {
viper.SetEnvPrefix("aaa")
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
viper.Automa... |
package availability
import (
"net/url"
"sync"
"github.com/kamilsk/check/errors"
)
// NewReport returns configured report builder.
func NewReport(options ...func(*Report)) *Report {
r := &Report{}
for _, f := range options {
f(r)
}
return r
}
// CrawlerForSites sets the website crawler to a report builder.... |
package imapsrv
import (
"fmt"
"log"
"net"
)
// state is the IMAP session state
type state int
const (
notAuthenticated state = iota
authenticated
selected
)
type encryptionLevel int
const (
// unencryptedLevel indicates an unencrypted / cleartext connection
unencryptedLevel encryptionLevel = iota
// star... |
package blurhash
import (
"math"
"strings"
"github.com/sergeisadov/blurhash/internal/base83"
"github.com/sergeisadov/blurhash/pkg/utils"
)
const bytesPerPixel = 4
const (
minComponent = 1
maxComponent = 9
)
// Encode method takes custom img params and returns blurhash string as result
// components must be i... |
package edit
import (
"fmt"
"io/ioutil"
"log"
"github.com/arnodel/golua/lib"
"github.com/arnodel/golua/lib/debuglib"
"github.com/arnodel/golua/lib/golib"
"github.com/arnodel/golua/runtime"
"github.com/atotto/clipboard"
)
type App struct {
running bool
window *Window
cmdWindow *Window
foc... |
/*
Copyright 2015 Gravitational, 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, soft... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.