text
stringlengths
11
6.3k
embedding
listlengths
768
768
func (a *API) CopyImage(source_id, dest_name, dest_region, dest_description, kms_key_id string, encrypted bool) (string, error) { request := ecs.CreateCopyImageRequest() request.Scheme = "https" request.ImageId = source_id request.DestinationImageName = dest_name request.DestinationRegionId = dest_region request....
[ -0.5929281115531921, -0.08760658651590347, 0.5838039517402649, -0.2782577574253082, -0.41375720500946045, 0.36145684123039246, -0.7521094679832458, 0.06957355886697769, -0.4749033451080322, 1.4425984621047974, -0.027190743014216423, 0.37488076090812683, -0.31639719009399414, 0.632653951644...
func (a *API) ImportImage(format, bucket, object, image_size, device, name, description, architecture string, force bool) (string, error) { images, err := a.GetImages(name) if err != nil { return "", fmt.Errorf("getting images: %v", err) } for _, image := range images.Images.Image { if force { plog.Infof("d...
[ -0.8523362278938293, 0.33055809140205383, 0.703741192817688, 0.4085597097873688, 0.6029210686683655, -0.05998525395989418, 0.23287929594516754, -0.16311337053775787, -0.06856105476617813, 1.23116135597229, -0.010107845067977905, 0.016961103305220604, 0.058165259659290314, 0.885848224163055...
func (a *API) finishImportImageTask(importImageResponse *ecs.ImportImageResponse) (string, error) { importDone := func(taskId string) (bool, error) { request := ecs.CreateDescribeTasksRequest() request.TaskIds = taskId res, err := a.ecs.DescribeTasks(request) if err != nil { return false, err } if len(...
[ -0.013705482706427574, 0.1341015249490738, 0.8944417238235474, -0.4365762174129486, -0.2179560661315918, 0.1589721441268921, 0.7799994945526123, -0.8465772271156311, -0.18900230526924133, 1.1765259504318237, -0.6265381574630737, -0.329889178276062, -0.17987777292728424, 0.830771803855896, ...
func (a *API) GetImages(name string) (*ecs.DescribeImagesResponse, error) { request := ecs.CreateDescribeImagesRequest() request.Scheme = "https" request.ImageName = name return a.ecs.DescribeImages(request) }
[ -0.6506490111351013, 1.2022156715393066, 0.40413960814476013, -0.8081302046775818, 0.993466854095459, -0.7587710022926331, -0.7387457489967346, -0.7641199827194214, 0.1687282770872116, 0.3424902558326721, -0.0018949491204693913, 0.5639736652374268, -0.5899143218994141, 0.928389310836792, ...
func (a *API) GetImagesByID(id string) (*ecs.DescribeImagesResponse, error) { request := ecs.CreateDescribeImagesRequest() request.Scheme = "https" request.ImageId = id return a.ecs.DescribeImages(request) }
[ -0.14853274822235107, 0.92121821641922, 0.32929450273513794, -0.6419966220855713, 0.9069778323173523, -0.8132995367050171, -0.467329740524292, -1.0334516763687134, 0.35051482915878296, 0.3058074414730072, -0.1983138620853424, 0.6891815066337585, -0.5450363755226135, 1.291040062904358, 0....
func (a *API) DeleteImage(id string, force bool) error { request := ecs.CreateDeleteImageRequest() request.Scheme = "https" request.ImageId = id request.Force = requests.NewBoolean(force) images, err := a.GetImagesByID(id) if err != nil { return fmt.Errorf("getting image: %v", err) } _, err = a.ecs.DeleteIm...
[ -1.69251549243927, 0.7391669154167175, 0.6117837429046631, 0.04347248375415802, 0.6301791071891785, -0.09505375474691391, -0.15182171761989594, -0.09736918658018112, 0.1799757331609726, 0.10428109765052795, 0.34045329689979553, -0.07699944078922272, 0.2487967163324356, 1.5684517621994019, ...
func (a *API) DeleteSnapshot(id string, force bool) error { request := ecs.CreateDeleteSnapshotRequest() request.Scheme = "https" request.SnapshotId = id request.Force = requests.NewBoolean(force) _, err := a.ecs.DeleteSnapshot(request) return err }
[ -1.0920603275299072, 0.6857067942619324, 0.33711299300193787, 0.25765809416770935, -0.31106874346733093, 0.23028182983398438, -0.3702315390110016, -0.2806074917316437, 0.8428414463996887, -0.6846591234207153, -0.9889162182807922, 0.19913707673549652, 0.6911971569061279, 0.17008903622627258...
func (a *API) UploadFile(filepath, bucket, path string, force bool) error { bucketClient, err := a.oss.Bucket(bucket) if err != nil { return fmt.Errorf("getting bucket %q: %v", bucket, err) } if !force { // TODO: Switch to head object whenever the library actually adds the call :( objects, err := bucketClien...
[ -0.6411197781562805, 0.325082391500473, 0.8823019862174988, -0.38634535670280457, 1.0092785358428955, -0.04891079291701317, 0.27708113193511963, -0.3970169126987457, -0.7984373569488525, 0.5059893131256104, -0.4195786118507385, 0.1291424036026001, -0.8690605759620667, 0.2398817092180252, ...
func (a *API) DeleteFile(bucket, path string) error { bucketClient, err := a.oss.Bucket(bucket) if err != nil { return fmt.Errorf("getting bucket %q: %v", bucket, err) } plog.Infof("deleting oss://%v/%v", bucket, path) return bucketClient.DeleteObject(path) }
[ -0.04396600276231766, -0.5504233241081238, 0.5787408351898193, 0.008544737473130226, 0.05776261165738106, 0.3917064964771271, 0.11368554085493088, -0.11150531470775604, -1.011186122894287, -0.44891035556793213, -0.13286957144737244, 0.0956667959690094, -0.28849437832832336, -0.526138722896...
func (a *API) PutObject(r io.Reader, bucket, path string, force bool) error { bucketClient, err := a.oss.Bucket(bucket) if err != nil { return fmt.Errorf("getting bucket %q: %v", bucket, err) } if !force { // TODO: Switch to head object whenever the library actually adds the call :( objects, err := bucketCli...
[ -1.0681902170181274, -0.3535853326320648, 0.7526796460151672, -0.5411502122879028, 0.1880420446395874, 0.5054677128791809, 0.0836385041475296, -0.6404277682304382, -0.4243132770061493, 0.6528472304344177, -0.6426679491996765, 0.32174769043922424, -0.8906248211860657, -0.5355992913246155, ...
func (a *API) ListRegions() ([]string, error) { request := ecs.CreateDescribeRegionsRequest() request.Scheme = "https" response, err := a.ecs.DescribeRegions(request) if err != nil { return nil, fmt.Errorf("describing regions: %v", err) } ret := make([]string, 0, len(response.Regions.Region)) for _, region :=...
[ -0.21753065288066864, -0.24346093833446503, 0.3127236068248749, -1.0067745447158813, 0.9329828023910522, -0.16435140371322632, -1.2225511074066162, -0.601382315158844, 0.5337481498718262, 0.16480258107185364, 0.13430659472942352, 0.8960966467857361, -0.47401443123817444, 0.0385004356503486...
func New() (*T) { me := T{ count: 0, datum: "", } return &me }
[ 0.09490635246038437, -0.9447820782661438, 0.3066806495189667, -0.8525933623313904, -0.38619452714920044, 0.3712899684906006, -0.08254087716341019, -0.1615781933069229, -0.7462827563285828, -0.8486983180046082, -0.9756622910499573, 0.07111001014709473, 1.114186406135559, -0.0021298627834767...
func (me *T) Insert(datum string) { switch { case 0 == me.count: me.datum = datum me.count = 1 case me.datum == datum: me.count += 1 default: me.count -= 1 } }
[ -0.9807144403457642, 0.7668818235397339, 0.4168752133846283, -0.7260485887527466, 0.2694617211818695, 0.4311743676662445, 0.9242657423019409, 0.4529680907726288, -0.5805572271347046, -0.6968860626220703, -1.0855116844177246, -0.1855495125055313, -0.7331441640853882, -0.16201874613761902, ...
func (me *T) Majority() string { return me.datum }
[ -0.9696934819221497, -0.37633827328681946, 0.23758059740066528, -0.27237263321876526, 0.45642948150634766, 0.7146341800689697, -0.34606868028640747, -0.7942090630531311, -0.2598215341567993, -1.0003770589828491, 0.09024418890476227, 0.4799472987651825, 0.6833308339118958, 0.031487889587879...
func (svc *Service) ListProposal(req client.ListProposalRequest, reply *client.ListProposalsReply) error { proposal, _, err := svc.proposalMaster.Proposal.QueryAllStores(req.ProposalId) if err != nil { svc.logger.Error("error getting proposal", err) return codes.ErrGetProposal } options := svc.proposalMaster.P...
[ -0.8433745503425598, -0.3113367557525635, 0.5409435629844666, -0.14708781242370605, 0.39890751242637634, -0.7844519019126892, -0.26523494720458984, -0.02836748957633972, 1.2114505767822266, 0.9324918985366821, 0.3676469922065735, 0.09196554869413376, -0.6688965559005737, 0.3198084235191345...
func (svc *Service) ListProposals(req client.ListProposalsRequest, reply *client.ListProposalsReply) error { // Validate parameters if len(req.Proposer) != 0 { err := req.Proposer.Err() if err != nil { return errors.New("invalid proposer address") } } // Query in single store if specified pms := svc.prop...
[ -0.7805883288383484, 0.15197372436523438, 0.6403719186782837, -0.7966453433036804, -0.4225003123283386, -0.4787394106388092, -0.4015944004058838, -0.2760198712348938, 1.2808278799057007, 0.7637025117874146, 0.46585673093795776, 0.4385813772678375, -0.7009515166282654, 0.47252416610717773, ...
func (svc *Service) GetFundsForProposalByFunder(req client.GetFundsForProposalByFunderRequest, reply *client.GetFundsForProposalByFunderReply) error { // Validate parameters err := req.Funder.Err() if err != nil { return errors.New("invalid funder address") } amount := svc.proposalMaster.ProposalFund.GetFundsFo...
[ -0.37619903683662415, 0.347777783870697, 0.32496127486228943, 0.19730737805366516, -0.34453946352005005, -0.970037579536438, 0.12664644420146942, 0.4389192461967468, 0.2831120491027832, -0.10031145066022873, 0.2621921896934509, -0.01837773807346821, -0.46414145827293396, 0.7191656827926636...
func Bool(name string, defaultValue bool) bool { if strVal, ok := os.LookupEnv(name); ok { if res, err := strconv.ParseBool(strVal); err == nil { return res } } return defaultValue }
[ 0.3534710109233856, 0.16885963082313538, 0.4931374192237854, 0.09869831800460815, -0.4644290506839752, 0.7317523956298828, -0.5439335107803345, 0.8293595314025879, -0.888150155544281, 0.8021752238273621, -0.4782228171825409, 0.1279108077287674, -0.1794438511133194, -0.7566953897476196, -...
func BoolStrict(name string, defaultValue bool) (bool, error) { if strVal, ok := os.LookupEnv(name); ok { res, err := strconv.ParseBool(strVal) if err != nil { return false, err } return res, nil } return defaultValue, nil }
[ 0.25000280141830444, 0.07954678684473038, 0.6080859303474426, -0.9642046689987183, -0.9372314214706421, 0.1576775312423706, -0.9512603282928467, -0.7577745914459229, -1.4963769912719727, 0.8178603649139404, -0.7783024907112122, 0.3637009263038635, -0.27003493905067444, -0.7526800036430359,...
func Duration(name string, defaultValue time.Duration) time.Duration { if strVal, ok := os.LookupEnv(name); ok { if d, err := time.ParseDuration(strVal); err == nil { return d } } return defaultValue }
[ -0.1348259299993515, -0.12491607666015625, 0.28700849413871765, 0.613292396068573, -0.15714605152606964, -0.14816232025623322, -0.13800375163555145, 0.319511741399765, -0.3439272344112396, 0.9877400994300842, -0.07033214718103409, -0.05629980191588402, 0.20953944325447083, 0.89311778545379...
func DurationStrict(name string, defaultValue time.Duration) (time.Duration, error) { if strVal, ok := os.LookupEnv(name); ok { d, err := time.ParseDuration(strVal) if err != nil { return 0, err } return d, nil } return defaultValue, nil }
[ -0.5188103914260864, 0.6259730458259583, 0.32457298040390015, -0.18189813196659088, -0.04001886397600174, -0.04086241126060486, -0.11992805451154709, -1.0652848482131958, -0.6206499338150024, 0.9201400279998779, -0.38559994101524353, 0.5166386365890503, -0.3915933072566986, 0.4081174433231...
func Float64(name string, defaultValue float64) float64 { if strVal, ok := os.LookupEnv(name); ok { if f, err := strconv.ParseFloat(strVal, 64); err == nil { return f } } return defaultValue }
[ 0.049339454621076584, 0.6706247329711914, 0.43851974606513977, 0.5630943179130554, 0.1283143311738968, -0.5938078761100769, -0.4695446789264679, 0.041305091232061386, -1.1561511754989624, 0.09220194816589355, -0.08327753841876984, -0.5764248371124268, -0.49912452697753906, 0.74455696344375...
func Float64Strict(name string, defaultValue float64) (float64, error) { if strVal, ok := os.LookupEnv(name); ok { f, err := strconv.ParseFloat(strVal, 64) if err != nil { return 0, err } return f, nil } return defaultValue, nil }
[ 0.09179466962814331, 0.6664749979972839, 0.3408759534358978, -0.1747799515724182, -0.16512787342071533, -0.6725240349769592, -0.11871417611837387, -0.6855653524398804, -0.9137757420539856, 0.7664684653282166, -0.05644616857171059, 0.3136623799800873, -0.9534236192703247, 0.3759662508964538...
func Int(name string, defaultValue int) int { if strVal, ok := os.LookupEnv(name); ok { if i64, err := strconv.ParseInt(strVal, 10, 0); err == nil { return int(i64) } } return defaultValue }
[ -0.21660389006137848, 0.6773410439491272, 0.5017753839492798, -0.6502184867858887, -0.2990196943283081, -0.016322463750839233, -0.3576238751411438, 0.6662296652793884, -1.4151259660720825, 0.5850271582603455, -0.0632597953081131, -0.12851667404174805, 0.027912648394703865, 0.44307324290275...
func IntStrict(name string, defaultValue int) (int, error) { if strVal, ok := os.LookupEnv(name); ok { i64, err := strconv.ParseInt(strVal, 10, 0) if err != nil { return 0, err } return int(i64), nil } return defaultValue, nil }
[ -0.41427743434906006, 0.7619190812110901, 0.48444899916648865, -0.976378321647644, -0.30095818638801575, -0.2004556655883789, -0.03063814342021942, -0.5877057909965515, -0.7303393483161926, 0.8499757647514343, -0.28574496507644653, 0.3893364667892456, -0.9493672847747803, -0.10819365084171...
func Int64(name string, defaultValue int64) int64 { if strVal, ok := os.LookupEnv(name); ok { if i64, err := strconv.ParseInt(strVal, 10, 64); err == nil { return i64 } } return defaultValue }
[ -0.7359327673912048, 0.6458880305290222, 0.45872145891189575, 0.3629528880119324, 0.005190091207623482, -0.5678504109382629, -0.3634508550167084, 0.48481321334838867, -0.7793272733688354, 0.4149978756904602, 0.3115718960762024, -0.44759711623191833, -0.6367191076278687, 0.5954060554504395,...
func Int64Strict(name string, defaultValue int64) (int64, error) { if strVal, ok := os.LookupEnv(name); ok { i64, err := strconv.ParseInt(strVal, 10, 64) if err != nil { return 0, err } return i64, nil } return defaultValue, nil }
[ -0.9667102098464966, 0.4968090057373047, 0.3576211929321289, -0.24780471622943878, -0.35635125637054443, -0.18690656125545502, -0.0641029104590416, -0.5913283824920654, -0.6187837719917297, 0.931705892086029, -0.021641772240400314, 0.296568363904953, -1.0377229452133179, -0.099253848195075...
func String(name, defaultValue string) string { if val, ok := os.LookupEnv(name); ok { return val } return defaultValue }
[ 0.19490665197372437, -0.0901649072766304, 0.2648482620716095, 0.08047766983509064, -0.6889299154281616, 0.7705366015434265, 0.09764095395803452, -0.915182888507843, -0.9416969418525696, 0.8034757375717163, -0.19061550498008728, -0.29286667704582214, -0.37956908345222473, -0.035972002893686...
func Uint(name string, defaultValue uint) uint { if strVal, ok := os.LookupEnv(name); ok { if i64, err := strconv.ParseUint(strVal, 10, 0); err == nil { return uint(i64) } // Bool extracts bool value from environment variable named name // and returns defaultValue if it is absent or can not be parsed } re...
[ -0.27277085185050964, -0.01791583187878132, 0.6507717967033386, -0.8947285413742065, -0.692828357219696, 0.259677916765213, -0.3781108558177948, 0.7987067103385925, -0.595834493637085, 0.14055174589157104, 0.14117805659770966, -0.058996859937906265, 0.05109721049666405, -0.1413073688745498...
func UintStrict(name string, defaultValue uint) (uint, error) { if strVal, ok := os.LookupEnv(name); ok { i64, err := strconv.ParseUint(strVal, 10, 0) if err != nil { return 0, err } return uint(i64), nil } return defaultValue, nil }
[ -0.3374232351779938, 0.49666380882263184, 0.5248674154281616, -0.9417300820350647, -0.2902466058731079, -0.36659324169158936, -0.31914234161376953, 0.11616211384534836, -0.6657127737998962, 0.2997821569442749, -0.4369335472583771, 0.10136222839355469, 0.15590737760066986, -0.48710361123085...
func Uint64(name string, defaultValue uint64) uint64 { if strVal, ok := os.LookupEnv(name); ok { if i64, err := strconv.ParseUint(strVal, 10, 64); err == nil { return i64 } } return defaultValue }
[ -0.7120449542999268, 0.48781365156173706, 0.5228440761566162, 0.22113755345344543, 0.013692027889192104, -0.39453601837158203, -0.3385053873062134, 0.6421298980712891, -0.8261080384254456, 0.2604951560497284, 0.42205363512039185, -0.7801647186279297, -0.17166723310947418, 0.339672863483428...
func Uint64Strict(name string, defaultValue uint64) (uint64, error) { if strVal, ok := os.LookupEnv(name); ok { i64, err := strconv.ParseUint(strVal, 10, 64) if err != nil { return 0, err } return i64, nil } return defaultValue, nil }
[ -0.9074404239654541, 0.8236222863197327, 0.4387490749359131, -0.2818340063095093, -0.04910516366362572, -0.4122790992259979, -0.24467605352401733, -0.5441014170646667, -0.43367236852645874, 0.37050992250442505, 0.3988941013813019, -0.37660691142082214, -0.4680655002593994, -0.1633784025907...
func (xsave *AMD64Xstate) Decode() []proc.Register { var regs []proc.Register // x87 registers regs = proc.AppendUint64Register(regs, "CW", uint64(xsave.Cwd)) regs = proc.AppendUint64Register(regs, "SW", uint64(xsave.Swd)) regs = proc.AppendUint64Register(regs, "TW", uint64(xsave.Ftw)) regs = proc.AppendUint64Reg...
[ 0.31427788734436035, 1.029006838798523, 0.7857908010482788, -0.34357404708862305, 0.060346245765686035, -0.3219678997993469, -0.066924549639225, 0.036531805992126465, 0.6480647325515747, 0.3842338025569916, -0.6700201630592346, 0.3962240517139435, -0.1890166699886322, 0.5924910306930542, ...
func UploadBill(serialCode string, latitude, longitude float64, denomination int, notes string, imFileHeader *multipart.FileHeader) error { // Check for bill sqlStatement := ` SELECT COUNT(serialCode), denomination FROM bills WHERE serialCode = $1 GROUP BY denomination; ` row := db.QueryRow(sqlState...
[ -0.10464952141046524, 0.6576519012451172, 1.0646922588348389, 0.21650660037994385, 0.4119432270526886, 0.39969661831855774, 0.49989426136016846, -0.2945720851421356, -0.5573704838752747, -0.03664616122841835, 0.04205230996012688, -0.36837971210479736, -0.6539279818534851, 2.141260147094726...
func Clean (current string) string { // Remove unicode characters. formatted := html2text.HTML2Text(current) // Remove specific characters. formatted = strings.Replace(formatted, "\n", " ", -1) formatted = strings.Replace(formatted, "\r", " ", -1) // Final unicode removal (specific to code sections). re...
[ 0.05718368664383888, -1.1131740808486938, 0.6737246513366699, -0.11725805699825287, -1.3199872970581055, -0.0706074982881546, -0.15566718578338623, -0.5237135887145996, -0.6560192108154297, 0.6409250497817993, 0.7370238304138184, 0.0589771494269371, -0.4588315188884735, 0.6575138568878174,...
func Register() { prometheus.MustRegister(httpMetrics.HTTPReqDuration) }
[ 0.08133188635110855, 1.4137208461761475, 0.612888514995575, 0.6726554036140442, 0.6646082401275635, 0.7713462114334106, -0.7901928424835205, -0.2728574872016907, -1.32114839553833, -0.2123195230960846, -0.04138000309467316, 1.0198129415512085, -0.09329365938901901, 1.190937876701355, -0....
func (db *DB) NewScope(value interface{}) *Scope { dbClone := db.clone() dbClone.Value = value return &Scope{db: dbClone, Search: dbClone.search.clone(), Value: value} }
[ -0.5355858206748962, 0.09416361153125763, 0.35433951020240784, 0.3547682762145996, -1.0410581827163696, 0.057160455733537674, 0.12136968225240707, -1.003834843635559, 0.7567958831787109, 1.013552188873291, 0.15777337551116943, 0.39799150824546814, -0.12346304208040237, 0.0492178276181221, ...
func (s *DB) CommonDB() sqlCommon { return s.db }
[ 0.3866119086742401, 0.9150593876838684, 0.2933685779571533, 1.0558823347091675, -0.5431724190711975, 0.9912644624710083, 0.3699202537536621, 0.4097619652748108, 0.7175999879837036, 0.010187125764787197, 0.32991823554039, 0.3392125070095062, -1.0551635026931763, 0.8491348624229431, -0.516...
func (s *DB) Set(name string, value interface{}) *DB { return s.clone().InstantSet(name, value) }
[ -0.1076870933175087, 0.7646558284759521, 0.3082750737667084, 0.12110523879528046, -1.1911439895629883, 0.43131861090660095, -0.6619912385940552, -0.9636886715888977, -0.4164959192276001, 0.9598069190979004, -1.1154872179031372, 0.27037322521209717, -0.714816689491272, 0.22838197648525238, ...
func (s *DB) Get(name string) (value interface{}, ok bool) { value, ok = s.values[name] return }
[ -1.1315706968307495, 0.5129284262657166, 0.24826456606388092, -0.5335592031478882, -0.44530683755874634, -0.5844504237174988, -0.9901083707809448, -0.3942710757255554, -0.8062785863876343, 0.8587254285812378, -0.9232664108276367, -0.02759408950805664, -0.25595635175704956, -0.2744168639183...
func (k *endpointService) CountEndpoints(environment *models.Environment, model *models.Model) (int, error) { return k.storage.CountEndpoints(environment, model) }
[ -0.3861425220966339, -0.08830847591161728, 0.3651055097579956, 0.8845894932746887, 0.41661128401756287, 0.7554444670677185, -0.2808108627796173, 0.5544907450675964, -1.0761052370071411, 1.4074842929840088, -0.9209073185920715, -0.3229660987854004, -0.1594877541065216, 0.16924650967121124, ...
func (k *endpointService) ListContainers(model *models.Model, version *models.Version, id uuid.UUID) ([]*models.Container, error) { ve, err := k.storage.Get(id) if err != nil { return nil, err } ctl, ok := k.clusterControllers[ve.EnvironmentName] if !ok { return nil, fmt.Errorf("unable to find cluster control...
[ -0.6977586150169373, -1.1286202669143677, 0.4804367423057556, 0.41121169924736023, 0.5286279320716858, -0.43008682131767273, -0.3507603704929352, -0.5305034518241882, 0.3523291051387787, 0.9977023005485535, -0.2830001711845398, 0.3567567467689514, -0.49115103483200073, 0.6835120320320129, ...
func consensuscmd() { cg, err := httpClient.ConsensusGet() if errors.Contains(err, api.ErrAPICallNotRecognized) { // Assume module is not loaded if status command is not recognized. fmt.Printf("Consensus:\n Status: %s\n\n", moduleNotReadyStatus) return } else if err != nil { die("Could not get current conse...
[ 0.10006531327962875, -0.679711103439331, 0.9754576086997986, -0.0903533399105072, 0.7816413640975952, 0.33524787425994873, 0.27881869673728943, 0.188067227602005, -1.3402115106582642, 0.4870433509349823, 0.36358898878097534, 0.9687271118164062, 0.23759327828884125, 1.3680222034454346, 0....
func NewBankDetails() *BankDetails { return &BankDetails{} }
[ 1.2401866912841797, 0.5151930451393127, -0.1258852779865265, 0.8133063912391663, -0.23072193562984467, 0.466018408536911, -0.2746540904045105, -0.5673172473907471, -0.4151279926300049, -0.9622755646705627, -0.07365033775568008, 0.7376964092254639, -0.7918790578842163, 0.9405288100242615, ...
func ParametersToSlice(parameters map[string]string) ([]string, error) { lines := make([]string, 0) keys := maps.Keys(parameters) sort.Strings(keys) //envvar names must begin with a letter or underscore invalidKey := regexp.MustCompile(`^[^a-zA-Z_]`) for _, key := range keys { if invalidKey.MatchString(key) { ...
[ -1.128811001777649, -1.1031180620193481, 0.600033700466156, -0.9734808802604675, 0.3569195568561554, -0.2655477523803711, -1.2081413269042969, -0.5708887577056885, -1.0921143293380737, 2.027452230453491, 0.4076373279094696, 0.4544248580932617, -0.17026591300964355, 1.168806791305542, -0....
func NewEncoding(encoder string) *Encoding { e := new(Encoding) e.encoder = encoder for i := 0; i < len(e.decodeMap); i++ { e.decodeMap[i] = 0xFF } for i := 0; i < len(encoder); i++ { e.decodeMap[encoder[i]] = byte(i) } return e }
[ -0.47630810737609863, 0.12565216422080994, 0.09513086080551147, 0.7556512951850891, -1.4668503999710083, -0.6749486327171326, 0.1938244104385376, 0.009080152027308941, 0.2937939763069153, 0.04871061444282532, -0.4549475610256195, -0.6778609752655029, -0.12634050846099854, 0.180393084883689...
func (enc *Encoding) EncodeBits(dst, src []byte, bits int) int { if bits < 0 { return 0 } return enc.encode(dst, src, bits) }
[ -0.9079620242118835, 1.4783835411071777, 0.18793293833732605, 0.06301885098218918, -0.863315999507904, 0.6900914907455444, -0.4088207483291626, -0.4064804017543793, -0.2915749251842499, 0.3647383153438568, -0.24791084229946136, 1.1981030702590942, -0.20570318400859833, 0.8495029211044312, ...
func (enc *Encoding) Encode(dst, src []byte) int { return enc.encode(dst, src, -1) }
[ -0.9207038879394531, 1.3099180459976196, 0.38394421339035034, 0.15561826527118683, -0.5661512017250061, -0.2637423574924469, 0.01851763390004635, 0.31958290934562683, -0.49341633915901184, 0.37774816155433655, -0.2491617202758789, 0.8984695672988892, 0.159175306558609, 0.3702732026576996, ...
func (enc *Encoding) EncodeToString(src []byte) string { buf := make([]byte, enc.EncodedLen(len(src))) n := enc.Encode(buf, src) return string(buf[:n]) }
[ -0.5149245858192444, 0.8316109776496887, 0.14337126910686493, -0.4374527931213379, 0.041535113006830215, -0.22346283495426178, -0.280631422996521, -1.1438885927200317, 0.9414454698562622, 0.6267184019088745, -0.377707302570343, 0.6675645709037781, 0.19963984191417694, 0.2256617397069931, ...
func (enc *Encoding) EncodeBitsToString(src []byte, bits int) string { dst := make([]byte, enc.EncodedLen(len(src))) n := enc.EncodeBits(dst, src, bits) return string(dst[:n]) }
[ -0.49538925290107727, 0.7232894897460938, 0.12720118463039398, -0.7659308910369873, -0.6645515561103821, 0.4216859042644501, -0.7878852486610413, -1.1752796173095703, 0.15874730050563812, 0.7525231242179871, -0.19305813312530518, 0.9772463440895081, 0.16730748116970062, -0.0713252872228622...
func (e *encoder) Close() error { // If there's anything left in the buffer, flush it out if e.err == nil && e.nbuf > 0 { m := e.enc.Encode(e.out[0:], e.buf[0:e.nbuf]) _, e.err = e.w.Write(e.out[0:m]) e.nbuf = 0 } return e.err }
[ 0.0826711431145668, -0.23112753033638, 0.878412663936615, -0.10203011333942413, -0.5886698365211487, 0.28803321719169617, 0.5942184925079346, -0.482648104429245, -0.5711556077003479, -0.24127332866191864, 0.48312392830848694, -0.16161063313484192, -1.545166254043579, 1.469821810722351, 0...
func NewEncoder(enc *Encoding, w io.Writer) io.WriteCloser { return &encoder{enc: enc, w: w} }
[ -0.0028836987912654877, -0.846649706363678, 0.21171537041664124, -0.09774263203144073, -1.1574864387512207, 0.2065291851758957, -0.027836717665195465, -0.0968765839934349, -0.4086045026779175, -0.5782132148742676, 0.6876381635665894, -0.21655188500881195, -0.19910208880901337, 1.1021459102...
func (enc *Encoding) EncodedLen(n int) int { return (n + 4) / 5 * 8 }
[ 0.40529370307922363, 0.2929615080356598, 0.18204949796199799, 0.026166561990976334, -0.6370090246200562, 0.7992326021194458, 0.6918814182281494, -0.48981326818466187, 0.7784740328788757, -0.5573782920837402, -1.5778390169143677, -0.07768329232931137, 0.010128791444003582, 0.374032616615295...
func (enc *Encoding) DecodeBitsString(s string, bits int) ([]byte, error) { if bits < 0 { return nil, errors.New("cannot decode a negative bit count") } return enc.decodeString(s, bits) }
[ 0.010865944437682629, 0.15760836005210876, 0.10174071043729782, 0.21838511526584625, -0.8281984925270081, -0.2448107749223709, -0.7373390793800354, -1.0428820848464966, -0.3760204017162323, -0.17779894173145294, 0.200489342212677, 0.3746809661388397, 0.45465365052223206, -0.114227205514907...
func (enc *Encoding) DecodeString(s string) ([]byte, error) { return enc.decodeString(s, -1) }
[ -0.6188521981239319, 0.11607339978218079, 0.20430052280426025, 0.6947252750396729, 0.19410423934459686, -0.4674992859363556, 0.22441355884075165, -0.517731785774231, 0.18014293909072876, -0.22676193714141846, -0.3797435164451599, 0.21060813963413239, 0.02022937685251236, -0.023451523855328...
func (enc *Encoding) DecodedLen(n int) int { return (n + 7) / 8 * 5 }
[ 0.47504526376724243, 0.4658396542072296, 0.10892494022846222, -0.5079554319381714, -0.8974359631538391, 0.46203044056892395, -0.004601823631674051, -0.3708020746707916, 0.8105180859565735, -1.0965890884399414, -1.6806919574737549, -0.353257954120636, 0.06533532589673996, 0.4580119252204895...
func NewDecoder(enc *Encoding, r io.Reader) io.Reader { return &decoder{enc: enc, r: r} }
[ 0.4838210642337799, -1.1141536235809326, 0.15545471012592316, -0.5370104908943176, -1.325048804283142, -0.28207486867904663, -1.307848334312439, 0.0959814190864563, -0.2953248918056488, -0.6867576837539673, 0.1186165064573288, -0.31921061873435974, 0.22198963165283203, 0.617161750793457, ...
func newMachine(s SSHInfo) *Machine { m := Machine{ ConnectionErrors: make([]string, 0), StreamData: make([]Stream, 0), SSHInfo: s, } if m.Extras == nil { m.Extras = make(map[string]interface{}, 0) } return &m }
[ -0.570206344127655, -0.08934422582387924, 0.4143577814102173, -0.7121367454528809, -0.5629667639732361, 0.27213239669799805, -0.45460930466651917, 0.19629864394664764, 0.005307793617248535, -0.923479437828064, -0.46704959869384766, 0.5887514352798462, -0.3256373107433319, 0.576031148433685...
func retrieveInventory(l string) ([]SSHInfo, error) { re, err := regexp.Compile(`^(http|https)://`) if err != nil { return nil, errors.Wrap(err, "error compiling regex") } if re.MatchString(l) { ssh, err := getInventoryFromURL(l) if err != nil { return nil, errors.Wrap(err, "could not get inventory from ...
[ -0.3696941137313843, -0.968843400478363, 0.7053008079528809, 0.3523181080818176, 0.5335180163383484, -0.1533219963312149, 0.2876586318016052, 0.045405127108097076, 0.015443884767591953, -0.6836537718772888, 0.0012282264651730657, -0.26092490553855896, -0.7438677549362183, 0.567602694034576...
func (m *Machine) connect(conf *ssh.ClientConfig, retry, wait int64) (*ssh.Client, error) { if conf.Timeout == 0 { client, err := ssh.Dial("tcp", m.address(), conf) if err != nil { return nil, errors.Wrap(err, "could not establish machine connection") } return client, nil } deadline := conf.Timeout + (t...
[ 0.18004529178142548, -0.1543963998556137, 0.6138506531715393, 0.14193356037139893, -0.5441423058509827, 0.12335124611854553, -0.6002669334411621, -0.7486304044723511, -1.3187425136566162, 0.30893823504447937, 0.15158700942993164, 0.34976041316986084, 0.11983790248632431, 0.2339760065078735...
func NewService(s userStorage) *userService { return &userService{ storage: s, } }
[ 0.163545623421669, -0.41693511605262756, 0.044155824929475784, 1.0957608222961426, -1.3195635080337524, -0.019777512177824974, -0.13932763040065765, -0.9099885821342468, 0.5987681746482849, -0.15804462134838104, -0.5196279883384705, 0.8653155565261841, 0.04052215442061424, -0.1126020923256...
func (u *userService) Get(id string) (*domain.User, error) { return u.storage.Get(id) }
[ -1.0850411653518677, 0.3876846134662628, 0.13996191322803497, 0.5651308298110962, 0.3789989948272705, -0.34031495451927185, -0.5903782844543457, -1.1000803709030151, -0.04058169201016426, -0.9490104913711548, -0.5404329895973206, 1.1583572626113892, 0.41340184211730957, -0.5786747336387634...
func (u *userService) Insert(user *domain.User) (*domain.User, error) { if err := user.Validate(); err != nil { return nil, err } return u.storage.Insert(user) }
[ -0.8889491558074951, 1.3372992277145386, 0.31528905034065247, 0.8773907423019409, -0.16873577237129211, 0.8419283032417297, 0.8024194240570068, -0.4210933744907379, 0.15302646160125732, -0.7956958413124084, -0.8921998739242554, 0.011990979313850403, -1.0618335008621216, -0.0222556870430707...
func (app *App) createQuote(b []byte) error { // TODO: // * Unmarshal b into a Quote // * Check if the quote exists in the storage, return an error if it does // * Write the quote to the storage var quote quotes.Quote err := json.Unmarshal(b, &quote) if err != nil { return fmt.Errorf("json unmarshal fail: %s...
[ -0.17048762738704681, -0.3995465040206909, 0.7164523601531982, 0.46377742290496826, 1.2574126720428467, -0.22595807909965515, -0.6879538297653198, 0.1876407116651535, 0.42345815896987915, 0.40059253573417664, -0.22430458664894104, -0.6905578970909119, -0.7901739478111267, 0.064667783677577...
func (app *App) getQuote(author string) ([]byte, error) { // TODO: // * Fetch author's quote from the storage // * Return an error if the quote does not exist // * Marshal the quote into JSON and return the result. // // Hint: Use // json.MarshalIndent(q, "", " ") // for producing formatted JSON - the test...
[ -0.1319623738527298, -0.4615843892097473, 0.7858519554138184, 0.8179194927215576, 0.15080559253692627, -1.3473381996154785, -0.6340877413749695, -0.21469375491142273, 0.7162712812423706, 0.3475896418094635, 0.4613991379737854, 0.3489117920398712, -0.19728106260299683, 0.4101865887641907, ...
func New(config Config) *LearnedPositionalEncoder { vectors := make([]nn.Param, config.NumEmbeddings+config.Offset) for i := 0; i < len(vectors); i++ { vectors[i] = nn.NewParam(mat.NewEmptyVecDense(config.EmbeddingDim)) } return &LearnedPositionalEncoder{ Config: config, Vectors: vectors, } }
[ 0.5776838064193726, -0.9210114479064941, 0.33519434928894043, 0.3747329115867615, -0.9052173495292664, 0.2776631712913513, 0.4855124056339264, 0.16708803176879883, -0.12427967041730881, -0.39104536175727844, -0.6552538275718689, 0.0422336719930172, 0.22318576276302338, 1.5329855680465698, ...
func (m *LearnedPositionalEncoder) Encode(positions []int) []ag.Node { g := m.Graph() embeddings := make([]ag.Node, len(positions)) for i, pos := range positions { embeddings[i] = g.NewWrap(m.Vectors[pos+m.Config.Offset]) } return embeddings }
[ -0.8550243973731995, 0.09439271688461304, 0.3771350681781769, 0.5661739110946655, 0.024439463391900063, 0.6046707630157471, 0.31853801012039185, 0.03831063210964203, 0.42338547110557556, 0.3322390019893646, 0.07534953951835632, 0.06006474792957306, -0.19610008597373962, 0.21475566923618317...
func main() { t := BuildTree(3, -1, 30, 10, -1, -1, 15, -1, 45) fmt.Println(t) fmt.Println(isValidBST(t)) t2 := BuildTree(5, 1, 4, -1, -1, 3, 6) //t2 := BuildTree(2, 2, 2) fmt.Println(t2) fmt.Println(isValidBST(t2)) t3 := BuildTree(120, 70, 140, 50, 100, 130, 160, 20, 55, 75, 110, 119, 135, 150, 200) fmt.Print...
[ -0.12575846910476685, -0.36327093839645386, 1.0098133087158203, 0.8772621750831604, -0.6982273459434509, 0.9887811541557312, 0.07129913568496704, 0.1677485704421997, -0.16482093930244446, 0.28141987323760986, -0.9569278359413147, 0.6022219657897949, -0.8911749720573425, 0.07944837212562561...
func done(ctx context.Context) bool { select { case <-ctx.Done(): return true default: return false } }
[ -0.27785375714302063, 1.2028658390045166, 0.6180902123451233, 0.5339372754096985, 0.19274230301380157, 0.36781924962997437, -0.7542572617530823, -1.0005111694335938, 0.30587780475616455, -0.35485976934432983, -0.8396652936935425, -0.597479522228241, -0.2190316766500473, -0.2837995588779449...
func run(ctx context.Context) error { // Load configuration and parse command line. This function also // initializes logging and configures it accordingly. tcfg, _, err := loadConfig(ctx) if err != nil { return err } cfg = tcfg defer func() { if logRotator != nil { logRotator.Close() } }() // Show ...
[ -0.2408512681722641, -0.16817502677440643, 0.9680516123771667, -0.45377737283706665, 1.0320464372634888, 0.43488752841949463, 0.48452773690223694, -0.4628746807575226, -0.33997833728790283, 0.27071744203567505, -0.6621534824371338, 0.05303121358156204, -0.9612823128700256, 0.27701628208160...
func extractOnlineDDL() error { if binaryFileName, isOverride := onlineddl.GhostBinaryFileName(); !isOverride { if err := os.WriteFile(binaryFileName, resources.GhostBinary, 0755); err != nil { // One possibility of failure is that gh-ost is up and running. In that case, // let's pause and check if the running...
[ 0.5750080943107605, -0.48156341910362244, 0.7353525161743164, 0.27615830302238464, 0.1459791213274002, 0.45301687717437744, -0.08524392545223236, 0.036906320601701736, -0.11352193355560303, -0.11039170622825623, -0.37065932154655457, -0.26510509848594666, -0.8278622627258301, 0.64794826507...
func TTL(t time.Duration) selector.Option { return func(o *selector.Options) { if o.Context == nil { o.Context = context.Background() } o.Context = context.WithValue(o.Context, ttlKey{}, t) } }
[ 0.5651049613952637, 0.3568989634513855, 0.48884761333465576, -0.22877603769302368, 0.6434005498886108, 0.40156111121177673, 0.7284724712371826, -0.17027798295021057, 1.4425333738327026, 0.6533036828041077, -0.0029251540545374155, -0.08089756965637207, 0.9301928281784058, -0.828382313251495...
func weaponIDIsBlacklisted(weaponID int) bool { for _, wid := range weaponIDBlacklist { if weaponID == wid { return true } } return false }
[ 0.15845830738544464, -0.3850206434726715, 0.398339182138443, -0.046520985662937164, 0.43570008873939514, -0.10347314924001694, -0.039838481694459915, -0.0012816475937142968, 0.2660923898220062, 1.5734388828277588, -0.7024679183959961, 1.1205101013183594, -1.1127318143844604, 1.081430315971...
func skillIDIsWeapon(skillID int) bool { if skillID == defs.SkillIDNone { return false } for _, w := range defs.Weapons { if w.SkillID == skillID { return true } } return false }
[ -0.15837125480175018, -0.6721223592758179, 0.3844674527645111, 0.03489378094673157, -0.39115360379219055, -0.3683280944824219, 0.25348174571990967, -0.40159139037132263, 0.6181479692459106, 0.7450026869773865, -0.4347638785839081, -0.014004871249198914, 0.32002970576286316, 0.3505204617977...
func itemIDToWeaponID(itemID int) int { for wid, w := range defs.Weapons { if itemID == w.ItemID { return wid } } return -1 }
[ -0.5100926756858826, -0.8804775476455688, 0.3458794057369232, -0.4974837005138397, 0.0950544998049736, -0.2351483255624771, 0.8776921629905701, -0.6776517033576965, 1.1255706548690796, 1.101304531097412, -0.037085678428411484, 0.6530189514160156, -0.23102642595767975, 0.012157482095062733,...
func sortedWeaponSkills(skills []decode.CharSkill) []decode.CharSkill { var ws []decode.CharSkill for _, s := range skills { // Ignore pugilism since it has no associated weapon. if skillIDIsWeapon(s.ID) && s.ID != defs.SkillIDPugilism { ws = append(ws, s) } } // Sort in descending order. sort.Slice(ws,...
[ 0.026025371626019478, -1.2065317630767822, 0.3688666820526123, 0.196851447224617, -0.4117072820663452, 0.28657811880111694, 0.21113809943199158, -1.3718559741973877, -0.1523437201976776, 0.19186832010746002, -0.2849387228488922, 0.6013787984848022, -0.011375835165381432, 0.5689578652381897...
func weaponIDsWithSkillID(skillID int) []int { return gen.FilterIDs(defs.WeaponIDMaxPlusOne, func(id int) bool { if weaponIDIsBlacklisted(id) { return false } return defs.Weapons[id].SkillID == skillID }) }
[ -0.010765224695205688, -0.5261821150779724, 0.35349175333976746, 0.4372183382511139, -0.7794985175132751, -0.5791114568710327, 0.32455480098724365, -0.35347780585289, 1.3256323337554932, 1.0237398147583008, -0.7771409749984741, 0.7533766031265259, 0.07411834597587585, 1.024552583694458, ...
func weaponCosts(numWeapons int) []int { // Spread the weapon IDs evenly along the X-axis. Map each ID to a point // cost according to y=sqrt(x), y(0)=0, y(max+1)=36. costs := make([]int, numWeapons) itvl := 1.0 / float64(len(costs)) for i := 0; i < len(costs); i++ { x := float64(i) * itvl y := math.Sqrt(x) ...
[ 0.15875570476055145, 0.06442084163427353, 0.41831979155540466, -0.23242764174938202, -0.4114221930503845, -0.5740700960159302, 0.059463005512952805, -0.7326456904411316, 0.4445093870162964, 1.103168249130249, -0.6225884556770325, -0.2018325924873352, -0.19753417372703552, -0.27026855945587...
func selectOneWeaponID(weaponIDs []int, points int) int { if len(weaponIDs) == 1 { return weaponIDs[0] } // Approximate weapon value by two characteristics: // 1. Price // 2. Reusablility. The value of non-reusable weapons is halved. // // Sort relevant weapon IDs in ascending order of value. sort.Slice(wea...
[ 0.022948335856199265, 0.015825534239411354, 0.4735458493232727, 0.3257826566696167, -0.4197620451450348, -0.2477262318134308, 0.6748855710029602, -0.7648283243179321, -0.011153781786561012, 0.785198450088501, 0.6270818710327148, 0.675796389579773, -0.47351962327957153, 0.4159082770347595, ...
func rankedWeaponPoints(skillLevel int, rank int, cfg npcdefs.NPCCfg) int { if rank >= maxWeaponCount { return 0 } // Calculate points assuming rank 0. points := itemPoints(skillLevel, cfg.WeaponPPLMin, cfg.WeaponPPLMax) // Subtract points for higher ranked weapons. points -= int(float64(rank) * weaponRankDif...
[ 0.23361124098300934, -0.20381736755371094, 0.07765703648328781, -0.188129723072052, -0.47809165716171265, -0.1967591792345047, 0.45436185598373413, 0.6769744753837585, -0.30763787031173706, 0.7317107915878296, -0.4724118411540985, 0.85489422082901, -0.1202675923705101, 0.31503573060035706,...
func selectRankedWeapons(skills []decode.CharSkill, cfg npcdefs.NPCCfg) []RankedWeapon { var rws []RankedWeapon wss := sortedWeaponSkills(skills) log.Debugf("sorted weapon skills:\n") for _, ws := range wss { log.Debugf(" %d %s", ws.Level, defs.SkillNames[ws.ID]) } for rank, ws := range wss { ids := wea...
[ 0.27546682953834534, -0.8651952743530273, 0.1340208649635315, 0.04502221941947937, 0.025074459612369537, -0.5706202983856201, 0.4482160806655884, -0.6579248905181885, 0.3439861536026001, 0.24881009757518768, -0.5373871326446533, 1.1402477025985718, -0.4194633960723877, 1.080878734588623, ...
func (rw *RankedWeapon) oneUseWeapons(rank int, cfg npcdefs.NPCCfg) []InvItem { var allWids []int for _, wid := range rw.AllWeaponIDs { if !defs.Weapons[wid].Reusable { allWids = append(allWids, wid) } } widMap := map[int]int{} // [id]count totalCount := util.RandRange(cfg.WeaponCountMin, cfg.WeaponCount...
[ -0.5463237166404724, -0.5722707509994507, 0.5934169888496399, -0.11604589968919754, 0.3711695373058319, -0.46713560819625854, 0.758259654045105, -0.3327133357524872, 0.5012254118919373, 1.1035093069076538, -0.5613344311714172, 0.5968119502067566, -1.2226598262786865, 0.7841017246246338, ...
func (rw *RankedWeapon) Items(skills []decode.CharSkill, cfg npcdefs.NPCCfg) []InvItem { w := defs.Weapons[rw.WeaponID] if !w.Reusable { return rw.oneUseWeapons(rw.Rank, cfg) } var items []InvItem items = append(items, InvItem{ ItemID: w.ItemID, Count: 1, }) if w.ClipItemID != defs.ItemIDNone { count...
[ -1.0597171783447266, -0.7485395073890686, 0.20286624133586884, -0.21805031597614288, 0.14677810668945312, -0.05309947207570076, 0.0021088437642902136, 0.12116464972496033, 0.5982616543769836, 0.8255935907363892, -0.17280636727809906, 0.5073701739311218, -0.34570935368537903, 0.071446917951...
func Lookup(configPath string, key string) ([]string, error) { out, _, err := checkedRun(exec.Command("sshd", "-T", "-f", configPath)) if err != nil { return nil, fmt.Errorf("failed to fetch effective config: %w", err) } // sshd -T prints out lowercase options key = strings.ToLower(key) lineRegexp := regexp.M...
[ -0.5933859348297119, -0.2286820262670517, 0.9037885665893555, -0.45182913541793823, 0.14257577061653137, 0.07110030204057693, -0.9091267585754395, 0.4696168303489685, -0.46783679723739624, 1.9423346519470215, 0.13619305193424225, 0.5503991842269897, -0.321309357881546, 0.49066978693008423,...
func Fetch(url string) bool { if !strings.HasPrefix(url, "http://") { fmt.Fprintf(os.Stderr, "not supprot prefix\n") return false } resp, err := http.Get(url) if err != nil { fmt.Fprintf(os.Stderr, "fetch: %v\n", err) return false } n, err := io.Copy(os.Stdout, resp.Body) fmt.Printf("request status %d, g...
[ -0.08083499222993851, -0.4243068993091583, 0.975029706954956, -0.46880343556404114, -1.158755898475647, 0.8308197855949402, -0.6105200052261353, 0.44432491064071655, -0.40952378511428833, -0.042607057839632034, 0.2521185874938965, 0.3897494077682495, 0.26763880252838135, 0.8791432976722717...
func FetchAll(urls []string) { ch := make(chan string) for _, url := range urls { go fetch(url, ch) // start a goroutine } for range os.Args[1:] { fmt.Println(<-ch) // receive from channel ch } }
[ 0.8087118268013, -0.02407105080783367, 0.5862773060798645, 0.11347522586584091, 0.33822181820869446, 0.7317318320274353, -0.5888427495956421, -0.3487408459186554, -0.6759653687477112, -0.16137519478797913, 0.04068363457918167, 0.6698805689811707, 0.034382447600364685, 1.4357900619506836, ...
func fetch(url string, ch chan<- string) { start := time.Now() resp, err := http.Get(url) if err != nil { ch <- fmt.Sprint(err) // send to channel ch return } nbytes, err := io.Copy(ioutil.Discard, resp.Body) resp.Body.Close() // don't leak resources if err != nil { ch <- fmt.Sprintf("while reading %s: %v"...
[ 0.06155097484588623, -0.7605342268943787, 0.7102867960929871, -1.3259693384170532, -0.2778049111366272, 0.30702024698257446, -1.0171030759811401, -0.4287617802619934, -0.4173261821269989, 0.2957504987716675, -0.08986517041921616, 1.1360690593719482, 0.9130668640136719, 1.1332165002822876, ...
func Fetch2(url string) (filename string, n int64, err error) { resp, err := http.Get(url) if err != nil { return "", 0, err } defer resp.Body.Close() local := path.Base(resp.Request.URL.Path) fmt.Println(local) if local == "/" { local = "index.html" } f, err := os.Create(local) if err != nil { return...
[ 0.23753124475479126, -0.4614621698856354, 0.8435352444648743, 0.2683655619621277, -0.7882442474365234, 0.36481520533561707, 0.5028917789459229, -0.6219367384910583, -0.17358382046222687, -0.2205246090888977, -0.4200519919395447, 0.5259180665016174, 1.1438965797424316, 0.9434598088264465, ...
func (h *HTTP) Start() error { errors := make(chan error) // Debug message to help us understand from logging level if we're listening forever // or until the first error if h.ListenForever { h.Debug("HTTP server will listen forever ( will auto restart on error ) ...") } go func() { for { h.SetStateConne...
[ -0.12160687148571014, -0.509956419467926, 0.6148772835731506, 0.3672029972076416, 0.2581736147403717, -0.17594578862190247, -0.19080403447151184, -0.019435692578554153, -0.7789512276649475, 0.331050306558609, -0.0663057193160057, 0.546333909034729, -0.28055673837661743, -0.0389389991760253...
func (h *HTTP) State() *ConnectivityState { return h.ConnectivityState }
[ 0.22387878596782684, -0.9654744863510132, 0.27820539474487305, 0.15519647300243378, 0.004336262587457895, 0.8386478424072266, -0.19962763786315918, -0.12026264518499374, 0.2781696617603302, -0.6685954928398132, 0.306765615940094, -0.056436192244291306, -0.9996585249900818, 0.31477519869804...
func NewFiveTuple(data []byte) *FiveTuple { return &FiveTuple{data: data} }
[ -0.5413923859596252, -0.0919131338596344, 0.24008089303970337, -0.05907323583960533, -0.957980751991272, -0.8735898733139038, -0.8596717119216919, -1.2613389492034912, -0.07001300156116486, -0.12150351703166962, -1.5570573806762695, -0.5295240879058838, -1.5088673830032349, 0.1917496025562...
func (p *FiveTuple) Hash() uint64 { return siphash.Hash(lookupKey, 0, p.data) }
[ -0.9570316076278687, 0.891448438167572, 0.27287736535072327, -0.1011226624250412, -0.08773298561573029, 0.15343450009822845, -0.42147770524024963, 0.3193169832229614, 0.33228594064712524, -0.37814927101135254, -0.5512406826019287, -0.5015610456466675, -0.645159125328064, -0.296078145503997...
func BenchmarkQueueLargeItem(b *testing.B) { var queue Queue // Benchmark pushing b.N items to queue, then separately popping // the same amount from the queue type largeItem struct { Number int64 FloatNum float64 Text string Something interface{} } for n := 0; n < b.N; n++ { queueItem := Que...
[ 0.6703143119812012, 0.5893431305885315, 0.6531935334205627, -0.5147168040275574, 1.033253788948059, 0.016021518036723137, -0.04940062761306763, -0.3515430986881256, -0.5686968564987183, 0.5864742994308472, -0.23037885129451752, -0.25819411873817444, 0.06658920645713806, 0.7230284214019775,...
func New64(seed uint32) Hash128 { seed64 := uint64(seed) return &sum64_128{seed64, seed64, 0, 0, 0, 0} }
[ 0.2539808452129364, 0.45817288756370544, 0.3040321171283722, 1.5093214511871338, -0.6031601428985596, -0.03501955047249794, -0.2365148663520813, -0.24195343255996704, -0.37081196904182434, -0.14127877354621887, 0.09996501356363297, -0.5532765984535217, 0.09730260819196701, 0.02972714416682...
func (s *sum64_128) Reset() { s.h1, s.h2, s.k1, s.k2, s.length, s.offset = 0, 0, 0, 0, 0, 0 }
[ -0.17287588119506836, 0.009731495752930641, 0.2714574337005615, 0.11403767019510269, -0.22319510579109192, 0.4870586097240448, 0.21891574561595917, -0.2750835418701172, -0.6057311296463013, 0.3207351565361023, -0.24076958000659943, 0.6906195282936096, -0.04943103343248367, -0.4668290317058...
func (this *StmtManager) PrepareOnce(preparer sqlPreparer, querySQL string, parentId int64) (resultStmt *Stmt, wasCached bool, err error) { var cacheKey = "" if parentId == 0 { cacheKey = "0$" + querySQL } else { cacheKey = strconv.FormatInt(parentId, 10) + "$" + querySQL } // check if exists this.locker.RLo...
[ -0.24116067588329315, 0.5966095328330994, 1.0026521682739258, -0.21097004413604736, -0.834238588809967, -0.44158393144607544, -0.25749456882476807, -0.6860984563827515, 0.48659613728523254, 0.6594617366790771, 0.18144719302654266, -1.0960586071014404, -0.5508449673652649, 0.696519434452056...
func (d *Device) RecordSpecialEvents(impl uhppoted.IUHPPOTED, request []byte) (any, error) { body := struct { DeviceID *uhppoted.DeviceID `json:"device-id"` Enabled *bool `json:"enabled"` }{} if response, err := unmarshal(request, &body); err != nil { return response, err } if body.DeviceID =...
[ -0.31041350960731506, 0.3317027986049652, 0.9128230214118958, 0.11246047914028168, -0.7666565775871277, 0.38201218843460083, 0.2844630181789398, 0.8008681535720825, 0.6303032636642456, 0.7874208092689514, -0.4611073136329651, 1.2916911840438843, -0.9339542388916016, 0.44882768392562866, ...
func RunDefaultServer() *gnatsd.Server { return RunServer(DefaultTestOptions) }
[ -1.3683167695999146, 0.25762245059013367, 0.5669106245040894, 0.025317948311567307, 1.207554578781128, 0.7282230257987976, 0.14946742355823517, -0.6130075454711914, 0.22830024361610413, -0.5816807746887207, 0.24366089701652527, -0.012316513806581497, -0.7298718094825745, 0.2510345280170440...
func RunServer(opts *gnatsd.Options) *gnatsd.Server { // if opts == nil { // opts = &DefaultTestOptions // } // Optionally override for individual debugging of tests // opts.NoLog = !doLog // opts.Trace = doTrace opts.Debug = true s := gnatsd.New(opts) // if err != nil || s == nil { // panic(fmt.Sprintf("N...
[ -0.9928632378578186, -0.05176027864217758, 0.7022607922554016, -0.39725813269615173, -0.33186018466949463, 0.8837651014328003, -0.013150082901120186, 0.099274180829525, 0.04340619966387749, -0.47791174054145813, 0.4360857903957367, 0.908900260925293, -0.5285021066665649, 0.2753914892673492...
func LoadConfig(configFile string) *gnatsd.Options { opts, err := gnatsd.ProcessConfigFile(configFile) if err != nil { panic(fmt.Sprintf("Error processing configuration file: %v", err)) } return opts }
[ 0.14055965840816498, 0.8581873774528503, 0.49696844816207886, -0.2667446434497833, -0.08854366838932037, 0.4437718689441681, -0.45892998576164246, -0.027098707854747772, -0.4714391231536865, 0.7911571860313416, 0.37363848090171814, -0.18871060013771057, 0.4062948226928711, 1.07416582107543...