text
stringlengths
11
4.05M
package main import ( "crypto/sha256" b64 "encoding/base64" "encoding/xml" "fmt" "net/http" "sort" "time" ) //Item contains a news item type Item struct { Title string `xml:"title"` Link string `xml:"link"` Desc string `xml:"description"` PubDate string `xml:"pubDate"` Key string `xml:"guid"` ...
// 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 wilco import ( "context" "regexp" "strings" "time" "github.com/golang/protobuf/ptypes/empty" "chromiumos/tast/common/servo" "chromiumos/tast/errors" "chrom...
// Copyright (c) 2021 Tailscale Inc & 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 ( "context" "encoding/json" "expvar" "log" "net" "net/http" "strings" "sync" "time" ) var ( dnsMu sync.Mutex dns...
package tournament /* TE DEBO EL TESTING func TestTournamentAdd(t *testing.T) { c := NewTournament() e0 := c.GetTeam(0) if e0 != nil { t.Error("El equipo con Id 0 ya existe") } c.add(NewTeam("test", 0)) e0 = c.GetTeam(0) if e0 == nil { t.Error("El equipo con ID 0 no fue agregado") } if e0.name != "...
package main import ( "github.com/polluxx/yard/search" "fmt" "net/http" "time" "encoding/json" "github.com/polluxx/yard/encoding/csv" "log" "os" "regexp" //"log/syslog" "sort" ) type Report struct { Title string Body []Record } type Record struct { time string...
package krc import "github.com/jbvmio/kafkactl" const ( ErrorStatusKey = "ERR_TOPICS_7777" TopicListKey = "TOPIC_LIST" LocalKind = "localDC" RemoteKind = "crossDC" StopCount = 5 ) var StopChannel chan bool type ErrorStatus struct { ErrorStatusKey string `json:"errStatusKey"` //key E...
package leetcode /* * @lc app=leetcode id=4 lang=golang * * [4] Median of Two Sorted Arrays */ // @lc code=start func findMedianSortedArrays(nums1 []int, nums2 []int) float64 { var ( nums1Length = len(nums1) nums2Length = len(nums2) ) if nums1Length > nums2Length { return find...
package namegen import ( "context" "fmt" "github.com/docker/docker/client" "github.com/hinshun/pls/pkg/failsafe" ) func GetUnusedContainerName(ctx context.Context, cli client.APIClient, prefix string) (string, error) { var ( containerName string retryPolicy = failsafe.NewRetryPolicy() ) err := failsafe...
package myreplication import ( "fmt" "net" "strconv" ) type ( connection struct { conn net.Conn packReader *packReader packWriter *packWriter currentDb string masterPosition uint64 fileName string } ) const ( _DEFAULT_DB = "mysql" ) func NewConnection() *connection { return &connect...
package main import ( "bytes" "encoding/json" "fmt" "html/template" "io/ioutil" "net/http" "os" ) type User struct { FirstName string LastName string Sex string Age int Attr []bool } var templates = template.Must(template.ParseFiles("tmpl/attrs.html")) func handleFunc (path string,...
package resource import ( "fmt" "io" "os" "strconv" "github.com/mebyus/ffd/cmn" "github.com/mebyus/ffd/resource/fiction" "github.com/mebyus/ffd/setting" "github.com/mebyus/ffd/track/fic" ) // Download fetches a fic from a given target. // An appropriate target is fic page URL. // SaveSource flag indicates wh...
package deployer import ( devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context" "io" ) // Interface defines the common interface used for the deployment methods type Interface interface { Status(ctx devspacecontext.Context) (*StatusResult, error) Deploy(ctx devspacecontext.Context, forceDeploy bool) ...
package bindings import ( validation "github.com/go-ozzo/ozzo-validation" "github.com/go-ozzo/ozzo-validation/is" ) // HelpRequest - this is the format an help would be sent to this app type HelpRequest struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Age int...
/* * traPCollection API * * traPCollectionのAPI * * API version: 1.0.0 * Generated by: OpenAPI Generator (https://openapi-generator.tech) */ package openapi // Maintainers - 管理者の一覧 type Maintainers struct { Maintainers []string `json:"maintainers"` }
package main import "fmt" import "github.com/contactless/wb-mqtt-noolite/noolite" import "github.com/evgeny-boger/wbgo" import "math/rand" import "sync" import "time" import "unsafe" type callback func(*noolite.Response) error type MTRF64 struct { inBuff chan *noolite.Request nlCallbacks [64]callback...
package task import ( "net/http" "github.com/synoday/gateway/web/router" ) // routes list all task domain routes. var routes = []*router.Route{ { Method: http.MethodGet, Path: "/task/{period}", Handler: List, }, { Method: http.MethodPost, Path: "/task", Handler: Add, }, { Method: http.M...
package main import ( "time" "github.com/typical-go/typical-go/pkg/typgo" "github.com/typical-go/typical-go/pkg/typmock" ) var descriptor = typgo.Descriptor{ ProjectName: "typmock-sample", ProjectVersion: "1.0.0", Tasks: []typgo.Tasker{ // mock &typmock.GoMock{}, // test &typgo.GoTest{ Timeout: ...
package adyoulike import ( "encoding/json" "fmt" "net/http" "strings" "github.com/buger/jsonparser" "github.com/prebid/openrtb/v19/openrtb2" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" "github.com/prebid/prebid-server/openr...
package common type SMSSend struct { Phone string `validate:"required" form:"phone"` Genre string `validate:"required,oneof=registered edit_password" form:"genre"` } type QueryAreaForm struct { SuperiorId *int `validate:"required" form:"superior_id" json:"superior_id" error_message:"上级地区编号~required:此为必填;"` }
package main import "fmt" var z = "car" // use var when its outside function // use := inside the function func main() { x := 32 // first time declaration := fmt.Println("Hello World", x) // in future, once a var is declared, use = x = 99 fmt.Println("Hello World", x) // example of operators y := 100 + 24 ...
import ( "strings" ) /* * @lc app=leetcode id=6 lang=golang * * [6] ZigZag Conversion * * https://leetcode.com/problems/zigzag-conversion/description/ * * algorithms * Medium (35.79%) * Likes: 1749 * Dislikes: 4733 * Total Accepted: 472.7K * Total Submissions: 1.3M * Testcase Example: '"PAYPALISHI...
package taller import ( "testing" "os" "path" "bytes" ) const ( TESTDIR string = "test" ) // return a template absolute path func update_environment() { current_dir, _ := os.Getwd() err := os.Setenv(TALLER_ENV_VARIABLE, path.Join(current_dir, TESTDIR)) if err != nil { panic("Failed to set environment varia...
package _1_addTwoDigits func main() {} func addTwoDigits(n int) int { return int(n/10)+int(n%10) }
package keeper import ( "bytes" "encoding/json" "time" gogotypes "github.com/gogo/protobuf/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irismod/service/types" ) // AddServiceBinding creates a new service binding func (k Keeper) AddServiceB...
package logrusOVH import ( "fmt" "github.com/sirupsen/logrus" ) // Protocol define available transfert proto type Protocol uint8 // Endpoint OVH logs endpoint var Endpoint string const ( // GELFUDP for Gelf + UDP GELFUDP Protocol = 1 + iota // GELFTCP for Gelf + TCP GELFTCP // GELFTLS for Gelf + TLS GELFTL...
package main func mergeTwoLists2(l1 *ListNode, l2 *ListNode) *ListNode { dummy := &ListNode{} cur := dummy for l1 != nil && l2 != nil { if l1.Val < l2.Val { cur.Next = l1 cur = cur.Next l1 = l1.Next } else { cur.Next = l2 cur = cur.Next l2 = l2.Next } } if l1 == nil { cur.Next = l2 } el...
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. // package aws import ( "context" "github.com/aws/aws-sdk-go-v2/service/acm" "github.com/aws/aws-sdk-go-v2/service/acm/types" "github.com/mattermost/mattermost-cloud/model" ) // ACMAPI represents the ...
package set3 import ( "bufio" "bytes" "cryptopals/utils" "encoding/base64" "math" "os" "testing" ) func TestBreakFixedNonceCTRStatistically(t *testing.T) { file, err := os.Open("./20.txt") if err != nil { t.Error(err) } defer file.Close() var minLength int var plainTexts [][]byte minLength = math.Ma...
package main import ( "sort" "fmt" ) func main() { nums := []int{2,4,3,5,6,1,2,3} sort.Ints(nums[:5]) fmt.Println(nums) }
package bank import ( "fmt" "time" ) func ProcessPayment(fromAccount int, toAccount int, amount int) error { fmt.Printf("Transfered %d from %d to %d at %v via bank transfer", amount, fromAccount, toAccount, time.Now().String()) return nil }
package logger var glog *logger func init() { glog = NewStdOut("", Lshortfile|Ltime, DEBUG) glog.depth = 3 } func SetPrefix(prefix string) { glog.SetPrefix(prefix) } func SetFlags(flags int) { glog.SetFlags(flags) } func SetLevel(level Level) { glog.SetLevel(level) } func Trace(v ...interface{}) { glog.Trac...
package core import ( "encoding/base64" "encoding/json" "fmt" "log" "net/http" "os" "os/exec" "runtime" "strings" "github.com/google/uuid" ) func IsLinux() bool { return runtime.GOOS == "linux" } func ExecCmd(name string, arg ...string) ([]byte, error) { cmd := exec.Command(name, arg...) out, err := cm...
package preload import ( "bytes" "fmt" "net/http" ) type Source struct { // HTTP(S) URI of the list blob. ListURI string // HTTP(S) URI of the ASCII-armored PGP signature taht is valid for data fetched // from ListURI. SigURI string // ASCII-armored PGP key to use when verifying the signature fetched from ...
package gbc const ( A = iota B C D E H L F ) const ( AF = iota BC DE HL HLI HLD SP PC ) const ( flagZ, flagN, flagH, flagC = 7, 6, 5, 4 ) // Register Z80 type Register struct { R [8]byte SP uint16 PC uint16 IME bool } func (r *Register) R16(i int) uint16 { switch i { case AF: return r.A...
package main func numIslands2(grid [][]byte) int { if len(grid) == 0 { return 0 } row, col := len(grid), len(grid[0]) var count int for x := 0; x < row; x++ { for y := 0; y < col; y++ { if grid[x][y] == '1' { count++ dfs(x, y, grid) } } } return count } func dfs(x, y int, grid [][]byte) { ...
package Activity import ( "encoding/json" "fmt" "os" ) type User struct { TipeID string NoID string } func CariLoker (loker []string){ var prompt int fmt.Printf("Cari loker berdasarkan? [1] Tipe ID, [2] No ID : ") fmt.Scan(&prompt) if prompt == 1 { CariTipeID(loker) }else if prompt == 2 { CariNoID(lo...
// Copyright 2020 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, ...
package des import ( "crypto/des" "CryptoHashCodeClass3/utils" "crypto/cipher" ) /** * 使用秘钥key对明文data进行加密 */ func DESEnCrypt(data []byte, key []byte) ([]byte, error) { //三要素:key、data、mode //DES:数据加密标准算法 Data Encryption Stardard block, err := des.NewCipher(key) if err != nil { return nil, err } //对明文进行尾部填...
/* Package bootstrap implements the capability to connect to an existing and online Tinzenite peer network. TODO: add encryption bootstrap capabilities */ package bootstrap import ( "github.com/tinzenite/channel" "github.com/tinzenite/shared" ) /* Create returns a struct that will allow to bootstrap to an existing...
/* Copyright 2020 Docker Compose CLI 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 a...
package main //2383. 赢得比赛需要的最少训练时长 //你正在参加一场比赛,给你两个 正 整数 initialEnergy 和 initialExperience 分别表示你的初始精力和初始经验。 // //另给你两个下标从 0 开始的整数数组 energy 和 experience,长度均为 n 。 // //你将会 依次 对上 n 个对手。第 i 个对手的精力和经验分别用 energy[i] 和 experience[i] 表示。当你对上对手时,需要在经验和精力上都 严格 超过对手才能击败他们,然后在可能的情况下继续对上下一个对手。 // //击败第 i 个对手会使你的经验 增加 experience[i],...
package main import ( "fmt" "github.com/fsetiawan29/design-pattern/structural/adapter" ) func main() { roundHole := adapter.NewRoundHole(5) roundPeg := adapter.NewRoundPeg(5) fmt.Printf("%+v\n", roundHole.Fits(roundPeg)) smallSquarePeg := adapter.NewSquarePeg(5) largeSquarePeg := adapter.NewSquarePeg(10) //...
package schema // CliConfiguration structure represents schema for `atmos.yaml` CLI config type CliConfiguration struct { BasePath string `yaml:"base_path" json:"base_path" mapstructure:"base_path"` Components Components `yaml:"components" json:"components" mapstructur...
package obj import ( "bufio" "fmt" "os" "strconv" "strings" ) type ObjParser interface { Filename() string Comment(s string) Vertex(components []float64) TextureVertex(components []float64) Normal(components []float64) Group(names []string) Face(vertexIds, textureVertexIds, normalIds []int) MaterialLibr...
package ravendb import ( "fmt" "reflect" "strings" ) // functionality related to reflection func isPtrStruct(t reflect.Type) (reflect.Type, bool) { if t.Kind() == reflect.Ptr && t.Elem() != nil && t.Elem().Kind() == reflect.Struct { return t, true } return nil, false } func isPtrMapStringToPtrStruct(tp refl...
package mr import ( "sync" "time" ) type Master struct { // Your definitions here. sync.Mutex nMap int nReduce int finishedMap int finishedReduce int mapTask map[string]int reduceTask map[int]bool inputFiles []string intermediateFiles []int } // //...
package cmd import ( "fmt" "io" "github.com/brainicorn/skelp/generator" "github.com/brainicorn/skelp/skelputil" "github.com/mgutz/ansi" "github.com/spf13/cobra" ) // Flags that are to be added to commands. var ( quietFlag bool noColorFlag bool homedirFlag string skelpdirFlag string ) func NewSkelpCom...
package credhub_test import ( "errors" "fmt" "io" "log" "code.cloudfoundry.org/credhub-cli/credhub/credentials" "code.cloudfoundry.org/credhub-cli/credhub/credentials/values" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/onsi/gomega/gbytes" "github.com/pivotal-cf/on-demand-service-bro...
package jaegerMiddleware import ( "github.com/gin-gonic/gin" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" ) func OpenTracingMiddleware() gin.HandlerFunc { return func(c *gin.Context) { carrier := opentracing.HTTPHeadersCarrier(c.Request.Header) wireSpanCtx, _ := opentra...
// Copyright (c) 2018 soren yang // // Licensed under the MIT License // you may not use this file except in complicance with the License. // You may obtain a copy of the License at // // https://opensource.org/licenses/MIT // // Unless required by applicable law or agreed to in writing, software // distributed und...
package mvt import ( "github.com/paulmach/orb" "github.com/paulmach/orb/geojson" "reflect" "testing" ) func TestLayersClip(t *testing.T) { cases := []struct { name string bound orb.Bound input Layers output Layers }{ { name: "clips polygon and line", input: Layers{&Layer{ Features: []*ge...
/* * traPCollection API * * traPCollectionのAPI * * API version: 1.0.0 * Generated by: OpenAPI Generator (https://openapi-generator.tech) */ package openapi // GameMeta - ゲーム名とID type GameMeta struct { // 追加されたゲームのUUID Id string `json:"id"` // 追加されたゲームの名前 Name string `json:"name"` }
// 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 feedback import ( "context" "time" "chromiumos/tast/ctxutil" "chromiumos/tast/errors" "chromiumos/tast/local/chrome" "chromiumos/tast/local/chrome/uiauto" "c...
package generator import ( "fmt" "math/rand" "proto-benchmark-value-vs-pointers/proto" ) func randString(l int) string { buf := make([]byte, l) for i := 0; i < (l+1)/2; i++ { buf[i] = byte(rand.Intn(256)) } return fmt.Sprintf("%x", buf)[:l] } func GenerateMessageValue(n int) []*proto.MessageValue { out := ...
// 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 audio import ( "context" "os" "path/filepath" "strings" "time" "chromiumos/tast/common/testexec" "chromiumos/tast/local/audio" "chromiumos/tast/local/audio/...
/* Copyright 2022 The Skaffold 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 main type ConfigAWS struct { } //todo aws proxy
package main import "fmt" func main() { var two int = 2 a := two << 1 // 4 b := two << 2 // 8 c := two << 3 // 16 d := two >> 1 // 1 e := two >> 2 // 0 f := two >> 3 // 0 fmt.Println(a, b, c, d, e, f) }
/* Copyright 2020 The Skaffold 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 problem15 func Solve() (int, int, error) { ints := []int{1, 0, 18, 10, 19, 6} return SolveBoth(ints) } func SolveBoth(ints []int) (int, int, error) { latest := map[int]int{} for i, v := range ints[:len(ints)-2] { latest[v] = i } var lastA int lastB := ints[len(ints)-2] next := ints[len(ints)-1] i :...
package main import ( "context" "github.com/prometheus/client_golang/prometheus" "github.com/webdevops/go-common/prometheus/collector" "go.uber.org/zap" devopsClient "github.com/webdevops/azure-devops-exporter/azure-devops-client" ) type MetricsCollectorProject struct { collector.Processor prometheus struct...
package main import ( "fmt" "unsafe" ) const ( a = "abc" b = len(a) c = unsafe.Sizeof(a) ) const ( i = 1 << iota j = 3 << iota k l ) func main() { sample1() fmt.Println("=====================") sample2() fmt.Println("=====================") sample3() fmt.Println("=====================") } func sampl...
package arithmetic func Add(num ...int) int { result := 0 for index := range num { result += num[index] } return result }
package types import ( "math/big" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/tharsis/ethermint/types" ) func newAccessListTx(tx *ethtypes.Transaction) *...
// code for linux // +build linux darwin // +build 386 package godebug var ColorRed = "\033[31;40m" var ColorYellow = "\033[33;40m" var ColorGreen = "\033[32;40m" var ColorCyan = "\033[36;40m" var ColorReset = "\033[0m"
// Copyright 2020 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, ...
package main import "testing" func Test_should_write_1(t *testing.T) { assertEquals(Roman(1), "I", t) } func Test_should_write_3(t *testing.T) { assertEquals(Roman(3), "III", t) } func Test_should_write_4(t *testing.T) { assertEquals(Roman(4), "IV", t) } func Test_should_write_5(t *testing.T) { assertEquals(Ro...
package main import ( "flag" "fmt" "io" "io/ioutil" "net/http" "os" ) func write(w io.Writer, list ...interface{}) { fmt.Println(list...) _, _ = fmt.Fprintln(w, list...) } func greet(w http.ResponseWriter, r *http.Request) { defer write(w) if r.URL.Scheme == "" { r.URL.Scheme = "http" } write(w, r.Prot...
package lang import ( "testing" ) func TestPairString(t *testing.T) { result := MakePair(MakeString("a"), MakeNumber(2)).String() expected := "[\"a\" 2]" if result != expected { t.Errorf("Wrong result, expected '%v', got '%v'", expected, result) } }
// 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 arc import ( "bytes" "context" "io/ioutil" "path" "time" "chromiumos/tast/common/android/ui" "chromiumos/tast/ctxutil" "chromiumos/tast/errors" "chromiumos...
package main import ( "flag" "log" "net" "os" "strings" tcpip "github.com/brewlin/net-protocol/protocol" "github.com/brewlin/net-protocol/protocol/link/fdbased" "github.com/brewlin/net-protocol/protocol/link/tuntap" "github.com/brewlin/net-protocol/protocol/network/arp" "github.com/brewlin/net-protocol/prot...
package field import ( "github.com/payfazz/ditto/structure/component" ) type List struct { *Field } func NewList() component.Interface { return &List{ Field: NewField(), } }
package http import ( "net/http" "strconv" "robot/common/logger" ) var log = logger.NewLog() func Start(port int){ router := &Router{} router.RegRoutes(InitRouter()) server := http.Server{ Addr:":"+strconv.Itoa(port), Handler:router, } log.Infof("http server listen on %d",port) server.ListenAndServe() } ...
package main; import "fmt"; func main(){ if c==1{ if d==1{ d++;}; } else { if d&e==1 { e++; } else { d--;}; }; };
package migrations //it is the schema of the table to be stored in the database type Product struct { Username string `json:"username"` UserID int `json:"user_id"` Price int `json:"price"` PhoneNo string `json:"phone_no"` OrderPlaced string `json:"order_placed"` Pass...
// Copyright 2017 The Cockroach Authors. // // Licensed as a CockroachDB Enterprise file under the Cockroach Community // License (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // https://github.com/cockroachdb/cockroach/blob/master/li...
package lang import ( "fmt" ) type symbol struct { value string } func MakeSymbol(name string) Expr { return &symbol{name} } func (s *symbol) String() string { return fmt.Sprintf(":%v", s.value) } func (s *symbol) Value() string { return s.value } func (s *symbol) Equal(o Expr) bool { switch other := o.(typ...
// Package log defines the contract for the xds-relay logger. // It also contains an implementation of the contract using the Zap logging // framework. package log import ( "context" ) // Logger is the contract for xds-relay's logging implementation. // // A self-contained usage example looks as follows: // // Lo...
package controllers import ( "api/models" "encoding/json" "io/ioutil" "net/http" "regexp" "strconv" ) //GetUsers List all users func GetUsers(w http.ResponseWriter, r *http.Request) { accouunts, err := models.GetUsers() if err != nil { w.Write([]byte(err.Error())) } if len(accouunts) > 0 { w.Header().S...
/*Package rpterr provides a place to report internal program errors To begin with, we simply dump to stderr */ package rpterr
package library import ( "encoding/json" "log" "net/http" "gopkg.in/mgo.v2" ) type Disk struct { Id string `json:"id" validate:"required"` Title string `json:"title" validate:"required"` Authors []string `json:"authors" validate:"required"` Genre string `json:"genre" validate:"required"` Mp3 ...
package Routes import ( "log" "net/http" ) func SetupRoutes() { http.HandleFunc("/upload", upload) http.HandleFunc("/remove", remove) http.HandleFunc("/rename", rename) err := http.ListenAndServe(":8080", nil) if err != nil { log.Println(err) return } }
package controllers import ( "fmt" "net/http" "time" jwt "github.com/dgrijalva/jwt-go" "github.com/gin-gonic/gin" utility "github.com/go-ignite/ignite-admin/utils" "github.com/go-ignite/ignite/models" ) func (router *MainRouter) PanelIndexHandler(c *gin.Context) { c.HTML(http.StatusOK, "index.html", nil) } ...
package response import ( "bytes" "io" "net/http" "os" "sync" "time" "github.com/webnice/transport/v3/charmap" "github.com/webnice/transport/v3/content" "github.com/webnice/transport/v3/data" "github.com/webnice/transport/v3/header" ) const ( // Максимальный размер данных загружаемый в память 250Mb maxDa...
// +build never package examples import ( "net/http" "os" "testing" "github.com/gavv/httpexpect" "google.golang.org/appengine/aetest" ) // These tests require installed Google Appengine SDK. // https://cloud.google.com/appengine/downloads // init() is used by GAE to start serving the app // added here for ill...
package main import ( "context" "fmt" "io/ioutil" "strings" "github.com/desdic/godmarcparser/dmarc" "github.com/desdic/godmarcparser/input" log "github.com/sirupsen/logrus" ) // ScanDirectory scans for dmarc reports in various formats func ScanDirectory(ctx context.Context, queue chan<- dmarc.Content, errors...
package gcppubsub import ( "context" "encoding/json" "fmt" "sync" "cloud.google.com/go/pubsub" "github.com/pkg/errors" log "github.com/sirupsen/logrus" "google.golang.org/api/option" "github.com/brocaar/lora-app-server/internal/handler" "github.com/brocaar/lorawan" ) // Config holds the GCP Pub/Sub integr...
package main import ( "fmt" "log" "strings" "time" "github.com/Debian/debiman/internal/archive" "github.com/Debian/debiman/internal/manpage" "pault.ag/go/debian/control" ) // mostPopularArchitecture is used as preferred architecture when we // need to pick an arbitrary architecture. The rationale is that // d...
package models import ( "github.com/astaxie/beego/orm" "time" ) func init() { orm.RegisterModel(&Calendar{}) orm.RegisterModel(&CalendarEvent{}) } type Calendar struct { Id int `json:"id"` Name string `json:"name" orm:"size(128)" form:"name"` Public bool `json:"public"...
package library import "errors" type MusicEntry struct { Id string Name string Artist string Source string Type string } type MusicManager struct { musics []MusicEntry } func NewMusicManager() *MusicManager { return &MusicManager{make([]MusicEntry, 0)} } func (m *MusicManager) Le...
package main import ( "fmt" "log" "os" "github.com/gin-gonic/gin" "github.com/joho/godotenv" "github.com/zhuangalbert/boilerplate/src/api/databases" "github.com/zhuangalbert/boilerplate/src/api/v1/controllers" ) func init() { if godotenv.Load() != nil { log.Fatal("Error loading .env file") } } func main(...
// This program demonstrates how to attach an eBPF program to a uretprobe. // The program will be attached to the 'readline' symbol in the binary '/bin/bash' and print out // the line which 'readline' functions returns to the caller. package main import ( "bytes" "debug/elf" "encoding/binary" "fmt" "log" "os" "...
// Copyright (C) 2015-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 th...
package convert import ( "encoding/json" "fmt" tfv1alpha1 "github.com/isaaguilar/terraform-operator/pkg/apis/tf/v1alpha1" tfv1alpha2 "github.com/isaaguilar/terraform-operator/pkg/apis/tf/v1alpha2" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" ) fun...
package singleton import ( "fmt" "log" "sort" "strings" "sync" "time" "github.com/naiba/nezha/model" pb "github.com/naiba/nezha/proto" "github.com/nicksnyder/go-i18n/v2/i18n" ) const ( _CurrentStatusSize = 30 // 统计 15 分钟内的数据为当前状态 ) var ServiceSentinelShared *ServiceSentinel type ReportData struct { Data...
package material import "github.com/galaco/gosigl" // getGLTextureFormat swap vtf format to openGL format func GLTextureFormatFromVtfFormat(vtfFormat uint32) gosigl.PixelFormat { switch vtfFormat { case 0: return gosigl.RGBA case 2: return gosigl.RGB case 3: return gosigl.BGR case 12: return gosigl.BGRA ...
package lxn import ( "io/ioutil" schema "github.com/liblxn/lxn/schema/golang" "github.com/liblxn/lxnc/internal/locale" ) type input struct { filename string bytes []byte } // Compile parses the given input and determines the locale information which is need // for formatting data. func Compile(loc locale.L...
package main import ( "log" "net/http" "os" "github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/99designs/gqlgen/graphql/playground" "github.com/go-chi/chi" "github.com/gorilla/websocket" "github.com/padulkemid/pingpos/config" "github.com/padulke...
package module import ( "fmt" "io" "github.com/dnaeon/gru/graph" ) // ImportGraph creates a DAG graph of the // module imports for a given module. // The resulting DAG graph can be used to determine the // proper ordering of modules and also to detect whether // we have circular imports in our modules. func Impor...
package main import "fmt" func main() { var ( blue = [3]int{6, 9, 3} red = [3]int{6, 9, 3} ) fmt.Println("Are they equal...", blue == red) var ( arr1 = [...]int{1, 2, 3} //size 3 arr2 = [...]int{1, 2, 3, 4} //size 4 ) _, _ = arr1, arr2 // fmt.Println("Are they equal...", arr1==arr2); // this comp...