CombinedText stringlengths 4 3.42M |
|---|
package safefile
import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"testing"
"time"
)
func ensureFileContains(name, data string) error {
b, err := ioutil.ReadFile(name)
if err != nil {
return err
}
if string(b) != data {
return fmt.Errorf("wrong data in file: expected %s, got %s", data, string(b))
... |
package transactionpool
import (
"testing"
"github.com/NebulousLabs/Sia/modules"
"github.com/NebulousLabs/Sia/types"
)
// addSiacoinTransactionToPool creates a transaction with siacoin outputs and
// adds them to the pool, returning the transaction.
func (tpt *tpoolTester) addSiacoinTransactionToPool() (txn types... |
package schema
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"sort"
"strings"
)
//go:generate msgp
// MetricData contains all metric metadata and a datapoint
type MetricData struct {
Id string `json:"id"`
OrgId int `json:"org_id"`
Name string `json:"name"`
Metric strin... |
package postgis
import (
"encoding/json"
"errors"
"fmt"
"database/sql"
gostErrors "github.com/geodan/gost/src/errors"
"github.com/geodan/gost/src/sensorthings/entities"
"github.com/geodan/gost/src/sensorthings/odata"
)
var totalDatastreams int
var dsMapping = map[string]string{"observedArea": "public.ST_AsGe... |
// 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 pkix contains shared, low level structures used for ASN.1 parsing
// and serialization of X.509 certificates, CRL and OCSP.
package pkix
import (
"... |
// 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 sql
import (
"context"
"database/sql/driver"
"errors"
"fmt"
"math/rand"
"reflect"
"runtime"
"strings"
"sync"
"sync/atomic"
"testing"
"time"... |
package main
import (
"bytes"
"encoding/json"
"net"
"net/http"
"sync"
)
type ipMap struct {
sync.RWMutex
m map[string]bool
}
type hookService struct {
client http.Client
AddIPsUri string
RemoveIPsUri string
SyncIPsUri string
hookedIPs ipMap
}
func (h *hookService) sendHTTPHook(ips []net.IP... |
package rocserv
import (
"context"
"sync"
"time"
"github.com/shawnfeng/sutil/slog"
)
const (
defaultCapacity = 32 // 初始连接wrapper数,可以比较小
defaultMaxCapacity = 512
defaultIdleTimeout = time.Second * 120
)
// ClientPool every addr has a connection pool, each backend server has more than one addr, in client si... |
package mackerel
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
type Host struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Status string `js... |
/*
Copyright 2017 the Heptio Ark 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 applicable law or agreed to in writ... |
package completion
import (
"fmt"
"io/ioutil"
"net/url"
"os"
"path"
"path/filepath"
"strings"
"time"
"github.com/zerowidth/gh-shorthand/pkg/alfred"
"github.com/zerowidth/gh-shorthand/pkg/config"
"github.com/zerowidth/gh-shorthand/pkg/parser"
"github.com/zerowidth/gh-shorthand/pkg/rpc"
)
const (
// rerun... |
package httphelper
import (
"encoding/json"
"fmt"
"log"
"net/http"
)
type ErrorCode string
const (
NotFoundError ErrorCode = "not_found"
ObjectNotFoundError = "object_not_found"
ObjectExistsError = "object_exists"
SyntaxError = "syntax_error"
ValidationError ... |
package http
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"time"
"github.com/golang/glog"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/client-go/kubernetes"
corev1listers "k8s.io/client-go/listers/core/v1"
extv1beta1listers "k8s.io/client-go/listers/extensions/v1beta1"
"github.co... |
package matterclient
import (
"strings"
"github.com/mattermost/mattermost-server/v5/model"
)
func (m *Client) parseResponse(rmsg *model.WebSocketResponse) {
m.logger.Infof("getting response: %#v", rmsg)
}
func (m *Client) DeleteMessage(postID string) error {
_, resp := m.Client.DeletePost(postID)
if resp.Error... |
/*
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 proxy
import (
"errors"
"sort"
"time"
"github.com/fagongzi/gateway/pkg/pb/metapb"
"github.com/fagongzi/gateway/pkg/util"
"github.com/fagongzi/log"
)
var (
errServerExists = errors.New("Server already exist")
errClusterExists = errors.New("Cluster already exist")
errBindExists = errors.New(... |
/*
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, ... |
package test
import (
"bytes"
"context"
"fmt"
"io/ioutil"
smtpclient "net/smtp"
"os"
"path/filepath"
"testing"
"time"
"github.com/jhillyerd/goldiff"
"github.com/jhillyerd/inbucket/pkg/config"
"github.com/jhillyerd/inbucket/pkg/message"
"github.com/jhillyerd/inbucket/pkg/msghub"
"github.com/jhillyerd/inb... |
/*
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 Istio 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 wri... |
package pq
import (
"bytes"
"encoding/binary"
"github.com/lib/pq/oid"
)
type readBuf []byte
func (b *readBuf) int32() (n int) {
n = int(int32(binary.BigEndian.Uint32(*b)))
*b = (*b)[4:]
return
}
func (b *readBuf) oid() (n oid.Oid) {
n = oid.Oid(binary.BigEndian.Uint32(*b))
*b = (*b)[4:]
return
}
func (b *... |
package main
import (
"fmt"
)
func buy(args []string) error {
return fmt.Errorf("buy called")
}
updated buy.go
package main
import (
"flag"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
)
func buy(args []string) error {
os.Args = args
var (
serv = flag.String("s", "localhost:8088", "path to the factom... |
package cec
import(
"log"
"time"
"strings"
)
type Device struct {
OSDName string
Vendor string
LogicalAddress int
ActiveSource bool
PowerStatus string
PhysicalAddress string
}
var logicalNames = []string{ "TV", "Recording", "Recording2", "Tuner",
"Playback","Audio", "Tuner2", "Tuner3",
"Playback2", "Recor... |
package dnstapio
import (
"log"
"net"
"sync/atomic"
"time"
tap "github.com/dnstap/golang-dnstap"
fs "github.com/farsightsec/golang-framestream"
)
const (
tcpWriteBufSize = 1024 * 1024
tcpTimeout = 4 * time.Second
flushTimeout = 1 * time.Second
queueSize = 10000
)
type dnstapIO struct {
endp... |
package ghch
import (
"bytes"
"encoding/json"
"fmt"
"io"
"log"
"strings"
"text/template"
"time"
"github.com/jessevdk/go-flags"
"github.com/octokit/go-octokit/octokit"
)
type ghOpts struct {
RepoPath string `short:"r" long:"repo" default:"." description:"git repository path"`
GitPath string `short:"g" lo... |
// Photobomb conducts workflow tests triggered by requests to its web server.
package main
import (
"encoding/json"
"fmt"
"os"
"time"
"github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
)
func main() {
app := cli.NewApp()
app.Name = NAME
app.Version = VERSION
app.Usage = "test workflows for the Getty... |
package worker
import (
"crypto/tls"
"crypto/x509"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"os/exec"
"os/signal"
"strings"
"syscall"
"time"
// include for conditional pprof HTTP server
_ "net/http/pprof"
"github.com/Sirupsen/logrus"
"github.com/cenk/backoff"
"github.com/getsentry/ra... |
package cli
type App struct {
Name string
Usage string
Action Action
Commands []Command
}
type Command struct {
Name string
ShortName string
Usage string
Description string
Action Action
}
type Action func(name string)
func (a App) Run(command string) {
for _, c := range a.Com... |
package main
import (
"flag"
"fmt"
"io"
"log"
"os"
"os/signal"
"runtime"
"strings"
"sync"
"text/template"
"time"
"github.com/hashicorp/logutils"
"github.com/rakutentech/go-nozzle"
"golang.org/x/net/context"
)
//go:generate ./bin/kafka-firehose-nozzle -gen-godoc
// Exit codes are int values that repres... |
package buildah
import (
"bytes"
"encoding/json"
"io"
"io/ioutil"
"os"
"path/filepath"
"time"
"github.com/Sirupsen/logrus"
"github.com/containers/image/docker/reference"
"github.com/containers/image/image"
is "github.com/containers/image/storage"
"github.com/containers/image/types"
"github.com/containers... |
package main
import (
"fmt"
"strings"
"github.com/fsouza/go-dockerclient"
"github.com/jawher/bateau/query"
)
var (
imgFields = map[string][]query.Operator{
"id": {query.EQ, query.LIKE},
"cmd": {query.EQ, query.LIKE},
"entrypoint": {query.EQ, query.LIKE},
"comment": {qu... |
// Copyright 2013 Francisco Souza. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package docker
import (
"encoding/json"
"errors"
"github.com/dotcloud/docker"
"io"
"net/http"
)
// Error returned when the image does not exist.
var Err... |
package common
import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"os"
"os/user"
"path"
"reflect"
"strconv"
"strings"
)
// CommandPropertySet is a generic function that will set a property for a given plugin/app combination
func CommandPropertySet(pluginName, appName, property, value string, properties map[string]... |
package main
import (
"bufio"
"bytes"
"fmt"
"log"
"net/http"
"net/url"
"os"
"strings"
"time"
)
type indexHandler struct {
dir http.Dir
}
// yanked out of golang's library
var htmlReplacer = strings.NewReplacer(
"&", "&",
"<", "<",
">", ">",
// """ is shorter than """.
`"`, """,
... |
// Copyright (c) Ilia Kravets, 2015. All rights reserved. PROVIDED "AS IS"
// WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. See LICENSE file for details.
package efhsim
import (
"fmt"
"io"
"log"
"my/itto/verify/packet/itto"
"my/itto/verify/sim"
)
const (
EFHM_DEFINITION = 0
EFHM_TRADE = 1
EFHM_QUOTE =... |
package bot
import (
"fmt"
"log"
"sync"
)
// Cmd holds the parsed user's input for easier handling of commands
type Cmd struct {
Raw string // Raw is full string passed to the command
Channel string // Channel where the command was called
User *User // User who sent the message
Message string /... |
package ole
import (
"syscall"
"unicode/utf16"
"unsafe"
)
var (
procCoInitialize, _ = modole32.FindProc("CoInitialize")
procCoInitializeEx, _ = modole32.FindProc("CoInitializeEx")
procCoUninitialize, _ = modole32.FindProc("CoUninitialize")
procCoCreateInstance, _ = modole32.FindProc("CoCreateIn... |
package gotana
import (
"encoding/json"
"github.com/go-redis/redis"
)
type genericStruct map[string]interface{}
type DAO interface {
Write(name string, data []byte) error
GetLatestItem(name string) error
GetItems(name string) []string
CountItems(name string) int64
ProcessItems(items []string) []genericStruct
... |
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package platformvm
import (
"errors"
"fmt"
"github.com/ava-labs/gecko/chains/atomic"
"github.com/ava-labs/gecko/database"
"github.com/ava-labs/gecko/database/versiondb"
"github.com/ava-labs/gecko/ids"
"github.co... |
// Package inf (type inf.Dec) implements "infinite-precision" decimal
// arithmetic.
// "Infinite precision" describes two characteristics: practically unlimited
// precision for decimal number representation and no support for calculating
// with any specific fixed precision.
// (Although there is no practical limit o... |
package main
import (
"bytes"
"code.google.com/p/go.tools/go/vcs"
"encoding/json"
"errors"
"fmt"
"io"
"log"
"os"
"os/exec"
"path/filepath"
"sort"
)
// Godeps describes what a package needs to be rebuilt reproducibly.
// It's the same information stored in file Godeps.
type Godeps struct {
ImportPath strin... |
// 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.
// Extended and bugfixes by Miek Gieben. Copyright 2010-2012.
// DOMAIN NAME SYSTEM
//
// Package dns implements a full featured interface to the Domain Name Sy... |
// 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.
// Extensions of the original work are copyright (c) 2011 Miek Gieben
// Package dns implements a full featured interface to the Domain Name System.
// Server- ... |
// Copyright 2017 MSolution.IO
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ... |
// Copyright 2017 MSolution.IO
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ... |
package log
import (
"fmt"
"github.com/ark-lang/ark/util"
"os"
"strings"
)
type LogLevel int
const (
LevelDebug LogLevel = iota
LevelVerbose
LevelInfo
LevelWarning
LevelError
)
var LevelMap = map[string]LogLevel{
"debug": LevelDebug,
"verbose": LevelVerbose,
"info": LevelInfo,
"warning": LevelWarn... |
// Package girc provides a high level, yet flexible IRC library for use with
// interacting with IRC servers. girc has support for user/channel tracking,
// as well as a few other neat features (like auto-reconnect).
//
// Much of what girc can do, can also be disabled. The goal is to provide a
// solid API that you do... |
package client
import (
"bytes"
"crypto/rand"
"encoding/base64"
"errors"
"io"
"github.com/flynn/go-discoverd"
"github.com/flynn/rpcplus"
"github.com/flynn/sampi/types"
)
func New() (*Client, error) {
disc, err := discoverd.NewClient()
if err != nil {
return nil, err
}
services, err := disc.Services("fl... |
// Copyright 2014 Hajime Hoshi
//
// 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 junos provides automation for Junos (Juniper Networks) devices.
Establishing A Session
To connect to a Junos device, the process is fairly straightforward.
jnpr := junos.NewSession(host, user, password)
defer jnpr.Close()
Compare Rollback Configurations
If you want to view the difference between... |
// xslx is a package designed to help with reading data from
// spreadsheets stored in the XLSX format used in recent versions of
// Microsoft's Excel spreadsheet.
package xlsx
Made reference to xslx2csv (https://github.com/tealeg/xlsx2csv) as an example of how to use XLSX.
// xslx is a package designed to help with... |
/*
Package templates is a thin wrapper around html/templates.
The templates package main function is to create a collection
of templates found in a templates directory
The templates directory structure only requires that a 'views' directory exist and it contains at least on html template.
An html template will be cr... |
/*
* This file is part of the libvirt-go-xml project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modif... |
// Package swf provides a full implementation of a client api for Amazon Simple Workflow Service
// http://docs.aws.amazon.com/amazonswf/latest/apireference/
//
// In addition it provides a basic facility for modeling swf workflows as FSMs (finite state machines), as well as
// implementations of pollers fof both decis... |
// Package cc contains methods for solving Chess Challange
package cc
Fix misspelled word
// Package cc contains methods for solving Chess Challenge
package cc
|
// 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 main
import (
"bufio"
"exec"
"fmt"
"go/ast"
"go/parser"
"go/token"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strings"
"unicode"
"utf8"
)... |
// +build darwin
package scard
// #cgo LDFLAGS: -framework PCSC
// #cgo CFLAGS: -I /usr/include
// #include <stdlib.h>
// #include <PCSC/winscard.h>
// #include <PCSC/wintypes.h>
import "C"
import (
"unsafe"
)
func (e Error) Error() string {
return "scard: " + C.GoString(C.pcsc_stringify_error(C.int32_t(e)))
}
/... |
/*
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 (c) 2014, The Tor Project, Inc.
// See LICENSE for licensing information
package natpmp
import (
"net"
"syscall"
"unsafe"
)
var iphlpapi = syscall.NewLazyDLL("Iphlpapi.dll")
var procGetBestRoute = iphlpapi.NewProc("GetBestRoute")
// mibIPForwardRow is MIBIPFORWARDROW from windows.
type mibIPForwardR... |
package utils
import (
"bytes"
"encoding/json"
"errors"
"io"
"io/ioutil"
"net/http"
)
//Client for http requests
type Client struct {
*http.Client
BaseURL string
ContentType string
}
//Response wrapper
type Response struct {
Resp *http.Response
Err error
}
//InfoExec for the MapExec
type InfoExec st... |
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package utils
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
l4g "github.com/alecthomas/log4go"
"github.com/mattermost/platform/einterfaces"
"github.com/mattermost/platform/mod... |
package scrape
// The following code was sourced and modified from the
// https://github.com/andrew-d/goscrape package governed by MIT license.
//TODO: add paginator to details
import (
"errors"
"fmt"
"io"
"regexp"
"strings"
"time"
"github.com/slotix/dataflowkit/splash"
"github.com/sirupsen/logrus"
"githu... |
package postgres
import (
"database/sql"
"encoding/json"
"fmt"
"sort"
"strconv"
"strings"
"time"
"regexp"
"github.com/lfq7413/tomato/errs"
"github.com/lfq7413/tomato/types"
"github.com/lfq7413/tomato/utils"
"github.com/lib/pq"
)
const postgresSchemaCollectionName = "_SCHEMA"
const postgresRelationDoesN... |
package cmds
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/url"
"os"
"os/user"
"path"
"path/filepath"
"strings"
units "github.com/docker/go-units"
"github.com/fsouza/go-dockerclient"
"github.com/gogo/protobuf/jsonpb"
"github.com/gogo/protobuf/proto"
pachdclient "github.com/pachyderm/pachyderm/sr... |
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this f... |
package gorocksdb
// #include "rocksdb/c.h"
import "C"
// Env is a system call environment used by a database.
type Env struct {
c *C.rocksdb_env_t
}
// NewDefaultEnv creates a default environment.
func NewDefaultEnv() *Env {
return NewNativeEnv(C.rocksdb_create_default_env())
}
// NewNativeEnv creates a Environm... |
// This file provides the EqC type, which represents strings that can be
// compared only for equality. Unlike Eq, EqC symbols are first canonicalized
// using a program-provided canonicalization function.
package intern
import (
"fmt"
)
// An EqC is a string that has been interned to an integer after being
// can... |
package sdk
import (
"crypto/rand"
"encoding/hex"
"encoding/json"
"fmt"
"regexp"
"sort"
"time"
"github.com/fsamin/go-dump"
)
// DefaultHistoryLength is the default history length
const (
DefaultHistoryLength int64 = 20
)
// ColorRegexp represent the regexp for a format to hexadecimal color
var ColorRegexp ... |
package handlers
import (
"crypto/rand"
"encoding/hex"
"flag"
"fmt"
"github.com/FactomProject/cli"
"github.com/FactomProject/serveridentity/functions"
"github.com/FactomProject/serveridentity/identity"
"io"
"os"
)
var SCRIPTNAME string = "fullidentity"
var PRINT_OUT bool = true
/*
* This file is only used ... |
package handlers
import (
"errors"
"fmt"
"github.com/codegangsta/cli"
"github.com/dmonay/okra/common"
"github.com/gin-gonic/gin"
"github.com/tommy351/gin-cors"
"gopkg.in/mgo.v2"
"gopkg.in/yaml.v1"
"io/ioutil"
"log"
"os"
)
func getConfig(c *cli.Context) (common.Config, error) {
yamlPath := c.GlobalString("... |
/*
Copyright 2015-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 law or agreed to i... |
// +build linux
package netlink
import (
"errors"
)
var (
// ErrAttrHeaderTruncated is returned when a netlink attribute's header is
// truncated.
ErrAttrHeaderTruncated = errors.New("attribute header truncated")
// ErrAttrBodyTruncated is returned when a netlink attribute's body is
// truncated.
ErrAttrBodyT... |
package goftp
import (
"bufio"
"crypto/tls"
"errors"
"fmt"
"io"
"log"
"net"
"os"
"regexp"
"strconv"
"strings"
)
var REGEX_PWD_PATH *regexp.Regexp = regexp.MustCompile(`\"(.*)\"`)
type FTP struct {
conn net.Conn
addr string
debug bool
tlsconfig *tls.Config
reader *bufio.Reader
writer *bufio.Wr... |
package fluidbackup
import "sync"
import "math/rand"
import "time"
import "bytes"
import "strings"
import "os"
import "fmt"
import "encoding/hex"
import "bufio"
type BlockId int64
type BlockShardId int64
/*
* BlockShard represents a slice of a file block.
*/
type BlockShard struct {
Id BlockShardId
Hash ... |
/*Package seq balabala
This package defines a *Seq* type, and provides some basic operations of sequence,
like validation of DNA/RNA/Protein sequence and getting reverse complement sequence.
This package was inspired by
[biogo](https://code.google.com/p/biogo/source/browse/#git%2Falphabet).
IUPAC nucleotide code: AC... |
package main
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
"strings"
)
func RunIntcode(input []int) []int {
output := make([]int, len(input))
for i, val := range input {
output[i] = val
}
for i := 0; i < len(input); i += 4 {
switch output[i] {
case 1:
// add
output[output[i+3]] = output[output[i+... |
package gas
import (
"io"
"io/ioutil"
"sync"
)
var (
fs *FS
lock sync.RWMutex
)
// Initialize the code using the default (UnitedFS)
func init() {
fs = UnitedFS()
}
// Refresh the internal FS to reflect possible changes in the UnitedFS
func Refresh() {
lock.Lock()
defer lock.Unlock()
fs = UnitedFS()
}
//... |
package main
import (
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
)
type mpath struct {
name string
path string
}
type vdir string
var mpathre = regexp.MustCompile(`^\.(.*)###(.*)$`)
var vdirre = regexp.MustCompile(`^[a-f0-9]{64}$`)
func newmpath(mp string) *mpath {
res := mpathre.FindAl... |
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
//
// Copyright (C) 2014 Sebastian 'tokkee' Harl <sh@tokkee.org>
// 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
// n... |
// Package goofclient consists of structs and their methods which can be used to
// connect to the host, send or receive messages through the server
package goofclient
import (
"bufio"
"errors"
"flag"
"fmt"
"log"
"net"
"net/rpc"
"os"
"strconv"
"strings"
)
//Nothing defines a blank variable
type Nothing bool... |
package service
import (
"fmt"
"github.com/ninjasphere/app-presets/model"
"github.com/ninjasphere/go-ninja/config"
"github.com/ninjasphere/go-ninja/logger"
nmodel "github.com/ninjasphere/go-ninja/model"
"strings"
)
// check that the service has been initialized
func (ps *PresetsService) checkInit() {
if ps.Lo... |
/*
Prifi-app starts a cothority node in either trustee, relay or client mode.
*/
package main
import (
"fmt"
"os"
"io/ioutil"
"os/user"
"path"
"runtime"
"bytes"
"github.com/BurntSushi/toml"
prifi_protocol "github.com/lbarman/prifi/sda/protocols"
prifi_service "github.com/lbarman/prifi/sda/services"
"gopkg... |
package smux
import (
crand "crypto/rand"
"encoding/binary"
"fmt"
"io"
"log"
"math/rand"
"net"
"net/http"
_ "net/http/pprof"
"strings"
"sync"
"testing"
"time"
)
func init() {
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
log.SetFlags(log.LstdFlags | log.Lshortfile)
ln, err... |
// generated by stringer -output=interfaces_string.go -type=BorderType,CommandCategory,DockingType,KeyboardMode; DO NOT EDIT
package wicore
import "fmt"
const _BorderType_name = "BorderNoneBorderSingleBorderDouble"
var _BorderType_index = [...]uint8{10, 22, 34}
func (i BorderType) String() string {
if i < 0 || i ... |
// Copyright 2015 The Cockroach 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... |
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package dependency
import (
"time"
"github.com/juju/errors"
"github.com/juju/loggo"
"launchpad.net/tomb"
"github.com/juju/juju/worker"
)
var logger = loggo.GetLogger("juju.worker.dependency")
// NewEngine returns an ... |
// 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 law ... |
// Copyright (c) 2016 Ivan A Kostko (github.com/ivan-kostko)
// 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 requir... |
// 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.
// +build ignore
// gen runs go generate on Unicode- and CLDR-related package in the text
// repositories, taking into account dependencies and versions.
packa... |
package atlas
import (
"math"
"strings"
)
// longestCommonPrefix finds the longest common prefix for all the strings
// given as an argument, or returns the empty string if a prefix can't be
// found.
//
// This function just uses brute force instead of a more optimized algorithm.
func longestCommonPrefix(vs []stri... |
package harness
import (
"fmt"
"github.com/revel/revel"
"go/build"
"os"
"os/exec"
"path"
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
"text/template"
)
var importErrorPattern = regexp.MustCompile("cannot find package \"([^\"]+)\"")
// Build the app:
// 1. Generate the the main.go file.
// 2. Ru... |
package poker
import (
"reflect"
"testing"
)
// Define a function BestHand([]string) ([]string, error).
//
// Also define a testVersion with a value that matches
// the targetTestVersion here.
const targetTestVersion = 4
var validTestCases = []struct {
name string
hands []string
best []string
}{
{
name: ... |
package search
import (
"encoding/json"
"encoding/hex"
"github.com/jinzhu/gorm"
dbModule "github.com/notegio/openrelay/db"
"github.com/notegio/openrelay/types"
"github.com/notegio/openrelay/blockhash"
"github.com/notegio/openrelay/common"
"net/http"
urlModule "net/url"
"fmt"
"strings"
"strconv"
"regexp"
)... |
// Package search deals with all search queries going to elasticsearch, and
// returning their result
package search
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"github.com/levenlabs/go-llog"
"github.com/levenlabs/thumper/config"
)
// Hit describes one of the documents matched by a... |
// Copyright 2016 Hajime Hoshi
//
// 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 hashstructure
import (
"encoding/binary"
"fmt"
"hash"
"hash/fnv"
"reflect"
"time"
)
// ErrNotStringer is returned when there's an error with hash:"string"
type ErrNotStringer struct {
Field string
}
// Error implements error for ErrNotStringer
func (ens *ErrNotStringer) Error() string {
return fmt.Sp... |
package git
import (
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
"time"
"golang.org/x/net/context"
)
// LocalMirror creates or updates a mirror of `url` at `gitDir` using `git clone
// --mirror`.
func LocalMirror(url, gitDir, ref string, timeout time.Duration, messages io.Writer) error {
c... |
package git
/*
#include <git2.h>
#include <git2/sys/openssl.h>
#cgo pkg-config: libgit2
*/
import "C"
import (
"bytes"
"encoding/hex"
"errors"
"runtime"
"strings"
"unsafe"
)
type ErrorClass int
const (
ErrClassNone ErrorClass = C.GITERR_NONE
ErrClassNoMemory ErrorClass = C.GITERR_NOMEMORY
ErrClassOs... |
package git
/*
#include <git2.h>
#include <git2/sys/openssl.h>
#cgo pkg-config: libgit2
#if LIBGIT2_VER_MAJOR != 0 || LIBGIT2_VER_MINOR != 24
# error "Invalid libgit2 version; this git2go supports libgit2 v0.24"
#endif
*/
import "C"
import (
"bytes"
"encoding/hex"
"errors"
"runtime"
"strings"
"unsafe"
)
type ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.