text stringlengths 3.08k 10.4k |
|---|
package rn2483_test
import (
"fmt"
"testing"
"time"
"github.com/go-logr/logr"
"github.com/go-logr/stdr"
"github.com/poy/onpar"
. "github.com/poy/onpar/expect"
. "github.com/poy/onpar/matchers"
"github.com/omaskery/rn2483"
"github.com/omaskery/rn2483/fake"
"github.com/omaskery/rn2483/testutils"
)
type tes... |
package types
import (
"path"
"encoding/json"
"strings"
"github.com/satori/go.uuid"
)
const (
WORKSPACE = "workspaces"
LAYOUT = "layouts"
JOB = "jobs"
VAR = "vars"
WATCH = "watch"
STATE = "state"
)
var secretKeys = []string{"secret", "access"}
// MakeTree populates a Tree based o... |
package store
import (
"fmt"
"strings"
"code.cloudfoundry.org/cf-networking-helpers/db"
)
type EgressDestinationTable struct{}
func (e *EgressDestinationTable) All(tx db.Transaction) ([]EgressDestination, error) {
query := egressDestinationsQuery("")
rows, err := tx.Queryx(query)
if err != nil {
return []Eg... |
// Command gotree is a reimplmentation of the Unix tree command in Go.
//
// It is not going to be a feature-complete drop-in replacement for the tree
// command, but rather a showcase of fs/memfs and fs/fsutil packages.
//
// Usage
//
// NAME:
// gotree - Go implementation of the Unix tree command
//
// USAGE:... |
package todolist
import (
"context"
"fmt"
"strings"
"github.com/fatih/color"
)
type IssueFields struct {
Statuscategorychangedate string `json:"statuscategorychangedate"`
Issuetype struct {
Self string `json:"self"`
ID string `json:"id"`
Description string `json:"descriptio... |
// Package cli provides commands to use Kocho.
package cli
import (
"fmt"
"os"
"text/tabwriter"
"github.com/giantswarm/kocho/dns"
"github.com/giantswarm/kocho/provider/aws/sdk"
"github.com/giantswarm/kocho/swarm"
"github.com/spf13/pflag"
)
const (
cliName = "kocho"
cliDescription = "kocho is a comma... |
package main
import (
"flag"
"fmt"
"log"
"net/url"
"os"
// "sync"
"time"
"github.com/sociam/xray-archiver/pipeline/db"
"github.com/sociam/xray-archiver/pipeline/util"
)
func analyze(app *util.App) error {
var err error
// if app.store == "cli" {
// app.dbId, err = db.insertApp(app)
// if err != nil {
... |
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"sort"
"sync"
"time"
log "github.com/sirupsen/logrus"
"github.com/cosandr/go-check-updates/api"
)
// NewInternalCache returns a pointer to a new InternalCache struct
func NewInternalCache() *InternalCache {
return &InternalCache{
f: api.File{... |
// Copyright 2018 ETH Zurich, <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 t... |
package gearman // import "github.com/nathanaelle/gearman/v2"
import (
"bytes"
"context"
"errors"
"io"
"log"
"github.com/nathanaelle/gearman/v2/protocol"
)
type (
// Worker define the exposed interface of gearman worker
Worker interface {
AddServers(...Conn)
AddHandler(string, Job) Worker
DelHandler(st... |
// Package middleware provide implementations of custom middleware for the echo framework.
package middleware
import (
"strings"
"time"
"unsafe"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"go.uber.org/zap"
"github.com/gozix/echo/v2/errors"
)
// ZapConfig defines the config for Acc... |
/*
* Copyright (C) 2016 Red Hat, Inc.
*
* 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 Licens... |
/*
Package ble provides functions to discover, connect, pair,
and communicate with Bluetooth Low Energy peripheral devices.
This implementation uses the BlueZ D-Bus interface, rather than sockets.
It is similar to github.com/adafruit/Adafruit_Python_BluefruitLE
*/
package ble
import (
"fmt"
"io"
"time"
"github.c... |
package main
import (
"time"
"github.com/ninjasphere/go-ninja/api"
"github.com/ninjasphere/go-ninja/logger"
"github.com/ninjasphere/go-ninja/model"
"github.com/ninjasphere/go-sonos"
"github.com/ninjasphere/go-sonos/ssdp"
"github.com/ninjasphere/go-sonos/upnp"
)
const (
DiscoveryPort = 13104
EventingPort = ... |
// Package arrowhead implements an arrowhead canvas object.
package arrowhead
import (
"image/color"
"math"
"git.sr.ht/~charles/fynehax/geometry/r2"
"fyne.io/fyne"
"fyne.io/fyne/canvas"
"fyne.io/fyne/theme"
)
const (
defaultTheta float32 = 10
defaultStrokeWidth float32 = 2
defaultLength int ... |
// 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 ... |
package core
import (
"bytes"
"crypto/sha256"
"encoding/binary"
"fmt"
"io"
"log"
"github.com/CityOfZion/neo-go/pkg/util"
)
// BlockBase holds the base info of a block
type BlockBase struct {
Version uint32
// hash of the previous block.
PrevHash util.Uint256
// Root hash of a transaction list.
MerkleRoot... |
package guardian
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"paperboy-back"
"regexp"
"strings"
"time"
"github.com/algao1/basically/btrank"
"github.com/algao1/basically/document"
"github.com/algao1/basically/parser"
"github.com/algao1/basically/trank"
)
// Service repr... |
package kubeauth
import (
"context"
"crypto/ecdsa"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"errors"
"github.com/SermoDigital/jose/jws"
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/logical/framework"
)
// pathConfig returns the path configuration for CRUD operations on the backend
// co... |
package main
// with go modules disabled
import (
"errors"
"fmt"
"log"
"os"
"strings"
"time"
"github.com/analogj/checkr/pkg/actions"
"github.com/analogj/checkr/pkg/config"
"github.com/analogj/checkr/pkg/utils"
"github.com/analogj/checkr/pkg/version"
"github.com/fatih/color"
"github.com/urfave/cli"
)
var... |
// Copyright Red Hat
package placementdecision
import (
"context"
"fmt"
"net"
"net/url"
"strings"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
identitatemv1alpha1 "github.com/identitatem/idp-clien... |
/*
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 tree
import (
"math"
"testing"
T "github.com/andreasstrack/util/testing"
)
func TestDefaultChildIterator(t *testing.T) {
tt := T.NewT(t)
tree := buildTestTree()
ci := newDefaultChildIterator(tree)
maxValue := int64(len(tree.GetChildren()))
for i := int64(0); i < maxValue; i++ {
tt.Assert(ci.HasNext... |
// Copyright 2015 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 mathstats
import (
"errors"
"math"
)
// A LocationHypothesis specifies the alternative hypothesis of a
// location test such as a t-test or a Mann-W... |
package main
import (
"bytes"
"fmt"
"math/rand"
"os"
"strconv"
"strings"
"time"
)
type command struct {
helpString string
usage string
callback func([]string)
}
const debugLogEnabled = false
var debugEnabled = true
var commands = make(map[string]*command)
func processCommand(name string, args []st... |
package tcpserver
import (
"context"
"log"
"net"
"os"
"sync"
"github.com/pkg/errors"
)
// Handler handles TCP connection
type Handler interface {
OnConnect(*Connection)
OnMessage(*Connection, []byte)
OnClose(*Connection, error)
}
// Logger is a Logger interface
type Logger interface {
Print(v ...interface... |
package email
import (
"bufio"
"bytes"
"crypto/tls"
"errors"
"mime/multipart"
"net/smtp"
"net/textproto"
"net/url"
"strings"
"github.com/rs/zerolog/log"
)
type localStatus int
const smtpScheme string = "smtp://"
// UserConfig represents config options provided the user. Not meant to be used
// directly f... |
// Package filter contains the app with methods to scan and retrieve logs from logGroup.
package filter
import (
"fmt"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
"log"
"os"
"regexp"
"strings"
)
// App contains the streamGroup to scan and the streamLogs to get from it
type App struct{}
// FilterLogs cre... |
package retention
import (
"context"
"errors"
"fmt"
modelv2 "github.com/mittwald/goharbor-client/v3/apiv2/model"
"strconv"
"github.com/go-openapi/runtime"
v2client "github.com/mittwald/goharbor-client/v3/apiv2/internal/api/client"
"github.com/mittwald/goharbor-client/v3/apiv2/internal/legacyapi/client"
"gith... |
package chartjs
import (
"bytes"
"fmt"
"github.com/GoAdminGroup/go-admin/modules/language"
"github.com/GoAdminGroup/go-admin/modules/logger"
"html/template"
)
type Chart struct {
ID string
Title template.HTML
Js template.JS
Height int
dataSetIndex int
}
func (c Chart) SetID(id string) Chart {
c.... |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tabletserver
import (
"net/http"
"sync"
"time"
log "github.com/golang/glog"
"github.com/gitql/vitess/go/stats"
"github.com/gitql/vitess/go/sync2"
... |
// Code generated by go-swagger; DO NOT EDIT.
package universe_management
// 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 ... |
package season
import (
"context"
"fmt"
"github.com/ironarachne/world/pkg/geography/climate"
"github.com/ironarachne/world/pkg/geography/region"
"github.com/ironarachne/world/pkg/words"
)
// Season is a meteorological season
type Season struct {
Name string `json:"name"`
Description ... |
/*
Copyright 2021 The Tekton 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, softw... |
/*
Copyright 2021 The GoPlus Authors (goplus.org)
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 cmd
import (
"html/template"
"io/ioutil"
"os"
"reflect"
"strings"
"fmt"
"github.com/kubernetes/kompose/pkg/app"
"github.com/kubernetes/kompose/pkg/kobject"
"github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
)
func runParser(t *ToolArgs) error {
composeConfig, err := readDockerCompose(t)
if err != n... |
package discovery
import (
"sync"
"time"
log "github.com/golang/glog"
"golang.org/x/net/context"
"github.com/youtube/vitess/go/vt/topo"
"github.com/youtube/vitess/go/vt/topo/topoproto"
topodatapb "github.com/youtube/vitess/go/vt/proto/topodata"
)
// NewCellTabletsWatcher returns a TopologyWatcher that monit... |
package internal
const (
apdexRollup = "Apdex"
apdexPrefix = "Apdex/"
webRollup = "WebTransaction"
backgroundRollup = "OtherTransaction/all"
errorsPrefix = "Errors/"
// "HttpDispatcher" metric is used for the overview graph, and
// therefore should only be made for web transactions.
dispatcherMetric ... |
// Code generated by go-swagger; DO NOT EDIT.
package voucher
// 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/... |
package recognizer
// #cgo pkg-config: dlib-1
// #cgo CXXFLAGS: -std=c++1z -Wall -O3 -DNDEBUG -march=native
// #cgo LDFLAGS: -ljpeg
// #include <stdlib.h>
// #include <stdint.h>
// #include "facerec.h"
import "C"
import (
"fmt"
"image"
"unsafe"
)
const (
// RecognitionModeHOG uses HOG method for recognition
Reco... |
package oraeventstore
import (
"database/sql"
"errors"
"os"
log "github.com/Sirupsen/logrus"
"github.com/xtracdev/goes"
"strings"
"time"
)
var (
ErrConcurrency = errors.New("Concurrency Exception")
ErrPayloadType = errors.New("Only payloads of type []byte are allowed")
ErrEventInsert = errors.New("Error in... |
package services
import (
"encoding/json"
"errors"
"log"
"time"
"github.com/arllanos/minesweeper-API/repository"
"github.com/arllanos/minesweeper-API/types"
"github.com/segmentio/ksuid"
)
const (
defaultRows = 10
defaultCols = 10
defaultMines = 15
maxRows = 30
maxCols = 30
minRows = 2
... |
package panda
import (
"bytes"
"encoding/binary"
"math"
"time"
)
const (
CCSDSLength = 6
ESALength = 10
UMILength = 21
)
type Packet interface {
Timestamp() time.Time
Bytes() ([]byte, error)
Payload() []byte
}
type Telemetry struct {
CCSDSHeader
ESAHeader
Data []byte
Sum uint16
}
func (t Teleme... |
package schema
import (
"database/sql"
"errors"
"sort"
)
const (
RenameTable = "RENAME_TABLE"
CreateTable = "CREATE_TABLE"
DropTable = "DROP_TABLE"
ChangeColumn = "CHANGE_COLUMN"
AddColumn = "ADD_COLUMN"
DropColumn = "DROP_COLUMN"
AddIndex = "ADD_INDEX... |
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
type Instruction struct {
name string
values [3]int
}
func readInput(filename string) (int, []Instruction) {
file, err := os.Open(filename)
if err != nil {
fmt.Printf("something bad with file: %v\n", err)
return 0, nil
}
defer file.Close... |
package prompt
import (
"bytes"
"fmt"
"github.com/c-bata/go-prompt"
"github.com/l-lin/tcli/completer"
"github.com/l-lin/tcli/conf"
"github.com/l-lin/tcli/executor"
"github.com/l-lin/tcli/renderer"
"github.com/l-lin/tcli/trello"
"github.com/rs/zerolog/log"
"io"
"os"
"strings"
)
func NewPrompt(conf conf.Con... |
// Copyright 2018-2019 Amazon.com, Inc. or its affiliates. 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. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license... |
package main
/*
#cgo LDFLAGS: -ldevmapper
#define _GNU_SOURCE
#include <libdevmapper.h>
*/
import "C"
import (
"reflect"
"unsafe"
)
const (
deviceCreate = iota
deviceReload
deviceRemove
deviceRemoveAll
deviceSuspend
deviceResume
deviceInfo
deviceDeps
deviceRename
deviceVersion
deviceStatus
deviceTable
... |
package configmap
import (
"reflect"
"sort"
"github.com/solo-io/solo-kit/pkg/api/v1/clients"
"github.com/solo-io/solo-kit/pkg/api/v1/clients/common"
"github.com/solo-io/solo-kit/pkg/api/v1/clients/kube/cache"
"github.com/solo-io/solo-kit/pkg/api/v1/resources"
"github.com/solo-io/solo-kit/pkg/errors"
apiexts "... |
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"sort"
"strings"
"time"
hclog "github.com/hashicorp/go-hclog"
)
const (
// NullAttribute is automatically added to an event if no other attributs are provided
NullAttribute = "null"
// KeySeperator is used to segment K/V pairs and canno... |
// Copyright (c) 2021 Terminus, 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 agree... |
package redisproto
import (
"bufio"
"github.com/gogf/gf/errors/gerror"
"github.com/osgochina/dmicro/drpc/codec/redis_codec"
"io"
"strconv"
"strings"
)
type readState struct {
readingMultiLine bool // 是否是多次读取
expectedArgsCount int //预期消息块的数量
msgType byte //消息类型
args [][]b... |
package lrucache
import (
"github.com/ZYunH/goutils"
"sync"
)
type lruCache struct {
m map[string]*node
root *node
maxSize int
hits int
misses int
lock sync.RWMutex
_buf []byte
_bufNodePtr *node
}
type node struct {
key string
value interface{}
prev *node
next *node
}
/... |
/*
Copyright 2021 The Kubermatic Kubernetes Platform 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 a... |
// Copyright (C) 2019 rameshvk. All rights reserved.
// Use of this source code is governed by a MIT-style license
// that can be found in the LICENSE file.
// Package js implements a basic gopherjs driver for dom
package js
import (
"strings"
"unsafe"
"github.com/dotchain/fuss/dom"
"github.com/gopherjs/gopherjs... |
package server
import (
"context"
"fmt"
"github.com/echocat/lingress/support"
"github.com/pires/go-proxyproto"
log "github.com/sirupsen/logrus"
"net"
"net/http"
"strings"
"time"
)
type HttpConnector struct {
Id ConnectorId
Handler ConnectorHandler
SoLinger int16
MaxConnections uint16
// See... |
package console
import (
"context"
"fmt"
"io"
"io/ioutil"
"os"
"os/signal"
"path/filepath"
"regexp"
"strings"
"syscall"
)
var (
onlyWhiteSpace = regexp.MustCompile(`^\s*$`)
exit = regexp.MustCompile(`^\s*exit\s*;*\s*$`)
)
type Handler interface {
ExecCommand(ctx context.Context, cmd string) er... |
package main_test
import (
"bytes"
"encoding/json"
"log"
"net/http"
"net/http/httptest"
"os"
"strconv"
"testing"
"github.com/MinhL4m/crud-go-postgres"
"github.com/joho/godotenv"
)
// This is in another package
// need to import "github.com/MinhL4m/crud-go-postgres" to work
var a main.App
// TestMain inclu... |
package wrapper
import (
"context"
"errors"
"fmt"
sdk "github.com/grafana/grafana-plugin-sdk-go"
"github.com/grafana/grafana-plugin-sdk-go/dataframe"
"github.com/grafana/grafana-plugin-sdk-go/genproto/datasource"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/components/simplejson"
"git... |
package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
"os/exec"
"github.com/charmbracelet/bubbles/spinner"
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
yt "github.com/noisersup/ledyt/yt-client"
"github.com/noisersup/ledyt/yt-... |
/*
Copyright 2013 CoreOS 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 testutil
import (
"bytes"
"io"
"math/rand"
"reflect"
"runtime"
"strings"
"sync"
"testing"
"time"
"github.com/johnny-morrice/godless/internal/constants"
"github.com/johnny-morrice/godless/internal/util"
"github.com/johnny-morrice/godless/log"
)
func RandKey(rand *rand.Rand, max int) string {
retu... |
// Package vox provides types for describing magicavoxel models,
// and a parser for .vox files.
package vox
import (
"fmt"
"image/color"
"strings"
)
// Main contains the models, palette and materials
// in a magicavoxel .vox file.
type Main struct {
Models []Model
Materials []Material
Scene Scene
}
// ... |
package wildcard
import (
"fmt"
"io"
"os"
)
const STREAM_BUFFER_SIZE = 10_000
type Stream struct {
stream *os.File
streamSize int64
bufferOffset int64
bufferMaxSize int64
buffer []byte
readerOffset int64
}
func NewStream(
stream *os.File,
streamSize int64,
) *Stream {
return &Stream{
... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: selection/selection.proto
package selection
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// Th... |
/*
SPDX-License-Identifier: Apache-2.0
Copyright Contributors to the Submariner 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 requ... |
package gosec
import (
"debug/elf"
"fmt"
"runtime"
)
//Not really used, just here for documentation.
const (
SGX_ENCLU_EENTER = 0x02
SGX_ENCLU_ERESUME = 0x03
SGX_ENCLU_EXIT = 0x04
)
const (
PAGE_READ = 0x1
PAGE_WRITE = 0x2
PAGE_EXEC = 0x4
PAGE_TCS = 0x8
PAGE_NOEXTEND = 0x10
)
const (
... |
package watcher_test
import (
"errors"
"os"
"sync/atomic"
"time"
"code.cloudfoundry.org/bbs/events"
"code.cloudfoundry.org/bbs/events/eventfakes"
"code.cloudfoundry.org/bbs/fake_bbs"
"code.cloudfoundry.org/bbs/models"
"code.cloudfoundry.org/bbs/models/test/model_helpers"
"code.cloudfoundry.org/lager"
"code... |
package openstack
import (
"context"
"fmt"
"io/ioutil"
"log"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/bootfromvolume"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/keypairs"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
"github.com/hashicorp... |
package main
import (
"fmt"
"github.com/2se/dolphin/config"
"github.com/2se/dolphin/core"
"github.com/2se/dolphin/core/cluster"
"github.com/2se/dolphin/core/dispatcher"
"github.com/2se/dolphin/core/outbox"
"github.com/2se/dolphin/core/router"
"github.com/2se/dolphin/core/scheduler"
"github.com/2se/dolphin/cor... |
// Copyright (c) 2021 Terminus, 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 agree... |
// Copyright (c) 2015-2017 <NAME> <<EMAIL>>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list... |
package main
import (
"errors"
"github.com/long2ice/trader/db"
"github.com/long2ice/trader/strategy"
"github.com/long2ice/trader/utils"
"github.com/shopspring/decimal"
"github.com/spf13/viper"
"gorm.io/gorm"
)
var DEBUG = viper.GetBool("common.debug")
/**
判断前若干次交易的升降比,当大于设定值的时候执行买和卖,注意:这只是个简单的策略,并不能盈利
**/
typ... |
package avatar
import (
"bufio"
"bytes"
"errors"
"image"
"image/draw"
"image/png"
"io/ioutil"
"strings"
"github.com/golang/freetype"
"github.com/golang/freetype/truetype"
"golang.org/x/image/font"
)
func getOptions(width int) (w, h int, fontSize float64, spacer, textY int) {
w, h = width, width
fontSize... |
// Copyright (c) 2020-2021 Blockwatch Data Inc.
// Author: <EMAIL>
package index
import (
"context"
"errors"
"fmt"
"blockwatch.cc/packdb/pack"
"blockwatch.cc/packdb/util"
"blockwatch.cc/tzgo/tezos"
. "blockwatch.cc/tzindex/etl/model"
)
const (
OpPackSizeLog2 = 15 // 32k packs ~4M
OpJournalSizeLog... |
/// 2>/dev/null ; gorun "$0" "$@" ; exit $?
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"regexp"
"strings"
"github.com/atotto/clipboard"
"github.com/fatih/color"
"github.com/manifoldco/promptui"
"github.com/zyedidia/highlight"
)
var BuildVersion string = "0.1.5"
func copyFile(contents []byte) {
/... |
package config
import (
"context"
"errors"
"fmt"
"os"
"strings"
validation "github.com/go-ozzo/ozzo-validation/v4"
"gitlab.com/verygoodsoftwarenotvirus/todo/internal/database"
dbconfig "gitlab.com/verygoodsoftwarenotvirus/todo/internal/database/config"
"gitlab.com/verygoodsoftwarenotvirus/todo/internal/data... |
package core
import (
"context"
"fmt"
"sync"
"time"
"github.com/Netflix/metrics-client-go/metrics"
)
type launchGuardStateMachineState int
const (
tickWindow = 15 * time.Second
)
const (
// The event queue is empty
emptyState launchGuardStateMachineState = iota
// The event at events[0] is a cleanup event... |
package main
import (
"os"
"io/ioutil"
"fmt"
"bytes"
"strings"
"github.com/tucnak/store"
"golang.org/x/crypto/ssh"
"gopkg.in/alecthomas/kingpin.v2"
)
var reservedCommands = []string {"list-all", "use", "add", "logout", "remove", "get", "put", "help", "--help", "-h"}
var applicationConfig []*ESHSessionConfig... |
package services
import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
"path"
"regexp"
"sort"
"strings"
"github.com/kathra-project/kathra-codegen-helm/models"
)
type TemplateService interface {
GetTemplates() *models.CodeGenTemplate
TemplateIsValid(t models.CodeGenTemplate) (bool, error)
Gener... |
package chess2
import (
"fmt"
"strings"
)
func toMoveSymbol(c Color, kingTurn bool) rune {
if c == ColorWhite {
if kingTurn {
return 'K'
}
return 'w'
}
if kingTurn {
return 'k'
}
return 'b'
}
func castlingRights(sb *strings.Builder, rights uint64) {
if rights == 0 {
sb.WriteRune('-')
}
if righ... |
package service
import (
"context"
"database/sql"
"fmt"
"io"
"net/http"
"strconv"
"time"
"github.com/bhmj/pg-api/internal/pkg/config"
"github.com/bhmj/pg-api/internal/pkg/db"
"github.com/bhmj/pg-api/internal/pkg/files"
"github.com/bhmj/pg-api/internal/pkg/log"
"github.com/bhmj/pg-api/internal/pkg/metrics"... |
package letsencrypt
import (
"encoding/json"
"io/ioutil"
"log"
"time"
"github.com/mholt/caddy/server"
"github.com/xenolf/lego/acme"
)
// OnChange is a callback function that will be used to restart
// the application or the part of the application that uses
// the certificates maintained by this package. When ... |
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License... |
/*
Package gap implements a genetic algorithm framework for problem solving
using advanced crossover and mutation techniques.
*/
package gap
import (
"fmt"
"runtime"
"time"
"github.com/stiganik/gap/combination"
"github.com/stiganik/gap/selection"
"github.com/stiganik/gap/solution"
// Statically import all sel... |
package jsonextract
import (
"encoding/json"
"fmt"
"os"
"strings"
)
// This example shows how to extract nested objects.
func ExampleObjects_nestedObjects() {
// Test input
var input = strings.NewReader(`
<script>
var x = {
"id": 339750489,
// This comment makes the input invalid JSON
"node_id": "MDEwOl... |
/*
* Copyright 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the Licen... |
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... |
package pgxpoolprometheus
/**
* (C) Copyright IBM Corp. 2021.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required... |
package verifier
import (
"context"
"sync"
"github.com/rotisserie/eris"
"github.com/solo-io/go-utils/contextutils"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/discovery"
"k8s.io/client-go/rest"
)
// ServerVerifyOption is used to specify one of sev... |
package main
import (
"context"
"fmt"
"github.com/36625090/solana-go/client"
"github.com/36625090/solana-go/client/rpc"
"github.com/36625090/solana-go/common"
"github.com/36625090/solana-go/program/assotokenprog"
"github.com/36625090/solana-go/program/metaplex/tokenmeta"
"github.com/36625090/solana-go/program/... |
package model
import (
"bytes"
"encoding/gob"
"github.com/therfoo/therfoo/metrics"
"github.com/therfoo/therfoo/optimizers"
"github.com/therfoo/therfoo/tensor"
"io/ioutil"
"math/rand"
"os"
"sync"
"time"
)
type Model struct {
accurate func(yTrue, yEstimate *tensor.Vector) bool
lossFunction func(yTrue, y... |
package print
import (
"fmt"
"path/filepath"
"strings"
"github.com/xlab/treeprint"
)
// TreePrinter prints list of repos in a directory tree format.
type TreePrinter struct {
}
// NewTreePrinter creates a TreePrinter.
func NewTreePrinter() *TreePrinter {
return &TreePrinter{}
}
// Print generates a tree view ... |
package webapp
import (
htmltemplate "html/template"
"image"
"net/http"
"net/url"
"github.com/boombuler/barcode"
"github.com/boombuler/barcode/qr"
"github.com/authgear/authgear-server/pkg/api/apierrors"
"github.com/authgear/authgear-server/pkg/auth/handler/webapp/viewmodels"
"github.com/authgear/authgear-se... |
/*
Package childproc implements spawning of child processes whose standard streams
are connected to an io.ReadCloser and io.WriteCloser.
Specifically, childproc differs from the standard os/exec package in its
handling of process termination. The Wait method of exec.Cmd waits for any
io.Reader connected to the stdin ... |
package cmd
import (
"context"
"fmt"
"os"
"path/filepath"
"time"
bashoverwriter "github.com/omakeno/bashoverwriter/pkg"
kbkb "github.com/omakeno/kbkb/pkg"
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/cli... |
// Copyright 2017 Baliance. All rights reserved.
//
// DO NOT EDIT: generated by gooxml ECMA-376 generator
//
// Use of this source code is governed by the terms of the Affero GNU General
// Public License version 3.0 as published by the Free Software Foundation and
// appearing in the file LICENSE included in the pack... |
// Copyright © 2018 NAME HERE <EMAIL ADDRESS>
//
// 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 ... |
package main
// #cgo CFLAGS: -I dart-sdk/include
// #include "stdint.h"
// #include "stdlib.h"
// #include "dart_api_dl.h"
// void dart_PostString(Dart_Port_DL port, int64_t context, const char *message);
// Dart_Port_DL init_ReceivePort();
import "C"
import (
"encoding/json"
"fmt"
"strings"
"unsafe"
"github.com... |
// Copyright 2020 DataStax
//
// 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 wr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.