CombinedText stringlengths 4 3.42M |
|---|
/*
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 bot
import "fmt"
func NewBot(cfg BotConfig) {
bot := &Bot{}
bot.Read = cfg.Readchan
bot.Send = cfg.Sendchan
bot.Channel = cfg.Channel
bot.init()
}
func (bot *Bot) init() {
fmt.Printf("new bot in %s\n", bot.Channel)
for {
m := <-bot.Read
fmt.Printf("#%s %s : %s\n", m.Channel, m.Username, m.Message)... |
package schema
import "errors"
// AnyOf validates if any of the sub field validators validates.
type AnyOf []FieldValidator
// Compile implements Compiler interface.
func (v *AnyOf) Compile() (err error) {
for _, sv := range *v {
if c, ok := sv.(Compiler); ok {
if err = c.Compile(); err != nil {
return
... |
package deployer
import (
"fmt"
"reflect"
"strings"
"time"
v32 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3"
v33 "github.com/rancher/rancher/pkg/apis/project.cattle.io/v3"
"github.com/rancher/norman/controller"
"github.com/rancher/rancher/pkg/catalog/manager"
alertutil "github.com/rancher/ra... |
// Copyright (c) 2017, Daniel Martí <mvdan@mvdan.cc>
// See LICENSE for licensing information
package interp
import (
"fmt"
"os"
"regexp"
"strconv"
"strings"
"unicode"
"unicode/utf8"
"mvdan.cc/sh/syntax"
)
func anyOfLit(v interface{}, vals ...string) string {
word, _ := v.(*syntax.Word)
if word == nil || ... |
package main
import (
"fmt"
"net"
"bytes"
"io/ioutil"
"os/exec"
"flag"
"github.com/writeas/writeas-telnet/store"
)
var (
banner []byte
outDir string
staticDir string
debugging bool
rsyncHost string
)
const (
colBlue = "\033[0;34m"
colGreen = "\033[0;32m"
colBGreen = "\033[1;32m"
colCyan = "\033[0;36... |
package wsmux
import (
"encoding/binary"
"io"
"net"
"sync"
"time"
)
const (
// DefaultCapacity of read buffer of stream
DefaultCapacity = 1024
)
/*Stream States:
created = stream has been created. Buffer is empty. Has not been accepted.
accepted = stream has been accepted. read write operations permitted.
clo... |
package wuxia
//Config is the settings needed by the static generatot. It is inspired by the
//jekyll configuration options.
//
// The format can either be json, yaml or toml
// TODO: add yaml and toml support.
type Config struct {
Source string `json:"source"`
Destination string `json:"destination"`
Sta... |
/* Copyright (c) 2016 Jason Ish
* 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 of conditions... |
package wuxia
//Config is the settings needed by the static generatot. It is inspired by the
//jekyll configuration options.
//
// The format can either be json, yaml or toml
// TODO: add yaml and toml support.
type Config struct {
Source string `json:"source"`
Destination string `json:"destination"`
Safe ... |
// Package errors provides common error handling tools
// NOTE: Subject to change, do not rely on this package from outside git-lfs source
package errors
// The LFS error system provides a simple wrapper around Go errors and the
// ability to inspect errors. It is strongly influenced by Dave Cheney's post
// at http:/... |
// Copyright 2017 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... |
package main
import (
"fmt"
"log"
"time"
"code.google.com/p/go.crypto/bcrypt"
"github.com/dchest/uniuri"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/jinzhu/gorm"
_ "github.com/mattn/go-sqlite3"
)
var db gorm.DB
var err error
type User struct {
Id int64
Username s... |
package main
import (
"context"
"fmt"
"os"
"strconv"
"sync"
"time"
"github.com/rs/zerolog/log"
"github.com/wzhliang/xing"
"github.com/wzhliang/xing/examples/hello"
)
var success = 0
var m sync.Mutex
func _assert(err error) {
if err != nil {
log.Error().Msgf("Client: %v", err)
}
}
func _assertReturn(re... |
// Copyright 2017-2021 Jeff Foley. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package http
import (
"context"
"crypto/tls"
"crypto/x509"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/cookiejar"
"net/ht... |
package network
//----------------------------------------------------------------------
// This file is part of Gospel.
// Copyright (C) 2011-2020 Bernd Fix
//
// Gospel 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 S... |
package gce
import (
"bytes"
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/emccode/rexray/core"
"github.com/emccode/rexray/core/config"
"github.com/emccode/rexray/core/errors"
"golang.org/x/net/context"
"golang.org/x/oauth2/google"
"google.golang.org/api/compute/v1"
"io/ioutil"
"net"
"net/http"
"rege... |
package ethutil
import (
"bytes"
"encoding/binary"
"encoding/hex"
"fmt"
"math/big"
"strings"
)
// Number to bytes
//
// Returns the number in bytes with the specified base
func NumberToBytes(num interface{}, bits int) []byte {
buf := new(bytes.Buffer)
err := binary.Write(buf, binary.BigEndian, num)
if err !=... |
package event
import (
"sync"
"time"
"github.com/oakmound/oak/timing"
)
// Oak uses the following built in events:
//
// - EnterFrame: the beginning of every logical frame.
// Payload: (int) frames passed since this scene started
//
// - CollisionStart/Stop: when a PhaseCollision entity starts/stops touching so... |
package morningStar
import (
"../jsonHttp"
"bytes"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"regexp"
"strconv"
"sync"
"time"
)
const IDS_URL = `https://elasticsearch.vibioh.fr/funds/morningStarId/_search?size=8000`
const PERFORMANCE_URL = `http://www.morningstar.fr/fr/funds/snapshot/snapshot.aspx?tab=1&id=`... |
package main
import (
"encoding/json"
"fmt"
"go.net/websocket"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"runtime"
"strings"
"text/template"
"time"
"uuid"
)
type ServerConfig struct {
Hostname string `json:"hostname"`
Port string `json:"port"`
NotifyPrefix string `json:"notifyPrefix"`
UseTL... |
// Copyright (c) 2018 Shivaram Lingamneni <slingamn@cs.stanford.edu>
// released under the MIT license
package irc
import (
"errors"
"fmt"
"regexp"
"time"
"github.com/oragono/oragono/irc/sno"
)
const hostservHelp = `HostServ lets you manage your vhost (i.e., the string displayed
in place of your client's hostn... |
package itsdangerous
import (
"bytes"
"crypto/hmac"
"crypto/sha1"
"crypto/subtle"
"encoding/base64"
"encoding/binary"
"errors"
"fmt"
"hash"
"strings"
"time"
)
// 2011/01/01 in UTC
const EPOCH = 1293840000
// Encodes a single string. The resulting string is safe for putting into URLs.
func base64Encode(src... |
package main
import (
"fmt"
"net/http"
"os"
"strconv"
"github.com/gocql/gocql"
)
func main() {
cluster := gocql.NewCluster("gophr.dev")
cluster.ProtoVersion = 4
cluster.Keyspace = "gophr"
cluster.Consistency = gocql.One
session, _ := cluster.CreateSession()
defer session.Close()
http.HandleFunc("/status... |
// Package zip implements functions for jarcat that manipulate .zip files.
package zip
import (
"bytes"
"encoding/binary"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
"sort"
"strings"
"time"
"gopkg.in/op/go-logging.v1"
"third_party/go/zip"
)
var log = logging.MustGetLogger("zip")
var modTime = ti... |
package main
import (
"testing"
"github.com/fsouza/go-dockerclient"
)
type TestDockerClient struct {
containers []docker.APIContainers
}
func (rdc *TestDockerClient) ListContainers() ([]docker.APIContainers, error) {
return rdc.containers, nil
}
func (rdc *TestDockerClient) AddContainer(container docker.APICon... |
package session
import (
"encoding/base64"
"encoding/hex"
"errors"
"fmt"
"log"
"time"
"github.com/gofly/saml"
"github.com/vanackere/ldap"
)
var (
ErrBindFailed = errors.New("ldap: bind failed")
ErrSessionNotFound = errors.New("session is not found")
)
func randomBytes(n int) []byte {
rv := make([]by... |
/*
* Copyright (C) 2015 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 tsm1 provides a TSDB in the Time Structured Merge tree format.
package tsm1 // import "github.com/influxdata/influxdb/tsdb/engine/tsm1"
import (
"archive/tar"
"bytes"
"fmt"
"io"
"io/ioutil"
"math"
"os"
"path/filepath"
"regexp"
"runtime"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/influ... |
// Copyright 2016 yati 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 (
"github.com/fsouza/go-dockerclient"
)
func createContainer(address, ca, cert, key, image string) error {
client, err := docker.NewClient... |
package cluster
import (
"bytes"
"context"
"encoding/json"
"fmt"
"math/rand"
"net/http"
"sync"
"time"
"github.com/lxc/lxd/lxd/db"
"github.com/lxc/lxd/lxd/db/cluster"
"github.com/lxc/lxd/lxd/db/query"
"github.com/lxc/lxd/lxd/node"
"github.com/lxc/lxd/lxd/task"
"github.com/lxc/lxd/lxd/warnings"
"github.c... |
package emitter_test
import (
"code.google.com/p/gogoprotobuf/proto"
"github.com/cloudfoundry-incubator/dropsonde/emitter"
"github.com/cloudfoundry-incubator/dropsonde/events"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"net"
"os"
)
var _ = Describe("UdpEmitter", func() {
Describe("Emit()", func() ... |
/*
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 jlexer contains a JSON lexer implementation.
//
// It is expected that it is mostly used with generated parser code, so the interface is tuned
// for a parser that knows what kind of data is expected.
package jlexer
import (
"encoding/base64"
"fmt"
"io"
"reflect"
"strconv"
"unicode/utf8"
"unsafe"
)
... |
package csvutil
import (
"encoding/csv"
"os"
"github.com/grokify/gotilla/strings/stringsutil"
)
/*
For UTF-8 BOM, csv.Reader.Read() will return error = "line 1, column 1: bare \" in non-quoted-field"
If you encounter this close the file and call again with stripBom = true
*/
// NewReader will create a csv.Rea... |
package main
import (
"net/http"
"github.com/apexskier/httpauth"
"github.com/gorilla/mux"
"fmt"
)
var (
backend httpauth.GobFileAuthBackend
aaa httpauth.Authorizer
)
func main() {
backend = httpauth.NewGobFileAuthBackend("auth.gob")
aaa, err = httpauth.NewAuthorizer(backend, []byte("... |
// Package methdecl tests code facts for a method declaration.
package methdecl
type w struct{}
//- @LessThan defines/binding LT
//- LT code LTCode
//-
//- LTCode child.0 LTFunc
//- LTCode child.1 LTRecv
//- LTCode child.2 LTName
//- LTCode child.3 LTParams
//- LTCode child.4 LTResult
//-
//- LTFunc.pre_text "func "
... |
package net2
import (
"net"
"strings"
"time"
rp "github.com/dropbox/godropbox/resource_pool"
)
const defaultDialTimeout = 500 * time.Millisecond
func parseResourceLocation(resourceLocation string) (
network string,
address string) {
idx := strings.Index(resourceLocation, " ")
if idx >= 0 {
return resourc... |
package protobuf
import (
"encoding/binary"
"errors"
"fmt"
"github.com/golang/protobuf/proto"
"github.com/name5566/leaf/log"
"github.com/name5566/leaf/util"
"math"
"reflect"
)
// -------------------------
// | id | protobuf message |
// -------------------------
type Processor struct {
littleEndian bool
msg... |
/**
* 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... |
package main
import (
"database/sql"
"encoding/json"
"fmt"
"log"
"strconv"
"strings"
"time"
"github.com/satori/go.uuid"
)
type treeRequest struct {
RequestType string
Action string
User string
JobId uuid.UUID
reply chan somaResult
Repository somaRepositoryRequest
Bucket ... |
// Copyright ©2018 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 dual_test
import (
"fmt"
"gonum.org/v1/gonum/num/dual"
)
func Example_Number_fike() {
// Calculate the value and derivative of the function
/... |
package ast
import (
"fmt"
"strconv"
"strings"
)
type addressNode struct {
Expr IExprNode
}
type arefNode struct {
Expr IExprNode
Index IExprNode
}
func (self arefNode) String() string {
return fmt.Sprintf("(vector-ref %s %s)", self.Expr, self.Index)
}
type assignNode struct {
Lhs IExprNode
Rhs I... |
package astquery
import (
"go/ast"
"go/build"
"go/parser"
"go/token"
"reflect"
"regexp"
"testing"
)
type nodeInfo struct {
Name string
Type reflect.Type
}
func TestSetFilter(t *testing.T) {
servicePkg := getTestPkg(t)
serviceTypes := Find([]ast.Node{servicePkg}, SetFilter{
Names: []string{"ServiceOne",... |
// Copyright 2016 The Serviced 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... |
package main
import (
"fmt"
"log"
"time"
"github.com/icholy/killable"
)
type Worker struct {
name string
ch chan int64
killable.Killable
}
func NewWorker(name string) *Worker {
return &Worker{
name: name,
ch: make(chan int64),
Killable: killable.New(),
}
}
func (w *Worker) startProducer(... |
// Copyright 2017 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... |
// 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 lzw implements the Lempel-Ziv-Welch compressed data format,
// described in T. A. Welch, ``A Technique for High-Performance Data
// Compression'', Co... |
// 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.
// This file contains the exported entry points for invoking the parser.
package parser
import (
"bytes"
"go/ast"
"go/scanner"
"go/token"
"io"
"io/iouti... |
// 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.
// Tests for transport.go
package http_test
import (
"bytes"
"compress/gzip"
"crypto/rand"
"fmt"
. "http"
"http/httptest"
"io"
"io/ioutil"
"os"
"str... |
// 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 fcgi
// This file implements FastCGI from the perspective of a child process.
import (
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/ht... |
package main
import (
"fmt"
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/ebitenutil"
"log"
"runtime"
)
const (
screenWidth = 320
screenHeight = 240
)
type Game struct {
canvasRenderTarget ebiten.RenderTargetID
}
func (g *Game) Update() error {
// TODO: Implement
return nil
}
func (g *G... |
package statistics
import (
"math/big"
"sync"
"time"
"github.com/edinnen/Thanksgiving_Intranet/analyzer/models"
"github.com/sirupsen/logrus"
"gopkg.in/oleiade/reflections.v1"
"github.com/jmoiron/sqlx"
"github.com/sec51/goanomaly"
)
// Engine holds necessary values for our statistics engine
type Engine stru... |
package estafette
import (
"fmt"
"regexp"
"strconv"
"strings"
"time"
"github.com/estafette/estafette-ci-api/cockroach"
contracts "github.com/estafette/estafette-ci-contracts"
manifest "github.com/estafette/estafette-ci-manifest"
"github.com/rs/zerolog/log"
)
// BuildService encapsulates build and release cr... |
// Copyright 2015 The etcd 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 t... |
package notifier
import (
"fmt"
"sort"
"strings"
"sync"
"time"
"github.com/jinzhu/gorm"
"github.com/oinume/lekcije/server/config"
"github.com/oinume/lekcije/server/emailer"
"github.com/oinume/lekcije/server/errors"
"github.com/oinume/lekcije/server/fetcher"
"github.com/oinume/lekcije/server/logger"
"githu... |
package ipam
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"math/rand"
"net"
"strconv"
"sync"
"testing"
"time"
"github.com/docker/libkv/store"
"github.com/docker/libkv/store/boltdb"
"github.com/docker/libnetwork/bitseq"
"github.com/docker/libnetwork/datastore"
"github.com/docker/libnetwork/ipamapi"... |
package main
import (
"fmt"
"github.com/glendc/cgreader"
"strings"
)
type Vector struct {
x, y int
}
type Ragnarok struct {
thor, target, dimensions Vector
energy int
}
func GetDirection(a, b string, x, y, v int) <-chan string {
ch := make(chan string)
go func() {
difference := x - y
s... |
// Copyright 2015 realglobe, 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... |
package rpcd
import (
"time"
"github.com/Symantec/Dominator/lib/image"
"github.com/Symantec/Dominator/lib/srpc"
"github.com/Symantec/Dominator/proto/imageserver"
)
func (t *srpcType) GetImage(conn *srpc.Conn,
request imageserver.GetImageRequest,
reply *imageserver.GetImageResponse) error {
var response images... |
// Copyright 2016, RadiantBlue Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable la... |
// +build linux
package server
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"
"time"
cnitypes "github.com/containernetworking/cni/pkg/types"
current "github.com/containernetworking/cni/pkg/types/current"
"github.com/containers/libpod/pkg/annotations"
selinux "github.c... |
package nodename
import (
"errors"
"net"
"os"
"strings"
)
// Get the name of the current machine as a short hostname, domain name, full name (host.domain) and an error.
func Get() (host string, domain string, full string, err error) {
host, err = os.Hostname()
if err != nil {
return
}
host = removeTrailingD... |
/*
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 2014 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 (
"bufio"
"flag"
"fmt"
"github.com/nu7hatch/gouuid"
"io"
"log"
"net"
"net/url"
"os"
"os/signal"
"syscall"
"time"
)
type exchangeid string
type Exchange struct {
id exchangeid
router *Router
socket net.Listener
uchan chan string
}
func NewExchange(id string, socket net.Listen... |
package exec
import (
"testing"
"github.com/frozzare/go-assert"
)
func TestCmd(t *testing.T) {
err := ExecCmd("ls", false)
assert.Nil(t, err)
err = ExecCmd("ls", true)
assert.Nil(t, err)
}
Fix failed tests
package exec
import (
"testing"
"github.com/frozzare/go-assert"
)
func TestCmd(t *testing.T) {
e... |
package main
import (
"os"
"fmt"
"log"
"flag"
"github.com/rwcarlsen/goexif/exif"
"github.com/rwcarlsen/goexif/tiff"
)
func main() {
flag.Parse()
fname := flag.Arg(0)
f, err := os.Open(fname)
if err != nil {
log.Fatal(err)
}
x, err := exif.Decode(f)
if err != nil {
log.Fatal(err)
}
x.Walk(Walker... |
// Copyright (c) 2017, Daniel Martí <mvdan@mvdan.cc>
// See LICENSE for licensing information
package expand
import (
"bytes"
"context"
"fmt"
"io"
"os"
"os/user"
"path/filepath"
"regexp"
"runtime"
"sort"
"strconv"
"strings"
"mvdan.cc/sh/syntax"
)
type Context struct {
// Env is used to get and set env... |
package services
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"time"
"jbrodriguez/unbalance/server/src/algorithm"
"jbrodriguez/unbalance/server/src/dto"
"jbrodriguez/unbalance/server/src/lib"
"jbrodriguez/unbalance/server/src/model"
"gi... |
package server
import (
"log"
"net/http"
"strings"
"github.com/gorilla/websocket"
"github.com/kjk/betterguid"
)
type wsHandler struct {
ws *wsConn
state *State
addr string
handlers map[string]func([]byte)
}
func newWSHandler(conn *websocket.Conn, state *State, r *http.Request) *wsHandler {
h ... |
// Copyright 2015 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.
package common_test
import (
"github.com/juju/testing"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"github.com/juju/juju/service/common"
)
type confSuite struct {
testing.IsolationSuite
}
var _ = gc.S... |
// Copyright 2012 The goauth2 Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The jwt package provides support for creating credentials for OAuth2 service
// account requests.
//
// For examples of the package usage please see jwt... |
package torrentlog
import (
"errors"
"fmt"
"os"
"time"
"code.uber.internal/infra/kraken/core"
"code.uber.internal/infra/kraken/utils/log"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
var (
errEmptyReceivedPieces = errors.New("empty received piece counts")
errNegativeReceivedPieces = errors.New("negati... |
/*
Package fetcher downloads and parses web pages into sets of links.
*/
package fetcher
import (
"errors"
"fmt"
"net/http"
"github.com/jackdanger/collectlinks"
)
// WebFetch encapsulates a Fetch operation and its result
type WebFetch struct {
url string
internalLinks []string
externalLinks []string... |
package options
import "time"
const DEFAULT_MAX_RETRY_ATTEMPTS = 3
const DEFAULT_SLEEP = 5 * time.Second
// List of recurring transient errors encountered when calling terraform
// If any of these match, we'll retry the command
var RETRYABLE_ERRORS = []string{
"(?s).*Failed to load state.*tcp.*timeout.*",
"(?s).*F... |
package ics
import "errors"
const vCalendar = "VCALENDAR"
type Calendar struct {
ProductID, Method string
}
func (c *Calendar) decode(d Decoder) error {
var pID, ver, cs, m bool
for {
p, err := d.p.GetProperty()
if err != nil {
return err
}
switch p := p.(type) {
case productID:
if pID {
retu... |
package dockerfile2llb
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/url"
"path"
"path/filepath"
"sort"
"strconv"
"strings"
"github.com/containerd/containerd/platforms"
"github.com/docker/distribution/reference"
"github.com/docker/docker/pkg/signal"
"github.com/docker/go-connections/nat"
"githu... |
package oembed
import (
"encoding/json"
"io"
"io/ioutil"
"net/http"
"net/url"
"regexp"
"strings"
)
// Oembed contains list of available oembed items (official endpoints)
type Oembed struct {
items []*Item
}
// Endpoint contains single endpoint to check against
type Endpoint struct {
URL string `json... |
/*
Copyright 2016 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 !providerless
/*
Copyright 2016 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 ... |
package main
import (
"image"
"image/color"
"io"
"os"
"time"
"github.com/lucasb-eyer/go-colorful"
"github.com/ninjasphere/go-ninja/api"
"github.com/ninjasphere/go-ninja/config"
"github.com/ninjasphere/go-ninja/logger"
"github.com/ninjasphere/go-ninja/model"
ledmodel "github.com/ninjasphere/sphere-go-led-co... |
package lex_test
import (
"testing"
"github.com/lxc/lxd/lxd/db/generate/lex"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestParse(t *testing.T) {
pkg, err := lex.Parse("./lxd/db/generate/lex")
require.NoError(t, err)
obj := pkg.Scope.Lookup("Parse")
assert.NotNil(t, ob... |
package applyspec
import (
models "bosh/agent/applier/models"
)
type V1ApplySpec struct {
PropertiesSpec PropertiesSpec `json:"properties"`
JobSpec JobSpec `json:"job"`
PackageSpecs map[string]PackageSpec `json:"packages"`
ConfigurationHash string `json:"c... |
package lytics
import (
"strings"
"time"
)
const (
campaignEndpoint = "program/campaign/:id"
campaignListEndpoint = "program/campaign" //status
variationEndpoint = "program/campaign/variation/:id"
variationListEndpoint = "program/campaign/variation"
)
type Campaign struct {
Id string `j... |
// Test rclone by doing real transactions to a storage provider to and
// from the local disk
package main
import (
"fmt"
"io/ioutil"
"log"
"math/rand"
"os"
"path"
"strings"
"time"
"github.com/ncw/rclone/fs"
"github.com/ogier/pflag"
// Active file systems
_ "github.com/ncw/rclone/drive"
_ "github.com/n... |
// Copyright 2016-2019 Authors of Cilium
//
// 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 daemon
import (
"github.com/sevlyar/go-daemon"
"github.com/Sirupsen/logrus"
"github.com/BluePecker/JwtAuth/server"
"github.com/BluePecker/JwtAuth/server/router/jwt"
"github.com/BluePecker/JwtAuth/storage"
"reflect"
"github.com/kataras/iris/core/router"
)
var (
// Redis/Mongodb ... |
package daemon
import (
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"github.com/gorilla/websocket"
"io/ioutil"
"log"
"net/http"
)
const (
ADD_CHAN = iota
DEL_CHAN
)
var logStream = hub{
Broadcast: make(chan []byte),
register: make(chan *connection),
unregister: make(chan *connection),
connecti... |
package daemon
import (
"os"
"fmt"
"github.com/sevlyar/go-daemon"
"github.com/Sirupsen/logrus"
"github.com/BluePecker/JwtAuth/pkg/storage"
"github.com/BluePecker/JwtAuth/daemon/server"
"syscall"
)
const (
TOKEN_TTL = 2 * 3600
VERSION = "1.0.0"
ALLOW_LOGIN_NUM = 3
)
t... |
package daemon
import (
"encoding/json"
"fmt"
"github.com/rancher/convoy/api"
"github.com/rancher/convoy/util"
"net/http"
)
type pluginInfo struct {
Implements []string
}
type pluginResponse struct {
Mountpoint string `json:",omitempty"`
Err string `json:",omitempty"`
}
type pluginRequest struct {
N... |
// Copyright 2018-2020 Authors of Cilium
//
// 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 opts
import (
"fmt"
"os"
"runtime"
"testing"
)
func TestValidateEnv(t *testing.T) {
valids := map[string]string{
"a": "a",
"something": "something",
"_=a": "_=a",
"env1=value1": "env1=value1",
"_env1=value1": "_env1=value1",
"env2=val... |
package isolated
import (
"code.cloudfoundry.org/cli/integration/helpers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
)
var _ = Describe("set-space-role command", func() {
Describe("help", func() {
When("--help flag is set", func() {... |
package main
import (
"bytes"
"fmt"
"os"
"os/exec"
"syscall"
"github.com/codegangsta/cli"
)
func main() {
app := cli.NewApp()
app.Name = "fail-notifier"
app.Version = "0.0.1"
app.Author = "Manabu Inoue"
app.Email = ""
app.HideVersion = true
app.EnableBashCompletion = true
app.Flags = []cli.Flag{
cli.... |
package main
import (
"bytes"
"fmt"
"github.com/codegangsta/cli"
"github.com/gr4y/fitbit-graphite/lib/fitbit"
"github.com/gr4y/fitbit-graphite/lib/processor"
"net"
"os"
)
func main() {
app := cli.NewApp()
app.Name = "fitbit-graphite"
app.Usage = "Exports your FitBit Data into your very own graphite instance... |
package outputs
import (
"fmt"
"sort"
"github.com/hexbotio/hex/models"
"github.com/nlopes/slack"
)
// Slack struct
type Slack struct {
}
// Output function
func (x Slack) Write(message models.Message, config models.Config) {
api := slack.New(config.SlackToken)
msg := ""
params := slack.NewPostMessageParamete... |
package drivers
import (
"encoding/json"
"fmt"
"io"
"os"
"strings"
"github.com/pborman/uuid"
"github.com/pkg/errors"
"golang.org/x/sys/unix"
"github.com/lxc/lxd/lxd/db"
"github.com/lxc/lxd/lxd/migration"
"github.com/lxc/lxd/lxd/operations"
"github.com/lxc/lxd/lxd/revert"
"github.com/lxc/lxd/shared"
"gi... |
package drivers
import (
"encoding/json"
"fmt"
"io"
"os"
"strings"
"github.com/pborman/uuid"
"github.com/pkg/errors"
"golang.org/x/sys/unix"
"github.com/lxc/lxd/lxd/db"
"github.com/lxc/lxd/lxd/migration"
"github.com/lxc/lxd/lxd/operations"
"github.com/lxc/lxd/lxd/revert"
"github.com/lxc/lxd/shared"
"gi... |
package mpmulticore
import (
"bufio"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"strconv"
"strings"
"time"
mp "github.com/mackerelio/go-mackerel-plugin-helper"
)
var graphDef = map[string]mp.Graphs{
"multicore.cpu.#": {
Label: "MultiCore CPU",
Unit: "percent... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.