CombinedText stringlengths 4 3.42M |
|---|
package api
import (
"bytes"
"code.google.com/p/goauth2/oauth"
"fmt"
"github.com/dgrijalva/jwt-go"
"github.com/tsuru/config"
"launchpad.net/gocheck"
"net/http"
"net/http/httptest"
"os"
)
func GetGoogleOAuthCode(oauthConfig *oauth.Config) (string, error) {
code := os.Getenv("GOOGLE_OAUTH_CODE")
if code == "... |
// Copyright © 2017 The Things Network
// Use of this source code is governed by the MIT license that can be found in the LICENSE file.
package monitor
import (
"context"
"io"
"sync/atomic"
"github.com/TheThingsNetwork/go-utils/log"
"github.com/TheThingsNetwork/ttn/api"
"github.com/TheThingsNetwork/ttn/api/bro... |
package bootstrap
import (
"context"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
"time"
"github.com/buildkite/agent/agent/plugin"
"github.com/buildkite/agent/bootstrap/shell"
"github.com/buildkite/agent/env"
"github.com/buildkite/agent/experiments... |
package bdiscord
import (
"bytes"
"fmt"
"strings"
"sync"
"github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config"
"github.com/42wim/matterbridge/bridge/helper"
"github.com/bwmarrin/discordgo"
)
const MessageLength = 1950
type Bdiscord struct {
*bridge.Config
c *discordgo.Sessi... |
// Copyright 2016 Stratumn SAS. All rights reserved.
// Use of this source code is governed by the license that can be found in the
// LICENSE file.
// Package rethinkstore implements a store that saves all the segments in a
// RethinkDB database.
package rethinkstore
import (
"encoding/json"
"math"
"strings"
"ti... |
package main
import (
"encoding/json"
"fmt"
"sync"
"time"
"github.com/grafana/grafana/pkg/log"
"github.com/intelsdi-x/snap/mgmt/rest/rbody"
"github.com/raintank/raintank-apps/task-agent/snap"
"github.com/raintank/raintank-apps/task-server/model"
)
type TaskCache struct {
sync.RWMutex
c *snap.Client... |
package main
import (
"encoding/csv"
"flag"
"fmt"
. "github.com/abhiyerra/workmachine/app"
"os"
)
type ImageTagging struct {
ImageUrl InputField `work_desc:"Use this image to fill the information below." work_id:"image_url" work_type:"image"`
Tags OutputField `work_desc:"List all t... |
// Copyright (c) 2013, Nikolay Georgiev
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions ... |
package mg
import (
"bytes"
"fmt"
"sync"
"time"
)
type taskTick struct{ ActionType }
type Task struct {
Title string
Cancel func()
CancelID string
ShowNow bool
}
type TaskTicket struct {
ID string
Title string
Start time.Time
CancelID string
tracker *taskTracker
showNow bool
cancel... |
/*
Copyright 2014 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, ... |
/*
Copyright (c) 2016, Percona LLC and/or its affiliates. All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any lat... |
package updateBloomData
import (
"Inf191BloomFilter/src/databaseAccessObj"
"strconv"
"github.com/willf/bloom"
)
const bitArraySize = 10000
const numberOfHashFunction = 5
// BloomFilter struct holds the pointer to the bloomFilter object
type BloomFilter struct {
bloomFilter *bloom.BloomFilter
}
// New is called... |
package sqls
import (
_ "github.com/go-sql-driver/mysql"
"fmt"
"os"
"testing"
)
var (
db *SqlWrap
username string = "root" // your mysql username for test
passwd string = "123456" // your mysql password for test
insertNum int64 = 100
)
func init() {
var err error
db, err = Open("mysql", fmt.... |
package templates
import (
"errors"
"fmt"
"time"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
kapiv1 "k8s.io/api/core/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/wait"
kapi "k8s.io/k... |
package application
import (
"net/http"
"os"
"path/filepath"
"time"
"github.com/didip/stopwatch"
"github.com/didip/tollbooth"
"github.com/pressly/chi"
"gopkg.in/tylerb/graceful.v1"
"github.com/resourced/resourced-master/handlers"
"github.com/resourced/resourced-master/middlewares"
)
func (app *Application... |
package connector
import (
"fmt"
"net"
"os"
"os/exec"
"path"
"time"
"strings"
humanize "github.com/dustin/go-humanize"
"github.com/ellcrys/crypto"
"github.com/ellcrys/util"
cutil "github.com/ncodes/cocoon-util"
"github.com/ncodes/cocoon/core/config"
"github.com/ncodes/cocoon/core/connector/monitor"
d... |
package eval
import (
"encoding/json"
"monkey/ast"
"regexp"
)
type RegEx struct {
RegExp *regexp.Regexp
Value string
}
func (re *RegEx) Inspect() string { return re.Value }
func (re *RegEx) Type() ObjectType { return REGEX_OBJ }
func (re *RegEx) CallMethod(line string, scope *Scope, method string, arg... |
package db
import (
"sync"
"time"
"github.com/couchbaselabs/sync_gateway/base"
"github.com/couchbaselabs/sync_gateway/channels"
)
var ChannelCacheMinLength = 50 // Keep at least this many entries in cache
var ChannelCacheMaxLength = 500 // Don't put more than this many entries in cache
var Channel... |
package check_test
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/gexec"
"github.com/idahobean/npm-resource"
"github.com/idahobean/npm-resource/check"
)
var ... |
package clicommand
import (
"bufio"
"context"
"fmt"
"io"
"net/http"
"os"
"os/signal"
"path/filepath"
"runtime"
"strconv"
"strings"
"sync"
"syscall"
"time"
"github.com/buildkite/agent/v3/agent"
"github.com/buildkite/agent/v3/api"
"github.com/buildkite/agent/v3/bootstrap/shell"
"github.com/buildkite/a... |
package wifi
import (
"context"
"fmt"
"net/http"
"os"
"strings"
"time"
log "github.com/Sirupsen/logrus"
"github.com/grandcat/zeroconf"
"github.com/parnurzeal/gorequest"
"github.com/resin-io/edge-node-manager/config"
)
var (
initialised bool
avahiTimeout time.Duration
)
type Host struct {
ip ... |
// Copyright (c) 2016 Pani Networks
// 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 shorty
import (
"crypto/rand"
"encoding/json"
"fmt"
"github.com/golang/glog"
"github.com/gorilla/mux"
omni_http "github.com/qorio/omni/http"
"io"
"io/ioutil"
"math"
"net/http"
"net/url"
"strings"
"time"
)
type ShortyAddRequest struct {
LongUrl string `json:"longUrl"`
Rules []RoutingRul... |
package pool
import (
"fmt"
"github.com/DVI-GI-2017/Jira__backend/db"
"github.com/DVI-GI-2017/Jira__backend/models"
"github.com/DVI-GI-2017/Jira__backend/services"
)
func init() {
resolvers["Project"] = projectsResolver
}
const (
ProjectCreate = Action("ProjectCreate")
ProjectsAll = Action("Project... |
package sereno_test
import (
"fmt"
"sync"
"testing"
"time"
"github.com/lytics/sereno"
"github.com/lytics/sereno/embeddedetcd"
"golang.org/x/net/context"
)
func TestSignal(t *testing.T) {
cluster := embeddedetcd.TestClusterOf1()
cluster.Launch()
defer func() {
t.Log("terminating etcd cluster")
cluster.T... |
package main
import (
"context"
"flag"
"fmt"
"math/rand"
"net/http"
_ "net/http/pprof"
"os"
"sync"
"time"
"golang.org/x/net/trace"
"github.com/dgraph-io/badger/badger"
"github.com/dgraph-io/badger/y"
"github.com/dgraph-io/dgraph/store"
"github.com/pkg/profile"
)
const mil float64 = 1000000
var (
whi... |
// since.go
/* REVISION HISTORY
21 Oct 2018 -- First started playing w/ MichaelTJones' code. I added a help flag
*/
package main
import (
"flag"
"fmt"
"log"
"os"
"sort"
"sync"
"time"
"github.com/MichaelTJones/walk"
)
var duration = flag.String("d", "", "find files modified within DURATION")
var format ... |
package compress
import (
"archive/tar"
"compress/gzip"
"io"
"log"
"os"
"github.com/goreleaser/releaser/config"
"github.com/goreleaser/releaser/uname"
"golang.org/x/sync/errgroup"
)
// Pipe for compress
type Pipe struct{}
// Name of the pipe
func (Pipe) Name() string {
return "Compress"
}
// Run the pipe
... |
package api
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"time"
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/api/response"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/infra/metrics"
"github.com/grafana/grafana/pkg/models"
"github.... |
/*
Copyright 2014 Google 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 in ... |
/*
Copyright The Helm 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, software
di... |
/*
Copyright 2017 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, ... |
/*
Copyright 2017 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, ... |
/*
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 status
import (
"context"
"fmt"
"path"
"path/filepath"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/werf/logboek"
"github.com/werf/werf/pkg/path_matcher"
"github.com/werf/werf/pkg/util"
)
type Result struct {
repos... |
package paxos
import (
"borg/assert"
"testing"
"fmt"
"os"
)
var (
IdOutOfRange = os.NewError("Id Out of Range")
)
func coordinator(me, nNodes uint64, v string, ins, outs chan msg, clock chan int) {
if me > nNodes {
panic(IdOutOfRange)
}
var crnd uint64 = me
Start:
start := msg{
cmd: "INVITE",
to: ... |
/*
Copyright 2015 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 realtime
import (
"sync"
"testing"
"time"
"github.com/go-redis/redis"
"github.com/stretchr/testify/assert"
)
type testDoc struct {
id string
doctype string
}
func (t *testDoc) ID() string { return t.id }
func (t *testDoc) DocType() string { return t.doctype }
func (t *testDoc) MarshalJSON()... |
/*
Copyright 2012 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
/*
Copyright 2017 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 system
// IsProcessAlive returns true if process with a given pid is running.
func IsProcessAlive(pid int) bool {
// TODO Windows containerd. Not sure this is needed
// p, err := os.FindProcess(pid)
// if err == nil {
// return true
// }
return false
}
// KillProcess force-stops a process.
func KillPro... |
package system // import "github.com/docker/docker/pkg/system"
import (
"unsafe"
"github.com/sirupsen/logrus"
)
const (
// Deprecated: use github.com/docker/pkg/idtools.SeTakeOwnershipPrivilege
SeTakeOwnershipPrivilege = "SeTakeOwnershipPrivilege"
// Deprecated: use github.com/docker/pkg/idtools.ContainerAdmini... |
package main
import (
"context"
"encoding/json"
"errors"
"flag"
"fmt"
"log"
"net"
"net/http"
"os"
"os/exec"
"strings"
"time"
)
// Listen for Docker image, container, and volume delete events and run a command after a delay.
// Event represents the subset of the Docker event message that we're
// interest... |
// +build coverage
/*
Copyright 2018 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 ag... |
// +build linux
/*
Copyright 2014 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 agree... |
package main
import (
"crypto/rand"
"fmt"
"github.com/caius/gobot"
"githubstatus"
"io/ioutil"
"math/big"
"net/http"
"regexp"
"signalstatus"
"strconv"
"strings"
)
var GitCommit string
var BuiltBy string
func main() {
fmt.Printf("Version: %s\nBuilt by: %s\n", GitCommit, BuiltBy) // FU GO
bot := gobot.Gob... |
/*
Copyright 2014 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 web
import (
"net/http"
"encoding/json"
"io"
"time"
"github.com/Sirupsen/logrus"
"github.com/feedhenry/mcp-standalone/pkg/mobile"
"github.com/feedhenry/mcp-standalone/pkg/mobile/app"
"github.com/feedhenry/mcp-standalone/pkg/web/headers"
"github.com/gorilla/mux"
"github.com/pkg/errors"
)
type Bui... |
package exec
import (
"archive/tar"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"os"
"path"
"time"
"github.com/cozy/cozy-stack/pkg/apps"
"github.com/cozy/cozy-stack/pkg/config"
"github.com/cozy/cozy-stack/pkg/consts"
"github.com/cozy/cozy-stack/pkg/couchdb"
"github.com/cozy/cozy-stack/pkg/instance"
"... |
package main
import "fmt"
type Circle struct {
x,y,r float64
}
func main(){
var c Circle;
fmt.Println(c)
circ:= new (Circle)
(*circ).x=9
fmt.Println(circ)
circ2:= Circle{0,0,8}
fmt.Println(circ2)
}
Added methods
package main
import "fmt"
import "math"
type Circle struct {
x,y,r float64
}
func area(c... |
// Calculate the number of legal 60-card decks in various Magic the Gathering formats.
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"math/big"
"strings"
)
type Legality struct {
Format, Legality string
}
type Card struct {
Name string
Type string
Legalities []Legality
}
func main() {... |
/*
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 core
import (
"errors"
"fmt"
"path"
"reflect"
"os"
"path/filepath"
"regexp"
"strings"
"time"
"github.com/MG-RAST/AWE/lib/conf"
"github.com/MG-RAST/AWE/lib/core/cwl"
"github.com/MG-RAST/AWE/lib/logger"
"github.com/MG-RAST/AWE/lib/rwmutex"
shock "github.com/MG-RAST/go-shock-client"
"github.com/d... |
package tablestorageproxy
import (
"bytes"
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"fmt"
"net/http"
"net/http/httputil"
"strings"
"time"
)
type GoHaveStorage interface {
GetKey() []byte
GetAccount() string
}
type TableStorageProxy struct {
goHaveStorage GoHaveStorage
baseUrl str... |
package firestore
import (
"context"
"fmt"
"sort"
"strings"
"time"
fs "cloud.google.com/go/firestore"
"go.skia.org/infra/go/firestore"
"go.skia.org/infra/go/sklog"
"go.skia.org/infra/go/util"
"go.skia.org/infra/task_scheduler/go/db"
"go.skia.org/infra/task_scheduler/go/types"
"google.golang.org/grpc/codes... |
package ecslogs
import (
"encoding/json"
"testing"
)
var (
jsonLenTests = []interface{}{
nil,
true,
false,
0,
1,
42,
-1,
-42,
0.1234,
"",
"Hello World!",
"Hello\nWorld!",
[]byte(""),
[]byte("Hello World!"),
json.Number("0"),
json.Number("1.2345"),
[]int{},
[]int{1, 2, 3},
... |
package qb
import (
"fmt"
"github.com/nu7hatch/gouuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"testing"
"time"
)
type pUser struct {
ID string `qb:"type:uuid; constraints:primary_key, auto_increment" db:"id"`
Email string `qb:"constraints:unique, notnull" db:"email... |
// 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.
//go:build go1.13 && (linux || darwin)
// +build go1.13
// +build linux darwin
package main
import (
"bufio"
"bytes"
"context"
"encoding/json"
"errors"
... |
package entrypoint
import (
"log"
"strings"
amb "github.com/datawire/ambassador/pkg/api/getambassador.io/v2"
"github.com/datawire/ambassador/pkg/kates"
)
// SecretRef is a secret reference -- basically, a namespace/name pair.
type SecretRef struct {
Namespace string
Name string
}
// ReconcileSecrets figu... |
package main
import (
"fmt"
"log"
"os"
"os/exec"
"regexp"
"sort"
"strconv"
"strings"
"github.com/go-playground/locales"
"golang.org/x/text/unicode/cldr"
"text/template"
)
const (
locDir = "../%s"
locFilename = locDir + "/%s.go"
)
var (
tfuncs = template.FuncMap{
"is_multibyte": func(s string)... |
package main
import (
"testing"
)
func TestGenKeyPairSuccess(t *testing.T) {
_, err := genKeyPair("/tmp/foo")
if err != nil {
t.Fatal(err)
}
}
more coverage.. beter temp directory
package main
import (
"io/ioutil"
"os"
"os/user"
"testing"
)
func TestGenKeyPairSuccess(t *testing.T) {
tmpfile, err := iou... |
// Copyright 2017 The Upspin Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"context"
"crypto/sha256"
"fmt"
"io/ioutil"
"net/http"
"os"
"golang.org/x/oauth2/google"
dns "google.golang.org/api/dns/v1"
... |
package main
import (
"fmt"
"time"
"launchpad.net/gnuflag"
"launchpad.net/juju-core/cmd"
"launchpad.net/juju-core/environs"
"launchpad.net/juju-core/log"
"launchpad.net/juju-core/state"
"launchpad.net/tomb"
// register providers
_ "launchpad.net/juju-core/environs/ec2"
)
var retryDuration = 10 * time.Seco... |
/*
Copyright 2016 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... |
/*
Copyright 2016 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 main
import (
"errors"
"fmt"
"net/url"
"os"
"regexp"
"strings"
"time"
"unicode"
"unicode/utf8"
"github.com/Sirupsen/logrus"
"github.com/cerana/cerana/pkg/logrusx"
"github.com/spf13/pflag"
"github.com/spf13/viper"
)
var (
flagSep = regexp.MustCompile(`[\s._-]+`)
specialCaps = regexp.MustCom... |
package integration_test
import (
"os/exec"
"path/filepath"
"github.com/cloudfoundry/libbuildpack/cutlass"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CF PHP Buildpack", func() {
SkipUnlessCflinuxfs2() // app depends on newrelic, so php5, so cflinuxfs2
var app *cutlass.App
RunC... |
// Copyright 2022 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
// Package dht implements a distributed hash table that satisfies the ipfs routing
// interface. This DHT is modeled after kademlia with Coral and S/Kademlia modifications.
package dht
import (
"crypto/rand"
"fmt"
"sync"
"time"
peer "github.com/jbenet/go-ipfs/p2p/peer"
routing "github.com/jbenet/go-ipfs/routing... |
package cpu6502
import "fmt"
type opcode byte
type Instruction struct {
Name string
Imm opcode
ZP, ZPX, ZPY opcode
ABS, ABSX, ABSY opcode
IND, INDX, INDY opcode
SNGL, BRA opcode
}
var Optable map[opcode]*Op
type Op struct {
F func(*Cpu, byte)
Name string
Mode mode
}
typ... |
// Copyright 2016 Afshin Darian. All rights reserved.
// Use of this source code is governed by The MIT License
// that can be found in the LICENSE file.
package sleuth
import (
"bytes"
"errors"
"io/ioutil"
"net/http"
"testing"
"time"
"github.com/ursiform/logger"
)
func init() {
// Tests should run using a ... |
package chromaticity
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"net/http/httptest"
"net/http/httputil"
"time"
"github.com/evq/chromaticity/utils"
"github.com/evq/go-restful"
)
var schedulesContainer *restful.Container
type Schedule struct {
Name string `json:"name"`
Description string `j... |
package presence
import (
"errors"
"fmt"
"testing"
"time"
)
func initRedisence(t *testing.T) *Session {
backend, err := NewRedis("192.168.59.103:6381", 10, time.Second*1)
if err != nil {
t.Fatal(err)
}
ses, err := New(backend)
if err != nil {
t.Fatal(err)
}
return ses
}
func TestInitialization(t *t... |
// Copyright 2015 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package prog
import (
"bytes"
"encoding/hex"
"fmt"
"reflect"
"strconv"
"strings"
)
// String generates a very compact program description (mostly f... |
package backoffs
import (
"time"
)
type ExponentialBackoff struct {
Interval int
Multiplier int
}
// Exponential backoff multiplies initial interval by failed request count and specified multiplier
func NewExponentialBackoff(interval, multiplier int) *ExponentialBackoff {
b := new(ExponentialBackoff)
b.Interv... |
/*
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, ... |
// Copyright 2009 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 expvar provides a standardized interface to public variables, such
// as operation counters in servers. It exposes these variables via HTTP at
// /de... |
// Copyright 2011 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 net
import (
"flag"
"regexp"
"runtime"
"testing"
"time"
)
func newLocalListener(t *testing.T) Listener {
ln, err := Listen("tcp", "127.0.0.1:0")... |
// Copyright 2011 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 os
import (
"runtime"
"syscall"
)
// File represents an open file descriptor.
type File struct {
*file
}
// file is the real representation of *Fi... |
// Copyright 2009 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 regexp implements regular expression search.
//
// The syntax of the regular expressions accepted is the same
// general syntax used by Perl, Python,... |
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package regexp implements a simple regular expression library.
//
// The syntax of the regular expressions accepted is:
//
// regexp:
// concatenation { '|' concatenation }
// concatenation:
// { closure }
// c... |
// Copyright 2009 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 regexp implements a simple regular expression library.
//
// The syntax of the regular expressions accepted is:
//
// regexp:
// concatenation { '|'... |
package byteutil
import (
"bytes"
// "fmt"
"github.com/shenwei356/bpool"
"unsafe"
)
// ReverseByteSlice reverses a byte slice
func ReverseByteSlice(s []byte) []byte {
// make a copy of s
l := len(s)
t := make([]byte, l)
for i := 0; i < l; i++ {
t[i] = s[i]
}
// reverse
for i, j := 0, l-1; i < j; i, j = ... |
//go:build functional
// +build functional
package cri_containerd
import (
"context"
"fmt"
"testing"
"github.com/Microsoft/hcsshim/internal/cpugroup"
"github.com/Microsoft/hcsshim/internal/processorinfo"
"github.com/Microsoft/hcsshim/osversion"
"github.com/Microsoft/hcsshim/pkg/annotations"
testutilities "gi... |
/*
Copyright 2020 The cert-manager 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... |
/*
Copyright 2017 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, ... |
/*
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, ... |
// Copyright 2016 Google 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 applicabl... |
package types
import (
"encoding/json"
"errors"
)
type Dependencies []Dependency
type Dependency struct {
App ACName `json:"app"`
ImageID Hash `json:"imageID"`
Labels Labels `json:"labels"`
}
type dependency Dependency
func (d Dependency) assertValid() error {
if len(d.App) < 1 {
return errors.New(`... |
package proxy
import (
"context"
"v2ray.com/core/common/net"
)
type key int
const (
sourceKey key = iota
targetKey
originalTargetKey
inboundEntryPointKey
inboundTagKey
resolvedIPsKey
)
func ContextWithSource(ctx context.Context, src net.Destination) context.Context {
return context.WithValue(ctx, sourceKe... |
package compute
import (
"encoding/json"
"fmt"
"net/http"
"strings"
)
const (
// FirewallRuleActionAccept indicates a firewall rule that, if it matches, will accept the packet and stop processing further rules.
FirewallRuleActionAccept = "ACCEPT_DECISIVELY"
// FirewallRuleActionDrop indicates a firewale rule ... |
package main
import (
"fmt"
"time"
"github.com/ninjasphere/go-ninja/channels"
"github.com/ninjasphere/go-zigbee/gateway"
)
type OnOffChannel struct {
Channel
channel *channels.OnOffChannel
}
// -------- On/Off Protocol --------
func (c *OnOffChannel) TurnOn() error {
return c.setState(gateway.GwOnOffStateT_... |
// Package canvas is responsible to convert the ascii symbols to hand drawn diagrams.
// It implements the basic canvas drawing operations like moveTo, lineTo, fillText.
// The Draw method signature declared in the Drawer interface implements the method separately on Line and Text struct.
package canvas
import (
"ma... |
package google
import (
"fmt"
"log"
"strings"
"time"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"google.golang.org/api/googleapi"
"google.golang.org/api/serviceusage/v1"
)
// These services can only be enabled as a side-effect of enabling other services,
// so don't bother storing them in the c... |
package main
import (
"github.com/thehowl/go-osuapi"
"github.com/bwmarrin/discordgo"
"fmt"
"strings"
"strconv"
)
func checkBeatmapLink(s *discordgo.Session, m *discordgo.MessageCreate) {
//check if message contains only one beatmap link
BeatmapSet := strings.Count(m.Content, "https://osu.ppy.sh/s/")
Beatmap ... |
/*
Copyright 2018 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, ... |
// +build e2e
/*
Copyright 2019 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... |
// Copyright 2009 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 runtime
import "unsafe"
type mOS struct {
machport uint32 // return address for mach ipc
waitsema uint32 // semaphore for parking on locks
}
var da... |
package main
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"fmt"
"testing"
)
func TestKeyGen(t *testing.T) {
c := elliptic.P521()
priv, err := ecdsa.GenerateKey(c, rand.Reader)
if err != nil {
t.Errorf("Error", err)
}
fmt.Printf("X = %v\nY = %v\nD = %v\n", priv.PublicKey.X, priv.PublicKey.Y, pri... |
package main
import (
"flag"
"github.com/BigTong/caspercloud"
_ "github.com/BigTong/caspercloud/ci"
"log"
"net"
"net/http"
_ "net/http/pprof"
"runtime"
)
const (
kDefaultDownloadDirectory = "./images"
)
func main() {
runtime.GOMAXPROCS(6)
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
port := flag.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.