text stringlengths 11 4.05M |
|---|
package main
import (
"fmt"
"github.com/gofiber/fiber/v2"
)
func main() {
app := fiber.New()
app.Get("/", func(c *fiber.Ctx) error {
return c.JSON(&fiber.Map{
"message": "Hello from Docker 🐳!!1",
})
})
err := app.Listen(":8080")
if err != nil {
fmt.Println(err)
}
}
|
package algorithm
func RemoveNthFromEnd(head *ListNode, n int) *ListNode {
if head == nil {
return head
}
slow := head
fast := head
i := 0
for i=0; i<n; i++ {
if fast == nil {
break
}
fast = fast.Next
}
if i < n {
return head
}
if fast == nil {
return head.Next
}
for fast.Next != nil ... |
package main
import (
"excho-job/routes"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
// CORS disable
r.Use(cors.Default())
routes.JobSeekerRoute(r)
routes.HireRoute(r)
routes.JobsRoute(r)
routes.JobSeekerDetailsRoute(r)
routes.ResumeRoute(r)
routes.JobPro... |
package main
import (
"fmt"
"text/template"
"time"
"os"
"log"
)
var tpl *template.Template
var fm = template.FuncMap{
"fDateTime" : formatDatetime,
}
func formatDatetime(t time.Time) string {
return t.Format(time.ANSIC)
}
func init() {
tpl = template.Must(template.New("").Funcs(fm).ParseFiles("tpl.gohtml"))
}... |
package dbc
import "fmt"
// Common Logger interface for using to logging contact's related panics
type Logger interface {
Debug(msg string)
}
// Interface for validating invariant of object
type SimpleInvariantValidator interface {
Invariant() bool
}
// Interface for validating invariant of object with Stringer i... |
package model
type SendVerificationMailRequest struct {
UserId uint
Email string
Token string
}
|
package crd
import (
"context"
"io"
"os"
"path/filepath"
fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
"github.com/rancher/wrangler/pkg/crd"
"github.com/rancher/wrangler/pkg/schemas/openapi"
"github.com/rancher/wrangler/pkg/yaml"
apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiexten... |
// Copyright (C)2018 by Lei Peng <pyp126@gmail.com>
//
// 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,... |
package thulac
import (
"sync"
"syscall"
"unsafe"
)
var (
dll *syscall.DLL
thulacInit *syscall.Proc
thulacDestory *syscall.Proc
thulacGetCtx *syscall.Proc
thulacFreeCtx *syscall.Proc
thulacCut *syscall.Proc
thulacFreeResult *syscall.Proc
)
var (
ctxCh chan uintptr
don... |
package yoinker
import (
"sync"
"github.com/lethal-bacon0/WebnovelYoinker/pkg/yoinker/book"
)
//IYoinkerManager Provides Functionality to yoink Webnovels and Webtoons
type IYoinkerManager interface {
StartYoink(metadata book.Metadata, exportPath string) string
GetAvailableVolumes(url string, website string) []bo... |
package main
/**
1.3.14
编写一个类 ResizingArrayQueueOfStrings,使用定长数组实现队列的抽象,然后扩展实现,
使用调整数组的方法突破大小的限制。
*/
func main() {
}
|
/*
* @Description:
* @Author: ccj
* @Date: 2020-05-02 22:42:42
* @LastEditTime: 2020-12-28 22:18:12
* @LastEditors:
*/
package main
import
(
"fmt"
"go_learn"
// "time"
"sync"
)
// 定义全局sync变量
var syncMap sync.Map
var waitGroup sync.WaitGroup
func main(){
fmt.Println("Hello world!")
basic.... |
package worker
import (
"fmt"
"io/ioutil"
"os"
"strings"
"time"
gocontext "context"
"github.com/bitly/go-simplejson"
"github.com/sirupsen/logrus"
"github.com/travis-ci/worker/backend"
"github.com/travis-ci/worker/context"
"github.com/travis-ci/worker/metrics"
)
type fileJob struct {
createdFile stri... |
// The MIT License (MIT)
// Copyright (c) 2014 Jade E Services Pvt. Ltd.
// 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
// t... |
// Copyright 2022 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Package env provides the basic building block in a virtualnet.
package env
import (
"context"
"fmt"
"net"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"tim... |
package common
type Queue interface {
Enqueue(val interface{})
Dequeue() (interface{}, error)
IsEmpty() bool
HasNext() bool
}
|
// Copyright 2018 NetApp, Inc. All Rights Reserved.
package core
import (
"reflect"
"testing"
"github.com/netapp/trident/config"
"github.com/netapp/trident/storage"
sc "github.com/netapp/trident/storage_class"
)
func findVolumeInMap(
t *testing.T, backendMap map[string]*mockBackend, name string,
) *storage.Vo... |
// Copyright 2015 Bowery, Inc.
package slack
import (
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
)
var (
testClient *Client
testChannel = "#testing"
testBadChannel = "#foobar"
testText = "trying this out"
testUsername = "drizzy drake"
)
func init() {
testClient = NewClient("so... |
package webhooks
const (
//possible keys
BlockApplied = Event("block.applied")
BlockForged = Event("block.forged")
BlockReverted = Event("block.reverted")
DelegateRegistered = Event("delegate.registered")
DelegateResigned = Event("delegate.resigned")
ForgerFailed = Event("forger.... |
package main
import "fmt"
// O podemos agrupar los mismos tipos en una misma linea
// type User struct {
// ID int
// Email, FirstName, LastName string
// }
// User representa un usuario
type User struct {
ID int
Email string
FirstName string
LastName string
}
type Group struct {
role string
... |
package main
import (
"fmt"
)
func main() {
i := 0
isLessThanFive := true
for isLessThanFive {
if i >= 5 {
isLessThanFive = true
}
fmt.Println(i)
i++
}
// you can also do the following below
// for {
// if i >= 5 {
// break
// }
// fmt.Println(i)
// i++
// }
... |
package leetcode
func duplicateZeros(arr []int) {
var shifted []int
for idx, n := range arr {
if n == 0 {
shifted = append(shifted, 0)
shifted = append(shifted, 0)
} else {
shifted = append(shifted, arr[idx])
}
if len(shifted) == len(arr) {
break
}
}
copy(arr, shifted)
}
|
package router
import (
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/net/ghttp"
"onvif-gf-demos/app/api"
)
// 你可以将路由注册放到一个文件中管理,
// 也可以按照模块拆分到不同的文件中管理,
// 但统一都放到router目录下。
func init() {
s := g.Server()
// 分组路由注册方式
s.Group("/", func(group *ghttp.RouterGroup) {
group.Group("/", func(group *ghttp.RouterGroup... |
/**
The Caring Hamster - service wor working with SMS messages
Author: kolabse
Runing:
hamster <typeEnv>
Arguments:
typeEnv - type of runtime enviroment. Posssible values - dev, prod
./hamster dev
*/
package main
import (
"encoding/json"
"io"
"log"
"net/http"
"os"
"strconv"
"strings"
"time"
"github.c... |
package presto
type result struct {
lastID int64
affected int64
}
func (r *result) LastInsertId() (int64, error) {
return r.lastID, nil
}
func (r *result) RowsAffected() (int64, error) {
return r.affected, nil
}
|
package reload
import (
"os"
"syscall"
)
type options struct {
logger Logger
sigHandle sigHandle
}
// Option 参数
type Option func(*options)
var defaultOptions = &options{
logger: &defaultLogger{},
sigHandle: make(sigHandle),
}
// evaluateOptions 参数处理
func evaluateOptions(opts []Option) *options {
optCo... |
// Copyright 2019 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 i... |
package shared
import (
"flag"
"github.com/hashicorp/memberlist"
cmap "github.com/streamrail/concurrent-map"
)
var (
Dir = flag.String("dir", "/etc/puller", "The dir to load service configs from")
D = flag.Bool("d", false, "Run as a daemon")
Join = flag.String("join", "", "Join a cluster")
P... |
// Copyright 2020 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package ui
import (
"context"
"net/http"
"net/http/httptest"
"time"
"chromiumos/tast/errors"
uiperf "chromiumos/tast/local/bundles/cros/ui/perf"
"chromiumos/tast/loc... |
package poly
import (
"fmt"
"image"
"testing"
)
func TestNewPolygon(t *testing.T) {
tests := []struct {
test, want string
err bool
}{
{"1,2 3,4 5,6", "(1,2)-(3,4)-(5,6)", false},
{"1,2 3,4 56", "", true},
{"1,2 3,4 a,b", "", true},
{"1,2 3,4", "", true},
{"1,2", "", true},
{"", "", true},
... |
package schemes
import (
"path"
regv1 "github.com/tmax-cloud/registry-operator/api/v1"
"github.com/tmax-cloud/registry-operator/internal/common/config"
"github.com/tmax-cloud/registry-operator/internal/utils"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
v1 "k8s.io/apimachinery/pkg/apis/me... |
// Copyright (C) 2016-Present Pivotal Software, Inc. All rights reserved.
// This program and the accompanying materials are made available under the terms of the 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 Licen... |
package day12
import (
"bufio"
"math"
"os"
"strconv"
)
type instruction struct {
direction string
ammount int
}
type location struct {
x int
y int
}
//ParseInput : parse input of day12
func ParseInput(fileName string) []instruction {
file, err := os.Open(fileName)
if err != nil {
panic(err)
}
scann... |
/*
* Created by lintao on 2023/8/1 下午5:13
* Copyright © 2020-2023 LINTAO. All rights reserved.
*
*/
package main
import (
"bytes"
"flag"
"fmt"
"go/ast"
"go/constant"
"go/format"
"go/token"
"go/types"
"html/template"
"log"
"os"
"path/filepath"
"regexp"
"strings"
"golang.org/x/tools/go/packages"
)
... |
package main
import (
"encoding/json"
"os"
"strings"
"time"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/external"
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
"github.com/aws/aws-sdk-go-v2/service/dynamodb/dynamodbattribute"
"github.com/pkg/e... |
/*
* Copyright (C) 2018 The ontology Authors
* This file is part of The ontology library.
*
* The ontology is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (a... |
package common
// active object对象
type Service struct {
channel chan interface{} `desc:"即将加入到数据slice的数据"`
data []interface{} `desc:"数据slice"`
}
// 新建一个size大小缓存的active object对象
func NewService(size int, done func()) *Service {
s := &Service{
channel: make(chan interface{}, size),
data: make([]interface... |
package migrates
import (
"festival/app/common/db"
"festival/app/model/module"
)
// 点亮线路表
// power by 7be.cn
func init() {
db.DbList = append(db.DbList,
module.ModUserRoute{},
)
}
|
package blocker
import (
"log"
"testing"
)
func TestBlocker(t *testing.T) {
var list RipIPList
err := list.LoadFromFile("allowedlist")
if err != nil {
t.Errorf("Error: %v", err)
}
log.Printf("length of entries: %v", len(list))
list.Dump()
DefaultAllowing.Dump()
log.Print("***split***")
}
|
// Copyright 2019 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, ... |
// Copyright 2016 The Lucas Alves Author. 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 (
"encoding/json"
"github.com/luk4z7/pagarme-go/auth"
"github.com/luk4z7/pagarme-go/lib/recipient"
"net/url"
"os"
)
var payab... |
package function
import (
"encoding/json"
"errors"
"github.com/hecatoncheir/Storage"
"log"
"os"
)
type Storage interface {
CreateJSON([]byte) (string, error)
}
type Functions interface {
ReadPriceByID(string, string) storage.Price
}
type Executor struct {
Store Storage
Functions Functions
}
var Execut... |
package module
import (
"fmt"
"io"
"io/ioutil"
"github.com/dnaeon/gru/resource"
"github.com/hashicorp/hcl"
"github.com/hashicorp/hcl/hcl/ast"
)
// Module type represents a collection of resources and module imports
type Module struct {
// Name of the module
Name string
// Resources loaded from the module
... |
package query
import (
"log"
"github.com/PuerkitoBio/goquery"
)
// URI query an url to get dom tree
func URI(uri string) *goquery.Document {
dom, err := goquery.NewDocument(uri)
if err != nil {
log.Println(err)
}
return dom
}
// Dom query dom to find matched nodes
func Dom(dom interface{}, pattern string) [... |
package main
import (
"flag"
"log"
"net/http"
"os"
"path/filepath"
"sync"
"text/template"
"mryer1.chat/trace"
)
// templ represents a single template
type templateHandler struct {
once sync.Once
filename string
templ *template.Template
}
// This implements net/http Handler interface thus it makes ... |
package metrics
import (
"github.com/anabiozz/yotunheim/backend/common/datastore"
)
type accumulator struct {
metrics chan datastore.InfluxMetrics
mapmetrics chan datastore.Response
getter MetricGetter
}
// MetricGetter ...
type MetricGetter interface {
GetMetric(influxMetrics datastore.InfluxMetrics) da... |
package main
import (
"crypto/tls"
"encoding/binary"
"fmt"
"io"
"net"
"os"
"snirouter/snirouter"
)
func readInt16BE(data []byte, pos int) int {
return int(binary.BigEndian.Uint16(data[pos : pos+2]))
}
/**
* Gets the SNI header. Returns the host if set, or an empty string, and a 'clean' connection to start TL... |
package com
import (
"JsGo/JsBench/JsProduct"
"JsGo/JsHttp"
"JsGo/JsLogger"
"JsGo/JsStore/JsRedis"
"JunSie/constant"
"JunSie/util"
"fmt"
)
type Goods struct {
ProID string //产品idJ
ProName string //产品名称J
Tags []string //标签
ProFormat JsP... |
package system
import (
"io/ioutil"
"github.com/layer5io/meshery/mesheryctl/internal/cli/root/config"
"github.com/layer5io/meshery/mesheryctl/pkg/utils"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/viper"
log "github.com/sirupsen/logrus"
)
var loginCmd = &cobra.Command{
Use: "login",... |
// Copyright 2021 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package platform
import (
"context"
"regexp"
"strconv"
"strings"
"time"
"github.com/golang/protobuf/ptypes/empty"
"chromiumos/tast/common/servo"
"chromiumos/tast/d... |
package kv
import (
"encoding/json"
"io"
"net/url"
"github.com/cerana/cerana/acomm"
"github.com/cerana/cerana/pkg/errors"
"github.com/cerana/cerana/pkg/kv"
"github.com/cerana/cerana/pkg/logrusx"
)
var watches = newChanMap()
// WatchArgs specify the arguments to the "kv-watch" endpoint.
type WatchArgs struct ... |
package segment
import (
"context"
"errors"
"sync"
"sync/atomic"
"time"
"github.com/derry6/gleafd/pkg/log"
)
var (
ErrClosed = errors.New("service closed")
ErrBizTagNotFound = errors.New("biztag not found")
)
type waitItem struct {
biztag string
result chan *Segment
step int... |
package list
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"sort"
"sync"
"time"
)
type Timer struct {
Time int64 `json:"time"`
Callback string `json:"callback"`
}
type List struct {
savefile string
list []*Timer
locker sync.Mutex
exitChan chan bool
}
func (l *List) Len() int {
retur... |
package WebUtility
import (
"crypto/tls"
"io/ioutil"
"net/http"
"strings"
"time"
)
func ReadWebPage(url string) (string, error) {
// 參考 https://dlintw.github.io/gobyexample/public/http-client.html
timeout := time.Duration(15 * time.Second)
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVe... |
package boshdeployment
import (
"context"
"fmt"
"strings"
"time"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/contr... |
package main
//32. 最长有效括号
//
//给定一个只包含 '('和 ')'的字符串,找出最长的包含有效括号的子串的长度。
//
//示例1:
//
//输入: "(()"
//输出: 2
//解释: 最长有效括号子串为 "()"
//示例 2:
//
//输入: ")()())"
//输出: 4
//解释: 最长有效括号子串为 "()()"
//思路 栈 ,动态规划
//"()(()"
func longestValidParentheses(s string) int {
result := 0
n := len(s)
array := make([]int, n)
stack := make(... |
/*
Copyright 2021-2023 ICS-FORTH.
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... |
// Copyright 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
package http2
import (
"fmt"
"net/http"
"net/url"
"strings"
"github.com/xgfone/go-tools/log2"
)
// Render is a HTTP render interface.
type Render interface {
// Render only writes the body data into the response, which should not
// write the status code and has no need to set the Content-Type header.
Render... |
// Copyright (C) 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
package crawler
import (
"fmt"
"io"
"log"
"net/url"
"os"
"path"
"strings"
"github.com/ahmdrz/goinsta"
"github.com/iveronanomi/goinstagrab"
)
// LatestMedia ...
func (s *service) LatestMedia() {
names := goinstagrab.Config.ScanTargets
for _, uName := range names {
user, err := s.api.Profiles.ByName(uName... |
// Copyright 2022 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package inputs
import (
"context"
"time"
"chromiumos/tast/ctxutil"
"chromiumos/tast/local/bundles/cros/inputs/fixture"
"chromiumos/tast/local/bundles/cros/inputs/pre"
... |
package servicegraph
import (
"encoding/json"
"math"
"strings"
"alauda.io/diablo/src/backend/integration/prometheus"
"github.com/prometheus/common/model"
)
const (
NODE_EDGE_TYPE = "edge"
NODE_WORKLOAD_TYPE = "workload"
NODE_SERVICE_TYPE = "service"
Quantile50 = 0.50
Quantile90 = 0.90
... |
// Copyright 2019 Liquidata, 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 models
type ItemModel struct {
ID int64 `json:"id"`
SKU string `json:"string,omitempty"`
ItemName string `json:"item_name,omitempty"`
Amount int `json:"amount,omitempty"`
}
|
package main
type Search struct {
Meta struct {
Status int `json:"status"`
} `json:"meta"`
Response struct {
Hits []Hit `json:"hits"`
} `json:"response"`
}
type Hit struct {
Type string `json:"type"`
Result Result `json:"result"`
}
type Result struct {
PrimaryArtist Artist `json:"primary_artist"`
T... |
package main
import (
"bufio"
"fmt"
"log"
"os"
"strings"
)
func blackCard(s []string, m int) string {
for len(s) > 1 {
n := m%len(s) - 1
if n == -1 {
s = s[:len(s)-1]
} else {
s = append(s[:n], s[n+1:]...)
}
}
return s[0]
}
func main() {
var m int
data, err := os.Open(os.Args[1])
if err != n... |
package store
import (
"context"
"errors"
"fmt"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ssm"
"github.com/aws/aws-sdk-go/service/ssm/ssmiface"
)
var (
ErrNoParameters = errors.New("No Parameters found")
)
type ParamStore st... |
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
//
package model
import (
"encoding/json"
"fmt"
"io"
"net/url"
"github.com/pkg/errors"
)
const (
forceInstallationRestartEnvVar = "CLOUD_PROVISIONER_ENFORCED_RESTART"
// ShowInstallationCountQuery... |
package db
import (
"github.com/astaxie/beego/orm"
"intra-hub/models"
)
func AddLog(user *models.User, action, table string, targetID int) error {
l := &models.Log{
Action: action,
Table: table,
TargetID: targetID,
User: user,
}
_, err := orm.NewOrm().Insert(l)
return err
}
|
package main
import (
// "fmt"
)
type ApiKeyDescriptor struct {
UUID string
Name string
Description string
AccessKey string
SecretKey string
Host string
GenAccessKey string
GenSecretKey string
ProjectId string
}
type LocalAuthConfigDescriptor struct {
UUID string
Host string
AccessKey string
Secret... |
// Copyright 2020 The SwiftShader 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 b... |
package models
import (
"time"
_ "github.com/jinzhu/gorm/dialects/mysql"
)
type Shortener struct {
CreatedAt time.Time `gorm:"column:created_at; type:datetime"`
ExpireDay int `gorm:"column:expire_day; type:int(11); default:'365'" `
ExpiredAt *time.Time `gorm:"column:expired_at; type:datetime"`
ID ... |
package main
import (
"strings"
"testing"
)
func TestCreateConfigString(t *testing.T) {
expected := true
testString := createConfigString("cookies", "cake", "candies")
actual := strings.Contains(testString, "cookies")
if actual != expected {
t.Fail()
}
actual = strings.Contains(testString, "cake")
if act... |
package main
import (
"encoding/json"
"fmt"
)
type Project struct {
Name string `json:"name"`
Url string `json:"url"`
Docs string `json:"docs,omitempty"`
}
func main() {
p1 := Project{
Name:"CleverGo高性能框架",
Url:"https://github.com/headwindfly/clevergo",
}
data, err := json.Marshal(p1... |
package main
import (
"os"
"github.com/typical-go/typical-go/pkg/typgo"
"github.com/typical-go/typical-go/pkg/typrls"
)
var descriptor = typgo.Descriptor{
ProjectName: "typical-go",
ProjectVersion: "0.11.7",
Tasks: []typgo.Tasker{
// compile
&typgo.GoBuild{MainPackage: "."},
// run
&typgo.RunBinary... |
package clipper
import (
"net"
"log"
"io"
"encoding/binary"
"sync"
"time"
"encoding/json"
"strings"
"fmt"
)
var _startTime time.Time
type clipperInfo struct {
path string
time float64
port uint32
}
type master struct {
connections []net.Conn
lastCopyConn net.Conn
mutex sync.Mutex
info ... |
// Copyright (c) 2020 Tigera, 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 appli... |
/*
Method Expressions:
MethodExpr = ReceiverType "." MethodName
ReceiverType = TypeName | "(" "*" TypeName ")" | "(" ReceiverType ")"
*/
package main
import (
"fmt"
)
//可以自由的向基本类型中添加方法
type WW int
func (w *WW) Print(flag string) {
fmt.Println(flag)
}
func main() {
var ww WW
ww.Print("w... |
package main
import (
"fmt"
"regexp"
)
type ExtraConfig map[string]interface{}
var test ExtraConfig = map[string]interface{}{"customer": map[interface{}]interface{}{
"body-tem": `{"code":601,"data":{"value":""},"message": "对不起,尊敬的旅客,您的访问存在风险,请您稍后重试。如有疑问请拨打0871-96598。感谢您的理解。IP:{{ .ClientIP }},时间:{{ .Time }},访问ID:{... |
package taskmanapi
import (
"net/http"
"strings"
"appengine"
)
//var BaseResourceHandlers = make(map[string]resourceHandler)
type ResourceHandler interface {
Handle(http.ResponseWriter, *http.Request, appengine.Context, *User, string, ...interface{})
AddResource(string, ResourceHandler)
}
type resourceHa... |
// Copyright © 2018 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 cluster
import (
"fmt"
"os"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/michaelhenkel/gokvm/image"
"github.com/michaelhenkel/gokvm/instance"
"github.com/michaelhenkel/gokvm/network"
log "github.com/sirupsen/logrus"
)
type Cluster struct {
Name string
Network network.Network
Image ... |
// Copyright 2019 Yunion
//
// 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 writi... |
package flux
// Action represents an action to be dispatched.
type Action struct {
Name string
Payload interface{}
}
// Dispatch dispatches actions to the registered stores. Each actions
// contained in a are dispatched sequentially within the call. eg a[1] will be
// dispached once a[0] dispatch is complete. ... |
package storage_test
import (
"context"
"io/ioutil"
"os"
"github.com/containers/image/copy"
"github.com/containers/image/types"
"github.com/containers/libpod/pkg/rootless"
cs "github.com/containers/storage"
"github.com/cri-o/cri-o/pkg/storage"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "g... |
package quark
type PartialHandler struct {
Prefixes []string
ExcludedPrefixes []string
Preds []func(*Context) bool
Handler Handler
}
func Partial(h interface{}) *PartialHandler {
return &PartialHandler{Handler: handlerOf(h)}
}
func (h *PartialHandler) For(prefixes ...string) *PartialHandler {
if len(prefixes) ... |
// +build debug
package west
const debug = true
|
package main
import (
"io"
"log"
"net"
"net/http"
"net/http/httputil"
)
type Proxy struct{}
func NewProxy() *Proxy {
return &Proxy{}
}
// ServeHTTP is the main handler for all requests.
func (p *Proxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
dump, _ := httputil.DumpRequest(req, false)
log.Pri... |
package matcher
import (
"bufio"
"io"
)
// SequenceMatcherOptions are the options for creating a new SequenceMatcher
type SequenceMatcherOptions struct {
precedingCharCount int
succeedingCharCount int
sequence []byte
eos rune
}
// MatchResult represents the result of one found match... |
package Workflows
import (
"fmt"
"math/rand"
"time"
"github.com/pkg/errors"
)
type FSM interface {
Inputs(inputs ...Input) (bool, error)
Input(input Input) (State, error)
IsInFinalState() bool
}
func NewFSM(fsmConfig *Config) (FSM, error) {
rand.Seed(time.Now().Unix())
config, err := parseConfig(fsmConfig... |
package heap
import "jean/classfile"
type InterfaceMethodRef struct {
MemberRef
method *Method
}
func newInterfaceMethodRef(rtCp *ConstantPool, info *classfile.ConstantInterfaceMethodrefInfo) *InterfaceMethodRef {
ref := &InterfaceMethodRef{}
ref.rtCp = rtCp
ref.copyMemberRefInfo(&info.ConstantMemberrefInfo)
r... |
package operator
import (
"context"
"fmt"
"time"
"github.com/google/uuid"
"github.com/jinghzhu/KubernetesPodOperator/pkg/types"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go... |
package core
import (
"sync"
"testing"
"github.com/google/uuid"
"github.com/jrapoport/gothic/core/audit"
"github.com/jrapoport/gothic/core/context"
"github.com/jrapoport/gothic/models/auditlog"
"github.com/jrapoport/gothic/models/types"
"github.com/jrapoport/gothic/models/types/key"
"github.com/jrapoport/got... |
package supportbundle
import (
"fmt"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"strings"
"time"
cursor "github.com/ahmetalpbalkan/go-cursor"
"github.com/fatih/color"
"github.com/pkg/errors"
analyzer "github.com/replicatedhq/troubleshoot/pkg/analyze"
troubleshootv1beta2 "github.com/replicatedhq/troublesh... |
package hsc
// HscDerivationPath is the standard BIP44 derivation path for hsc
const HscDerivationPath string = "m/44'/532'/0'/0/0"
|
// Written in 2014 by Petar Maymounkov.
//
// It helps future understanding of past knowledge to save
// this notice, so peers of other times and backgrounds can
// see history clearly.
package faculty
import (
// "fmt"
"sync"
"github.com/gocircuit/escher/think"
)
// Eye is an implementation of Leslie Valiant's ... |
package transformer
import (
"bytes"
"fmt"
"github.com/kubesimple/transformer/context"
v1 "github.com/kubesimple/transformer/transform/v1"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
)
func Transform(s context.Session) error {
return transform(nil, s)
}
func transform(b... |
package main
import (
L "./lib"
"fmt"
"os"
)
func main() {
filename := os.Args[1]
bags := L.ParseBagsData(filename)
res := 0
for _, bag := range bags {
if bag.CanContain("shiny gold") {
res += 1
}
}
fmt.Printf("%d\n", res)
}
|
/*
Copyright The containerd 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.