text stringlengths 3.08k 10.4k |
|---|
package raptor
import (
"bytes"
"fmt"
"net/http"
"strconv"
"strings"
"time"
json "encoding/json"
"github.com/si3nloong/raptor/validator"
"github.com/valyala/fasthttp"
)
// Context :
type Context struct {
*fasthttp.RequestCtx
}
// QueryString :
func (c *Context) QueryString() string {
buf := new(bytes.Bu... |
package token
import (
"fmt"
"strings"
"github.com/kujirahand/nadesiko3go/core"
)
// TType : Token Type
type TType string
// Token : トークン定義
type Token struct {
Type TType
Literal string
Josi string
FileInfo core.TFileInfo
}
// Tokens : トークンのスライス
type Tokens []*Token
const (
//__BEGIN_TOKEN__
UNK... |
// package errors provides error handling primitives in a request context.
//
// Adding request information
//
// var ctx context.Context
// var req *http.Request
// ctx = errors.WithRequest(ctx, req)
//
// Adding contextual information
//
// ctx = errors.WithInfo(ctx, "X-Request-ID", "123")
//
// Creat... |
package main
import (
"errors"
"flag"
"fmt"
"math"
"sort"
"strconv"
"time"
)
// soal 1
func cetakKalimat(kalimat string, tahun int) {
fmt.Println("SOAL KE-1")
fmt.Println(kalimat, tahun)
}
// soal 2
func runKelilingSegitigaSamaSisi() {
result := recover()
if result != nil {
fmt.Println("Panic soal 2")
... |
package dingo
import (
"errors"
"time"
)
var ResultError = struct {
// the report channel returned from 'dingo' is nil
NoChannel error
// timeout
Timeout error
// the report channel is closed
ChannelClosed error
// there is no handler registered, shouldn't call .Then()
NoHandler error
}{
errors.New("channe... |
package mongodal
import (
"gopkg.in/mgo.v2"
)
// MgoSessionDAL contains mongoDB collection utility
type MgoSessionDAL interface {
DB(db string) MgoDBDAL
}
// MgoDBDAL contains mongo DB collection utility
type MgoDBDAL interface {
C(collection string) MgoCollectionDAL
}
// MgoCollectionDAL contains mgo Collection... |
/*
* Copyright (c) 2018 XLAB d.o.o
*
* 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... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package cloudformation
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
// The input for the ListChangeSets action.
type ListChangeSetsInput struct {
_ struct{} `type:"structure"`
// A s... |
package main
import (
"bytes"
"context"
cryptorand "crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"math/big"
"os"
"time"
log "github.com/sirupsen/logrus"
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io... |
/*
Sniperkit-Bot
- Status: analyzed
*/
// Copyright 2015-2016, Cyrill @ Sch<EMAIL> and the CoreStore 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.apa... |
/*
* 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 (
"context"
"flag"
"fmt"
"os"
"strconv"
"github.com/pkg/errors"
"github.com/gilcrest/go-api-basic/datastore"
"github.com/gilcrest/go-api-basic/domain/errs"
"github.com/gilcrest/go-api-basic/domain/logger"
"github.com/rs/zerolog"
)
// cliFlags are the command line flags parsed at start... |
package config
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"runtime"
"testing"
"github.com/99designs/gqlgen/codegen/config"
"github.com/stretchr/testify/require"
)
func TestLoadConfig(t *testing.T) {
t.Parallel()
t.Run("config does not exist", func(t *testing.T) {
... |
// Copyright 2021 <NAME> University. All Rights Reserved.
// Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information.
package structs
import (
"fmt"
"sort"
)
// Account holds the info on an identity account
type Account struct {
Usernames []string
Password string
R... |
package dataset_test
import (
"fmt"
"log"
"testing"
"time"
"github.com/m-lab/annotation-service/handler/dataset"
"github.com/m-lab/annotation-service/handler/geoip"
check "gopkg.in/check.v1"
)
func TestExtractDateFromFilename(t *testing.T) {
date, err := dataset.ExtractDateFromFilename("Maxmind/2017/05/08/20... |
package main
import (
"context"
"crypto/tls"
"fmt"
"io/ioutil"
"net/http"
"strings"
"time"
"github.com/adevinta/vulcan-check-sdk"
"github.com/adevinta/vulcan-check-sdk/state"
"github.com/adevinta/vulcan-report"
"github.com/sirupsen/logrus"
)
var (
checkName = "vulcan-exposed-files"
logger = check.New... |
// Copyright © 2020 <NAME> <<EMAIL>>
//
// 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 koala
import (
"time"
"github.com/lindsaygelle/nook"
"github.com/lindsaygelle/nook/animal"
"github.com/lindsaygelle/nook/character"
"github.com/lindsaygelle/nook/gender"
"github.com/lindsaygelle/nook/personality"
"golang.org/x/text/language"
)
var (
lymanBirthday = nook.Birthday{
Day: 12,
Month... |
package config
import (
"errors"
"strconv"
"strings"
"time"
"unicode"
)
// Config represents BOAST's configuration.
// It contains the structs for each configuration section and is used to unmarshal the
// TOML configuration file.
type Config struct {
API APIConfig `toml:"api"`
HTTPRcv HTTPRcvConfig `t... |
package ftpgo
import (
"bufio"
"errors"
"os"
"path"
"path/filepath"
"strconv"
"strings"
"time"
)
//FileMatchList dir search
func FileMatchList(dir string, regexp string) (matches []string) {
files, _ := filepath.Glob(dir + "/" + regexp)
return files
}
//ReadFileList get row data list
func ReadFileList(file... |
// (c) Copyright 2016 Hewlett Packard Enterprise Development LP
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required ... |
package service
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
"github.com/dgrijalva/jwt-go"
"github.com/jinzhu/gorm"
"github.com/mitchellh/mapstructure"
"github.com/tektoncd/hub/api/pkg/app"
"github.com/tektoncd/hub/api/pkg/db/model"
"go.uber.org/zap"
)
// User Service
ty... |
// Copyright © 2020-present <EMAIL> All rights reserved.
// Distributed under the terms and conditions of the BSD License.
// See accompanying files LICENSE.
package packet
import (
"fmt"
"google.golang.org/protobuf/proto"
"qchen.fun/fatchoy"
)
// Packet表示一个应用层消息
type Packet struct {
Cmd int32 ... |
//
// Copyright © 2016 <NAME> <<EMAIL>>
//
// 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"
"strings"
"time"
"github.com/gobwas/glob"
"github.com/hyperpilotio/node-agent/pkg/analyzer"
"github.com/hyperpilotio/node-agent/pkg/collector"
"github.com/hyperpilotio/node-agent/pkg/common"
"github.com/hyperpilotio/node-agent/pkg/processor"
"github.com/hyperpilotio/node... |
package g2db
import (
"encoding/json"
"fmt"
"reflect"
"strings"
"time"
"github.com/atcharles/gof/v2/g2cache/store"
"github.com/novalagung/gubrak/v2"
"github.com/unknwon/com"
"github.com/atcharles/gof/v2/g2util"
)
var cacheNULL = "null"
type cacheMem struct {
Logger g2util.LevelLogger `inject:""`
Cache ... |
package quill
import (
"bytes"
"io/ioutil"
"strconv"
"testing"
)
func TestSimple(t *testing.T) {
cases := map[string]struct {
ops string
want string
}{
"empty": {
ops: `[{"insert": "\n"}]`,
want: "<p><br></p>",
},
"two paragraphs (single op)": {
ops: `[{"insert": "line1\nline2\n"}]`,
w... |
// Copyright 2018 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 mutcask
import (
"context"
"fmt"
"hash/crc32"
"os"
"path/filepath"
"sync"
"github.com/filedag-project/filedag-storage/kv"
fslock "github.com/ipfs/go-fs-lock"
"golang.org/x/xerrors"
)
const lockFileName = "repo.lock"
var _ kv.KVDB = (*mutcask)(nil)
type mutcask struct {
sync.Mutex
cfg ... |
package jab
import (
"encoding/xml"
"github.com/emgee/go-xmpp/src/xmpp"
"github.com/trasa/jabmud/world"
"log"
)
// Deal with an incoming Presence message, returning a presence
// message suitable to be returned to the client.
func HandlePresence(presence *xmpp.Presence) (response interface{}) {
log.Printf("pres:... |
package chow
import (
"bytes"
"encoding/json"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"strings"
"syscall"
)
var placeholders map[string]io.WriteCloser
// stepLog describes a step invocation.
//
// This is logged to the console in production and serialized into an
// expectation file when testing.
type ste... |
// Copyright (c) 2020 <NAME> (<EMAIL>)
// This package is licensed under a MIT license that can be found in the LICENSE file.
// Package splice wraps the splice system call.
package splice
import (
"errors"
"io"
"net"
"runtime"
"sync"
"sync/atomic"
"syscall"
"time"
)
const (
idleTime = time.Seco... |
package brbundle_test
import (
"net/http/httptest"
"os"
"path/filepath"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"go.pyspa.org/brbundle"
"go.pyspa.org/brbundle/brhttp"
)
func initServer(rootPath string) *httptest.Server {
r := brbundle.NewRepository()
r.RegisterFolder(rootPath)
return http... |
package hls
import (
"bytes"
"errors"
"fmt"
"io"
"log"
"os/exec"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
)
// ErrNoAudioInQueue is an error stating that there are no more audio to stream in the queue
var ErrNoAudioInQueue = errors.New("no audio in queue")
const (
// DefaultEncoding is the defau... |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package compute
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Get a Compute Instance Group within GCE.
// For ... |
package utils
import (
"math"
"math/rand"
"sort"
"time"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
//Gaussian returns the gaussien at zero
func Gaussian(mean float64, std float64) float64 {
return mean + std*gauassian()
}
func gauassian() float64 {
//Polar method
var x, y, z float64
for z >= 1 || ... |
package unifi
import (
"fmt"
"strings"
)
// GetClients returns a response full of clients' data from the UniFi Controller.
func (u *Unifi) GetClients(sites []*Site) ([]*Client, error) {
data := make([]*Client, 0)
for _, site := range sites {
var response struct {
Data []*Client `json:"data"`
}
u.DebugL... |
// Copyright (c) 2020 twihike. All rights reserved.
// Use of this source code is governed by a MIT license
// that can be found in the LICENSE file.
package geo
import (
"math"
"strings"
)
const (
// MinLatitude is minimum latitude. Avoiding singularity at the poles.
MinLatitude = -85.05112878
// MaxLatitude i... |
// Code generated by smithy-go-codegen DO NOT EDIT.
package iotsitewise
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/iotsitewise/types"
smithy "github.com/awslabs/smithy-go"
"github.com/aw... |
package admission
import (
"fmt"
"github.com/openshift/generic-admission-server/pkg/cmd"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/api/core/v1"
"github.com/anchore/kubernetes-admission-controller/cmd/kubernetes-admission-controller/validation"
k8s "k8s.io/client-go/kubernetes"
"github.com/a... |
package tgbotbase
import (
"log"
"math"
"sort"
"time"
)
// Cron interface declares interfaces for communication with some cron daemon
type Cron interface {
AddJob(when time.Time, job CronJob)
}
// CronJob provides a piece of work which should be done once its time has come
type CronJob interface {
Do(scheduled... |
package main
import (
"context"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"runtime"
"strings"
"time"
"github.com/alecthomas/kong"
jsoniter "github.com/json-iterator/go"
"github.com/willabides/gharchive-client"
"golang.org/x/text/language"
"golang.org/x/text/message"
)
var cli struct {
Start string ... |
package main
import (
"context"
"encoding/json"
"errors"
"flag"
"fmt"
_ "image/jpeg"
"image/png"
_ "image/png"
"io/ioutil"
"net/http"
"os"
"os/signal"
"time"
"github.com/inconshreveable/log15"
"github.com/julienschmidt/httprouter"
"github.com/rs/cors"
"github.com/urfave/negroni"
)
// main is tasked ... |
package tags
import (
"testing"
"github.com/ProtonMail/go-crypto/openpgp/packet"
"github.com/spiegel-im-spiegel/gpgpdump/parse/context"
"github.com/spiegel-im-spiegel/gpgpdump/parse/reader"
"github.com/spiegel-im-spiegel/gpgpdump/parse/values"
)
var (
tag11Body1 = []byte{0x62, 0x00, 0x5a, 0x19, 0x0d, 0xe4, 0x4... |
// Package referral ...
package referral
import (
"context"
"fmt"
"strconv"
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
log "github.com/sirupsen/logrus"
tokentypes "github.com/Decentr-net/decentr/x/token/types"
"github.com/Decentr-net/vulcan/internal/blockchain"
"github.com/Decentr-net/vulcan/internal/... |
// Copyright 2018 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 writ... |
package cmd
import (
"fmt"
"errors"
"github.com/mikaelm1/pirate/data"
"github.com/spf13/cobra"
)
var (
listDropletsFlag bool
getSingleDroplet int
//create droplet vairables
dropletName string
regionName string
dropletSize string
imageName string
backupsEnabled bool
sshKey []strin... |
package main
import (
"errors"
"flag"
"io/ioutil"
"net/http"
"os"
"strings"
"time"
"github.com/eiannone/keyboard"
"github.com/fatih/color"
)
const (
maxLineLength = 70
textStorageFilename = "typing.txt"
fetchFrom = "https://raw.githubusercontent.com/nvol/typing/master/" +
textStorageFil... |
package gotd
import (
"io"
"net/http"
"net/url"
"strconv"
"time"
"github.com/pkg/errors"
)
// NewPriceHistoryService https://developer.tdameritrade.com/price-history/apis
// Historical price data for charts
func NewPriceHistoryService(s *Service) *PriceHistoryService {
rs := &PriceHistoryService{s: s}
return... |
package adventlang
import (
"github.com/alecthomas/participle/v2"
"github.com/alecthomas/participle/v2/lexer"
)
type Program struct {
Pos lexer.Position
Statements []*Statement `@@*`
}
type Statement struct {
Pos lexer.Position
If *IfStatement `@@`
For *ForStatement `| @@`
While *WhileStatement `... |
package undonut
import (
"fmt"
"io"
)
// ExitOption maps to DONUT_OPT_EXIT_*
type ExitOption int32
const (
ExitOptionThread ExitOption = 1
ExitOptionProcess ExitOption = 2
)
func (e ExitOption) String() string {
switch e {
case ExitOptionThread:
return "EXIT_OPTION_THREAD"
case ExitOptionProcess:
return... |
package path
import (
"container/heap"
"sync"
"github.com/erinpentecost/hex"
)
type aStarInfo struct {
// parent is the hex we moved from to get to this hex.
// This forms a linked list pointing all the way back to `from`.
parent hex.Hex
// cost is the total value from `from` to this hex.
cost int
}
// unwi... |
package ui
import (
"math"
"github.com/jakubDoka/mlok/ggl/pck"
"github.com/jakubDoka/mlok/ggl/txt"
"github.com/jakubDoka/mlok/load"
"github.com/jakubDoka/mlok/mat"
"github.com/jakubDoka/goml/goss"
)
// Assets contains all data that is important for ui elements
type Assets struct {
// spritesheet that scene w... |
package main
import (
"context"
"fmt"
"net/http"
"os"
"os/signal"
"strconv"
"syscall"
"time"
cmneo4j "github.com/Financial-Times/cm-neo4j-driver"
fthealth "github.com/Financial-Times/go-fthealth/v1_1"
logger "github.com/Financial-Times/go-logger/v2"
"github.com/Financial-Times/http-handlers-go/v2/httphand... |
package dag
import (
"container/list"
"context"
"fmt"
"sync"
"github.com/gohornet/hornet/pkg/common"
"github.com/gohornet/hornet/pkg/model/hornet"
"github.com/iotaledger/hive.go/contextutils"
)
type ParentsTraverserInterface interface {
Traverse(ctx context.Context, parents hornet.MessageIDs, condition Predi... |
package imagedriver
import (
"context"
"github.com/rs/zerolog"
"github.com/everpeace/csi-driver-stager/pkg/stager/image"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/pkg/errors"
zlog "github.com/rs/zerolog/log"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
var _ ... |
package spotifyservice
import (
"context"
"encoding/json"
"fmt"
"html/template"
"log"
"net/http"
"strings"
"github.com/go-chi/chi"
"github.com/schairez/spotifywork/internal"
"github.com/schairez/spotifywork/spotifyservice/spotifyapi"
)
var templates = template.Must(template.ParseGlob("templates/*"))
func ... |
/*
* Copyright 2022 The Furiko 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 The Serulian 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 formatter
import (
"github.com/serulian/compiler/sourceshape"
)
// emitVariable emits the specified variable.
func (sf *sourceFormatter) emitVa... |
package main
import (
"flag"
"fmt"
"os"
"regexp"
"strings"
"github.com/ryanuber/columnize"
"encoding/csv"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi"
)
// A Resource to export on ... |
package instana
import (
"bufio"
"fmt"
"net"
"os"
"os/exec"
"regexp"
"strconv"
"time"
f "github.com/looplab/fsm"
)
const (
eInit = "init"
eLookup = "lookup"
eAnnounce = "announce"
eTest = "test"
retryPeriod = 30 * 1000
maximumRetries = 2
)
type fsmS struct {
agent *agentS
fsm *f... |
// Copyright (c) 2019 Siemens AG
//
// 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, modify, merge, publish, di... |
/*
* Copyright (c) 2019 The Gonm Author
*
* File for transaction
*/
package gonm
import (
"context"
"fmt"
"reflect"
"cloud.google.com/go/datastore"
"golang.org/x/sync/errgroup"
)
// Transaction is Transaction mode of Gonm
type Transaction struct {
Transaction *datastore.Transaction
Context context.Co... |
// Code generated by go-swagger; DO NOT EDIT.
package webhooks
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com... |
/*
Copyright 2016 The Rook 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 agreed to ... |
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package ec2
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource Type definition for AWS::EC2::VPCCidrBl... |
package propertycost
import (
"errors"
"math"
)
//DownPayment describes a down payment and
//its assocciated costs.
//AmountInHand - how much money you have to pay down on the price of the house
//RequiredPercentage - The percentage of property cost that needs to be a down payment
//Rent(decimal form) - The rent on... |
package configinfo
import (
"encoding/json"
"io"
"os"
"github.com/SyntropyNet/syntropy-agent/agent/docker"
"github.com/SyntropyNet/syntropy-agent/agent/mole"
"github.com/SyntropyNet/syntropy-agent/agent/swireguard"
"github.com/SyntropyNet/syntropy-agent/agent/common"
"github.com/SyntropyNet/syntropy-agent/in... |
package main
import (
"encoding/json"
"fmt"
"log"
"os"
"strings"
"github.com/davecgh/go-spew/spew"
"github.com/itchio/damage"
"github.com/itchio/damage/hdiutil"
"github.com/itchio/wharf/state"
"gopkg.in/alecthomas/kingpin.v2"
)
var (
app = kingpin.New("damage", "Your devilish little DMG helper")
ver... |
/*
Onix Config Manager - Onix Db Manager- Onix Database Manager
Copyright (c) 2018-2020 by www.gatblau.org
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licens... |
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// Giorgis (<EMAIL>)
// Corbatto (<EMAIL>)
package avcodec
//#cgo CFLAGS: -Wno-deprecated-declarations
//#cgo pkg-config: libavcodec
//#include <libavcodec/avcodec.h>
import "C"
import (
"unsafe"
)
// Init initializes opt... |
// main_test.go
// joadavis Nov 2020
/*
Please set up environment first
export WORST_DB_USERNAME=postgres
export WORST_DB_PASSWORD=<PASSWORD>
export WORST_DB_NAME=test_worst
Then spin up a postgres instance with
sudo docker run -it --name test-pg -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres
And manually t... |
package gas
import (
"net/http/httptest"
"strconv"
"testing"
"ktkr.us/pkg/gas/testutil"
)
func mapeq(m1, m2 map[string]string) bool {
if len(m1) != len(m2) {
return false
}
for k, v := range m1 {
if m2[k] != v {
return false
}
}
return true
}
type Test struct {
pat string
url string
val... |
package go_faas
import (
"time"
)
// HTTP Request
type QueryParams map[string]string
type FaasRequestDefinition struct {
// Method can be GET/PUT/POST/PATCH/DELETE
Method string
// This is the address of OpenFaas gateway you get e.g. http://127.0.0.1:8080
GatewayAddress string
// Path of the API being called e... |
// Command deploy is a Gengo-specific deployment script which can be invoked by Goship.
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/coreos/go-etcd/etcd"
gsconfig "github.com/gengo/goship/lib/config"
"github.com/golang/glog"
yam... |
package rpcd
import (
"encoding/gob"
"errors"
"fmt"
"io"
"time"
imgclient "github.com/Symantec/Dominator/imageserver/client"
"github.com/Symantec/Dominator/lib/format"
"github.com/Symantec/Dominator/lib/image"
"github.com/Symantec/Dominator/lib/log"
"github.com/Symantec/Dominator/lib/log/prefixlogger"
obje... |
// Code generated by go-swagger; DO NOT EDIT.
package governance
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-open... |
package jzip
import (
"strings"
)
// NewNormalize Normalizeを初期化する関数
func NewNormalize() *Normalize {
return &Normalize{}
}
// Normalize Normalizeの構造体
type Normalize struct {
join string
}
// Add CSVの1行を受け取り、加工を行い、スライスで返す
func (n *Normalize) Add(record []string) [][]string {
if n.join != "" {
record[8] = n.joi... |
package server
import (
"encoding/json"
"net/http"
"sort"
"strings"
"github.com/zlogic/vogon-go/data"
"github.com/zlogic/vogon-go/server/auth"
)
// getCurrency returns the currency for component.
func getCurrency(component data.TransactionComponent, accounts []*data.Account) string {
for _, account := range a... |
package main
import (
"crypto/tls"
"flag"
"fmt"
"net"
"net/http"
"net/url"
"os"
"strings"
"time"
log "github.com/Sirupsen/logrus"
"github.com/uninett/goidc-proxy/conf"
)
var startTime time.Time
var xhrEndpoints []string
const defaultVersion = "0.1"
func init() {
// Log as JSON to stderr
log.SetFormatt... |
// Package goublu Completion does partial completion
package goublu
import (
// "fmt"
"strings"
)
// type Dashes []string
// Completor has map[string] of Dash-Commands keyed by Ublu keywords and an
// array of the last set of candidate completions and the index of the last
// one tried
type Completor struct {
CMa... |
package apiclient
import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
"github.com/MindsightCo/collector/cache"
gomock "github.com/golang/mock/gomock"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
prommodel "github.com/prometheus/common/model"
)
var epoch = pr... |
// Package types defines the different objects used in logol (grammar, match, etc.)
package types
import (
"log"
"strconv"
"strings"
logs "github.com/osallou/logol-go-playground/lib/log"
"gopkg.in/yaml.v2"
)
var logger = logs.GetLogger("logol.types")
type Morphism struct {
Morph map[string][]string
}
type Pa... |
package main
import (
"fmt"
)
var board [6][6]Tower
var freetowers []Tower = initializeFreetowers()
/*
var board_height = [6][6]int{
{0, 3, 4, 2, 1, 5},
{2, 1, 5, 0, 3, 4},
{5, 4, 2, 3, 0, 1},
{4, 0, 3, 1, 5, 2},
{3, 5, 1, 4, 2, 0},
{1, 2, 0, 5, 4, 3},
}
*/
// tricky tricky puzzle maker
var board_height = ... |
package scrapy
import (
"os"
"os/signal"
"syscall"
"time"
"github.com/Shopify/sarama"
go_utils "github.com/Genesis-Palace/go-utils"
"github.com/go-redis/redis"
"github.com/nsqio/go-nsq"
)
var (
Stop = make(chan os.Signal, 1)
)
func init() {
signal.Notify(Stop, syscall.SIGINT, syscall.SIGTERM, syscall.SIG... |
// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved.
// See License for license information.
package solarlottery
import (
"fmt"
"math/rand"
"sort"
"github.com/mattermost/mattermost-plugin-solar-lottery/server/sl"
"github.com/mattermost/mattermost-plugin-solar-lottery/server/utils/bot"
"github.c... |
package onlinedp
import (
"fmt"
"log"
"strings"
"github.com/TopoSimplify/db"
"github.com/TopoSimplify/ctx"
"github.com/TopoSimplify/rng"
"github.com/TopoSimplify/streamdp/common"
"github.com/intdxdt/geom"
"github.com/paulmach/go.geojson"
)
type NeighbQ struct {
ID, I, J, FID, Snap int
NodeTable s... |
package main
import (
"bytes"
"errors"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
"github.com/cszatmary/publisher/internal/file"
"github.com/cszatmary/publisher/internal/git"
"github.com/cszatmary/publisher/internal/log"
"github.com/sc-lang/go-sc"
flag "github.com/spf13/pflag"
)
type config s... |
/*
* Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net)
* Copyright 2020-present Open Networking Foundation
* 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://w... |
package ns_x
import (
"github.com/bytedance/ns-x/v2/base"
"reflect"
"strconv"
"strings"
)
// Builder is a convenience tool to describe the whole network and build
// when a node is described for the first time, a unique id is assigned to it, which will be the index of node in the built network
type Builder interf... |
package abc
type ABCFile struct {
Minor uint16
Major uint16 // Major 46 supported
Constants ConstantPool
Methods []MethodInfo
Metadata []MetadataInfo
Instances []InstanceInfo
Classes []ClassInfo
Scripts []ScriptInfo
MethodBodies []MethodBodyInfo
}
// Each slice holds an additional d... |
/*
* Copyright (c) 2008-2022, Hazelcast, 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 b... |
package scanner
import (
"unicode"
"unicode/utf8"
"github.com/batiazinga/hdl/iohdl/internal/token"
)
const (
eof = -1
)
// Scanner can scan a source text to extract its tokens.
type Scanner struct {
// input file
filename string
src []byte
// current rune and its width and position
// line and column... |
package main
import (
"crypto/sha256"
"encoding/json"
"fmt"
"github.com/ghodss/yaml"
"github.com/golang/glog"
"github.com/ibm-garage-cloud/webhook-image-rewrite/cmd/configmanager"
"github.com/ibm-garage-cloud/webhook-image-rewrite/cmd/model"
"io/ioutil"
"k8s.io/api/admission/v1beta1"
admissionregistrationv1b... |
package persi_acceptance_tests_test
import (
"encoding/json"
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
"testing"
"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
"github.com/cloudfoundry-incubator/cf-test-helpers/help... |
package main
import (
"context"
"crypto/tls"
"fmt"
"io"
"net"
"net/http"
"os"
"os/signal"
"syscall"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/soheilhy/cmux"
"golang.org/x/sync/errgroup"
"google.golang.org/grpc/transport"
"gopkg.in/gemnasium/logrus-graylog-hook.v2"
"github.com/L... |
/* Copyright 2019 Comcast Cable Communications Management, 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 ... |
// Copyright (c) 2020-2021 Doc.ai and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// 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/license... |
package empire
import (
"errors"
"fmt"
"regexp"
"strings"
"time"
"github.com/jinzhu/gorm"
"github.com/remind101/empire/pkg/service"
"github.com/remind101/pkg/timex"
"golang.org/x/net/context"
)
const (
ExposePrivate = "private"
ExposePublic = "public"
)
var (
// ErrInvalidName is used to indicate that ... |
/*
Copyright 2021-2022 The Volcano 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.