text stringlengths 11 4.05M |
|---|
//************************************************************************//
// RightScale API client
//
// Generated with:
// $ praxisgen -metadata=ca/cac/docs/api -output=ca/cac -pkg=cac -target=1.0 -client=API
//
// The content of this file is auto-generated, DO NOT MODIFY
//*********************... |
package dto
type FindUserDto struct {
Email string `json:"email"`
Username string `json:"usernameOrId"`
IsSubscribed bool `json:"isSubscribed"`
Role int `json:"role"`
}
|
package main
import (
"testing"
"github.com/jackytck/projecteuler/tools"
)
func TestP108(t *testing.T) {
cases := []tools.TestCase{
{In: 2, Out: 4},
{In: 1000, Out: 180180},
}
tools.TestIntInt(t, cases, solve, "P108")
}
|
package work
import (
"log"
"time"
)
func createMonitor(monitorType string) Monitor {
switch monitorType {
case "cpu":
return &Cpu{}
case "disk":
return &Disk{}
case "free":
log.Println(111)
return &Disk{}
case "uptime":
return nil
default:
log.Println("不受支持的监控类型")
return nil
}
}
func Run(moni... |
// Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0.
package gluetidb
import (
"bytes"
"context"
"strings"
"time"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/tidb/br/pkg/glue"
"github.com/pingcap/tidb/br/pkg/gluetikv"
"github.com/pingcap/tidb/br/pkg/logutil"
"github.com/p... |
package runner
// This file defines an interface for task queues used by the runner
import (
"context"
"os"
"regexp"
"strings"
"time"
"github.com/go-stack/stack"
"github.com/karlmutch/errors"
)
// convert types take an int and return a string value.
type MsgHandler func(ctx context.Context, project string, su... |
package RegularExpressions
import (
"fmt"
"testing"
)
func TestTask4(t *testing.T) {
// syntax abstract tree of this regular expression: (a(|b))*
regularTree := Repeat{Pattern: Concatenate{
Left: Literal{Character: 'a'},
Right: Choose{
Left: Empty{},
Right: Literal{Character: 'b'},
},
}}
handler :... |
package main
import (
"net"
"time"
)
func main() {
conn := getConn() //建立连接
for {
_, err := conn.Write([]byte("Hello World!")) //向服务端发数据
if err != nil { //发送数据出错就重新建立连接
conn = getConn()
}
time.Sleep(10 * time.Second) //睡眠10秒
}
}
func getConn() net.Conn {
for {
conn, er... |
package ginja
import (
"errors"
"os"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestError(t *testing.T) {
Convey("Error implements Error interface", t, func() {
err := Error{Title: "Test error"}
So(err, ShouldImplement, (*error)(nil))
So(err.Error(), ShouldNotBeBlank)
So(err.Error(),... |
package controllers
import (
"alta-store/lib/database"
"alta-store/models"
"net/http"
"strconv"
"github.com/labstack/echo"
)
func GetProductsController(c echo.Context) error {
products, err := database.GetProducts()
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, err.Error())
}
return c.JS... |
// Package handlers contains the request handler functions.
package handlers
import "github.com/spazbite187/sensornet/app"
// Data ...
type Data struct {
Data *app.Data
}
|
package rsync
import (
"github.com/cpusoft/goutil/belogs"
"github.com/cpusoft/goutil/ginserver"
"github.com/gin-gonic/gin"
model "rpstir2-model"
)
// start to rsync from sync
func RsyncRequest(c *gin.Context) {
belogs.Debug("RsyncRequest(): start")
syncUrls := model.SyncUrls{}
err := c.ShouldBindJSON(&syncUrl... |
package nsnet
import (
"fmt"
"net"
"time"
)
// network interface check
// waits for netsetgo to creates tunneling between host and container
func WaitForNetwork() error {
maxAttempt := 3
checkInterval := time.Second
for i := 0; i < maxAttempt; i++ {
interfaces, err := net.Interfaces()
if err != nil {
re... |
//+build linux,arm
package main
import (
"fmt"
"time"
"github.com/zyxar/berry/core"
"github.com/zyxar/berry/device/ds1307"
)
var (
clock *ds1307.Clock
addrid uint = 0x68
busid uint = 0x01
)
func initClock() (err error) {
clock, err = ds1307.New(addrid, busid)
return
}
func clockRoutine() {
if clock !=... |
package validation
import "errors"
// Verror is an error that occurs
// during validation, we can
// return this to a user
type Verror struct {
error
}
// Payload is the value we
// process
type Payload struct {
Name string `json:"name"`
Age int `json:"age"`
}
// ValidatePayload is 1 implementation of
// the... |
package runners
import (
"errors"
"fmt"
"time"
"github.com/hyperpilotio/go-utils/log"
"github.com/hyperpilotio/workload-profiler/clients"
"github.com/hyperpilotio/workload-profiler/db"
"github.com/hyperpilotio/workload-profiler/jobs"
"github.com/hyperpilotio/workload-profiler/models"
)
type ProfileRun struct... |
/*
Copyright 2020 The Qmgo 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, sof... |
package trie
import (
"testing"
"github.com/google/btree"
"github.com/openacid/low/mathext/zipf"
)
type KVElt struct {
Key string
Val int32
}
func (kv *KVElt) Less(than btree.Item) bool {
o := than.(*KVElt)
return kv.Key < o.Key
}
func makeKVElts(srcKeys []string, srcVals []int32) []*KVElt {
elts := make([... |
package pain
import (
"encoding/xml"
"github.com/thought-machine/finance-messaging/iso20022"
)
type Document00800101 struct {
XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:pain.008.001.01 Document"`
Message *CustomerDirectDebitInitiationV01 `xml:"pain.008.001.01"`
}
func (d *Doc... |
package gannettApi
import (
"fmt"
"net/url"
)
// Use for querying for the list of articles
var GannettApiSearchRoot = "http://api.gannett-cdn.com/prod/Search/v4/assets/proxy"
// Use for getting the article content
var GannettApiPresentationRoot = "http://api.gannett-cdn.com/presentation/v4/assets"
/*
Get default... |
package utils
import (
"KServer/library/kiface/iutils"
"encoding/json"
"github.com/golang/protobuf/proto"
)
type ByteTool struct {
*Protobuf
Data []byte
}
func NewIByte() iutils.IByte {
return &ByteTool{}
}
func (b *ByteTool) ProtoBuf(value proto.Message) error {
return b.Protobuf.Decode(b.Data, value)
}
func... |
package main
import (
"html/template"
"net/http"
"github.com/satori/go.uuid"
)
var t *template.Template
func init(){
t=template.Must(template.ParseFiles("96files.gohtml"))
}
func main() {
http.HandleFunc("/",index)
http.Handle("/favicon.ico",http.NotFoundHandler())
http.ListenAndServe(":8080",nil)
}
func ... |
package server
import (
"encoding/json"
"errors"
"fmt"
"github.com/idena-network/idena-indexer/log"
"net/http"
"strconv"
)
type Response struct {
Result interface{} `json:"result,omitempty"`
Error *RespError `json:"error,omitempty"`
}
type RespError struct {
Message string `json:"message"`
}
func WriteEr... |
// Copyright © 2017 NAME HERE <EMAIL ADDRESS>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law ... |
package phases
import (
"mobingi/ocean/pkg/config"
configstorage "mobingi/ocean/pkg/storage"
)
func Init(cfg *config.Config) (configstorage.Cluster, error) {
storage := configstorage.NewStorage()
err := storage.Init(cfg)
if err != nil {
return nil, err
}
return storage, nil
}
|
package client
import (
"net/http"
"github.com/go-osin/session"
)
// TODO: deprecated with cookie
const (
SessKeyUser = "user"
SessKeyToken = "token"
)
var (
SessionIDCookieName = "_sess"
)
func init() {
SetupSessionStore(session.NewInMemStore())
}
func SetupSessionStore(store session.Store) {
session.Gl... |
package reporting
import (
"fmt"
"log"
"time"
"github.com/streadway/amqp"
)
type Publisher struct {
channel *amqp.Channel
connexion *amqp.Connection
exchangeName string
routingKey string
}
func (pub *Publisher) Init(params map[string]string) {
var err error
pub.connexion, err = amqp.Dial(params... |
package Plugins
import (
"../Misc"
"../Parse"
"fmt"
"github.com/go-redis/redis"
"strings"
"sync"
"time"
)
func Redis(info Misc.HostInfo, ch chan int, wg *sync.WaitGroup) {
ip := fmt.Sprintf("%s:%d", info.Host, info.Port)
client := redis.NewClient(&redis.Options{
Addr: ip,
Password: info.Password,
D... |
package minnow
import (
"fmt"
"log"
"os"
"sync"
"time"
)
type ProcessorRegistry struct {
definitionsPath Path
processorPools map[ProcessorId]*ProcessorPool
mutex *sync.RWMutex
logger *log.Logger
}
func NewProcessorRegistry(definitionsPath Path) (*ProcessorRegistry, error) {
processorPoo... |
package main
import "flag"
// 标准参数
var (
// 显示版本号
paramVersion = flag.Bool("version", false, "Show version")
// 工作模式
paramMode = flag.String("mode", "v2", "v2")
// 并发导出,提高导出速度, 输出日志会混乱
paramPara = flag.Bool("para", false, "parallel export by your cpu count")
paramLanguage = flag.String("lan", "en_us", "set ... |
package errors
import "net/http"
func ResourceNotFound(err error, w http.ResponseWriter) {
if err != nil {
w.WriteHeader(http.StatusNotFound)
return
}
}
func InternalServerError(err error, w http.ResponseWriter) {
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
} |
package device
// #cgo CFLAGS: -g -Wall
// #cgo LDFLAGS: -lSoapySDR
// #include <stdlib.h>
// #include <stddef.h>
// #include <SoapySDR/Device.h>
// #include <SoapySDR/Formats.h>
// #include <SoapySDR/Types.h>
import "C"
import "unsafe"
// ListSensors gets a list of the available global readable sensors.
//
// Return... |
// +build i2c,!spi
package main
import (
_ "github.com/djthorpe/gopi-hw/sys/i2c"
)
const (
MODULE_NAME = "sensors/bme680/i2c"
)
|
package saucecloud
import (
"archive/zip"
"context"
"os"
"testing"
"time"
"github.com/jarcoal/httpmock"
"github.com/rs/zerolog/log"
"github.com/stretchr/testify/assert"
"github.com/saucelabs/saucectl/internal/config"
"github.com/saucelabs/saucectl/internal/cypress"
"github.com/saucelabs/saucectl/internal/... |
package main
import (
"fmt"
"google.golang.org/grpc"
"log"
"math"
"mid/calc/calcpb"
"net"
)
type Server struct {
calcpb.UnimplementedCalcServiceServer
}
func main() {
l, err := net.Listen("tcp", "0.0.0.0:50051")
if err != nil {
log.Fatalf("Failed to listen:%v", err)
}
s := grpc.NewServer()
calcpb.Regis... |
package apocalisp
import (
"apocalisp/core"
"fmt"
"os"
"path/filepath"
"runtime/debug"
"github.com/peterh/liner"
)
func withLiner(handler func(*liner.State)) {
state := liner.NewLiner()
defer state.Close()
state.SetCtrlCAborts(false)
handler(state)
}
func Repl(eval func(*core.Type, *core.Environment) (*c... |
// Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be use... |
package main
import (
"fmt"
)
const target = 347991
const size = 1001
const half = size / 2
//dir 0 = right 1 = up 2 = left 3 = down
func main() {
var spiral [size][size]int
spiral[half][half] = 1
dir := 3
row,col := half,half
step := 1
found := false
for !found {
for i := 0; i < 2 && !found; i++ {
d... |
package main
import (
"context"
"github.com/signaux-faibles/keycloakUpdater/v2/logger"
"github.com/signaux-faibles/libwekan"
)
type BoardsMembers map[libwekan.BoardSlug]Users
func manageBoardsMembers(wekan libwekan.Wekan, fromConfig Users) error {
fields := logger.DataForMethod("manageBoardsMembers")
// périmèt... |
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"path"
"strings"
)
var source = flag.String("source", "./tsconfig.lib.json", "Source tsconfig json file")
var destination = flag.String("destination", "./tsconfig.lib.json", "Destination tsconfig json file")
var libs = flag.String("libs", "./libs", "the... |
package day18
func IsPalindrome(input string) bool {
stack := Stack{}.NewStack()
queue := Queue{}.NewQueue()
for _, char := range input {
stack.Push(char)
queue.EnQueue(char)
}
for stack.Pop() == queue.DeQueue() && stack.Len()/2 > 0 {
}
return stack.Len()/2 == 0
}
|
package models
import (
orm "go-admin/global"
"go-admin/tools"
)
type Cust struct {
Id int `json:"id" gorm:"type:int;primary_key"` //
SysCode string `json:"sysCode" gorm:"type:varchar(50);"` // 系统编号
CustName string `json:"custName" gorm:"type:varchar(128);"` // 客户名称
SimpleName stri... |
/*
* Copyright (c) 2020. Ant Group. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
package snapshot
import (
"context"
"fmt"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/snapshots"
"github.com/containerd/containerd/snapshots/storage"
"github.com/pkg/errors"
)
t... |
package catm
import (
"encoding/xml"
"github.com/thought-machine/finance-messaging/iso20022"
)
type Document00300105 struct {
XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:catm.003.001.05 Document"`
Message *AcceptorConfigurationUpdateV05 `xml:"AccptrCfgtnUpd"`
}
func (d *Document... |
package sdl2
import (
"fmt"
"io/ioutil"
"github.com/veandco/go-sdl2/mix"
"github.com/evelritual/goose/audio"
)
const (
maxVol = 128
minVol = 0
)
// Player wraps needed methods for the audio.Player interface.
type Player struct {
currVol int
}
// Sound holds SDL chunk data for playback in use with the audio... |
/*
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 fi... |
package server
import "github.com/majgis/htmls/token"
// A section of a HTMLTemplate used for final rendering
type templateSection struct {
htmlToken token.HTMLToken
bytes []byte
ch chan responseChunk
}
|
package mandrill
import (
"log"
"testing"
)
func TestUsersInfo(t *testing.T) {
u := UsersAPI{}
info, err := u.GetInfo("NjixlbCzdB14TazGCnYyEQ")
if err != nil {
log.Println("UsersAPI GetInfo Error")
log.Print(err)
}
log.Println("UsersAPI GetInfo Successful")
log.Printf("UsersAPI GetInfo Results: %#v\n\n", ... |
package nut
import (
"time"
"github.com/gin-gonic/gin"
"github.com/go-pg/pg"
)
func (p *AdminPlugin) indexLinks(l string, c *gin.Context) (interface{}, error) {
var items []Link
err := p.DB.Model(&items).
Where("lang = ?", l).
Order("loc ASC").Order("sort_order ASC").Select()
return items, err
}
func (p *... |
package main
import "fmt"
func main() {
a := make([]int, 5)
fmt.Println(a, cap(a), len(a))
b := make([]int, 5, 1000)
fmt.Println(b, len(b), cap(b))
}
|
package main
import (
"fmt"
)
func main() {
p1 := struct {
firstName string
lastName string
}{
firstName: "James",
lastName: "Bond",
}
fmt.Println("p1 :: ", p1)
fmt.Println("Individual Details :: ")
fmt.Println("\t First Name :: ", p1.firstName)
fmt.Prin... |
package tpl
import (
"bytes"
"encoding/xml"
"fmt"
"html/template"
"io/ioutil"
"log"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/anihouse/bot/config"
"github.com/bwmarrin/discordgo"
)
var (
tpls *template.Template
)
func Init() {
tpls = template.New("").Funcs(funcs)
fmt.Println("Loading temp... |
package iris
import (
"bytes"
"net/http"
"net/url"
"strings"
)
// PathParameter is a struct which contains Key and Value, used for named path parameters
type PathParameter struct {
Key string
Value string
}
// PathParameters type for a slice of PathParameter
// Tt's a slice of PathParameter type, because it'... |
package main
import (
"fmt"
"os"
"jvmgo_c/ch8/cmd"
"jvmgo_c/ch8/classpath"
"jvmgo_c/ch8/rtda/heap"
"strings"
"jvmgo_c/ch8/interpreter"
)
func main() {
cmd := cmd.ParseCmd()
if cmd.VersionFlag {
fmt.Println("version 0.0.1")
}else if cmd.HelpFlag {
fmt.Printf("Usage: %s [-option] class [args...]\n",os.Ar... |
package git
import (
"context"
"encoding/json"
"fmt"
"net/http"
"os"
"github.com/google/go-github/v39/github"
"github.com/labstack/echo/v4"
"golang.org/x/oauth2"
)
type (
handler struct {
confPath string
}
Config struct {
Owner string
Repo string
Token string
}
)
func NewHandler(confPath strin... |
package main
import (
"fmt"
)
func obterNota(nota float64) string {
if(nota >= 6) {
return "Aprovado"
}
return "Reprovado"
// return "aprovado" ? nota >= 6 : "reporvado" // Não existe operador ternário igual ao C
}
func main() {
fmt.Println(obterNota(6.2))
} |
package cmd
import (
"fmt"
"log"
cups "github.com/jbpratt78/go-cups"
"github.com/spf13/cobra"
)
var optionsCmd = &cobra.Command{
Use: "options",
Short: "Options from the printer's attribute list",
Run: func(cmd *cobra.Command, args []string) {
if len(args) < 1 {
log.Fatal("not enough args")
}
conn ... |
package main
import (
"log"
"github.com/petar/GoLLRB/llrb"
)
type Num struct {
num int
}
func NewNum(num int) *Num {
return &Num{num: num}
}
func (n *Num) Less(than llrb.Item) bool {
return n.num < than.(*Num).num
}
func Iterator(item llrb.Item) bool {
log.Println("item: ", item)
return true
}
func main()... |
package keys
import (
"github.com/spf13/cobra"
"github.com/foundriesio/fioctl/client"
"github.com/foundriesio/fioctl/subcommands"
)
var (
api *client.Api
)
var cmd = &cobra.Command{
Use: "keys",
Short: "Manage keys in use by your factory fleet",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
... |
/*
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, ... |
package dto
import (
"github.com/d-d-j/ddj_master/common"
"fmt"
)
//Task is internal master structure that is used to match given input with result and control data processing.
//All tasks are managed by TaskManager.
type Task struct {
Id int64
Type int32
AggregationType int32
Data ... |
package triplestore
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/UFOKN/nabu/internal/graph"
)
//BlazeUpdateNQ updates the blaze triple store
func BlazeUpdateNQ(s []byte, sue string) ([]byte, error) {
nt, g, err := graph.NQToNTCtx(string(s))
if err != nil {
log.Printf("nqToNTCtx err: %s t... |
package api_test
import (
"context"
"net/http"
"reflect"
"strings"
"testing"
"github.com/chanioxaris/go-datagovgr/datagovgrtest"
"github.com/jarcoal/httpmock"
)
func TestCrimeJustice_TrafficAccidents_Success(t *testing.T) {
ctx := context.Background()
fixture := datagovgrtest.NewFixture(t)
httpmock.Activa... |
package web
import (
"encoding/json"
"sync"
"github.com/pingcap/errors"
"github.com/pingcap/tidb/br/pkg/lightning/checkpoints"
"github.com/pingcap/tidb/br/pkg/lightning/common"
"github.com/pingcap/tidb/br/pkg/lightning/mydump"
"go.uber.org/atomic"
)
// checkpointsMap is a concurrent map (table name → checkpoi... |
package api
import (
"backend/models"
)
type UseCase interface {
GetObjects(firstNumber, count int) ([]models.Object, error)
} |
// DRUNKWATER TEMPLATE(add description and prototypes)
// Question Title and Description on leetcode.com
// Function Declaration and Function Prototypes on leetcode.com
//17. Letter Combinations of a Phone Number
//Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the num... |
package util
import (
// "fmt"
"sync"
"time"
)
//过期时间 10小时
const Time int64 = 1 //3600 * 10
//动态缓存数据库
var Caches *CacheManager
type CacheManager struct {
lock *sync.RWMutex
caches map[string]*Cache
}
type Cache struct {
Value interface{}
Times int64
}
func Init() {
Caches = NewCacheManager(300)
}
func ... |
package gherkin
import (
"testing"
. "github.com/tychofreeman/go-matchers"
)
type Context struct {
wasCalled bool
firstWasCalled bool
secondWasCalled bool
actionWasCalled bool
secondActionCalled bool
wasGivenRun bool
wasThenRun bool
givenData []map[string]string
thenData []... |
package actions
import (
"errors"
"strings"
"github.com/barrydev/api-3h-shop/src/common/connect"
"github.com/barrydev/api-3h-shop/src/factories"
"github.com/barrydev/api-3h-shop/src/model"
)
func InsertShipping(body *model.BodyShipping) (*model.Shipping, error) {
queryString := ""
var args []interface{}
var... |
/*
Copyright paskal.maksim@gmail.com
Licensed under the Apache License, Version 2.0 (the "License")
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... |
/*
TESTO ESERCIZIO
--------------------
Scrivete un programma che simuli l’ordinazione, la cottura e l’uscita dei piatti
in un ristorante.
10 clienti ordinano contemporaneamente i loro piatti.
In cucina vengono preparati in un massimo di 3 alla volta, essendoci solo 3 fornelli.
Il tempo necessario per preparare ogni ... |
package capi
import (
"fmt"
"github.com/giantswarm/aws-gs-to-capi/giantswarm"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
capiawsv1alpha3 "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha3"
kubeadmapiv1alpha3 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3"
kubeadmtypev1beta1 "... |
package rethinkdb
// To test this rethinkdb integration, run rethinkdb on docker
// docker run -d --name rethinkdb -p 28015:28015 -p 8080:8080 rethinkdb:latest
// If on Mac, find the IP address of the docker host
// $ boot2docker ip
// 192.168.59.103
// For linux it's 127.0.0.1.
// Now you can go to 192.168.59.103:808... |
// Unit tests for default configuration facade.
//
// @author TSS
package facade
import (
"testing"
corefacade "github.com/mashmb/1pass/1pass-core/core/facade"
"github.com/mashmb/1pass/1pass-core/core/service"
"github.com/mashmb/1pass/1pass-core/port/out"
"github.com/mashmb/1pass/1pass-parse/repo/file"
)
func ... |
package data
import (
uuid "github.com/satori/go.uuid"
"golang.org/x/net/websocket"
)
type Character struct {
ID uuid.UUID
Pos Point
Conn *websocket.Conn
Send chan []byte
}
|
package main
/*
* @lc app=leetcode id=24 lang=golang
*
* [24] Swap Nodes in Pairs
*/
/**
* Definition for singly-linked list.
* type ListNode struct {
* Val int
* Next *ListNode
* }
*/
func swapPairs(head *ListNode) *ListNode {
dummy := new(ListNode)
dummy.Next = head
cur := dummy... |
package main
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
func TestBackup_Ok(t *testing.T) {
mockedStorageService := new(mockStorageServie)
mockedWriter := new(mockWriteCloser)
mockedWriter.On("Close").Return(nil)
mockedStorageService.On("Writer", mock.Ma... |
package eod
import (
"encoding/json"
"fmt"
"strings"
"time"
"github.com/Nv7-Github/Nv7Haven/eod/base"
"github.com/Nv7-Github/Nv7Haven/eod/basecmds"
"github.com/Nv7-Github/Nv7Haven/eod/categories"
"github.com/Nv7-Github/Nv7Haven/eod/elements"
"github.com/Nv7-Github/Nv7Haven/eod/logs"
"github.com/Nv7-Github/N... |
package src
import (
"encoding/json"
"net/http"
"github.com/getsentry/sentry-go"
log "github.com/sirupsen/logrus"
)
type GasStationPrice struct {
Id string `json:"id"`
Name string `json:"name"`
Address string `json:"address"`
X_wgs float64 `json:"x_wgs"`
Y_wgs float64 `json:"y_... |
package pilot
import (
"bytes"
"log"
"encoding/json"
"errors"
"net/http"
uuid "github.com/satori/go.uuid"
)
var (
ErrorNoNodes = errors.New("No Nodes registered")
)
// Pilot
type Pilot struct {
UUID string `json:"uuid"`
Nodes []*NodeRegistry `json:"nodes"`
}
func NewPilot() *Pilot {
return &Pil... |
package main
import (
"flag"
"fmt"
"os"
)
type animal interface {
cry()
}
type dog struct {
}
type cat struct {
}
func (d dog) cry() {
fmt.Println("わん!")
}
func (c cat) cry() {
fmt.Println("にゃー")
}
func main() {
var name string
flag.StringVar(&name, "animal", "", "動物名")
flag.Parse()
flag.Usage = func() {
... |
package api
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
type VolumesFromSizeCase struct {
name string
input struct {
rootVolumeSize, targeSize, perVolumeMaxSize uint64
}
output string
}
func TestVolumesFromSize(t *testing.T) {
tests := []VolumesFromSizeCase{
{
name: "200G 200G 2... |
package sync
import (
"os"
"github.com/devspace-cloud/devspace/sync/remote"
"github.com/devspace-cloud/devspace/sync/util"
)
// s.fileIndex needs to be locked before this function is called
func shouldRemoveRemote(relativePath string, s *Sync) bool {
// File / Folder was already deleted from map so event was alr... |
package main
import "github.com/helm/helm/cli"
func main() {
cli.Cli().RunAndExitOnError()
}
|
package main
import "fmt"
func main() {
done := make(chan bool)
values := []string{"a", "b", "c"}
for _, v := range values {
go func() {
fmt.Println(v)
done <- true
}()
}
// wait for all goroutines to complete before exiting
/*
for _ = range values {
<-done
}
*/
for range values {
<-done
... |
package reg
import "testing"
func TestAsMethods(t *testing.T) {
cases := [][2]Register{
{RAX.As8(), AL},
{ECX.As8L(), CL},
{EBX.As8H(), BH},
{R9B.As16(), R9W},
{DH.As32(), EDX},
{R14L.As64(), R14},
{X2.AsX(), X2},
{X4.AsY(), Y4},
{X9.AsZ(), Z9},
{Y2.AsX(), X2},
{Y4.AsY(), Y4},
{Y9.AsZ(), Z9},... |
package controllers
import (
"net/url"
"strconv"
"github.com/cloudreve/Cloudreve/v3/pkg/serializer"
"github.com/cloudreve/Cloudreve/v3/pkg/util"
"github.com/cloudreve/Cloudreve/v3/service/callback"
"github.com/gin-gonic/gin"
)
// RemoteCallback 远程上传回调
func RemoteCallback(c *gin.Context) {
var callbackBody cal... |
package msgpackdiff
import (
"encoding/base64"
"errors"
"io/ioutil"
"github.com/algorand/msgp/msgp"
)
// GetBinary gathers the binary content of a string that represents a MessagePack object. The string
// may be a base64 encoded binary object, or the path to a binary file that contains the object as
// its only... |
// Copyright 2017 PingCAP, 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... |
package rest
import (
"github.com/jinmukeji/jiujiantang-services/pkg/rest"
proto "github.com/jinmukeji/proto/v3/gen/micro/idl/partner/xima/user/v1"
"github.com/kataras/iris/v12"
)
// 注销登录
func (h *webHandler) SignOut(ctx iris.Context) {
req := new(proto.UserSignOutRequest)
req.Ip = ctx.RemoteAddr()
_, err := h.... |
package semt
import (
"encoding/xml"
"github.com/thought-machine/finance-messaging/iso20022"
)
type Document01500101 struct {
XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:semt.015.001.01 Document"`
Message *IntraPositionMovementConfirmationV01 `xml:"IntraPosMvmntConf"`
}
fu... |
package teststore_test
import (
"github.com/igogorek/http-rest-api-go/internal/app/model"
"github.com/igogorek/http-rest-api-go/internal/app/store"
"github.com/igogorek/http-rest-api-go/internal/app/store/teststore"
"github.com/stretchr/testify/assert"
"testing"
)
func TestUserRepository_Create(t *testing.T) {
... |
package commands
import (
// HOFSTADTER_START import
// HOFSTADTER_END import
// custom imports
"fmt"
"github.com/hofstadter-io/examples/blog/server/databases/postgres"
"os"
// infered imports
// infered imports
"github.com/spf13/viper"
"github.com/spf13/cobra"
)
// HOFSTADTER_START const
// HOFSTADTE... |
package main
import (
"fmt"
"net/http"
"path/filepath"
"os"
"io/ioutil"
"github.com/gin-gonic/gin"
"ipfs_api/pkg/our_infura"
//"github.com/wabarc/ipfs-pinner/pkg/infura"
)
func main() {
router := gin.Default()
root := router.Group("/")
{
root.POST("upload", upload)
root.POST("retrieve", retrieve)
}... |
/*
Copyright 2019 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agree... |
package main
import (
"encoding/csv"
"fmt"
"io"
"os"
"strconv"
mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
func main() {
session, err := mgo.Dial("127.0.0.1")
if err != nil {
panic(err)
}
defer session.Close()
session.SetMode(mgo.Monotonic, true)
s := session.DB("bigdata_school_chile").C("school")
... |
package strucct
// type PlayerInfo struct {
// PlayerId int64 `xorm:"not null pk autoincr BIGINT(20)"`
// Name string `xorm:"not null default '' unique(uk_name) VARCHAR(128)"`
// NickName string `xorm:"not null default '' unique(uk_name) VARCHAR(128)"`
// Position int `xorm:"not nul... |
package jobs
import (
"fmt"
"github.com/gocql/gocql"
"github.com/gorhill/cronexpr"
"github.com/prometheus/common/log"
)
// TODO * Add metrics for how often we try CAS because we did not see current
// TODO correct job meta data.
// TODO * Load job info using EACH_QUROUM to make sure we pick up state correctly
/... |
package reply
type ProtocolErrReply struct {
Msg string
}
func (r *ProtocolErrReply)ToBytes()[]byte{
return []byte("-ERR Protocol error: '" + r.Msg + "'\r\n")
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.