text
stringlengths
11
6.3k
embedding
listlengths
768
768
func UnmarshalPrivate(key string) (*ecdsa.PrivateKey, error) { block, _ := pem.Decode([]byte(key)) if block == nil { return nil, errors.New("no PEM block found in private key") } privKey, err := x509.ParseECPrivateKey(block.Bytes) if err != nil { return nil, err } return privKey, nil }
[ -0.2336684763431549, 0.47384634613990784, 0.7976958751678467, -1.005867600440979, -0.925717830657959, -0.7646201252937317, -0.0792035236954689, -0.31152766942977905, -0.3260992467403412, 0.5514434576034546, 0.09127883613109589, -0.010258152149617672, -0.8145724534988403, 0.1458152830600738...
func UnmarshalPublic(key string) (*ecdsa.PublicKey, error) { block, _ := pem.Decode([]byte(key)) if block == nil { return nil, errors.New("no PEM block found in public key") } pubKey, err := x509.ParsePKIXPublicKey(block.Bytes) if err != nil { return nil, err } ecdsaPubKey, ok := pubKey.(*ecdsa.PublicKey) i...
[ 0.343386709690094, 0.9371446967124939, 0.5105027556419373, -0.9107455611228943, -1.340278148651123, -0.4576888978481293, 0.1360725313425064, 0.009575855918228626, -0.6985962986946106, 0.5557187795639038, -0.05671210214495659, -0.08851589262485504, 0.0480455718934536, -0.5421422123908997, ...
func MarshalPublic(key *ecdsa.PublicKey) (string, error) { if key == nil || key.Curve == nil || key.X == nil || key.Y == nil { return "", fmt.Errorf("key or part of key is nil: %+v", key) } key.Curve = fixCurve(key.Curve) rawPriv, err := x509.MarshalPKIXPublicKey(key) if err != nil { return "", err } keyB...
[ 0.4117198884487152, 0.6293818354606628, 0.5312342643737793, -0.2527792751789093, -1.3558776378631592, 0.2953293025493622, -0.29572948813438416, -0.14679531753063202, -0.1097150519490242, 0.694953203201294, -0.025768930092453957, 0.5820825099945068, 0.4061415195465088, 0.5119986534118652, ...
func Sign(operation []byte, privKey ecdsa.PrivateKey) (signedR, signedS *big.Int, err error) { r, s, err := ecdsa.Sign(rand.Reader, &privKey, operation) if err != nil { return big.NewInt(0), big.NewInt(0), err } signedR = r signedS = s return }
[ -1.0958225727081299, 0.1184515729546547, 0.4650445878505707, -0.4417952597141266, -0.3647354245185852, -0.521895170211792, 0.5912213325500488, 0.8160387873649597, 0.8915883302688599, 0.1307961642742157, -0.7742732763290405, 0.07482324540615082, -0.29612553119659424, 0.1119643822312355, 0...
func Hash(a interface{}) (string, error) { h := sha1.New() if err := json.NewEncoder(h).Encode(a); err != nil { return "", nil } return base64.URLEncoding.EncodeToString(h.Sum(nil)), nil }
[ 0.01896464079618454, 0.5763723254203796, 0.8054044842720032, 0.9317474961280823, -1.0992051362991333, 0.8971966505050659, -0.03044399432837963, 0.3749607503414154, 0.8400080800056458, 0.7648830413818359, 0.3474888503551483, 0.8982431888580322, 0.5866209268569946, 0.21873688697814941, 0.1...
func (s *AccountService) GetInformation() (*Account, error) { u := fmt.Sprintf(pathAccount, s.client.baseURL) var out Account err := s.client.DoPrivate(u, http.MethodGet, nil, &out) return &out, err }
[ -0.7494169473648071, 0.20274618268013, 0.3424634635448456, 0.6082894206047058, 0.5267142653465271, -0.9538216590881348, 0.6542848348617554, -0.8745937347412109, 0.3162873387336731, -0.38034185767173767, -0.2205207794904709, 1.1323719024658203, -0.4673019051551819, -0.02183382213115692, 0...
func (s *AccountService) GetPositions() ([]Position, error) { u := fmt.Sprintf(pathPositions, s.client.baseURL) var out []Position err := s.client.DoPrivate(u, http.MethodGet, nil, &out) return out, err }
[ -1.3263925313949585, 0.5582253336906433, 0.42452308535575867, 0.7281322479248047, 1.1133215427398682, -0.3336142599582672, 0.24291963875293732, -0.43767642974853516, 0.1569361537694931, -0.401346892118454, 0.13341112434864044, 0.275144100189209, -1.1250200271606445, 0.08201999217271805, ...
func (s *AccountService) SetLeverage(x int) error { u := fmt.Sprintf(pathAccountLeverage, s.client.baseURL) in := RequestLeverage{Leverage: x} return s.client.DoPrivate(u, http.MethodPost, &in, nil) }
[ -0.9004285931587219, 0.7299515604972839, 0.5227213501930237, -0.27722370624542236, 0.4288124144077301, 0.056913819164037704, -0.6835768222808838, -0.5191173553466797, 0.059026848524808884, 0.3326779305934906, -0.28680774569511414, 0.37957820296287537, -1.2287191152572632, 0.647200047969818...
func (c *Client) SetVerbose(verbose bool) { c.verbose = verbose if c.rpc != nil { c.rpc.Verbose = verbose } }
[ 0.17848555743694305, 0.773351788520813, 0.6690306663513184, 0.5062222480773926, 1.5945664644241333, 0.3648603558540344, -0.5552321076393127, -0.003488612826913595, -0.6770636439323425, 0.24823518097400665, 0.11173055320978165, 1.1987905502319336, -2.09314227104187, 1.187964677810669, -0....
func (c *Client) HandleDisconnect(cb func()) { c.discCb = &cb }
[ 0.9338074326515198, -0.2698453366756439, 0.43022608757019043, -0.3669072091579437, -0.020664164796471596, 0.6224274039268494, 0.9742321968078613, -0.17327013611793518, -0.6694479584693909, -0.9492536783218384, -0.8116413354873657, -0.5490353107452393, 0.05139956995844841, -0.21821016073226...
func (c *Client) ConnectLocal(ip, port string) error { c.IP = ip c.Port = port err := c.connectRPC() if err != nil { return err } return c.handshake() }
[ 0.029817448928952217, -0.7229247093200684, 0.4298710823059082, 0.3614231050014496, 0.011446070857346058, -0.2519894242286682, -0.6009606719017029, -0.02130925841629505, -0.35300517082214355, 0.4706936180591583, 0.3899027109146118, -0.31336313486099243, -0.5762346386909485, -0.2592270076274...
func (c *Client) ConnectRemote(id, accessToken string, useRefl ...*reflector.Client) error { var refl reflector.Client if len(useRefl) == 0 { refl = reflector.NewClient(accessToken) } else { refl = *useRefl[0] } call, err := refl.CallPrinter(id) if err != nil { return err } split := strings.Split(call.C...
[ -0.6117311716079712, -0.3313688039779663, 0.8078826665878296, -0.07077869027853012, -0.5282624363899231, 0.37832140922546387, -0.7196820378303528, -0.7551541924476624, 0.13416403532028198, 0.2065717577934265, -0.24111679196357727, 0.9750418663024902, -1.1853033304214478, -0.087125569581985...
func (c *Client) Close() error { if c.rpc == nil { return nil // Nothing to do } return c.rpc.Close() }
[ 0.3426204323768616, 0.23421333730220795, 0.5137077569961548, -0.6625471711158752, 0.4398627281188965, 0.715141236782074, 0.16251403093338013, -1.1471182107925415, -0.26361915469169617, -0.610399067401886, 0.5161502957344055, 0.29159197211265564, -2.3182897567749023, 0.5663084387779236, 0...
func (c *Client) HandleStateChange(cb func(old, new *PrinterMetadata)) { c.stateCbs = append(c.stateCbs, cb) }
[ -0.28985390067100525, -0.11573632806539536, 0.5037786960601807, -0.24916276335716248, 0.1962329000234604, 0.613574206829071, -0.539740264415741, -0.6603397727012634, 0.14963850378990173, -0.003528816858306527, -0.32403048872947693, 0.21970124542713165, -0.49094757437705994, 0.8110075592994...
func (c *Client) HandleCameraFrame(cb func(frame *CameraFrame)) { c.cameraCbs = append(c.cameraCbs, cb) go c.requestCameraStream() }
[ -0.06860954314470291, -0.07690033316612244, 0.26086893677711487, 0.9526626467704773, 0.03941996395587921, -0.6330941319465637, 0.29576921463012695, -0.44443395733833313, 0.8810431957244873, -0.6111894249916077, -1.230853796005249, -0.23673537373542786, -0.6203687787055969, 0.59638947248458...
func (c *Client) AuthenticateWithThingiverse(token, username string) error { accessToken, err := c.getThingiverseAccessToken(token, username) if err != nil { return err } _, err = c.authenticate(*accessToken) return err }
[ -0.5513755679130554, -0.12012622505426407, 0.5378630757331848, 0.6709018349647522, -0.08069848269224167, -0.43433815240859985, -1.025380253791809, -0.9421126842498779, -0.2593696415424347, 0.11642514169216156, -0.4646102488040924, 0.38541507720947266, -0.39587321877479553, -0.2784766554832...
func (h *FlinkApplicationQueryHandler) Create(ctx context.Context, project, service, applicationId string, req CreateFlinkApplicationQueryRequest) (*CreateFlinkApplicationQueryResponse, error) { path := buildPath("project", project, "service", service, "flink", "application", applicationId, "query") bts, err := h.cli...
[ -0.43033695220947266, -0.06530711054801941, 0.238631471991539, 0.23863251507282257, -0.5856384634971619, 0.7243456244468689, 0.3481108248233795, -0.728788435459137, -0.2818075716495514, 0.08291858434677124, 0.7873606085777283, 0.5055444836616516, -0.7906296253204346, 0.9903262853622437, ...
func (h *FlinkApplicationQueryHandler) Get(ctx context.Context, project, service, applicationId, queryId string) (*GetFlinkApplicationQueryResponse, error) { path := buildPath("project", project, "service", service, "flink", "application", applicationId, "query", queryId) bts, err := h.client.doGetRequest(ctx, path, ...
[ -0.2554304599761963, -0.16056126356124878, 0.34485918283462524, -0.23960405588150024, -0.2607938051223755, 0.2954539954662323, -0.18448495864868164, -0.5901480317115784, 0.06004723533987999, -0.06598861515522003, 0.9017962217330933, 1.583512306213379, -0.7248231172561646, 0.248672977089881...
func (h *FlinkApplicationQueryHandler) Delete(ctx context.Context, project, service, applicationId, queryId string) error { path := buildPath("project", project, "service", service, "flink", "application", applicationId, "query", queryId) bts, err := h.client.doDeleteRequest(ctx, path, nil) if err != nil { return ...
[ 0.23787429928779602, -0.25713205337524414, 0.21582220494747162, 0.19438783824443817, -0.23214389383792877, 0.7862235307693481, 0.11466778814792633, -0.4525687098503113, 0.403160959482193, 0.41595420241355896, 1.0182268619537354, 1.1808043718338013, -0.9474558234214783, 0.17375154793262482,...
func (h *FlinkApplicationQueryHandler) List(ctx context.Context, project, service, applicationId string) (*ListFlinkApplicationQueryResponse, error) { path := buildPath("project", project, "service", service, "flink", "application", applicationId, "query") bts, err := h.client.doGetRequest(ctx, path, nil) if err != ...
[ -0.3597303032875061, -0.5324064493179321, 0.23297837376594543, -0.013252613134682178, -0.342477411031723, 0.08954198658466339, 0.1385892778635025, -0.24445569515228271, 0.45935529470443726, 0.5450701713562012, 0.33901605010032654, 0.8029431700706482, -0.49609696865081787, 0.663291931152343...
func (h *FlinkApplicationQueryHandler) CancelJob(ctx context.Context, project, service, applicationId, queryId string) (*CancelJobFlinkApplicationQueryResponse, error) { path := buildPath("project", project, "service", service, "flink", "application", applicationId, "query", queryId, "cancel_job") bts, err := h.clien...
[ 0.6709783673286438, 0.04376381263136864, 0.47676873207092285, 0.24243809282779694, -0.5029135942459106, 0.9030803442001343, 0.23724618554115295, -0.11305225640535355, 0.24491332471370697, -0.41767945885658264, 0.8497898578643799, 0.7627435326576233, -0.672938346862793, 0.07936800271272659,...
func NewContext() (c *Context) { c = new(Context) c.Ctx, c.Cancel = context.WithCancel(context.Background()) // don't block if DB and NATS terminated with an error together c.Err = make(chan error, 2) return }
[ 0.7873551845550537, 0.20027847588062286, 0.4229869544506073, 0.6149360537528992, -0.10019602626562119, 0.10198237746953964, -0.7778944969177246, -0.7506204843521118, 0.34860748052597046, -0.07741368561983109, 0.33061015605926514, 0.21159955859184265, -0.12032271921634674, 0.146832466125488...
func (c *Context) Terminate(err error) { if err == context.Canceled { c.Err <- nil // no errors, a legal cancel, already canceled return } c.Err <- err c.Cancel() }
[ 0.8917121887207031, 0.030398402363061905, 0.30632510781288147, 0.622754693031311, -0.2803920805454254, 0.08395590633153915, -1.0352662801742554, 0.13995715975761414, 1.531262993812561, -0.6858953237533569, -0.38965752720832825, -0.8106862902641296, -0.25424787402153015, 0.25898128747940063...
func (c *Context) Terminatef(format string, args ...interface{}) { c.Terminate(fmt.Errorf(format, args...)) }
[ 0.23979860544204712, -0.13464266061782837, 0.4375307857990265, 0.1640467494726181, 1.024986743927002, -0.5394546389579773, -0.46739816665649414, -0.16835087537765503, -0.46586108207702637, -0.6527578830718994, -0.4932423532009125, -0.2886868417263031, 0.10460999608039856, 0.304587513208389...
func (c *Context) Errs() (err error) { select { case err = <-c.Err: default: } return }
[ -0.28654029965400696, 0.4257354438304901, 0.12535308301448822, -0.07893634587526321, 0.5316518545150757, -0.39914289116859436, -0.6394794583320618, -0.8931291103363037, 0.8806251287460327, -0.749087393283844, 0.8783812522888184, 0.5830602645874023, -0.2258136123418808, -0.6213082671165466,...
func (c *Config) FromFlags(fset *flag.FlagSet, prefix string) { flag.StringVar(&c.DBAddr, prefix+"db-addr", c.DBAddr, "cockroachdb server's address") flag.IntVar(&c.DBPort, prefix+"db-port", c.DBPort, "cockroachdb server's port") flag.StringVar(&c.DBName, prefix+"db-name", c.DBName, "database name"...
[ 0.49998489022254944, 0.24334804713726044, 0.20390763878822327, -1.497761845588684, 0.12282917648553848, -0.03281436860561371, -1.1754167079925537, -0.4172496497631073, -1.1203221082687378, 0.0804847851395607, -0.675588071346283, 1.0312010049819946, 0.16495433449745178, 0.6985250115394592, ...
func (c *Config) OpenDBURL() string { return fmt.Sprintf("postgresql://%s@%s:%d/%s?sslmode=disable", c.DBUser, c.DBAddr, c.DBPort, c.DBName) }
[ -0.5756345987319946, 0.10574465990066528, 0.6711501479148865, 0.2787304222583771, -0.35450583696365356, 1.358969807624817, 0.11920502036809921, 0.10565976798534393, -0.8553802967071533, 0.18151246011257172, -0.0062297252006828785, 0.36088141798973083, -0.6721588373184204, 0.098183333873748...
func NewDB(conf *Config) (db *DB, err error) { db = new(DB) db.DB, err = sql.Open("postgres", conf.OpenDBURL()) // TODO (kostyarin): configure db: max idle, max open, lifetime, etc // using hardcoded values, or keeping the values in // the Config return }
[ -0.12166468799114227, 0.37582099437713623, 0.3099033534526825, 1.5160690546035767, -0.3252885937690735, 0.3514605164527893, 0.2837393283843994, 0.3602343797683716, 0.07151488214731216, 0.15597845613956451, 0.2536238133907318, 0.058629486709833145, -0.23316241800785065, 0.3434741199016571, ...
func (db *DB) Init(ctx *Context) (err error) { const createTable = `CREATE TABLE IF NOT EXISTS ` + tableName + ` ( id SERIAL PRIMARY KEY, header VARCHAR(255), data TEXT )` _, err = db.DB.ExecContext(ctx.Ctx, createTable) return }
[ -0.1412651687860489, 0.6831332445144653, 0.4883355498313904, 0.13456043601036072, 0.5887780785560608, 0.9345113635063171, -0.013921119272708893, -0.21963544189929962, -0.7180962562561035, -0.3845192790031433, 0.08005522191524506, 0.8004447817802429, -0.44978541135787964, 0.4701524078845978...
func (db *DB) Select( ctx *Context, id int64, ) ( ni *msg.NewsItem, err error, ) { const selectNewsItem = `SELECT * FROM ` + tableName + ` WHERE id = $1` ni = new(msg.NewsItem) err = db.DB.QueryRowContext(ctx.Ctx, selectNewsItem, id).Scan( &ni.ID, &ni.Header, &ni.Data, ) return }
[ -0.2847180962562561, 0.5991217494010925, -0.06627367436885834, 0.5796314477920532, -0.5977545976638794, -0.5394006967544556, -0.9910010099411011, -1.3837616443634033, 0.155033677816391, -0.5594573616981506, -0.23117399215698242, 0.196675106883049, -0.3134229779243469, 0.3224450945854187, ...
func NewQQ(ctx *Context, conf *Config, db *DB) (qq *QQ, err error) { qq = new(QQ) if qq.Conn, err = nats.Connect(conf.NATSURL); err != nil { return nil, fmt.Errorf("conencting NATS: %v", err) } qq.Subs, err = qq.Conn.Subscribe( conf.Subject, // strings.Replace(conf.Subject, "_", ".", -1) qq.handler(ctx, db), ...
[ -0.5027381181716919, -0.4604428708553314, 0.6193552613258362, -0.021172204986214638, -0.5952535271644592, -0.08892156183719635, -1.0711703300476074, -0.7192137837409973, -0.6227455139160156, -0.02063322253525257, -0.47843611240386963, 0.5987253785133362, 0.5155687928199768, 0.5881431102752...
func startStats(l *logrus.Logger, c *config.C, buildVersion string, configTest bool) (func(), error) { mType := c.GetString("stats.type", "") if mType == "" || mType == "none" { return nil, nil } interval := c.GetDuration("stats.interval", 0) if interval == 0 { return nil, fmt.Errorf("stats.interval was an in...
[ 0.3858453333377838, 0.36268723011016846, 0.5710544586181641, 0.38775432109832764, 0.2862289547920227, -0.2131260186433792, 0.6275218725204468, -0.7500579357147217, 0.42970961332321167, -0.5917484760284424, 0.01623077504336834, 1.1266297101974487, -0.032964881509542465, 0.38951560854911804,...
func maximumPeople(p []int64, x []int64, y []int64, r []int64) int64 { free := int64(0) events := generateCache(p, x, y, r) sum := make(map[int64]int64, 0) clouds := make(map[int64]bool, 0) for _, e := range events { if e.t == 0 { clouds[e.idx] = true } else if e.t == 1 { if len(clouds) == 0 { free...
[ -0.008066375739872456, 0.2680233418941498, 0.9065366983413696, 0.5157989263534546, -0.8109229803085327, 0.008152913302183151, 0.40156611800193787, 0.0855928361415863, 0.08786365389823914, 0.895759105682373, 0.07747813314199448, -0.7184390425682068, -0.8793305158615112, 0.14007695019245148,...
func generateCache(p []int64, x []int64, y []int64, r []int64) []event { events := make([]event, 0) for i := 0; i < len(p); i++ { e := event{ t: 1, x: x[i], p: p[i], idx: int64(i), } events = append(events, e) } for i := 0; i < len(y); i++ { e0 := event{ t: 0, x: y[i] - r[i], ...
[ -0.30529725551605225, 0.2527008056640625, 1.2121169567108154, 0.13097158074378967, -0.17852254211902618, 0.37311676144599915, 0.3292740285396576, -0.4815358817577362, 0.14494545757770538, 1.3440580368041992, -0.22192780673503876, -0.3442462384700775, -0.25235915184020996, -0.11717661470174...
func findMax(sum map[int64]int64) int64 { dx := int64(0) for _, v := range sum { dx = int64(math.Max(float64(dx), float64(v))) } return dx }
[ -0.3665635287761688, 0.6089164018630981, 0.46592652797698975, 0.7321833372116089, -0.3392075300216675, -0.6248611211776733, -0.15630093216896057, -0.7997927069664001, 0.1623820960521698, 0.032742731273174286, 0.3306449353694916, -0.1367644965648651, -0.029524534940719604, 0.658733546733856...
func (o *UpdateVmcCloudAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewUpdateVmcCloudAccountOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return...
[ 0.2475610375404358, -1.118451714515686, 0.7387855648994446, 0.645742654800415, -0.040808696299791336, -1.0613454580307007, 0.345100998878479, -0.01727142557501793, 0.42197275161743164, 1.1094056367874146, 0.6652472615242004, -0.009821461513638496, -1.2315642833709717, -0.6654287576675415, ...
func NewUpdateVmcCloudAccountOK() *UpdateVmcCloudAccountOK { return &UpdateVmcCloudAccountOK{} }
[ 0.5293548703193665, -0.7803117632865906, 0.17893053591251373, 1.2607117891311646, -0.643774688243866, -0.08246781677007675, 1.15377938747406, 0.8628053069114685, -0.5461451411247253, 1.5436702966690063, 0.08963125199079514, 0.19146016240119934, -0.6238415837287903, -0.19424207508563995, ...
func NewUpdateVmcCloudAccountForbidden() *UpdateVmcCloudAccountForbidden { return &UpdateVmcCloudAccountForbidden{} }
[ 1.2655723094940186, 0.1514333188533783, 0.28543320298194885, 1.0365848541259766, -0.5109118819236755, 0.15614597499370575, 0.5440613627433777, -0.16886404156684875, -0.8390355706214905, 0.6591048240661621, 0.13200516998767853, 0.6756261587142944, -1.3755024671554565, -1.2487627267837524, ...
func NewUpdateVmcCloudAccountNotFound() *UpdateVmcCloudAccountNotFound { return &UpdateVmcCloudAccountNotFound{} }
[ 0.780035674571991, -1.0270370244979858, 0.15895089507102966, 0.382426381111145, 0.08447198569774628, 0.47341188788414, 0.3977075219154358, 0.22032424807548523, -0.6428938508033752, 1.13252854347229, -0.11252587288618088, 0.3884955644607544, -1.1246501207351685, -0.4032624065876007, 0.268...
func IntAdd(x int, y int) int { return x + y }
[ 0.2999855577945709, -0.6842029094696045, 0.5849687457084656, -0.7969500422477722, -0.770401656627655, 0.9801411032676697, -1.092801809310913, -0.9788458943367004, -0.14106078445911407, 0.21152110397815704, 0.32913389801979065, 0.7389057874679565, -0.7669416666030884, -0.4054652154445648, ...
func main() { natruals := make(chan int) squares := make(chan int) //counter go func() { for i := 0; i < 100; i++ { natruals <- i } close(natruals) }() //squarer go func() { for x := range natruals { squares <- x * x } close(squares) }() //Printer for x := range squares { fmt.Println(x...
[ -0.31609976291656494, -0.07263574004173279, 0.6415106654167175, -0.2538968026638031, -0.3508877456188202, 0.6502623558044434, 0.6529324054718018, -1.164825677871704, -0.5328813791275024, -0.32270142436027527, 0.3946419954299927, 1.0690802335739136, 0.4799804091453552, 0.3991703391075134, ...
func decodePutRequest(contentType string, r *http.Request) (zapcore.Level, error) { if contentType == "application/x-www-form-urlencoded" { return decodePutURL(r) } return decodePutJSON(r.Body) }
[ -0.9462667107582092, -0.6125235557556152, 0.4534917175769806, -0.234846830368042, -0.9226850271224976, 0.08537817001342773, 0.06950467079877853, -0.49032559990882874, 0.21304327249526978, 0.5969139337539673, 0.16847188770771027, 0.4104672968387604, -0.7641635537147522, 0.5555256605148315, ...
func Must(err error) bool { if err != nil { if panicOnErrorMode { panic(err) } else { klog.Errorf("%s", err) return false } } return true }
[ -0.49818941950798035, 0.2867845594882965, 0.42167073488235474, 0.14846044778823853, -0.7902052402496338, 1.1588106155395508, -1.1340205669403076, 0.20201733708381653, -0.054015934467315674, -0.05960078909993172, -0.8108882308006287, 0.10663658380508423, -0.0010636697988957167, 1.2160294055...
func Filter(handlerFunc http.HandlerFunc) http.HandlerFunc { return func(writer http.ResponseWriter, request *http.Request) { // Verify the JWT token _, err := ExtractToken(request) if err != nil { http2.HandleUnauthorizedError(writer, request.RequestURI, err) return } // Call the next filter handl...
[ 0.323372483253479, 0.17646104097366333, 0.5072218775749207, 0.306450754404068, -1.332009196281433, -0.011206845752894878, 0.06233000382781029, 0.15432856976985931, -0.35871055722236633, -0.4425787627696991, -0.21025444567203522, 0.7291969060897827, 0.47865161299705505, -0.24902696907520294...
func NewQueryPart(name string) *QueryPart { return &QueryPart{ Value: name, Arguments: make(map[string]string), SubFields: []*QueryPart{}, requiredArgs: []string{}, } }
[ 0.6087343692779541, -0.5387459397315979, 0.11513790488243103, -0.8409321904182434, -1.5728265047073364, 0.5419821739196777, -0.821115255355835, -1.1531018018722534, -0.04954666644334793, 0.3419109880924225, -0.7582714557647705, 0.03948833793401718, -0.9444397687911987, 0.4366733133792877, ...
func SetTest() { gin.SetMode(gin.TestMode) }
[ 0.4773572087287903, 0.8386737108230591, 0.24646995961666107, 0.9084278345108032, 1.3420251607894897, 0.8259916305541992, 0.7093028426170349, -0.04898799955844879, -0.5750015377998352, -0.34902700781822205, -0.17256632447242737, 0.4231266677379608, -0.7234233617782593, 0.13642843067646027, ...
func New(port string) *Engine { g := gin.New() g.Use(gin.Recovery()) g.GET("/ping", func(c *gin.Context) { c.String(200, "pong") }) return &Engine{g, port} }
[ 0.15781618654727936, -0.3600783944129944, 0.4765569865703583, 0.053672730922698975, 0.10896126925945282, 0.04730227217078209, -0.21916913986206055, -0.22524483501911163, -1.1924076080322266, -0.46511542797088623, -0.09212074428796768, 0.40736109018325806, 0.4597240388393402, 0.099985219538...
func (e *Engine) Static(path, location string) { e.gin.Static(path, location) }
[ -1.0189486742019653, -0.7617789506912231, 0.17367473244667053, -0.4784431755542755, 0.2748416066169739, 0.24929066002368927, 0.2002992182970047, 0.4108981490135193, -1.3061749935150146, 0.19036775827407837, -0.35938116908073425, 0.6648653745651245, 1.1663254499435425, 0.021563764661550522,...
func (e *Engine) UseLogger() { e.gin.Use(gin.Logger()) }
[ -0.5806637406349182, 0.487145334482193, 0.6308521032333374, -0.019267896190285683, 1.0762951374053955, -0.7990878224372864, 0.4812934696674347, 0.4399688243865967, -0.6128851175308228, -0.7016890048980713, 0.9323768615722656, -0.474307656288147, 0.07930399477481842, 1.8803125619888306, 0...
func (e *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) { e.gin.ServeHTTP(w, req) }
[ -0.035535551607608795, 0.3947368860244751, 0.3880738317966461, 0.9898059964179993, 1.1142568588256836, 0.8922542929649353, -0.06173693388700485, 0.002484716009348631, -1.0711126327514648, 0.5322204828262329, 0.6311774253845215, 0.07983698695898056, 0.2594894468784332, 0.5286266803741455, ...
func (e *Engine) Group(prefix string) *RouterGroup { return &RouterGroup{e.gin.Group(prefix)} }
[ -0.43675822019577026, 1.0785890817642212, 0.15291650593280792, -0.3278387486934662, -0.2492106556892395, -0.466115266084671, -0.14697255194187164, -0.24306930601596832, -0.32818615436553955, -0.05813015624880791, 0.36981314420700073, 0.9291728734970093, 0.40928611159324646, 0.6288289427757...
func (e *Engine) GET(path string, fn Controller) { e.gin.GET(path, adapt(fn)) }
[ -0.14860641956329346, -0.13802310824394226, 0.2902234196662903, -0.3656790852546692, 0.9313588738441467, -0.7710385322570801, -0.5902963876724243, 0.39177507162094116, -1.020493984222412, -0.6334400773048401, 0.477281779050827, 0.9418506026268005, 1.0353728532791138, -0.5526198744773865, ...
func (e *Engine) PATCH(path string, fn Controller) { e.gin.PATCH(path, adapt(fn)) }
[ -0.01455045398324728, -0.5750004053115845, 0.10442394018173218, -0.29575908184051514, 0.04168470948934555, 0.5463910698890686, -0.017905578017234802, 1.048685073852539, -0.33584994077682495, -0.6402629613876343, 0.46774762868881226, 0.6264963150024414, 1.029000997543335, -0.116150490939617...
func (e *Engine) POST(path string, fn Controller) { e.gin.POST(path, adapt(fn)) }
[ 0.29488030076026917, -0.10071184486150742, 0.2233620285987854, 0.578073263168335, 0.12378323078155518, -0.15760311484336853, -0.35690563917160034, 0.3953610956668854, -0.8268765211105347, -1.3617241382598877, -0.18030202388763428, -0.2793252468109131, 0.6755317449569702, 0.0133789628744125...
func (e *Engine) PUT(path string, fn Controller) { e.gin.PUT(path, adapt(fn)) }
[ -0.05131247639656067, 0.2352074533700943, 0.2247694581747055, -0.6068337559700012, 0.523474931716919, 0.07870757579803467, 0.3767859637737274, 0.7350994944572449, -0.8754655718803406, -0.2501576542854309, -0.12763799726963043, 0.4439147710800171, 0.3323590159416199, -0.3798368275165558, ...
func (e *Engine) Any(path string, fn Controller) { e.gin.Any(path, adapt(fn)) }
[ -0.18991796672344208, -0.300991415977478, 0.4141054153442383, 0.3370957374572754, 0.5224055647850037, -0.45255836844444275, -0.26007482409477234, 0.6022868156433105, -0.9619880318641663, -0.9390925765037537, 0.8069055080413818, 0.22699013352394104, 0.9155811667442322, 0.2766996920108795, ...
func (e *Engine) Run() error { return e.gin.Run(":" + e.port) }
[ -0.49900689721107483, -0.329048216342926, 0.3223714232444763, 0.2183673083782196, 1.2590270042419434, 0.4507661759853363, 0.5691856741905212, 0.5657662749290466, -1.20134699344635, 0.06825417280197144, -0.16567641496658325, 0.570685863494873, -0.3189879059791565, 0.14927175641059875, 0.3...
func (r *RouterGroup) UseLogger() { r.gin.Use(gin.Logger()) }
[ -0.9013350605964661, 0.7326639294624329, 0.6339225172996521, -0.38725215196609497, 0.4236987829208374, -1.0534130334854126, 0.5105705857276917, 0.13571296632289886, -0.8143408894538879, -0.457062304019928, 1.0764449834823608, -0.29204538464546204, -0.7065724730491638, 1.8760771751403809, ...
func (r *RouterGroup) GET(path string, fn Controller) { r.gin.GET(path, adapt(fn)) }
[ -0.29617002606391907, 0.3679399788379669, 0.1838613748550415, -0.5345105528831482, 0.33399906754493713, -1.0563193559646606, -0.36545491218566895, -0.008822808973491192, -1.1849886178970337, -0.3787890672683716, 0.45727628469467163, 1.0832598209381104, 0.3154681324958801, -0.45960280299186...
func (r *RouterGroup) POST(path string, fn Controller) { r.gin.POST(path, adapt(fn)) }
[ 0.15485769510269165, 0.2954173684120178, 0.20318634808063507, 0.3668566942214966, -0.32018354535102844, -0.38728103041648865, -0.18494735658168793, 0.013447740115225315, -1.0781341791152954, -1.086889624595642, -0.18666601181030273, -0.14665727317333221, 0.026385538280010223, 0.15802787244...
func (r *RouterGroup) PUT(path string, fn Controller) { r.gin.PUT(path, adapt(fn)) }
[ -0.20621061325073242, 0.6784192323684692, 0.21559081971645355, -0.8691098690032959, 0.02010190114378929, -0.26525235176086426, 0.6020892858505249, 0.2702549397945404, -1.0922640562057495, 0.016969013959169388, -0.18190133571624756, 0.6599884033203125, -0.40575161576271057, -0.2712608277797...
func (r *RouterGroup) PATCH(path string, fn Controller) { r.gin.PATCH(path, adapt(fn)) }
[ -0.22481413185596466, -0.1272868663072586, 0.09237980842590332, -0.49002429842948914, -0.5242140293121338, 0.26632213592529297, 0.21766215562820435, 0.5739519596099854, -0.5026479363441467, -0.3620465099811554, 0.4181406497955322, 0.6571487188339233, 0.2653083801269531, 0.02465728856623172...
func (r *RouterGroup) DELETE(path string, fn Controller) { r.gin.DELETE(path, adapt(fn)) }
[ 0.45966604351997375, 0.7756236791610718, 0.24659289419651031, 0.2058776170015335, 0.3141484558582306, -0.42372679710388184, 0.5662510991096497, 0.4283384382724762, -0.6542513966560364, 0.10428542643785477, 0.27490121126174927, 0.32902324199676514, -0.2401372641324997, -0.09802663326263428,...
func (r *RouterGroup) Group(prefix string) *RouterGroup { return &RouterGroup{r.gin.Group(prefix)} }
[ -0.39001306891441345, 1.0597416162490845, 0.03491068631410599, -0.3892437517642975, -0.588124692440033, -0.50420743227005, -0.11566159129142761, -0.5053995847702026, -0.023671511560678482, -0.2806331217288971, 0.159968301653862, 1.070857048034668, 0.1252712607383728, 0.4656774401664734, ...
func MakeStatus(id, status string) StatusJSON { return StatusJSON{statusData{id, "status", statusAttrs{status}}} }
[ -0.43510910868644714, -1.4533053636550903, 0.05047411099076271, -0.9926550388336182, -1.8333603143692017, 0.01257538516074419, -1.4222650527954102, 0.7718862891197205, 0.45649388432502747, 0.6137191653251648, -1.3436191082000732, 0.5600678324699402, 1.0801225900650024, -0.5235942006111145,...
func adapt(cr Controller) gin.HandlerFunc { type error struct { Error string `json:"error"` } return func(c *gin.Context) { // TODO: make some id random cc := Context{c, "someID"} code, ctx, err := cr(&cc) if err != nil { if e, ok := err.(*errors.Chain); ok { e.Pkg.Log.Info("Error in API", logs.I{ ...
[ -0.6349688172340393, -0.67039954662323, 0.9309930801391602, -0.3689509630203247, -0.8209030032157898, -0.0048366268165409565, 0.5660505890846252, -0.14954699575901031, 0.3059159517288208, 0.22783274948596954, -0.1373240351676941, 0.49625110626220703, 1.0110026597976685, -0.1171941980719566...
func NewHTTPTrigger(httpClients map[string]*http.Client, sensor *v1alpha1.Sensor, trigger *v1alpha1.Trigger, logger *zap.SugaredLogger) (*HTTPTrigger, error) { httptrigger := trigger.Template.HTTP client, ok := httpClients[trigger.Template.Name] if !ok { client = &http.Client{} if httptrigger.TLS != nil { t...
[ -0.05538666248321533, -0.553192675113678, 0.5172194242477417, -0.6318363547325134, -0.7660059332847595, -0.10971563309431076, -0.7727610468864441, -0.17663384974002838, -0.46275803446769714, 0.1859835833311081, -0.5779716968536377, 0.4598482847213745, -0.7434107661247253, 0.236904844641685...
func (t *HTTPTrigger) GetTriggerType() apicommon.TriggerType { return apicommon.HTTPTrigger }
[ 0.22379547357559204, 0.2851106822490692, 0.31377989053726196, 0.015645930543541908, 1.1518809795379639, -0.044819630682468414, 0.340807169675827, -0.14002123475074768, 0.5398122072219849, -0.214503213763237, -0.5256313681602478, 0.9657946228981018, -1.274428367614746, 0.708112359046936, ...
func (t *HTTPTrigger) FetchResource(ctx context.Context) (interface{}, error) { if t.Trigger.Template.HTTP.Method == "" { t.Trigger.Template.HTTP.Method = http.MethodPost } return t.Trigger.Template.HTTP, nil }
[ 0.59553462266922, 0.01217842660844326, 0.2153710126876831, 0.3250250220298767, -0.6507952809333801, -0.11300680041313171, 0.04322288557887077, 0.0031095880549401045, 0.42350924015045166, 0.46664416790008545, 0.6417564153671265, -0.47750189900398254, -0.15888704359531403, 0.7805449366569519...
func (t *HTTPTrigger) ApplyResourceParameters(events map[string]*v1alpha1.Event, resource interface{}) (interface{}, error) { fetchedResource, ok := resource.(*v1alpha1.HTTPTrigger) if !ok { return nil, fmt.Errorf("failed to interpret the fetched trigger resource") } resourceBytes, err := json.Marshal(fetchedRes...
[ -0.42647865414619446, -0.7991228103637695, 0.5867643356323242, -0.4483790397644043, -0.7627592086791992, -0.2530813217163086, -0.04260208085179329, -0.046129077672958374, -0.06644301116466522, 0.6712248921394348, 0.4369944930076599, 0.28886520862579346, -0.6316162347793579, 0.2839929163455...
func (t *HTTPTrigger) Execute(ctx context.Context, events map[string]*v1alpha1.Event, resource interface{}) (interface{}, error) { var payload []byte var err error trigger, ok := resource.(*v1alpha1.HTTPTrigger) if !ok { return nil, fmt.Errorf("failed to interpret the trigger resource") } if (trigger.Method =...
[ -0.8565003871917725, -0.2735775411128998, 1.0481756925582886, 0.1311124861240387, 0.07064485549926758, -0.5835845470428467, -1.1225433349609375, -0.7154996991157532, -0.30256521701812744, 0.39179596304893494, -0.29819637537002563, -0.31829193234443665, 0.16043180227279663, -0.3356721997261...
func (t *HTTPTrigger) ApplyPolicy(ctx context.Context, resource interface{}) error { if t.Trigger.Policy == nil || t.Trigger.Policy.Status == nil || t.Trigger.Policy.Status.Allow == nil { return nil } response, ok := resource.(*http.Response) if !ok { return fmt.Errorf("failed to interpret the trigger execution...
[ 0.8874412775039673, -0.12162134051322937, 0.6121951937675476, -0.09699589759111404, 0.5274323225021362, 0.07780934870243073, -0.024752531200647354, 0.4616008698940277, 0.9040409922599792, -0.7562183737754822, 0.3424530625343323, -0.2276879996061325, 0.21743176877498627, 0.6447650194168091,...
func Println() { fmt.Println(String()) }
[ 0.7732412815093994, -0.44821494817733765, 0.17950887978076935, 0.042651910334825516, -0.4249946177005768, 0.36541298031806946, -0.07371292263269424, -0.1928776055574417, -0.21744124591350555, -1.3686476945877075, -0.11212147772312164, 1.4139050245285034, 0.7266018986701965, -0.078510977327...
func String() string { var version bytes.Buffer if AppName != "" { fmt.Fprintf(&version, "%s ", AppName) } fmt.Fprintf(&version, "v%s", Version) if Prerelease != "" { fmt.Fprintf(&version, "-%s", Prerelease) } return version.String() }
[ 0.4779199957847595, -1.1991856098175049, 0.3085711896419525, 0.09405224025249481, -0.5728943943977356, 1.2660019397735596, 0.5184154510498047, -0.7923220992088318, -0.43755489587783813, 0.7996972799301147, -0.11644443869590759, 0.9556317329406738, -0.011958829127252102, 0.1298588514328003,...
func LongPrintln() { fmt.Println(LongString()) }
[ 0.9449483156204224, -0.08081292361021042, 0.5314699411392212, -0.2275521457195282, -0.2176317721605301, 0.04465894028544426, -0.25212278962135315, 0.6488824486732483, 0.2777523696422577, -1.7808979749679565, -0.6876463294029236, 0.9049074053764343, 1.347946286201477, -0.18506354093551636, ...
func LongString() string { var version bytes.Buffer fmt.Fprintf(&version, "%s", String()) if Build != "" { fmt.Fprintf(&version, "+build.%s", Build) if GitCommit != "" { fmt.Fprintf(&version, ".%s", GitCommit) } } release, ok := manifest.KubeManifest.Releases[Version] if !ok { return version.String(...
[ 0.47159743309020996, -0.9549907445907593, 0.6426817178726196, -0.3741496503353119, -0.19410599768161774, 0.773595929145813, -0.628224790096283, -0.4149492681026459, -0.46317988634109497, 0.5255158543586731, 0.3368087410926819, 0.33311596512794495, 0.05065472796559334, 0.3148523271083832, ...
func endsWithSemicolon(line string) bool { prev := "" scanner := bufio.NewScanner(strings.NewReader(line)) scanner.Split(bufio.ScanWords) for scanner.Scan() { word := scanner.Text() if strings.HasPrefix(word, "--") { break } prev = word } return strings.HasSuffix(prev, ";") }
[ 1.569779872894287, -0.07662151008844376, 0.9232543706893921, 0.5860017538070679, -0.7083205580711365, -0.8335584402084351, -0.8760586977005005, 0.6844680905342102, 0.10283148288726807, 0.7212250828742981, -1.0873759984970093, -0.7163628935813904, -0.7132949829101562, 0.6719464063644409, ...
func SplitSQLStatements(r io.ReadSeeker, direction bool) ([]string, error) { _, err := r.Seek(0, 0) if err != nil { return nil, err } var buf bytes.Buffer scanner := bufio.NewScanner(r) // track the count of each section // so we can diagnose scripts with no annotations upSections := 0 downSections := 0 ...
[ 0.143358513712883, -0.9049556255340576, 0.8791614770889282, -0.07401067763566971, -0.5890495181083679, -0.27942800521850586, 0.06739716231822968, -0.6924928426742554, 0.23525293171405792, 0.7754864692687988, 0.13855211436748505, -0.2141677737236023, -0.4125695526599884, 0.7099649310112, ...
func change(val *int){ *val = 55 // changing the value using dereference }
[ -0.5637026429176331, 0.29175740480422974, 0.698262095451355, -0.3183983564376831, -0.318495512008667, 0.6595733761787415, 0.7596646547317505, 0.3470640778541565, 0.15087583661079407, -0.023188423365354538, -0.32918813824653625, 1.4345909357070923, 0.2718813121318817, 1.41232430934906, 1....
func returnPointer() *int { i := 5 return &i }
[ -0.4251798093318939, -0.7228997349739075, 0.4922645390033722, -0.35509687662124634, -1.0891613960266113, 0.2174132913351059, 1.3511396646499634, -1.0065786838531494, -0.21243272721767426, 0.1299862414598465, -0.03959737718105316, -0.2904107868671417, -1.759911298751831, 0.00240045133978128...
func modify(arr *[3]int){ arr[0] = 2000 // short hand syntax for (*arr)[0] }
[ -0.8471553325653076, -0.21219506859779358, 0.5015164613723755, -0.023631423711776733, -0.005103555973619223, -0.24851809442043304, -0.49146729707717896, 0.27110758423805237, 1.0461673736572266, 0.0025601182132959366, -0.38144946098327637, -0.05672994256019592, 0.6503445506095886, 0.5041156...
func modifyUsingSlice(sls []int){ sls[0] = 500 }
[ -1.439332127571106, 0.4420284926891327, 0.3356355130672455, 0.24326466023921967, 0.6128726601600647, -0.2199200540781021, 0.10934635996818542, 0.07610508054494858, 1.1678284406661987, 1.0692672729492188, 0.2709340751171112, 0.7299652099609375, -0.3374464809894562, 1.4143667221069336, 0.9...
func clientInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { log.Printf("Method Called: %s", method) return invoker(ctx, method, req, reply, cc, opts...) }
[ 0.4092893898487091, -0.1629803478717804, 0.4491174519062042, -1.0275719165802002, -0.888994038105011, 0.010868783108890057, -0.2219829112291336, 0.31748315691947937, 0.352763295173645, -0.7971916794776917, 0.29305994510650635, 0.19781407713890076, -0.6218401789665222, -0.9932575821876526, ...
func NewServer(name, version string) Server { return &server{ Name: name, Version: version, Defaults: conf.NewConfigFile(), Overrides: conf.NewConfigFile(), } }
[ -0.3050176501274109, -1.7008157968521118, 0.29187312722206116, 0.40098002552986145, -1.0717958211898804, 0.2623243033885956, -0.818749189376831, 0.3817138969898224, -0.5975466966629028, 0.30101150274276733, -1.7281736135482788, 0.38988953828811646, -0.45123305916786194, 0.06251699477434158...
func (cs *ContainerStorage) GetContainerId() uint32 { return atomic.AddUint32(&cs.currentContainerId, 1) }
[ 0.24735789000988007, -0.13098835945129395, 0.6250843405723572, 0.48441338539123535, 0.6497220993041992, 0.36976853013038635, 0.9039275050163269, -0.18369534611701965, -0.043692320585250854, -0.47258996963500977, 0.4328927993774414, 0.3746813237667084, -0.8140577673912048, 1.540306806564331...
func (cs *ContainerStorage) FlushIDsFrom(from uint32) bool { log.Infof("Flushing containers starting from %v", from) cs.contStRWMutex.Lock() defer cs.contStRWMutex.Unlock() var numFlushed int numEntriesBefore := len(cs.localContainerStorage) for i := from; i <= cs.maxContainerId; i++ { if bm, ok := cs.localCo...
[ -0.2089150995016098, 0.009789981879293919, 0.6245558857917786, -0.3041454255580902, -0.05042476952075958, -0.0003612545260693878, 0.32809317111968994, -0.6131532192230225, 0.31213197112083435, -0.008120838552713394, -0.4665376543998718, -0.03702929615974426, -0.3316377103328705, 0.46556845...
func (cs *ContainerStorage) getContainer(idd uint32) ([][12]byte, bool) { var container [][12]byte var memcMapping *memcache.Item var memerr error id := strconv.FormatInt(int64(idd), 10) done := false toCounter := 0 for !done { if memcMapping, memerr = cs.containerStorage.Get(id); memerr != nil { if memerr...
[ -0.8060801029205322, 0.14827494323253632, 1.0017304420471191, -0.2526518702507019, -0.059411682188510895, -0.8784244656562805, 0.20805974304676056, -0.39216017723083496, -0.005997053813189268, 0.11048199981451035, -0.1842745542526245, -0.030332982540130615, -0.42025521397590637, 0.33028841...
func (cs *ContainerStorage) addContainer(idd uint32, container [][12]byte) bool { var buf bytes.Buffer enc := gob.NewEncoder(&buf) if encErr := enc.Encode(container); encErr != nil { log.Error("encode error addIndex:", encErr) } //try to add for max 10 times id := strconv.FormatInt(int64(idd), 10) done := fal...
[ -1.1110864877700806, 0.716544508934021, 1.0539979934692383, -0.43499302864074707, 0.6476913690567017, 0.26471269130706787, -0.24366414546966553, -0.6257600784301758, 0.14508570730686188, 0.11913624405860901, -0.4891621172428131, -0.3524796664714813, -0.8281422853469849, 0.7301721572875977,...
func (m *RunnersSummary) Validate(formats strfmt.Registry) error { var res []error if err := m.validateConnectedCapacity(formats); err != nil { res = append(res, err) } if err := m.validateConnectedRunners(formats); err != nil { res = append(res, err) } if err := m.validateContainersCount(formats); err != ...
[ -0.20642705261707306, 0.4877053499221802, 0.47509947419166565, 0.03239383175969124, -0.22431521117687225, 0.39043155312538147, 0.6475883722305298, -0.4193894565105438, -0.49249184131622314, -0.07686425000429153, 0.5360723733901978, 0.2979036867618561, -0.21584154665470123, 0.40697458386421...
func (m *RunnersSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil }
[ 0.13089445233345032, 0.7767673134803772, 0.42356255650520325, -0.052022021263837814, -0.5972303748130798, 1.4861407279968262, 0.17199482023715973, 0.47944799065589905, 0.7265859842300415, 0.4038020074367523, 0.6325940489768982, 0.7946905493736267, -0.7097091674804688, 0.05521637573838234, ...
func Init(cfg Configuration, db Database) { config = cfg database = db runs.Load(database) }
[ 0.8880736231803894, 0.43056198954582214, 0.292976975440979, -0.1407179981470108, -0.10989062488079071, 0.7196580171585083, 0.07102111726999283, 0.787909209728241, -0.998919665813446, 0.4450390338897705, -0.28682124614715576, 0.5099961757659912, -0.36257204413414, 1.1950284242630005, 1.00...
func parseConfig() (*AuthConfig, error) { cfg := &AuthConfig{} flag.IntVar(&cfg.ServicePort, "port", 8081, "the port to run the openvpn authd service on") flag.StringVar(&cfg.ServiceBind, "interface", "127.0.0.1", "the interface to run the service on") flag.StringVar(&cfg.AuthHeader, "auth-header", "X-Auth-Email", ...
[ 0.6950031518936157, -0.46895071864128113, 0.7369130253791809, 0.05623123422265053, -0.09054352343082428, 0.41467395424842834, -0.18609647452831268, -0.32277610898017883, -0.32680797576904297, 0.17785848677158356, -0.46408239006996155, 0.33765044808387756, -0.0577518567442894, 0.51036781072...
func NewTelegramPublisher() *TelegramPublisher { return &TelegramPublisher{} }
[ 0.4974782466888428, -0.6500439047813416, -0.04158343747258186, -0.2512040138244629, -1.1246638298034668, 0.0035903092939406633, -1.1184101104736328, 0.9054824709892273, -0.47558584809303284, -0.41080963611602783, -0.22442331910133362, -0.7991825342178345, -0.03990185260772705, 0.3610460460...
func (dv *TelegramPublisher) Publish(item Item) { telegramToken, ok := os.LookupEnv("TELEGRAM_TOKEN") if !ok { fmt.Errorf("TELEGRAM_TOKEN not found") } bot, err := tgbotapi.NewBotAPI(telegramToken) if err != nil { fmt.Errorf("%v", err) } bot.Debug = true chatIDStr, ok := os.LookupEnv("TELEGRAM_CHAT_ID") ...
[ -0.5722471475601196, -0.17282715439796448, 0.5212202072143555, 0.31934109330177307, 0.31129246950149536, 0.6471444368362427, -0.5634778141975403, 0.14472097158432007, -1.214341640472412, 0.3362964987754822, -0.5283535718917847, 0.5057904720306396, -0.5907926559448242, 1.1131349802017212, ...
func Subscribe(subchanMessages chan Message, closeChan chan int) { var threadHandle C.HANDLE go func() { for { select { case <-closeChan: C.Stop(threadHandle) r, _, err := CloseHandle.Call(uintptr(threadHandle)) if r == 0 { panic(err) } return case c := <-chanMessages: subchan...
[ 0.6158819198608398, 0.01516763400286436, 0.7074198126792908, 0.17735342681407928, -0.022900721058249474, 0.7075178623199463, 0.24159806966781616, -0.8896179795265198, -0.8737829327583313, -0.6864480972290039, -0.039002567529678345, 0.37125730514526367, -1.3389745950698853, -0.2472971826791...
func BaseNetworkCommand() commands.Command { return &networkCommand{ BaseCommand: commands.New("network", "Manage network"), } }
[ -0.04253096133470535, -0.20623770356178284, 0.37142008543014526, 0.3244688808917999, 1.0445162057876587, 0.22832389175891876, -0.3781048655509949, -0.39552825689315796, 0.29567524790763855, -1.1207499504089355, -0.5053321123123169, -0.1255488395690918, -0.25570783019065857, 0.0918626487255...
func handleNetwork(in string) (*upcloud.IPNetwork, error) { result := &upcloud.IPNetwork{} var dhcp string var dhcpDefRout string var dns string args, err := commands.Parse(in) if err != nil { return nil, err } fs := &pflag.FlagSet{} fs.StringVar(&dns, "dhcp-dns", dns, "Defines if the gateway should be giv...
[ -0.5019180178642273, 0.6946954727172852, 0.8719372153282166, 0.4459500312805176, 0.8014011383056641, -0.8061124682426453, 0.1395186334848404, 0.2508450746536255, -0.31185147166252136, -0.5597055554389954, -0.14898736774921417, -1.6531810760498047, -0.3379705250263214, 0.17999839782714844, ...
func RecordHistory() error { applications, err := apps.AllUsableApps() if err != nil { return err } appIDChan := make(chan int) wg := new(sync.WaitGroup) // Adding goroutines to workgroup for i := 0; i < 100; i++ { wg.Add(1) go func(appIDChan chan int, wg *sync.WaitGroup) { defer wg.Done() // Decreasin...
[ 0.2354273796081543, 1.0647525787353516, 0.7779162526130676, -0.44164833426475525, 0.24252673983573914, -0.02606005221605301, 0.8582566380500793, -0.04920189082622528, -0.462517112493515, 0.37773701548576355, 0.27990561723709106, 0.6610025763511658, -0.2940267324447632, 0.9306815266609192, ...
func Read(ctx *gin.Context) { begin := time.Now() //打印日志 log.Logger.WithFields(logrus.Fields{ Path: ReadPath, }).Info("receive request from prometheus") //解码request request := &prompb.ReadRequest{} if err := prometheus.Unmarshal(request, ctx.Request); err != nil { log.Logger.WithError(err).WithFields(logrus....
[ -0.1995517611503601, -0.22543993592262268, 1.1727242469787598, 0.3960663974285126, -0.0978209376335144, 0.9554771184921265, 0.4076809883117676, -0.5977300405502319, -0.5450462698936462, 0.1473895013332367, 0.548923671245575, 0.1679304987192154, -0.7899139523506165, -0.5101548433303833, 0...
func Write(ctx *gin.Context) { begin := time.Now() log.Logger.WithFields(logrus.Fields{ Path: WritePath, }).Info("receive request from prometheus") //解析request request := &prompb.WriteRequest{} if err := prometheus.Unmarshal(request, ctx.Request); err != nil { log.Logger.WithError(err).WithFields(logrus.Field...
[ -1.025500774383545, 0.03394566476345062, 0.9638550877571106, 0.6163457632064819, 0.7060225009918213, 0.3791198134422302, 0.41788917779922485, 0.025381149724125862, -0.7983308434486389, 0.7883145809173584, 0.38943132758140564, 0.2037934958934784, -0.46406078338623047, -0.012004776857793331,...