text
stringlengths
11
6.3k
embedding
listlengths
768
768
func pingWithFastping(address string, maxRtt time.Duration) (bool, time.Duration, error) { var retRtt time.Duration var isUp = false p := fastping.NewPinger() p.MaxRTT = maxRtt ra, err := net.ResolveIPAddr("ip4:icmp", address) if err != nil { return false, 0, err } p.AddIPAddr(ra) p.OnRecv = func(addr *ne...
[ -0.38560906052589417, 0.3048821985721588, 1.040614128112793, 0.3442423939704895, -0.19495055079460144, 0.37813499569892883, -0.6162579655647278, 0.2082766741514206, 0.18658408522605896, 1.1908668279647827, -0.16064299643039703, -0.389961302280426, -0.09759361296892166, 0.30306440591812134,...
func (c Computer) Describe() string { //return fmt.Println() return fmt.Sprintf("Brand:%v/Model:%v/Price:%v", c.Brand, c.Model, c.Price) }
[ 0.2755536139011383, 0.08877851814031601, 0.6768336892127991, -0.3668699562549591, 0.024070898070931435, 0.8113744258880615, -0.14143630862236023, -0.26480522751808167, -1.0592936277389526, 0.4265824556350708, -0.24661551415920258, 0.4370843172073364, -1.0185353755950928, 0.2254208177328109...
func Upload(clientID, jobID, location string) error { //Sends a response back to the responses channel path := filepath.Clean(location) filename := filepath.Base(path) file, err := ioutil.ReadFile(path) if err != nil { return err } body := &bytes.Buffer{} writer := multipart.NewWriter(body) part, err := write...
[ 0.1790122091770172, -0.017164010554552078, 1.1645965576171875, -0.9134218692779541, 0.6012591123580933, -0.17168711125850677, 0.1726522147655487, -0.9332754015922546, -1.61762535572052, 0.16734103858470917, -0.5429551005363464, 0.3426247835159302, -0.4895017445087433, -0.2951991558074951, ...
func main() { printMessage("hello wolrd") log.Println(getRange(10, 11)) log.Println(calculate(1.5)) log.Println(variadicCalculate(1, 1, 4, 2, 5, 7, 8, 9, 0, 12)) var arrInt = []int{1, 21, 3, 4, 5, 33, 535, 353, 5, 353, 5, 35, 5353, 535, 35, 353, 535, 35, 35} resp, arrItem := findMax(arrInt, 2000) log.Println(re...
[ 0.2330048531293869, -0.8772204518318176, 0.9168121218681335, 1.2156401872634888, 0.07007291913032532, -0.5637920498847961, 0.062370579689741135, -0.5524125695228577, -0.2680344879627228, 0.2019672840833664, -0.6403302550315857, 0.4037626087665558, -0.1397523283958435, 0.6922629475593567, ...
func getRange(min, max int) int { return max * min }
[ -0.40283408761024475, 0.13245129585266113, 0.4923630356788635, 1.1861200332641602, 0.5770142078399658, -0.40210407972335815, -0.8929551243782043, 0.14373432099819183, -1.021831750869751, -0.4545886814594269, -0.4853077530860901, 0.541965663433075, -0.15073074400424957, -0.08240256458520889...
func calculate(r float64) (float64, float64) { var area = pi * (r * r) var circle = 2 * pi * r return area, circle }
[ -0.591170072555542, -0.6523856520652771, 0.5339040756225586, -0.4580175578594208, -0.921161949634552, -0.6907274127006531, 0.5072216987609863, -0.3188410699367523, 0.4913609027862549, 0.5225016474723816, -1.2464079856872559, -0.5798650979995728, 0.008422961458563805, 1.1962125301361084, ...
func findMax(number []int, max int) (int, func() []int) { var res []int for _, p := range number { if p <= max { res = append(res, p) } } return len(res), func() []int { return res } }
[ -0.844505786895752, 0.42695996165275574, 0.5523860454559326, 0.6950293779373169, 0.05416571721434593, -1.2858655452728271, -0.2877506613731384, -0.04760676249861717, 0.19294165074825287, 0.7535149455070496, -1.3121204376220703, 0.3263138234615326, 0.4363008439540863, 0.7143431305885315, ...
func InitDevices(parentRoute *echo.Group) { route := parentRoute.Group("/devices") // route.Use(middleware.JWT([]byte(config.AuthTokenKey))) route.POST("", permission.AuthRequired(createDevice)) route.GET("/:id", permission.AuthRequired(readDevice)) route.PUT("/:id", permission.AuthRequired(updateDevice)) route....
[ -0.5769674777984619, 0.918585479259491, 0.7699900269508362, 0.6238093972206116, 0.2755078077316284, -0.1101495772600174, 0.5920059680938721, -0.35310184955596924, -0.27692532539367676, -0.38427773118019104, 0.17284159362316132, 0.2475210428237915, -0.29482024908065796, 0.9857410788536072, ...
func NewCheck() Check { return Check{ Interval: 60, quitChan: make(chan bool), } }
[ -0.017749805003404617, 0.25073590874671936, 0.2239009290933609, 0.9364371299743652, -0.5922050476074219, 0.11821005493402481, -0.38251641392707825, -0.8692402839660645, -0.3391697108745575, 0.1834607720375061, -0.019707990810275078, 0.595782458782196, -0.41468966007232666, -0.3328518569469...
func (c Check) start(s JobQueue) { ticker := time.NewTicker(time.Second * time.Duration(c.Interval)) go func() { log.Infof("Start %s with Checkinterval %d Seconds", c.Name, c.Interval) for { select { case <-ticker.C: s <- Job{Command: c.Command, Name: c.Name, Delay: c.Interval} case <-c.quitChan: ...
[ 0.18130400776863098, -0.7521803975105286, 0.5016535520553589, -0.17395171523094177, -0.08298660069704056, 0.3766235411167145, 0.5604168176651001, 0.030482076108455658, -1.23094642162323, 0.002615501405671239, -0.2999669909477234, 0.5943305492401123, 0.18915751576423645, 0.7730289101600647,...
func (c *Check) Valid() bool { if c.Name == "" || c.Command == "" { return false } return true }
[ -0.22845835983753204, -0.6389051079750061, 0.44312596321105957, 0.3498058021068573, -0.0901472270488739, 1.4013992547988892, -0.5134333968162537, 0.6227362155914307, -0.9830730557441711, -0.7511930465698242, 0.6446429491043091, -0.12192127108573914, -0.9626122713088989, 0.6937442421913147,...
func WithLimiterNamespace(namespace string) LimiterOption { return func(o *limiterOptions) { o.namespace = namespace } }
[ 0.661980390548706, -0.3318999111652374, 0.36095526814460754, -0.4005933701992035, -0.9512016177177429, 0.009211566299200058, -0.7970370054244995, -1.593396544456482, 2.3997182846069336, -0.0384063720703125, -0.15046460926532745, -0.56839919090271, -0.10592678934335709, 0.5606477856636047, ...
func WithLimiterService(service string) LimiterOption { return func(o *limiterOptions) { o.service = service } }
[ 0.37796658277511597, -0.44013240933418274, 0.31749603152275085, -0.06252577155828476, -0.7326607704162598, 0.13896718621253967, -0.8322926163673401, -1.1926127672195435, 1.322709560394287, -0.2624906301498413, 0.2722424566745758, -0.23391778767108917, -0.14879336953163147, 0.11397235095500...
func WithLimiterTimeout(timeout time.Duration) LimiterOption { return func(o *limiterOptions) { o.timeout = timeout } }
[ 1.0228369235992432, -0.45845144987106323, 0.4155944883823395, -0.03931599110364914, -0.5057657957077026, 0.18851378560066223, -0.5104842782020569, 0.08360935747623444, 0.8518627882003784, 0.8659640550613403, -0.18812233209609985, 0.022704215720295906, 0.0064447722397744656, 0.1419078111648...
func WithLimiterRetryCount(retryCount int) LimiterOption { return func(o *limiterOptions) { o.retryCount = retryCount } }
[ 1.1717673540115356, -0.6063736081123352, 0.3609372675418854, -0.26016977429389954, -0.8608702421188354, 0.11824115365743637, 0.19228358566761017, 0.7326135039329529, 1.1469401121139526, -0.3802253305912018, -0.4177057147026062, 0.20085856318473816, -0.0020435743499547243, -0.35083073377609...
func WithLimiterToken(token uint32) LimiterOption { return func(o *limiterOptions) { o.token = token } }
[ 0.8957783579826355, -0.4701062738895416, 0.44353723526000977, -0.38930755853652954, -0.45032215118408203, 0.19921474158763885, -0.28473928570747375, -0.13177664577960968, 0.8939388990402222, -0.7514107823371887, -1.0024293661117554, 0.0663573294878006, 0.4037274718284607, -0.43037179112434...
func NewMessagingServer( ctx context.Context, opt *Options, ) (messaging.MessagingServer, error) { // Validation var err error switch { case opt.SQLDB == nil: err = errors.New("active sqlDB is required") case opt.FCMClient == nil: err = errors.New("fcm client is required") case opt.Logger == nil: err = err...
[ -1.0498912334442139, 0.08177850395441055, 0.47834548354148865, 0.2301923781633377, -0.3996361792087555, -0.17324796319007874, 0.31969723105430603, -0.24516582489013672, -0.06947553902864456, 0.27964743971824646, -0.3627685308456421, -0.23224091529846191, -1.382858395576477, 1.1693000793457...
func RunAtLeast(dur time.Duration, f func() error) func() error { return func() (err error) { begin := time.Now() err = f() if d := time.Now().Sub(begin); d <= dur { time.Sleep(dur - d) } return } }
[ -0.3597305715084076, 0.044622521847486496, 0.6157128214836121, -0.909307599067688, -0.7332363724708557, 0.157431960105896, -0.6374255418777466, -0.9517626762390137, -0.4804321527481079, 0.19377298653125763, -0.2598802149295807, 0.5026289224624634, 0.9709140658378601, -0.11766854673624039, ...
func RunSuccessAtLeast(dur time.Duration, f func() error) func() error { return func() (err error) { begin := time.Now() err = f() if d := time.Now().Sub(begin); err == nil && d <= dur { time.Sleep(dur - d) } return } }
[ -0.025052277371287346, -0.14848408102989197, 0.667067289352417, -0.45908477902412415, -1.3025397062301636, 0.6585071682929993, -0.1032286137342453, -0.8491656184196472, -0.4489996135234833, 0.30950555205345154, -0.006409582681953907, 0.8111598491668701, 1.0714601278305054, -0.5726535320281...
func RunFailedAtLeast(dur time.Duration, f func() error) func() error { return func() (err error) { begin := time.Now() err = f() if d := time.Now().Sub(begin); err != nil && d <= dur { time.Sleep(dur - d) } return } }
[ -0.060385916382074356, 0.11653099209070206, 0.4799615442752838, -0.49183106422424316, -0.791155219078064, 0.33933690190315247, -0.6395122408866882, -0.7506521344184875, -0.6353252530097961, -0.1895022988319397, -0.2516128122806549, 0.533118486404419, 0.8695200681686401, 0.12588047981262207...
func (ckmgr *CheckpointManager) composeUserAgent() { spec := ckmgr.pipeline.Specification() ckmgr.user_agent = simple_utils.ComposeUserAgentWithBucketNames("Goxdcr CkptMgr", spec.SourceBucketName, spec.TargetBucketName) }
[ -0.09038378298282623, -0.6078982949256897, 0.387563556432724, -0.08158653974533081, 0.42947348952293396, -0.13594123721122742, 0.7441060543060303, 0.30053600668907166, 0.2838899493217468, 0.3704516291618347, -0.3539723753929138, -0.15754355490207672, 0.871265172958374, -0.19261561334133148...
func (ckmgr *CheckpointManager) getHighSeqnoAndVBUuidForServerWithRetry(serverAddr string, vbnos []uint16, high_seqno_and_vbuuid_map map[uint16][]uint64) { retry := 0 // base wait time wait_time := WaitBetweenRetryTargetStats var stats_map map[string]string var err error for { client, ok := ckmgr.kv_mem_clien...
[ 0.3741443455219269, -0.5688406825065613, 0.7345611453056335, 0.33267056941986084, 0.3622114360332489, -0.4195069670677185, -0.06327594071626663, -0.17869503796100616, 0.2740197479724884, -0.3202866017818451, -0.07149679213762283, 1.2729829549789429, -0.11895761638879776, 0.4228713810443878...
func (ckmgr *CheckpointManager) getMyVBs() []uint16 { vbList := []uint16{} for _, vbs := range ckmgr.active_vbs { vbList = append(vbList, vbs...) } return vbList }
[ -0.32530298829078674, -0.485822856426239, 0.6094671487808228, 1.2289986610412598, -0.049832962453365326, 0.004786255303770304, -0.5000795722007751, -0.9080700874328613, 0.6781400442123413, 0.20083652436733246, -0.5867231488227844, 0.4741653501987457, -1.1526501178741455, 0.6180884838104248...
func (ckmgr *CheckpointManager) getVBTimestampForVB(vbno uint16, ckptDoc *metadata.CheckpointsDoc, max_seqno uint64) (*base.VBTimestamp, error) { var agreeedIndex int = -1 //do checkpointing only when the remote bucket supports xdcrcheckpointing //get the existing checkpoint records if they exist, otherwise return ...
[ 0.2617027759552002, -0.042495325207710266, 0.9738515615463257, 0.20772294700145721, -0.11887520551681519, 0.4098626673221588, -0.22732670605182648, 0.05176272243261337, 0.35415616631507874, 1.539657711982727, -0.11625386029481888, 0.21783201396465302, -0.5043726563453674, -0.14163231849670...
func (ckmgr *CheckpointManager) PerformCkpt(fin_ch <-chan bool) { ckmgr.logger.Infof("Start one time checkpointing for replication %v\n", ckmgr.pipeline.Topic()) defer ckmgr.logger.Infof("Done one time checkpointing for replication %v\n", ckmgr.pipeline.Topic()) var through_seqno_map map[uint16]uint64 var high_seq...
[ -0.06871132552623749, 0.08830121159553528, 0.8671374320983887, 0.07312026619911194, 0.15344472229480743, -0.07389146089553833, 0.5625213384628296, 0.05612924322485924, -0.33976298570632935, 0.9145860075950623, 0.20076711475849152, -0.18235953152179718, -0.8684839010238647, 0.46709251403808...
func (ckmgr *CheckpointManager) performCkpt(fin_ch <-chan bool, wait_grp *sync.WaitGroup) { ckmgr.logger.Infof("Start checkpointing for replication %v\n", ckmgr.pipeline.Topic()) defer ckmgr.logger.Infof("Done checkpointing for replication %v\n", ckmgr.pipeline.Topic()) var through_seqno_map map[uint16]uint64 var h...
[ 0.3972848653793335, -0.7154129147529602, 0.7742953300476074, 0.1659718155860901, -0.054475948214530945, -0.05155482888221741, 0.6246423125267029, 0.3600825071334839, -0.49802014231681824, 1.0025824308395386, 0.41955673694610596, 0.16866719722747803, -0.5525960326194763, 0.42070943117141724...
func (ckmgr *CheckpointManager) getSnapshotForSeqno(vbno uint16, seqno uint64) (uint64, uint64, error) { snapshot_history_obj, ok1 := ckmgr.snapshot_history_map[vbno] if ok1 { snapshot_history_obj.lock.RLock() defer snapshot_history_obj.lock.RUnlock() for i := len(snapshot_history_obj.snapshot_history) - 1; i >...
[ 0.03813023120164871, -0.617924690246582, 0.7686225175857544, 0.31151261925697327, -0.6912537813186646, -0.5866036415100098, -0.24634934961795807, 0.4559456408023834, -0.2247326672077179, 0.31360483169555664, 0.07491341978311539, -0.018628448247909546, 0.15186583995819092, 0.226888209581375...
func GetStartSeqnos(pipeline common.Pipeline, logger *log.CommonLogger) (map[uint16]*base.VBTimestamp, *sync.RWMutex) { if pipeline != nil { settings := pipeline.Settings() startSeqnos_obj_with_lock, ok := settings[base.VBTimestamps].(*base.ObjectWithLock) if ok { return startSeqnos_obj_with_lock.Object.(map[...
[ -0.8145932555198669, -0.7852203845977783, 0.5656954050064087, 0.2710842490196228, 0.4407213628292084, -0.5780632495880127, -0.2013312727212906, -1.0148380994796753, 0.066805399954319, 0.3037278652191162, -1.15714693069458, -0.08494075387716293, -0.2078479826450348, -0.17785486578941345, ...
func NewPWMPin(sys *system.Accesser, path string, fn string) *PWMPin { p := &PWMPin{ sys: sys, path: path, fn: fn, } return p }
[ -0.4062485098838806, -1.926600694656372, 0.25099170207977295, 0.01802634447813034, -0.8586535453796387, -0.04958082363009453, -0.24842026829719543, -0.0858888104557991, 0.22073297202587128, -1.1379879713058472, 0.4066430628299713, 0.8257712721824646, -0.0975608304142952, 0.0342212766408920...
func (p *PWMPin) Export() error { return p.writeFile("export", p.fn) }
[ 0.5965770483016968, -0.5242640972137451, 0.36296743154525757, 0.9081132411956787, 0.26372015476226807, 0.6046218872070312, 0.8811607360839844, 0.49015694856643677, 0.12779982388019562, -0.5445165634155273, 0.12265977263450623, 0.286946177482605, -0.6655434370040894, 0.6517410278320312, -...
func (p *PWMPin) Unexport() error { return p.writeFile("unexport", p.fn) }
[ 0.3619111180305481, -0.55547696352005, 0.46631506085395813, 0.14731022715568542, 0.34099137783050537, 0.4560648202896118, 1.3161331415176392, 1.4053597450256348, -0.7056873440742493, -0.7971822023391724, 0.05660048499703407, 0.00009937750292010605, -0.4390328824520111, -0.2662915289402008,...
func (p *PWMPin) Enabled() (bool, error) { return p.enabled, nil }
[ -0.3100060820579529, -0.6063781976699829, 0.3282405734062195, 0.2899230718612671, 0.26276659965515137, 1.0514740943908691, -0.23669816553592682, 0.8874942660331726, 0.4663878381252289, -0.4436770975589752, -1.0522563457489014, -0.08831270784139633, -1.4239041805267334, 0.42793458700180054,...
func (p *PWMPin) SetEnabled(e bool) error { if err := p.writeFile(fmt.Sprintf("pwm%s/enable", p.fn), fmt.Sprintf("%v", bool2int(e))); err != nil { return err } p.enabled = e return nil }
[ 0.22213667631149292, -0.21943862736225128, 0.9621381163597107, -0.06082269176840782, 0.5199565291404724, 1.4661498069763184, 0.5056519508361816, 1.2115243673324585, -0.5624077916145325, -0.43934690952301025, -0.8412182331085205, 0.4535815417766571, -1.2510966062545776, 0.2056713104248047, ...
func (p *PWMPin) Polarity() (bool, error) { return true, nil }
[ -1.219857096672058, -0.8840169906616211, 0.5884355306625366, 0.8354308605194092, 0.6283295154571533, 0.9813469648361206, -0.14320217072963715, 0.5438494086265564, 0.6291996240615845, -0.37324848771095276, -0.31952935457229614, -0.6563479900360107, -2.2866103649139404, 0.45271676778793335, ...
func (p *PWMPin) SetPolarity(bool) error { return nil }
[ -0.43459996581077576, -0.7516735792160034, 0.461254358291626, 0.6884772181510925, 0.647697389125824, 1.0204448699951172, 0.20540885627269745, 0.7107640504837036, 0.0711841732263565, -0.4636021852493286, -0.07554946094751358, -0.3300732970237732, -2.064523220062256, 0.6766202449798584, -0...
func (p *PWMPin) Period() (period uint32, err error) { if p.period == 0 { return p.period, errors.New("Jetson PWM pin period not set") } return p.period, nil }
[ -1.0019041299819946, -0.38154861330986023, 0.438549280166626, 0.2399333119392395, -0.3384309411048889, 1.1896711587905884, 0.8223869800567627, -0.47803476452827454, 0.6326322555541992, -0.11401363462209702, 1.204148292541504, 0.3150387704372406, -1.4876421689987183, 0.48573750257492065, ...
func (p *PWMPin) SetPeriod(period uint32) error { if p.period != 0 { return errors.New("Cannot set the period of individual PWM pins on Jetson") } // JetsonNano Minimum period if period < minimumPeriod { return errors.New("Cannot set the period more then minimum") } if err := p.writeFile(fmt.Sprintf("pwm%s/pe...
[ -0.3079052269458771, -0.597234845161438, 0.7657102942466736, -0.46083077788352966, -0.13658398389816284, 2.04616379737854, 0.9181391000747681, 0.0641680657863617, 0.5874019861221313, -0.7333399653434753, 0.17829550802707672, 0.7411165833473206, -1.2792056798934937, 0.7352014780044556, 1....
func (p *PWMPin) DutyCycle() (uint32, error) { return p.dc, nil }
[ 0.03546503558754921, -0.09035570174455643, 0.3046906292438507, -0.925070583820343, 0.1528230458498001, 0.7477161884307861, 0.6471513509750366, -0.5879562497138977, -0.46257221698760986, -0.35960590839385986, 0.21236394345760345, 0.20966023206710815, -1.4558353424072266, 0.7180668115615845,...
func (p *PWMPin) SetDutyCycle(duty uint32) error { if p.period == 0 { return errors.New("Jetson PWM pin period not set") } if duty > p.period { return errors.New("Duty cycle exceeds period") } rate := gobot.FromScale(float64(duty), 0, float64(p.period)) // never go below minimum allowed duty because very sh...
[ -0.6444869637489319, -0.23978476226329803, 0.9141130447387695, -1.10117506980896, 0.13097473978996277, 1.0889383554458618, 0.7980977892875671, -0.9032903909683228, -0.24336041510105133, -0.3912033140659332, -0.2614511251449585, 0.9210090041160583, -0.3512275815010071, 0.755805492401123, ...
func MakeGzipHandler(handler http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { encodings := strings.Split(r.Header.Get("Accept-Encoding"), ",") var w_compressed io.WriteCloser var err error for _, encoding := range encodings { encoding = strings.TrimSpace(encoding) ...
[ 0.11817619949579239, -0.3626452684402466, 0.9467431902885437, 0.38831663131713867, -0.7002437114715576, -0.11547695100307465, 0.7360510230064392, -0.7538029551506042, -0.04134707525372505, 0.18944895267486572, -0.11114279925823212, -0.6525533199310303, -0.5727986097335815, 0.43336400389671...
func (sSig shebangSig) detect(in []byte) bool { in = firstLine(in) if len(in) < len(sSig)+2 { return false } if in[0] != '#' || in[1] != '!' { return false } in = trimLWS(trimRWS(in[2:])) return bytes.Equal(in, sSig) }
[ 0.1817270964384079, -0.30352067947387695, 0.6132786870002747, 1.0035367012023926, -0.7506619095802307, 0.2335660755634308, -1.004654049873352, 0.7115611433982849, -0.2717881202697754, 0.2502395212650299, -1.6339261531829834, -0.19726334512233734, -1.005299687385559, 1.080880880355835, -0...
func NewConfig(yamlContent []byte) (*Config, error) { config := Config{} err := yaml.UnmarshalStrict(yamlContent, &config) if err != nil { return nil, err } if config.APIVersion == nil { return nil, fmt.Errorf("apiVersion must be specified") } else if *config.APIVersion != supportedAPIVersion { return ni...
[ 0.25126904249191284, -0.7104846239089966, 0.46347761154174805, -0.23194493353366852, -0.6959404349327087, -0.3793686628341675, -0.46901190280914307, 1.141537070274353, -0.06547653675079346, 0.5585315227508545, -0.1433238685131073, -0.28676921129226685, -0.5489916801452637, 0.35405090451240...
func (c *Config) IsEventMatch(eventType string, jsonEventData interface{}) (bool, *Action) { for _, action := range c.Actions { for _, event := range action.Events { // does the event type match with regex? matched, _ := regexp.MatchString(event.Name, eventType) if matched { // no JSONPath specified, ...
[ -0.2376449853181839, -0.7099692821502686, 0.9615849852561951, 0.39509645104408264, 0.27120286226272583, -0.6745952367782593, 0.16130085289478302, 0.017544103786349297, 0.45865657925605774, 0.7428238987922668, 0.12644682824611664, 0.3118908703327179, -0.07424010336399078, 0.2068123519420623...
func (c *Config) FindActionByName(actionName string) (bool, *Action) { for _, action := range c.Actions { if actionName == action.Name { return true, &action } } return false, nil }
[ -0.005184529349207878, -0.7481672167778015, 0.4192892909049988, 0.2836952209472656, -0.03760004788637161, -0.8318886756896973, 0.4630313515663147, -1.1176443099975586, -0.16141827404499054, 1.4936623573303223, -1.0436201095581055, -0.19123637676239014, -0.7990652322769165, 1.06435418128967...
func (a *Action) FindTaskByName(taskName string) (bool, *Task) { for _, task := range a.Tasks { if taskName == task.Name { return true, &task } } return false, nil }
[ -0.09682456403970718, -0.31466007232666016, 0.4930550158023834, 0.2676394581794739, -0.22924713790416718, -0.5442954897880554, 0.40638723969459534, -0.6698411107063293, -0.44698023796081543, 1.1278914213180542, -1.0671762228012085, -0.4090534746646881, -0.486841082572937, 1.160407900810241...
func (unitImpl *UnitImpl) Acted() bool { return unitImpl.actedImpl }
[ -0.43359139561653137, -1.3888274431228638, 0.3831866979598999, -0.9300804734230042, 0.36849433183670044, 1.4779728651046753, 2.06748628616333, -0.017638511955738068, 0.44414862990379333, -0.3848493695259094, -0.6915829181671143, 1.277701735496521, -0.32932525873184204, 0.018277980387210846...
func (unitImpl *UnitImpl) DashX() float64 { return unitImpl.dashXImpl }
[ -0.5639175176620483, 0.7053809762001038, 0.4889066219329834, 0.3211691081523895, -0.4802568554878235, 0.8316654562950134, 0.16272923350334167, 0.6471083164215088, 0.2486165314912796, -1.848944902420044, -1.0474162101745605, 0.15300315618515015, 0.5216385722160339, 0.08314865082502365, 0....
func (unitImpl *UnitImpl) DashY() float64 { return unitImpl.dashYImpl }
[ -0.6175603270530701, 0.21455994248390198, 0.6857095956802368, -0.04885890707373619, 0.29931461811065674, -0.2855451703071594, 0.9718607664108276, -0.12711447477340698, -0.6186294555664062, -1.5108996629714966, -0.6846916079521179, -0.08764390647411346, 0.35377535223960876, 0.79363334178924...
func (unitImpl *UnitImpl) Energy() int64 { return unitImpl.energyImpl }
[ -1.2586430311203003, 0.6263436675071716, 0.26873189210891724, -0.00019749770581256598, -0.5893237590789795, 0.33527085185050964, 1.7217555046081543, 0.4439394474029541, -0.5214388966560364, 0.11245178431272507, -0.6312207579612732, -0.6615063548088074, -0.7820698022842407, 0.69949531555175...
func (unitImpl *UnitImpl) Genarium() int64 { return unitImpl.genariumImpl }
[ -1.58568274974823, 0.7462007403373718, 0.6847910284996033, -0.3603660762310028, 0.03033955581486225, 0.8738662600517273, 1.0447626113891602, 0.41191256046295166, -0.04096933454275131, -0.5788748860359192, 0.5766426920890808, 0.12803909182548523, -0.7299433946609497, 0.49849933385849, 0.1...
func (unitImpl *UnitImpl) IsBusy() bool { return unitImpl.isBusyImpl }
[ -0.7934982776641846, -0.16755765676498413, 0.7396373152732849, 0.246538445353508, 0.48833343386650085, -0.004274014849215746, 0.5310869812965393, -0.776057243347168, -0.48395007848739624, -0.1470639556646347, -1.3622838258743286, 1.297865629196167, -0.12837113440036774, 0.1494353711605072,...
func (unitImpl *UnitImpl) Job() stardash.Job { return unitImpl.jobImpl }
[ -0.21871733665466309, 0.19182534515857697, 0.362184077501297, 0.25776803493499756, -0.5666994452476501, 0.710195779800415, 1.1281507015228271, 0.6823710799217224, 0.0433354377746582, -1.9650824069976807, 0.2210036665201187, 0.3254118859767914, -0.42625340819358826, 0.13134707510471344, 0...
func (unitImpl *UnitImpl) Legendarium() int64 { return unitImpl.legendariumImpl }
[ -0.40365850925445557, 0.6856400966644287, 0.5204315781593323, -1.033534049987793, 0.05466924607753754, 0.4501500427722931, 0.6599719524383545, 0.48991432785987854, 0.3443359136581421, -0.8240055441856384, 0.09334686398506165, 0.31624293327331543, -0.619003176689148, 0.3785732686519623, -...
func (unitImpl *UnitImpl) Moves() float64 { return unitImpl.movesImpl }
[ -1.157844066619873, 0.5914750099182129, 0.2941736876964569, -0.2882046699523926, 0.12106867134571075, 0.1805860847234726, 0.9004002213478088, -0.5340114831924438, 0.07191763073205948, -0.7299012541770935, -0.6749304533004761, -0.14274466037750244, -0.4942645728588104, 0.439955472946167, ...
func (unitImpl *UnitImpl) Mythicite() int64 { return unitImpl.mythiciteImpl }
[ -0.4665323495864868, 0.5998619198799133, 0.3737795650959015, -0.43538224697113037, 0.4233376681804657, -0.3521832227706909, 0.7770950794219971, 0.08579283207654953, -0.3445228636264801, -0.6826202869415283, 0.555439293384552, 0.17737437784671783, -1.1168206930160522, 0.7386583089828491, ...
func (unitImpl *UnitImpl) Owner() stardash.Player { return unitImpl.ownerImpl }
[ -0.6905397176742554, -0.49083593487739563, 0.3395354449748993, 0.48448023200035095, -0.5647708177566528, 0.4543669521808624, 1.8665971755981445, -0.7301581501960754, 0.3606402277946472, -1.1058714389801025, -0.14979493618011475, 0.6114418506622314, 0.08730936050415039, -0.14063720405101776...
func (unitImpl *UnitImpl) Protector() stardash.Unit { return unitImpl.protectorImpl }
[ -0.475546658039093, 0.005350636318325996, 0.3513605296611786, -0.33811941742897034, -0.8865211009979248, 0.467586874961853, 0.9577935338020325, 0.31561416387557983, 0.6745458245277405, -1.7905770540237427, -0.13387265801429749, -0.36754515767097473, -0.4332113564014435, 0.07818618416786194...
func (unitImpl *UnitImpl) Rarium() int64 { return unitImpl.rariumImpl }
[ -1.4973679780960083, 0.10810045152902603, 0.5289899110794067, -0.16113440692424774, -0.12116969376802444, 0.016644498333334923, 0.7733185291290283, 0.2450011521577835, 0.6137048006057739, -0.7754959464073181, -0.1302555799484253, 0.5184718370437622, -1.0542597770690918, 0.5278066992759705,...
func (unitImpl *UnitImpl) Shield() int64 { return unitImpl.shieldImpl }
[ -0.4600151777267456, 0.6602672934532166, 0.327261358499527, -0.48099496960639954, -0.39261317253112793, 0.7410747408866882, 1.5955121517181396, -0.43152034282684326, 1.0527642965316772, -1.5879054069519043, -0.702155351638794, 0.4617311954498291, -0.7036557197570801, 0.38321149349212646, ...
func (unitImpl *UnitImpl) X() float64 { return unitImpl.xImpl }
[ -0.9497866034507751, 0.3698701560497284, 0.459620863199234, -0.3245728015899658, -0.5389648675918579, 1.068963646888733, 0.2763444185256958, 0.14863228797912598, 0.6285350918769836, -1.1504745483398438, -1.0923740863800049, 0.7056999206542969, 0.0955994501709938, 0.1244078204035759, -0.4...
func (unitImpl *UnitImpl) Y() float64 { return unitImpl.yImpl }
[ -0.9576736688613892, -0.23887479305267334, 0.5069650411605835, -0.2641742527484894, 0.002906025620177388, 0.10051928460597992, 1.2933125495910645, -0.6379233598709106, -0.2180660367012024, -0.9743646383285522, -0.768518328666687, 0.5832379460334778, 0.02847675234079361, 0.8448275923728943,...
func (unitImpl *UnitImpl) Attack(enemy stardash.Unit) bool { return unitImpl.RunOnServer("attack", map[string]interface{}{ "enemy": enemy, }).(bool) }
[ -2.53121018409729, 0.1370031088590622, 0.4406477212905884, 0.2897755205631256, 0.2807619869709015, 0.29358968138694763, 0.33223193883895874, 0.4954707622528076, -0.06824000179767609, 0.34284499287605286, -0.196261465549469, 0.0331670306622982, -0.7463017702102661, 0.10809444636106491, -0...
func (unitImpl *UnitImpl) Dash(x float64, y float64) bool { return unitImpl.RunOnServer("dash", map[string]interface{}{ "x": x, "y": y, }).(bool) }
[ -0.7925053834915161, -0.10733546316623688, 0.6154472231864929, 0.09523958712816238, 0.2439119517803192, 0.8628445863723755, -0.3898105025291443, -0.09823749959468842, -0.4444984495639801, -1.0019866228103638, -0.17841282486915588, 0.6422551274299622, 0.9657180309295654, 0.4192905128002167,...
func (unitImpl *UnitImpl) Mine(body stardash.Body) bool { return unitImpl.RunOnServer("mine", map[string]interface{}{ "body": body, }).(bool) }
[ -1.276020884513855, 0.22769877314567566, 0.55890953540802, 0.44780251383781433, 0.07233482599258423, 1.1530747413635254, -0.3365078270435333, -0.5765308737754822, -0.2585054039955139, -0.4010162949562073, -0.4692687392234802, 0.017334990203380585, -1.2137659788131714, 1.2277438640594482, ...
func (unitImpl *UnitImpl) Move(x float64, y float64) bool { return unitImpl.RunOnServer("move", map[string]interface{}{ "x": x, "y": y, }).(bool) }
[ -1.7255381345748901, -0.07161780446767807, 0.6033357381820679, -0.049617305397987366, -0.04295393452048302, 0.5884495377540588, -0.3077254295349121, -1.123700499534607, -0.4226274788379669, -0.05528652295470238, -0.4318840205669403, -0.0030888717155903578, -0.4748876094818115, -0.196596398...
func (unitImpl *UnitImpl) Safe(x float64, y float64) bool { return unitImpl.RunOnServer("safe", map[string]interface{}{ "x": x, "y": y, }).(bool) }
[ -0.7565730810165405, 0.590065062046051, 0.5986703038215637, -0.11783920228481293, -0.1183168888092041, 0.5936815738677979, -0.5650068521499634, -1.206640362739563, -0.5727841854095459, -0.0012656586477532983, -0.4995214343070984, 0.7160955667495728, -0.16965703666210175, -0.686242878437042...
func (unitImpl *UnitImpl) Shootdown(missile stardash.Projectile) bool { return unitImpl.RunOnServer("shootdown", map[string]interface{}{ "missile": missile, }).(bool) }
[ -0.7979015707969666, 0.5372451543807983, 0.5961074233055115, -0.11488278210163116, -0.3513626754283905, 0.917680025100708, -0.042055126279592514, -0.15072807669639587, 0.768769383430481, 0.149928018450737, -0.08472499996423721, 0.6057859659194946, -1.0099254846572876, 0.7297081351280212, ...
func (unitImpl *UnitImpl) Transfer(unit stardash.Unit, amount int64, material string) bool { return unitImpl.RunOnServer("transfer", map[string]interface{}{ "unit": unit, "amount": amount, "material": material, }).(bool) }
[ -0.749170184135437, -0.0822364017367363, 0.48894551396369934, 0.1486404836177826, -0.21498069167137146, 0.9546000361442566, 0.1506003886461258, -0.6842269897460938, -0.20101261138916016, -0.5528634786605835, -0.334616094827652, 0.6956321001052856, -0.48212331533432007, 0.1636897325515747, ...
func (unitImpl *UnitImpl) InitImplDefaults() { unitImpl.GameObjectImpl.InitImplDefaults() unitImpl.actedImpl = true unitImpl.dashXImpl = 0 unitImpl.dashYImpl = 0 unitImpl.energyImpl = 0 unitImpl.genariumImpl = 0 unitImpl.isBusyImpl = true unitImpl.jobImpl = nil unitImpl.legendariumImpl = 0 unitImpl.movesImpl...
[ -0.30246424674987793, 0.2783716320991516, 0.7924857139587402, -0.5815024971961975, 0.9015823602676392, 0.21809732913970947, 0.9541075825691223, 0.34092679619789124, 0.14719945192337036, -0.36795490980148315, -1.8513402938842773, 0.4481082558631897, -0.7005538940429688, 0.7080733180046082, ...
func (unitImpl *UnitImpl) DeltaMerge( deltaMerge base.DeltaMerge, attribute string, delta interface{}, ) (bool, error) { merged, err := unitImpl.GameObjectImpl.DeltaMerge( deltaMerge, attribute, delta, ) if merged || err != nil { return merged, err } stardashDeltaMerge, ok := deltaMerge.(DeltaMerge) i...
[ -1.535804033279419, 0.200328528881073, 1.1661345958709717, -0.7091956734657288, -0.1344105750322342, 0.06339938938617706, 0.12324652075767517, 0.3440183997154236, 0.08586623519659042, -0.7462493777275085, -0.9857926964759827, -0.26047083735466003, -0.40846341848373413, 0.4876774251461029, ...
func getDB(ctx context.Context) (db *pgxpool.Pool, dbName string, closer func(), err error) { db, err = pgxpool.Connect(ctx, *connectionString) if err != nil { return } // Create the testing database dbNum := r.Intn(10000) dbName = fmt.Sprintf("_test_db_%d", dbNum) if err = Execute(ctx, db, fmt.Sprintf("CREA...
[ -0.09947001934051514, 0.9054732322692871, 0.9716639518737793, 0.6079108715057373, 0.8116129636764526, 0.2734218239784241, 1.000611424446106, -0.7642003893852234, 0.30199915170669556, 0.05939563363790512, 1.006934642791748, 0.4676247537136078, -0.8591079115867615, 0.16671301424503326, 0.5...
func createTestTable(ctx context.Context, db *pgxpool.Pool, dbName, schemaSpec string) (tableInfo, error) { var tableName string outer: for { // Create the testing database tableNum := r.Intn(10000) tableName = fmt.Sprintf("_test_table_%d", tableNum) // Find the DB. var actualTableName string err := Ret...
[ 0.47558462619781494, 0.4608990252017975, 0.5495232343673706, -0.36429882049560547, -0.09614936262369156, -0.062215134501457214, 0.17789961397647858, -0.7176123857498169, -0.24887673556804657, 0.08504826575517654, 0.0929182693362236, 0.020476695150136948, -0.47741392254829407, 0.21475756168...
func dropSinkDB(ctx context.Context, db *pgxpool.Pool) error { return DropSinkDB(ctx, db) }
[ -1.2618314027786255, 0.14499740302562714, 0.1568664312362671, 1.258278250694275, -0.3768034279346466, 0.2954241633415222, 0.3182655870914459, -0.836507260799408, 0.4920163154602051, 0.298276424407959, -0.11910941451787949, 0.2962481379508972, -1.5355278253555298, 1.1673321723937988, -0.1...
func createSinkDB(ctx context.Context, db *pgxpool.Pool) error { if err := dropSinkDB(ctx, db); err != nil { return err } return CreateSinkDB(ctx, db) }
[ -0.5827046036720276, 0.2470419555902481, 0.39073893427848816, 0.9516697525978088, 0.27060720324516296, 0.10838937014341354, 0.3129693567752838, -0.6704237461090088, 0.8641564846038818, 0.23993495106697083, 0.011076163500547409, -0.163636714220047, -1.226356863975525, 1.0505049228668213, ...
func TestDB(t *testing.T) { a := assert.New(t) ctx, cancel := context.WithCancel(context.Background()) defer cancel() db, dbName, dbClose, err := getDB(ctx) if !a.NoError(err) { return } defer dbClose() // Find the DB. var actualDBName string if err := Retry(ctx, func(ctx context.Context) error { return...
[ 0.4901718497276306, 1.3344796895980835, 0.6893844604492188, 0.5834250450134277, 0.7511650919914246, 0.4329059422016144, 0.9547958374023438, 0.03615393862128258, 0.8524836301803589, -0.4982384145259857, 0.31837886571884155, -0.3417268693447113, -0.4977124333381653, 0.6125516295433044, 0.1...
func clobData(legnth, nonce int) io.Reader { ret := &io.LimitedReader{R: &clobSourceReader{}, N: int64(nonce + legnth)} nonce = nonce % len(clobSourceTest) _, _ = io.CopyN(io.Discard, ret, int64(nonce)) return ret }
[ 0.8040726184844971, 0.8605923056602478, 0.4687923192977905, -0.7036667466163635, -0.529866099357605, 1.0281763076782227, -0.35368040204048157, -0.7108930349349976, 0.08829594403505325, 0.2440241575241089, -0.1298229694366455, 0.10517492145299911, -0.5404291152954102, -0.7249389886856079, ...
func (c *clobSourceReader) Read(p []byte) (n int, err error) { ret := len(p) for len(p) >= len(clobSourceTest) { copy(p, clobSourceTest) p = p[len(clobSourceTest):] } if rem := len(p); rem > 0 { copy(p, clobSourceTest[:rem]) } return ret, nil }
[ -0.368783175945282, 0.007766214199364185, 0.49078214168548584, -0.2246185839176178, 0.047109272330999374, 0.44940128922462463, 0.3476105034351349, 0.08168401569128036, 0.20062878727912903, 0.8605477809906006, -0.21854478120803833, -0.20143210887908936, -1.3999066352844238, -0.1003780066967...
func MockedProvider(t *testing.T, c *config.Config, callback string) (*config.Config, goth.Provider) { const ( testClientKey = "provider-test-client-key" testSecret = "provider-test-secret" testCallback = "http://auth.exmaple.com/test/callback" ) mp := newMockProvider(t, callback) p := provider.Name(mp.Na...
[ -0.5782964825630188, 0.49539363384246826, 0.4089469015598297, -0.013624731451272964, -0.5282379388809204, 0.01148858480155468, 0.1813780814409256, 0.5194424390792847, 1.1036951541900635, 0.8020395636558533, -0.4502900242805481, -0.323055624961853, -0.7927457094192505, 0.535966694355011, ...
func MockOpenIDConnect(t *testing.T) string { const discovery = `{ "issuer": "https://example.com/", "authorization_endpoint": "https://example.com/authorize", "token_endpoint": "https://example.com/token", "userinfo_endpoint": "https://example.com/userinfo", "jwks_uri": "https://example.com/.well-known/jwks...
[ -0.7397168278694153, -0.5851249098777771, 0.7186083197593689, -0.9084747433662415, -0.6699675917625427, 0.07915488630533218, 0.09969180822372437, -0.44083598256111145, -0.23962602019309998, -0.20638668537139893, -0.5082975029945374, -0.22278225421905518, -0.7290462851524353, -0.43049702048...
func ProvidersConfig(t *testing.T) *config.Config { const ( testClientKey = "provider-test-client-key" testSecret = "provider-test-secret" testCallback = "http://auth.exmaple.com/test/callback" ) setEnv(t, config.Auth0DomainEnv, "example.com") setEnv(t, config.OpenIDConnectURLEnv, MockOpenIDConnect(t)) s...
[ -0.5037253499031067, 0.28318095207214355, 0.43047693371772766, -0.1698826402425766, -0.5518348813056946, 0.13634607195854187, -0.13311612606048584, 0.6662723422050476, 0.48442497849464417, 1.10463547706604, -0.42836904525756836, -0.36558282375335693, -0.088267982006073, 0.7281767725944519,...
func (fp MockProvider) Name() string { return fp.faux.Name() }
[ -0.997380256652832, -0.11328164488077164, 0.24025441706180573, 0.14009582996368408, -0.8886386156082153, 0.052880123257637024, 0.32563239336013794, -0.2103123664855957, 0.1828015148639679, 1.7353723049163818, -0.903662383556366, -0.2114364206790924, -0.260938823223114, 0.34821224212646484,...
func (fp MockProvider) SetName(name string) { fp.faux.SetName(name) }
[ -1.20200777053833, 0.5747774839401245, 0.35204002261161804, 0.6916464567184448, -0.3875621259212494, -0.025247039273381233, 0.39775338768959045, 0.22879013419151306, 0.5073651671409607, 1.395990252494812, -1.3277642726898193, -0.31574198603630066, -0.2996671795845032, 0.9502860903739929, ...
func (fp MockProvider) BeginAuth(state string) (goth.Session, error) { s, err := fp.faux.BeginAuth(state) if err != nil { return nil, err } authURL, err := s.GetAuthURL() if err != nil { return nil, err } authURL += fmt.Sprintf("&%s=%s", key.Role, fp.Role) if fp.Callback != "" { au, err := url.Parse(authU...
[ -0.4951457381248474, -0.12548570334911346, 0.3867933750152588, 0.2950253188610077, -0.7786195278167725, -0.4166082739830017, 1.0408142805099487, -0.25725993514060974, 1.1861494779586792, 0.6019703149795532, 0.48256930708885193, 0.17617352306842804, 0.40252354741096497, -0.12388206273317337...
func (fp MockProvider) UnmarshalSession(s string) (goth.Session, error) { sess, err := fp.faux.UnmarshalSession(s) if err != nil { return nil, err } return &mockSession{ sess, fp.Role, fp.t, }, nil }
[ -0.7228808999061584, 0.20721834897994995, 0.4954027533531189, -0.5012059211730957, -0.42997312545776367, -0.5185847282409668, 0.8604138493537903, -0.13649682700634003, 0.9029504656791687, 0.5018170475959778, -0.10192382335662842, 0.387991338968277, -0.4316166341304779, -0.6954880356788635,...
func (fp MockProvider) FetchUser(session goth.Session) (goth.User, error) { sess := session.(*mockSession) return fp.faux.FetchUser(sess.Session) }
[ -0.24229949712753296, 0.037596412003040314, 0.19805030524730682, 0.8291170597076416, -0.2705730199813843, -0.2950395345687866, 0.9581813812255859, -0.9207075834274292, 1.2287983894348145, 0.3858146369457245, -0.7144439816474915, 0.20576606690883636, 0.4525243043899536, -0.12282019853591919...
func (fp MockProvider) Debug(b bool) { fp.faux.Debug(b) }
[ -0.5662813782691956, 1.3592602014541626, 0.28034335374832153, 0.5051906704902649, 1.2564204931259155, 0.7108873724937439, 0.5532495975494385, 0.6008663773536682, 0.3996388614177704, 0.5866945385932922, -0.16076722741127014, -0.02536546252667904, -0.33027294278144836, 0.6018835306167603, ...
func (fp MockProvider) RefreshToken(refreshToken string) (*oauth2.Token, error) { return fp.faux.RefreshToken(refreshToken) }
[ -0.30684441328048706, -0.016861211508512497, 0.29781076312065125, 1.2168439626693726, -0.1480495035648346, 0.16095559298992157, 0.03740140423178673, 0.24136435985565186, 0.7784212231636047, -0.31398412585258484, -0.7182908654212952, 1.2528818845748901, 0.721135675907135, 0.3278686404228210...
func (fp MockProvider) RefreshTokenAvailable() bool { return fp.faux.RefreshTokenAvailable() }
[ -1.0037322044372559, -0.1211131289601326, 0.17864727973937988, 1.0518543720245361, -0.3197043240070343, 0.01539896335452795, -0.5245671272277832, 0.028221745043992996, -0.1061588004231453, 1.436327338218689, -1.2149715423583984, 0.9443378448486328, 0.39206311106681824, 0.34522175788879395,...
func (s *mockSession) Authorize(provider goth.Provider, params goth.Params) (string, error) { tok := params.Get(key.Role) require.Equal(s.t, s.Role, tok) return s.Session.Authorize(provider, params) }
[ -1.0061906576156616, 0.36883026361465454, 0.42412513494491577, 0.5603104829788208, 0.4450395405292511, -0.9353976845741272, 0.6045858263969421, -0.12028413265943527, 0.43239885568618774, 1.8352466821670532, 0.5372887849807739, 0.6130930781364441, -0.3897339999675751, 0.16519208252429962, ...
func ToMockProvider(p goth.Provider) *MockProvider { return p.(*MockProvider) }
[ -0.4697297513484955, 0.8400442004203796, 0.1376570165157318, 0.3043210208415985, -0.09809887409210205, 0.34328746795654297, 0.795632541179657, -0.9485183954238892, 1.0994720458984375, 1.288844108581543, -0.3399559259414673, 0.1166582703590393, -0.3778771460056305, -0.0951404720544815, 0....
func createCollector() prometheus.Collector { return prometheus.NewGaugeFunc( prometheus.GaugeOpts{ Namespace: "program", Name: "build_info", Help: "A metric with a constant '1' value labeled by program build info.", ConstLabels: MapValue, }, func() float64 { return 1 }, ) }
[ 0.30825570225715637, -0.8070542812347412, 0.4580533802509308, -0.14773909747600555, 0.2089383900165558, 1.0115011930465698, -0.02983732894062996, -0.3875810503959656, -0.5284587144851685, -0.18360121548175812, 0.9322911500930786, -0.22718273103237152, -0.2381514310836792, 0.957199931144714...
func getPermutation(n int, k int) string { digits := []byte{'1', '2', '3', '4', '5', '6', '7', '8', '9'}[:n] fac := make([]int, 10) fac[0] = 1 for i := 1; i < 10; i++ { fac[i] = i * fac[i-1] } inds := make([]int, 0) k-- n-- for k > 0 { nind, nr := k/fac[n], k%fac[n] k = nr inds = append(inds, nind) n...
[ -0.6110568046569824, 0.5017220377922058, 0.9050432443618774, 0.10611986368894577, -0.46083736419677734, -0.8146036863327026, 0.5027298331260681, 0.1384410709142685, 0.1585737019777298, 0.8672538995742798, -0.19226966798305511, -0.4316931664943695, -0.34048154950141907, 0.11940977722406387,...
func CreateGatekeeperNamespace(cfg *rest.Config) error { c, err := client.New(cfg, client.Options{}) if err != nil { return err } // Create gatekeeper namespace ns := &v1.Namespace{ ObjectMeta: metav1.ObjectMeta{ Name: "gatekeeper-system", }, } ctx := context.Background() _, err = controllerutil.Crea...
[ -0.19506922364234924, 0.15171976387500763, 0.3908533751964569, 0.20231372117996216, 0.5975143909454346, 0.8639088869094849, 0.5004803538322449, -0.38936883211135864, 0.21314331889152527, 0.14910173416137695, -0.46427926421165466, -0.24309831857681274, -0.7863039374351501, 1.247240662574768...
func DeleteObjectAndConfirm(ctx context.Context, t *testing.T, c client.Client, obj client.Object) func() { t.Helper() // Cache the identifying information from obj. We refer to this cached // information in the callback, and not obj itself. gvk := obj.GetObjectKind().GroupVersionKind() namespace := obj.GetNamesp...
[ 0.19271220266819, -0.6581383943557739, 0.7962432503700256, -0.36745452880859375, -0.20426194369792938, -0.22294163703918457, 0.12454637140035629, -1.116800308227539, 0.19695289433002472, 0.2827669382095337, -0.3716168999671936, 1.0167710781097412, 0.25814807415008545, -0.1158367171883583, ...
func CreateThenCleanup(ctx context.Context, t *testing.T, c client.Client, obj client.Object) { t.Helper() cpy := obj.DeepCopyObject() cpyObj, ok := cpy.(client.Object) if !ok { t.Fatalf("got obj.DeepCopyObject() type = %T, want %T", cpy, client.Object(nil)) } err := c.Create(ctx, cpyObj) if err != nil { t....
[ 0.5263318419456482, -0.04389030113816261, 0.8322991132736206, -0.33098888397216797, 0.5161904692649841, 0.27605685591697693, 1.0112686157226562, -0.3970927298069, 0.026622425764799118, 0.3234049081802368, -0.06388621032238007, 0.047304484993219376, 0.41512414813041687, -0.2928704619407654,...
func Emoji(key string) []byte { emojiInit.Do(initEmoji) return emojis[key] }
[ -0.6821635961532593, 0.30574721097946167, 0.22328580915927887, 0.42310747504234314, -0.8751290440559387, -0.6978965401649475, -0.5474440455436707, -0.4439009428024292, -0.3777175843715668, 0.6306453347206116, -1.4339462518692017, 0.19184212386608124, -0.5496736168861389, 0.0141629539430141...
func Emojify(source []byte) []byte { emojiInit.Do(initEmoji) start := 0 k := bytes.Index(source[start:], emojiDelim) for k != -1 { j := start + k upper := j + emojiMaxSize if upper > len(source) { upper = len(source) } endEmoji := bytes.Index(source[j+1:upper], emojiDelim) nextWordDelim := byte...
[ -0.6823775172233582, 0.8379624485969543, 0.6496865749359131, -0.13227711617946625, -1.2156938314437866, -1.3148658275604248, 0.492441326379776, 0.6240107417106628, 0.21357977390289307, 0.8150425553321838, -1.4121310710906982, 0.388423889875412, -1.2093170881271362, -0.06520482897758484, ...
func Which(command string) (string, error) { err, _, exitCode, stdOut, stdErr := RunCommandAndWait("", nil, "bash", []string{"-c", "which " + command}, map[string]string{}) if err != nil { return "", errors.Wrapf(err, "Error locating command %s", command) } else if exitCode == 1 { // Not found return "", nil ...
[ 0.1449899673461914, -0.6460179090499878, 1.1396255493164062, -0.1675802767276764, -0.788518488407135, -0.34168779850006104, 0.2738693058490753, -0.6881039142608643, -0.3311358094215393, 0.20930403470993042, 0.6293520927429199, 0.7474803924560547, -0.2060263305902481, 0.25913599133491516, ...
func findPaths(m int, n int, maxMove int, startRow int, startColumn int) int { grid := make([][][]int, maxMove+1) for k := 0; k <= maxMove; k++ { grid[k] = make([][]int, m) for i := 0; i < m; i++ { grid[k][i] = make([]int, n) } } res := 0 grid[0][startRow][startColumn] = 1 for move := 0; move < maxMove...
[ -0.218763530254364, 1.2497142553329468, 0.9400991797447205, 0.43085014820098877, -0.44890034198760986, -1.0625414848327637, 0.8246867656707764, -0.1387822926044464, -0.26073959469795227, 0.38522249460220337, -0.016693612560629845, -0.6881045699119568, -1.2579288482666016, 1.045469045639038...
func findPaths2(m int, n int, maxMove int, startRow int, startColumn int) int { prevGrid := make([][]int, m) nextGrid := make([][]int, m) for i := 0; i < m; i++ { prevGrid[i] = make([]int, n) nextGrid[i] = make([]int, n) } res := 0 prevGrid[startRow][startColumn] = 1 for move := 0; move < maxMove; move++ {...
[ 0.08998627215623856, 0.9106048941612244, 0.9849808216094971, 0.5257845520973206, -0.6154805421829224, -1.3792704343795776, 0.7953615784645081, -0.14246073365211487, -0.4235793650150299, 0.3107120096683502, -0.0016807554056867957, -0.11652971804141998, -0.927591860294342, 1.0496541261672974...