text
stringlengths
11
4.05M
package 组合 import "sort" func subsets(nums []int) [][]int { combinations = make([][]int, 0) sort.Ints(nums) formCombinations(nums,[]int{}) return combinations } var combinations [][]int func formCombinations(sortedArray []int, nowCombinations []int) { combinations = append(combinations, NewSlice(nowCombinations...
package main import ( "bufio" "fmt" "io" "io/ioutil" "os" ) //使用buifo包读文件 func readfileBybuifo(){ fileobj,err:=os.Open("./main.go") if err!=nil{ fmt.Printf("open file failed err:%v",err) return } //记得关闭文件 defer fileobj.Close() reader:=bufio.NewReader(fileobj) for{ //创建一个用来从文件中读取内容的对象 res,err:=rea...
// Licensed to SolID under one or more contributor // license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright // ownership. SolID licenses this file to you under // the Apache License, Version 2.0 (the "License"); you may // not use this file except in compli...
package flow import "github.com/guilhermesteves/aclow" type DeletingTodo struct { app *aclow.App } func (n *DeletingTodo) Address() []string { return []string{"deleting_todo"} } func (n *DeletingTodo) Start(app *aclow.App) { n.app = app } func (n *DeletingTodo) Execute(msg aclow.Message, call aclow.Caller) (acl...
package event import ( "github.com/serverless/event-gateway/function" "github.com/serverless/event-gateway/metadata" "go.uber.org/zap/zapcore" ) const ( // TypeHTTPRequest is a special type of event HTTP requests that are not CloudEvents. TypeHTTPRequest = TypeName("http.request") ) // TypeName uniquely identif...
package component import ( "github.com/Azer0s/quacktors" "github.com/Azer0s/quacktors/register" ) //Relay returns a quacktors.Actor that forwards messages //to a named actor. func Relay(pidName string) quacktors.Actor { return &relayComponent{ pidName: pidName, } } type relayComponent struct { pidName string ...
package persistence import ( "database/sql" "errors" "gopetstore/src/domain" "gopetstore/src/util" "log" ) const getItemByIdSQL = `select I.ITEMID,LISTPRICE,UNITCOST,SUPPLIER AS supplierId,I.PRODUCTID AS productId, NAME AS productName,DESCN AS productDescription,CATEGORY AS CategoryId,STATUS, IFNULL(ATTR1, "") A...
package graphql_test import ( "context" "errors" "reflect" "sync" "testing" "time" "github.com/samsarahq/thunder/graphql" "github.com/samsarahq/thunder/graphql/schemabuilder" "github.com/samsarahq/thunder/internal" "github.com/samsarahq/thunder/reactive" ) type User struct { Name string Age int ...
package goproxy import ( "strings" "github.com/sirkon/goproxy/internal/errors" ) type nodeExtension struct { path string node *node } type node struct { f Plugin further []*nodeExtension } func (n *node) addNode(path string, f Plugin) error { return n.realAdd(path, path, f) } func (n *node) getNode(p...
package leetcode /*Given a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only 1 right child. 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/increasing-order-search-tree 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。*...
package nntp import ( "fmt" "html/template" "io" "net/url" ) // Shows a good bye screen. func FinalScreen(out io.Writer) { text := `<html> <head> <title>Loread — The low reader</title> </head> <body> <h1>Good bye…</h1> </body> </html>` out.Write([]byte(text)) } // Produces HTM...
package main var ( mappers map[int]string ) func init() { mappers = map[int]string{ 0: "No Mapper", 1: "MMC1", 2: "UNROM", 3: "CNROM", 4: "MMC3", 5: "MMC5", 6: "FFE F4xxx", 7: "AOROM", 8: "FFE F3xxx", 9: "MMC2", 10: "MMC4", 11: "Colour Dreams", 12: "FFE F6xxx", 13:...
package db import "database/sql" func DbConn() (db *sql.DB) { dbDriver := "mysql" dbUser := "root" dbPass := "mysql123" dbName := "classicmodels" db, err := sql.Open(dbDriver, dbUser+":"+dbPass+"@tcp(172.17.0.2:3306)/"+dbName) if err != nil { panic(err.Error()) } return db }
// // Last.Backend LLC CONFIDENTIAL // __________________ // // [2014] - [2018] Last.Backend LLC // All Rights Reserved. // // NOTICE: All information contained herein is, and remains // the property of Last.Backend LLC and its suppliers, // if any. The intellectual and technical concepts contained // herein are prop...
package dockertree type Root struct { Registry string BasePath string RootNodes []*Node } func (r *Root) AddRootNode(n *Node) { r.RootNodes = append(r.RootNodes, n) } func (r *Root) GetBaseName() string { return r.Registry + r.BasePath }
// Copyright 2021 Google LLC. 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 applica...
package main import ( "fmt" ) func main() { t := []int{73, 74, 75, 71, 69, 72, 76, 73} nT := dailyTemperatures(t) fmt.Println(t) fmt.Println(nT) } func dailyTemperatures(T []int) []int { n := len(T) res := make([]int, n) var stack []int for i := 0; i < n; i++ { t := T[i] for len(stack) > 0 && t > T[stac...
package main import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" ) func main() { _ = fake.NewFakeClient() }
package goini import ( "fmt" "testing" ) func Test(t *testing.T) { iniFile := Init("config.ini") module := iniFile.ReadString("COMMON", "module", "") fmt.Println("module: ", module) }
package main import ( "os" "fmt" "log" "bytes" "net/url" "strconv" "net/http" "io/ioutil" "encoding/json" "github.com/gorilla/mux" ); var NODE_ID int; // find out how to make this const but dynamically defined (ie defined by command line args at runtime, but unchangeable after that) type RelayMessage struc...
package ginx import ( "encoding/json" "fmt" "html/template" "net/http" "net/url" ) type IResponse interface { Json(obj interface{}) IResponse JsonP(object interface{}) IResponse Html(file string, obj interface{}) IResponse Text(format string, values ...interface{}) IResponse Redirect(path string) IRespo...
package leetcode /*Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority element always exist in the array. 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/majority-element 著作权归领扣网...
package main import ( "fmt" "time" "net" "os" "log" "flag" "github.com/titanous/heartbleeder/tls" ) var defaultTLSConfig = tls.Config{InsecureSkipVerify: true} type Host struct { address string state string message string } func main() { numScanners := flag.Int("s", 99, "how many async checks...
package unittest import ( "fmt" "reflect" "testing" "unsafe" ) type storage interface { store() } type storageImpl struct{} func (s *storageImpl) store() { fmt.Println("store in storageImpl") } func createStorageImpl() *storageImpl { return nil } func createStorageImpl2() storage { return nil } // 测试inte...
package main import "fmt" // START OMIT func main() { var i interface{} if i == nil { fmt.Printf("1 i == nil (%v, %T)\n", i, i) } var number int = 42 i = number if i != nil { fmt.Printf("2 i != nil (%v, %T)\n", i, i) } var numberPtr *int = nil i = numberPtr if i != nil { fmt.Printf("3 WTF !!! i != n...
package main import "testing" func TestHello(t *testing.T) { // Declaring a generalized function for checking if the expected // and actual messages are equal or not assertCorrectMessage := func(t *testing.T, got string, want string) { t.Helper() if got != want { t.Errorf("got %q want %q", got, want) } ...
/* * @file * @copyright defined in aergo/LICENSE.txt */ package p2pcommon import ( "testing" "github.com/aergoio/aergo/types" "github.com/stretchr/testify/assert" ) func TestFromPeerAddress(t *testing.T) { type args struct { ip string port uint32 id string } tests := []struct { name string ar...
package handlers import ( // "encoding/json" "github.com/cantdocpp/go-service-example/data" "log" "net/http" ) type Products struct { l *log.Logger } func NewProducts(l *log.Logger) *Products { return &Products{l} } func (p *Products) ServeHTTP(w http.ResponseWriter, r *http.Request) { if r.Method == http.Me...
package eod import ( "fmt" "github.com/Nv7-Github/Nv7Haven/eod/types" "github.com/bwmarrin/discordgo" ) var noModCmds = map[string]types.Empty{ "suggest": {}, "mark": {}, "image": {}, "inv": {}, "lb": {}, "add...
// Copyright (c) 2020 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/licenses/LIC...
/* Given a list of floating point numbers, standardize it. Details A list x1,x2,…,xn is standardized if the mean of all values is 0, and the standard deviation is 1. One way to compute this is by first computing the mean μ and the standard deviation σ and then computing the standardization by replacing every xi with ...
package method_interface import "math" // 接口是由一组方法签名定义的集合,接口类型的变量可以保存任何实现了这些方法的值,即,类型通过实现接口的所有方法来实现这个接口 type Abser interface { Abs() int32 } // 这种类型定义类似于C中的typedef type MyInteger int32 func (i MyInteger) Abs() int32 { if i < 0 { return int32(-i) } return int32(i) } type V struct { X, Y int32 } func (v *V) ...
package main import ( "encoding/json" "fmt" "strconv" "github.com/gorilla/websocket" "github.com/satori/go.uuid" "net" "net/http" "github.com/antonholmquist/jason" "github.com/hypebeast/go-osc/osc" "github.com/gorilla/mux" "flag" ) var DebugMode bool const GoBoHTTPListeningPort = "8100" const GoBoUDPListe...
package weather_controller import ( "github.com/gin-gonic/gin" "interface-testing/api/domain/weather_domain" "interface-testing/api/services" "net/http" "strconv" ) func GetWeather(c *gin.Context){ long, _ := strconv.ParseFloat(c.Param("longitude"), 64) lat, _ := strconv.ParseFloat(c.Param("latitude"), 64) req...
package main import ( "os" "io" "fmt" ) var test = "test_variable" // Printt print some info func Printt(){ fmt.Println("hello world~!!!") } // VariableDefineMulti 变量的重声明 func VariableDefineMulti(){ var err error n, err := io.WriteString(os.Stdout, "Hello, everyone!\n") if err != nil{ f...
package test import ( "fmt" "gengine/builder" "gengine/context" "gengine/engine" "testing" ) const rules_execute string = ` rule "1" "1" begin println("----1-------") end rule "2" "2" begin println("----2-------") end rule "3" "3" begin println("----3-------") end rule "4" "4" begin println("----4-------") en...
package models type ModQueueListing struct { Kind string `json:"kind"` Data ModQueueListingData `json:"data"` } type ModQueueListingData struct { Modhash string `json:"modhash"` Dist float64 `json:"dist"` Children []ModQueueListingChild `json:"children"` } type M...
package main import ( "fmt" "strconv" ) func main() { fmt.Println(countSeniors([]string{ "9751302862F0693", "3888560693F7262", "5485983835F0649", "2580974299F6042", "9976672161M6561", "0234451011F8013", "4294552179O6482", })) } func countSeniors(details []string) int { var ans int for _, d := range ...
/* You are given a string S with length N. You may perform the following operation any number of times: choose a non-empty substring of S (possibly the whole string S) such that each character occurs an even number of times in this substring and erase this substring from S. (The parts of S before and after the erased ...
package realm import ( "archive/zip" "bytes" "encoding/json" "io" "net/http" "github.com/10gen/realm-cli/internal/cli/user" "github.com/10gen/realm-cli/internal/utils/api" ) const ( adminAPI = "/api/admin/v3.0" privateAPI = "/api/private/v1.0" requestOriginHeader = "X-BAAS-Request-Origin" cliHeaderValu...
package test import ( "bytes" "github.com/gin-gonic/gin" "github.com/stretchr/testify/assert" "net/http" "net/http/httptest" "net/url" "proxy_download/common" "proxy_download/initRouter" "testing" ) var router *gin.Engine func init() { router = initRouter.SetupRouter() } func TestUserPostForm(t *testing.T...
package operatorcontroller const ( GroupName = "operatorcontroller.kubeplus" )
package emboxen import "encoding/gob" // This packages defines events sent from building // environment to the Emboxen engine. type BuildEvent interface{} // Sent when buliding program has generated a message useful to // the user. type BuildOutputEvent struct { Output []byte } // Sent when building process has f...
package fakes import ( "github.com/cloudfoundry/bosh-bootloader/commands" "github.com/cloudfoundry/bosh-bootloader/storage" ) type AWSUp struct { ExecuteCall struct { CallCount int Receives struct { UpConfig commands.UpConfig State storage.State } Returns struct { Error error } } } func (u...
package main import ( "encoding/csv" "fmt" "os" "reflect" "strconv" "strings" ) // PersonalInfo you can change this for what you need. type PersonalInfo struct { Name string Surname string Lastname string Sex string Age string Address string City string Zipcode ...
package lib // PageNumber is a convenience type for selecting the page number in the account List request. // Beside regular unsigned numbers, it can have special values First and Last // as the server API can use "first" and "last" keywords instead of numeric page numbers. // To avoid using pointers for page numbers ...
// Copyright 2015 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...
/* Description It is known that Sheffer stroke function (NOT-AND) can be used to construct any Boolean function. The truth table for this function is given below: Truth table for Sheffer stroke function x y x|y 0 0 1 0 1 1 1 0 1 1 1 0 Consider the problem of adding two binary numbers A and B, each containing N bits....
package cosmos import "testing" func TestCosmosDocument(t *testing.T) { client := getDummyClient() coll := client.Database("dbtest").Collection("colltest") doc := coll.Document("doctest") if doc.client.rType != "docs" { t.Errorf("%+v", doc.client) } if doc.client.rLink != "dbs/dbtest/colls/colltest/docs/doc...
/* * Package vgm * * Part of XPMC. * Contains data/functions related to VGM file generation * * TODO: * - Add proper support for the YM2413. * - Add support for the YM3812. * - Add support for the RF5C68 * * /Mic, 2012 */ package vgm import "../utils" const ( // VGM commands...
package data import ( "io" "os" "path" "path/filepath" ) // Unpack unpacks the assets from this package into a target directory. func Unpack(base string, uri string) (err error) { return UnpackWithFilePermissions(base, uri, 0666) } // UnpackWithFilePermissions unpacks the assets from this package into a target ...
package helpers import ( "strings" "time" "github.com/dgrijalva/jwt-go" "github.com/gofiber/fiber/v2" ) type Token struct { Hash string Expire int64 } type AuthConfiguration struct { App_Jwt_Secret string Api_Jwt_Secret string Jwt_Expire int } var AuthConfig *AuthConfiguration func CreateToken(ctx *...
package server import ( "crypto/rand" "fmt" "math/big" "time" "github.com/root-gg/plik/server/common" ) /* Plik cleaning design : - Uploads and files can be removed from the server by two actions : - Manually from the : UI / API / Command line - Automatically when the upload TTL expires -...
package logs const DBSchema = ` CREATE TABLE IF NOT EXISTS message_logs ( id SERIAL PRIMARY KEY, created_at TIMESTAMP WITH TIME ZONE, updated_at TIMESTAMP WITH TIME ZONE, deleted_at TIMESTAMP WITH TIME ZONE, channel_name TEXT, channel_id TEXT, guild_id TEXT, author TEXT, author_id TEXT ); CREATE INDEX IF NO...
package flarmport import "github.com/adrianmo/go-nmea" // PGRMZ - Garmin's barometric altitude // Syntax: // Treat the following three versions as identical although FLARM currently only // delivers the last one: // PGRMZ,<Value>,F,3 // PGRMZ,<Value>,F // PGRMZ,<Value>,F,2 type TypePGRMZ struct { nmea.BaseSentence `...
package paper import "sort" // paperSorte joins a By function and a slice of Papers to be sorted. type paperSorter struct { papers []Paper by func(p1, p2 *Paper) bool } // By is the type of a "less" function that defines the ordering of its Paper arguments. type By func(p1, p2 *Paper) bool // Sort is a method...
package main import "fmt" func main() { fmt.Println(hammingWeight(11)) } func hammingWeight(num uint32) int { count := 0 for i := 0; i < 32; i++ { if num&1 == 1 { count++ } num = num >> 1 if num == 0 { break } } return count }
package main import ( "encoding/json" "fmt" "strings" "os" ) type Book struct { Name string `json:"the_book_name"` Authors []string `json:"the_author_list"` } type User struct { Name string Age int phone string } func line() { fmt.Println(strings.Repeat("-", 30)) } func marshals() { jBool, _ := json.Mar...
package model type Role int const ( Admin Role = iota General ) func (q Role) String() string { return [...]string{"Admin", "General"}[q] } func (q Role) Values() int { return [...]int{0, 1}[q] } type User struct { Id int `json:"id"` Key string `json:"key"` Username string `json:"u...
package x import "github.com/golang/protobuf/proto" //type RPCClientHandler func(cmd string, pb interface{}) interface{} type RPCClientHandler func(cmdSre string, pbIn, pbOut proto.Message) error // all clients struc var RPC_AllClinetsPlay = struct { RPC_Auth RPC_Auth_Client RPC_Chat RPC_Chat_Client RPC_Gen...
package main import ( "bytes" "encoding/base64" "fmt" ) //加密 func EnCrypt(orig, key []byte) string { //将秘钥中的每个字节累加,通过sum实现orig的加密工作 sum := 0 for i := 0; i < len(key); i++ { sum += int(key[0]) } //给明文补码 var pkcs_code = PKCS5Padding(orig, 8) //通过秘钥,对补码后的明文进行加密 for j := 0; j < len(pkcs_code); j++ { pkcs...
package usecase_test import ( "context" "database/sql" "encoding/json" "errors" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/syahidfrd/go-boilerplate/domain" "github.com/syahidfrd/go-boilerplate/domain/mocks" "github.com/syahidfrd/go-boilerplate/trans...
package models /** database/sql 是必须要引入的 */ import ( "database/sql" "github.com/baotingfang/gomvc" "time" ) /** 定义实体类 */ type Todo struct { Id int Title string Finished bool PostDate time.Time } /** 定义List操作 */ func GetTodoLists() (*[]Todo, error) { var db *gomvc.MysqlDB = GetDB() defer db.Clos...
package middle import ( "github.com/CCDirectLink/CCUpdaterCLI" "github.com/CCDirectLink/CCUpdaterCLI/ccmod" "strings" ) // PackedModLocation type PackedModLocation struct { // True for packed mods. This overrules everything else, including Drive. Valid bool Location string Metadata ccmodupdater.PackageMetadata...
package routers import ( "github.com/astaxie/beego/plugins/cors" "oa-flow-centor/controllers" "github.com/astaxie/beego" ) func init() { beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{ AllowAllOrigins: true, AllowOrigins: []string{"http://192.168.43.52"}, AllowMethods: []strin...
// Copyright 2015-2018 trivago N.V. // // 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 main import ( "google.golang.org/grpc" "github.com/indrasaputra/aptx/internal/builder" "github.com/indrasaputra/aptx/internal/config" ) func main() { cfg, cerr := config.NewConfig(".env") checkError(cerr) postgres, perr := builder.BuildPostgresConnPool(cfg.Postgres) checkError(perr) redis, rerr := b...
package main import "work/src/api/app" func main() { app.StartApp() }
package main import ( "fmt" ) func main() { v1 := 100 fmt.Println("Value stored in variable v1::", v1) }
package ircf import "fmt" // From https://www.npmjs.com/package/irc-formatting 1.0.0-rc3 type Block struct { Bold, Italic, Underline, Reverse bool Color, Highlight int Text string } var Empty = NewBlock(nil, "") func NewBlock(prev *Block, text string) *Block { this :...
package config import ( "fmt" "io" "log" "os" ) func createdir(dir string) (bool, error) { _, err := os.Stat(dir) if err == nil { //directory exists return true, nil } err2 := os.MkdirAll(dir, 0755) if err2 != nil { return false, err2 } return true, nil } // SetLogger 设置logger func SetLogger(logg...
package main //TODO: unittests import ( "encoding/json" "flag" "fmt" "github.com/BurntSushi/toml" "github.com/bestmethod/go-logger" "github.com/julienschmidt/httprouter" "github.com/leonelquinteros/gorand" "net/http" "os" "strings" ) type configLogger struct { LogToConsole bool ErrorToStderr bool LogTo...
package main import ( "github.com/mattn/go-oci8" "database/sql" "fmt" "os" "os/exec" "strings"] _ "github.com/mattn/go-oci8" ) func getDSN() string { // same as "sqlplus sys/syspwd@tnsentry as sysdba" //return "sys/Welcome1@?as=sysdba" return "system/Welcome1" } func main() { os.Setenv("NLS_LANG", "") ...
package kimono import ( "encoding/json" "io/ioutil" "net/http" "net/url" ) type Kimono struct { Name string `json:"name"` Count int `json:"count"` Frequency string `json:"frequency"` Version int `j...
package main import ( "flag" "fmt" "net/http" "os" "strings" "time" "github.com/go-kit/kit/log" "github.com/spf13/afero" httptransport "github.com/go-kit/kit/transport/http" "github.com/iineva/ipa-server/cmd/ipasd/service" "github.com/iineva/ipa-server/pkg/httpfs" "github.com/iineva/ipa-server/pkg/storag...
package web import ( "github.com/labstack/echo/v4" "github.com/mixnote/mixnote-api-go/src/framework/handlers" "github.com/mixnote/mixnote-api-go/src/framework/middlewares" ) func RegisterRoutes(e *echo.Echo) { e.GET("/home", handlers.Home().Index) e.Static("/static", "public/assets") e.File("/", "public/index.h...
package main import ( "context" "fmt" "time" ) /** 利用context+channel实现个数控制,当消耗了指定的数目时,就停止子goroutine的实现 如果单单以channel,可以实现吗? 只能控制当前的goroutine,只能在一个函数内,除非将ch定义为全局变量,否则就不能在多个函数中传播, 不像context,可以在多个上下文中传输 */ func onlyChan(ct context.Context, i int) { for { select { case <-ct.Done(): fmt.Printf("子执行了i%d个,就该停止了"...
package test import "testing" type Assert struct { T *testing.T } func A(t *testing.T) *Assert { return &Assert{t} } func (a *Assert) Equal(actualValue interface{}, expectValue interface{}) { assertEqualSkip(a.T, 1, actualValue, expectValue) } func (a *Assert) True(actualValue interface{}) { a.Equal(actualValu...
/* What happens when the CapsLock key on your keyboard doesn't have a notch in it? "This hPPENS." The goal of this program is to consistently emulate keyboard misses where each A press is replaced with CapsLock. Uppercase 'A's from the source should yield the same effect. When CapsLock is enabled, capitalization is ...
package oidc import ( "context" "errors" "net/url" "time" "github.com/google/uuid" "github.com/ory/fosite/handler/oauth2" "github.com/ory/fosite/token/jwt" ) // EncodeJWTSecuredResponseParameters takes the result from GenerateJWTSecuredResponse and turns it into parameters in the form of url.Values. func Enco...
package pattern // patterns // ▤ ▥ ▦ ▧ ▨ ▩ var Symbols = map[string]string{ "horizontal": "▤", "vertical": "▥", "hatch": "▦", "diag1": "▧", "diag2": "▨", "cross_hatch": "▩", }
package main import ( "encoding/json" "fmt" "go/build" "io/ioutil" "log" "net/http" "net/http/httputil" "net/url" "os" "os/exec" "os/user" "path/filepath" "regexp" "strconv" "strings" "sync" "time" "github.com/fluxynet/gorexy/wsutils" "github.com/fsnotify/fsnotify" ) const httpMapping = "http" con...
package boltrepo import ( "encoding/binary" "github.com/boltdb/bolt" "github.com/scjalliance/drivestream/binpath" "github.com/scjalliance/drivestream/fileversion" "github.com/scjalliance/drivestream/resource" ) var _ fileversion.Map = (*FileVersions)(nil) // FileVersions accesses a map of file versions in a bo...
package app import ( "log" "fyne.io/fyne/v2" "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/theme" "fyne.io/fyne/v2/widget" "go.bmvs.io/ynab" "gorm.io/driver/sqlite" "gorm.io/gorm" ) type GlobalState struct { DB *gorm.DB YNABClient ynab.ClientServicer Homescreen fy...
// Copyright 2016 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 main import ( "os" "github.com/go-kit/kit/log" "github.com/prometheus/common/promlog" promlogflag "github.com/prometheus/common/promlog/flag" kingpin "gopkg.in/alecthomas/kingpin.v2" ) const ( helpRoot = `Tool to interact with a remote-adapter and its configuration.` ) var ( defaultLogLevel promlog.A...
package skpsilk import "math" const ( MAX_ORDER_LPC = 16 MAX_CORRELATION_LENGTH = 640 LSF_COS_TAB_SZ_FIX = 128 ) func min_32(a, b int32) int32 { if a < b { return a } return b } func RSHIFT_ROUND(a, shift int32) int32 { if shift == 1 { return (a >> 1) + (a & 1) } else { return ((a >> (shi...
package list import ( "fmt" "testing" ) func TestList_Push(t *testing.T) { l := New() l.PushBack(1) l.PushBack(2) l.PushBack(3) fmt.Println(l.len, l.Values()) l.PushFront(4) l.PushFront(5) l.PushFront(6) fmt.Println(l.len, l.Values()) } func TestList_Remove(t *testing.T) { l := New() n1 := l.PushBack...
package installconfig import ( survey "github.com/AlecAivazis/survey/v2" "github.com/aws/aws-sdk-go/aws/request" "github.com/pkg/errors" "github.com/openshift/installer/pkg/asset" alibabacloudconfig "github.com/openshift/installer/pkg/asset/installconfig/alibabacloud" awsconfig "github.com/openshift/installer/p...
// Copyright 2020 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 package chain import ( "github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/balance" valuetransaction "github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/transaction" "github.com/iotaledger/wasp/packages/coretypes" "github...
/* For license and copyright information please see LEGAL file in repository */ package uip // DecryptRoutingPart usually use in encrypted connection from OS to UIP Router! // Default frame size is 128bit due cipher block size but peer can change by settings. func (p *Packet) DecryptRoutingPart(frameSize uint16, encr...
package gogrib2 import ( "io" ) // fetchSection expects the reader to be at the start of a GRIB2 section. // It does not matter which one. // This function returns the section number, a slice containing the data or an error if the section could not be read properly. func fetchSection(data io.Reader) (int, []byte, er...
package main import ( "encoding/json" "fmt" "net/http" "net/http/httptest" "time" "github.com/gorilla/mux" ) var rrBookings *httptest.ResponseRecorder var req *http.Request func aRequestIsCreatedForTheEndpoint(method, endpoint string) error { var _ error if requestBody == nil { req, _ = http.NewRequest(me...
package main import ( "database/sql" "encoding/json" "log" "net/http" "github.com/elgs/gosqljson" _ "github.com/lib/pq" "github.com/rs/cors" ) // http://localhost:8080/customers/list func getCustomerList() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Typ...
package model import "time" type ShareRQ struct { Account int `json:"account"` Group int `json:"group"` Guests string `json:"guest"` ExpiredAt *time.Time `json:"expired_at"` Permission string `json:"permission"` Message string `json:"message,omitempty"` } type Transfer...
package qfileop import ( "errors" "fmt" "github.com/evnix/ashtra/server/binhelp" "github.com/satori/go.uuid" "hash/crc32" "io/ioutil" "os" "strconv" ) var version int64 = 1 var minSupportedVersion int64 = 1 type QFileOp struct { filePath string pushId int64 pushFP *os.File pushDataFP...
package errmsg const ( SUCCEED = 200 ERROR = 500 // code = 1000... 用户模块的错误 ERROR_USERNAME_USED = 1001 ERROR_PASSWORD_WRONG = 1002 ERROR_USER_NOT_EXIST = 1003 ERROR_TOKEN_EXIST = 1004 ERROR_TOKEN_RUNTIME = 1005 ERROR_UTOKEN_WRONG = 1006 ERROR_TOKEN_TYPE_WRONG = 1007 ERROR_USER_NO_RIGHT ...
// Copyright 2011 Gary Burd // Copyright 2013 Unknown // // 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 applica...
package splunkforwarder import ( "context" "strconv" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/runtime" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" logf "sigs.k8s.io/controller-runtime/pkg/log" configv1 "github.com/openshift/api/config/v1" appsv1 "k8s.io/api/a...
package main import ( "fmt" "io" "net/http" "os" ) type englisBot struct{} type bot interface { getGreeting(int) string } func (en englisBot) getGreeting(i int) string { return "hello" } type ownWriter struct { content string } func (ow ownWriter) Write(p []byte) (n int, err error) { ow.content = string(p...