text
stringlengths
11
6.3k
embedding
listlengths
768
768
func AnswerABC100Cその1(N int, A []int) int { // 必ず誰か1人が「2で割れる」を負担する必要がある // いくら3倍しても、「2で割れる」回数は増えない // → 2で割れる回数で決まる var ans int for _, a := range A { countDivide2 := 0 // 2で割れる回数 for a > 0 { if a%2 == 0 { a /= 2 countDivide2++ } else { break } } ans += countDivide2 } return ans }
[ 0.010593989863991737, -0.3056032657623291, 0.6860467195510864, 0.13200758397579193, -0.26351866126060486, 0.22809672355651855, 1.1678529977798462, -0.22628922760486603, -0.595932126045227, 0.48835650086402893, -0.09171118587255478, 0.18289588391780853, -0.02528485096991062, 0.8625551462173...
func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error { *c = DefaultConfig c.LogsLabels = make(map[string]string) type plain Config return unmarshal((*plain)(c)) }
[ -0.04840207099914551, 0.9124608635902405, 0.4513939917087555, -0.4024405777454376, -0.18466448783874512, -0.37831175327301025, 0.3944834768772125, 0.9174229502677917, -0.003341284114867449, 0.3938535451889038, -0.36100059747695923, 0.31935378909111023, 0.3380013108253479, 0.11872548609972,...
func (c *Config) ApplyDefaults(globals integrations.Globals) error { c.Common.ApplyDefaults(globals.SubsystemOpts.Metrics.Autoscrape) if id, err := c.Identifier(globals); err == nil { c.Common.InstanceKey = &id } return nil }
[ -0.7335220575332642, 1.349898338317871, 0.2852819561958313, -0.029553037136793137, 1.1977332830429077, 0.7011541128158569, 0.30836212635040283, 0.0514063835144043, -0.23237915337085724, 0.2647339701652527, -0.47112202644348145, -0.5578335523605347, -0.8994613289833069, 0.9181172847747803, ...
func (c *Config) Name() string { return IntegrationName }
[ -0.5266671776771545, 0.04575951397418976, 0.23271343111991882, -0.1506478637456894, -0.6879554986953735, -0.0023632447700947523, 0.37722140550613403, 0.3036164939403534, -0.660168468952179, 1.5323082208633423, -1.352612018585205, -0.752324640750885, -0.2404927760362625, 0.8045186400413513,...
func (c *Config) Identifier(globals integrations.Globals) (string, error) { if c.Common.InstanceKey != nil { return *c.Common.InstanceKey, nil } return globals.AgentIdentifier, nil }
[ -0.42397695779800415, -0.433485746383667, 0.38513898849487305, -0.5139622688293457, -0.2399139255285263, 0.832482099533081, 1.0994362831115723, 0.7414022088050842, 0.4751414656639099, 1.1675376892089844, -0.31217527389526367, -0.46541261672973633, -0.6975296139717102, 0.4947184920310974, ...
func badSulotionLongestValidParentheses(s string) int { var max int sLen := len(s) for i := 0; i < sLen-1; i++ { for j := sLen; j > i; j-- { if checkValid(s[i:j]) { if max < j-i { max = j - i } } } } return max }
[ 0.43153318762779236, 0.05100017040967941, 0.636379063129425, 0.3162350654602051, -1.1570521593093872, -0.5396755933761597, 0.2561561167240143, -0.10875356197357178, 0.5862636566162109, 0.45600977540016174, -0.14773336052894592, -0.048172660171985626, -1.2629687786102295, -0.234954729676246...
func NewSpaceIterationsController(service *goa.Service, db application.DB, config SpaceIterationsControllerConfiguration) *SpaceIterationsController { return &SpaceIterationsController{Controller: service.NewController("SpaceIterationsController"), db: db, config: config} }
[ 0.7163458466529846, 0.4055408239364624, 0.2733401656150818, 0.3686087429523468, -0.7016109228134155, 0.017789697274565697, 0.509568989276886, -0.33275356888771057, 0.39002087712287903, 0.17305415868759155, 0.3401832580566406, 0.20259757339954376, 0.4373417794704437, 0.9128428101539612, -...
func (c *SpaceIterationsController) Create(ctx *app.CreateSpaceIterationsContext) error { currentUser, err := login.ContextIdentity(ctx) if err != nil { return jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error())) } // Validate Request if ctx.Payload.Data == nil { return jsonapi.JSONErrorResponse(ct...
[ 0.0858057290315628, 0.37864357233047485, 0.782732367515564, 0.6502244472503662, -0.6220653057098389, 0.46448954939842224, 0.46469470858573914, -0.5943728089332581, -0.06727109849452972, 0.11324287950992584, 0.22969000041484833, 0.025629336014389992, 0.1683366447687149, 0.8307307958602905, ...
func (c *SpaceIterationsController) List(ctx *app.ListSpaceIterationsContext) error { return application.Transactional(c.db, func(appl application.Application) error { err := appl.Spaces().CheckExists(ctx, ctx.SpaceID.String()) if err != nil { return jsonapi.JSONErrorResponse(ctx, err) } iterations, err := ...
[ -0.35874855518341064, -0.32579436898231506, 0.5975258946418762, -0.6920475363731384, -0.12183276563882828, -0.787126362323761, -0.04294617101550102, 0.08227517455816269, 0.7581382989883423, 1.0336765050888062, 0.01618688739836216, 0.38555750250816345, -0.19621747732162476, 1.31598186492919...
func TestServer(expectedResponse string) *httptest.Server { return httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { rw.Write([]byte(expectedResponse)) })) }
[ -0.8173636794090271, -0.9283174276351929, 0.45479026436805725, -0.45977574586868286, 0.41254565119743347, 0.5652397274971008, 0.5780271291732788, -0.1085844561457634, 1.0359445810317993, -1.290753722190857, -0.5843266248703003, -0.165739044547081, -1.4940778017044067, -0.5797954797744751, ...
func parseStructMeta(v interface{}) (structMeta, error) { structRfl := reflect.Indirect(reflect.ValueOf(v)) // Fail if the passed type is not a struct if !isStruct(structRfl) { return structMeta{}, fmt.Errorf("Expected struct, got: %s", structRfl.Kind().String()) } var meta structMeta for i := 0; i < structRf...
[ 0.23336656391620636, 0.23411530256271362, 0.8320258259773254, -0.5356704592704773, -0.32534658908843994, -0.7774995565414429, 0.12150930613279343, -0.26539063453674316, 0.42754319310188293, 0.47270917892456055, -0.6756792664527893, 0.00523179629817605, 0.5064719319343567, -0.19929568469524...
func parseSlice(v interface{}) ([]interface{}, error) { structRfl := reflect.ValueOf(v) result := []interface{}{} // Fail if the passed type is not a slice if structRfl.Kind() != reflect.Slice { return result, fmt.Errorf("Expected slice, got: %s", structRfl.Kind().String()) } for i := 0; i < structRfl.Len();...
[ -1.0524711608886719, 0.011895421892404556, 0.31562328338623047, 0.6392866969108582, -0.28661206364631653, -1.0876147747039795, 0.05891925096511841, -0.36051174998283386, 0.519729495048523, 0.3366795480251312, -0.6199639439582825, 0.0881887897849083, -0.6220719814300537, 0.6467563509941101,...
func parseMap(v interface{}) (map[string]interface{}, error) { structRfl := reflect.ValueOf(v) result := map[string]interface{}{} // Fail if the passed type is not a map if structRfl.Kind() != reflect.Map { return result, fmt.Errorf("Expected map, got: %s", structRfl.Kind().String()) } mapRange := structRfl....
[ -0.6327736973762512, -0.270559698343277, 0.7106522917747498, -0.18185938894748688, -0.8325774073600769, -0.10700538754463196, 0.3054986596107483, -0.4294085204601288, 0.9894605875015259, -0.036414530128240585, -0.2610267102718353, 0.04109200835227966, -0.24466893076896667, 0.67116326093673...
func NewBlobSet(handles ...BlobHandle) BlobSet { m := make(BlobSet) for _, h := range handles { m[h] = struct{}{} } return m }
[ 0.49783995747566223, -0.7378140091896057, 0.37673455476760864, 0.1338827759027481, -0.5074952840805054, 0.5907866954803467, 0.04780830815434456, -1.1137317419052124, -1.227313756942749, -0.8126991987228394, -0.2092064917087555, -0.17267021536827087, -0.8456060290336609, 0.06637274473905563...
func (s BlobSet) Has(h BlobHandle) bool { _, ok := s[h] return ok }
[ 0.7313055396080017, -0.37916409969329834, 0.34788745641708374, -0.460749089717865, -0.14682120084762573, 0.36864417791366577, -0.3621516525745392, -0.2741508185863495, -0.7896362543106079, -0.2122839093208313, -0.6705796122550964, -0.18563534319400787, -0.4688388407230377, 0.47169139981269...
func (s BlobSet) Insert(h BlobHandle) { s[h] = struct{}{} }
[ 0.3183814287185669, 0.296708881855011, 0.1699417382478714, -0.6706650257110596, -0.06792992353439331, 0.6619491577148438, 0.4857257604598999, -0.2514073848724365, -0.8437873721122742, -0.34968316555023193, -1.1851567029953003, -0.12200309336185455, -1.381054162979126, 0.30614742636680603, ...
func (s BlobSet) Delete(h BlobHandle) { delete(s, h) }
[ 1.5544564723968506, 0.04721762612462044, 0.15676985681056976, 0.29566317796707153, 0.12003827840089798, 0.5293810963630676, 0.30755630135536194, -0.6673115491867065, -0.1769443303346634, 0.06903905421495438, -0.30947145819664, -0.005240938626229763, -0.8188503980636597, 0.5707129836082458,...
func (s BlobSet) Equals(other BlobSet) bool { if len(s) != len(other) { return false } for h := range s { if _, ok := other[h]; !ok { return false } } return true }
[ -0.5395094156265259, -1.0998482704162598, 0.43473610281944275, -0.27498531341552734, -0.20718787610530853, -0.39082011580467224, -1.0809026956558228, -1.3917852640151978, -0.12983298301696777, 0.7148662209510803, -1.2861353158950806, 0.5024625658988953, -0.8384524583816528, 0.2582713067531...
func (s BlobSet) Merge(other BlobSet) { for h := range other { s.Insert(h) } }
[ -0.5821628570556641, 0.14836061000823975, 0.35264748334884644, 0.45833420753479004, -0.12032167613506317, 0.25278356671333313, -0.9897273778915405, -0.9201344847679138, -0.08032673597335815, -0.2801426947116852, -0.9432236552238464, -0.521746814250946, -1.0650306940078735, 0.64069205522537...
func (s BlobSet) Intersect(other BlobSet) (result BlobSet) { result = NewBlobSet() set1 := s set2 := other // iterate over the smaller set if len(set2) < len(set1) { set1, set2 = set2, set1 } for h := range set1 { if set2.Has(h) { result.Insert(h) } } return result }
[ 0.3001013696193695, -0.13706859946250916, 0.9844715595245361, 0.4948238432407379, -1.2698239088058472, -0.2927860915660858, -0.46488091349601746, -1.440112590789795, -0.39210760593414307, 0.6708623170852661, 0.2136109471321106, -0.4778675138950348, -1.271466851234436, 0.15475405752658844, ...
func (s BlobSet) Sub(other BlobSet) (result BlobSet) { result = NewBlobSet() for h := range s { if !other.Has(h) { result.Insert(h) } } return result }
[ 0.12898635864257812, -0.06499302387237549, 0.6234446167945862, 0.2926153838634491, -1.682655930519104, -0.07338761538267136, -0.309128075838089, -1.0270018577575684, 0.038141995668411255, 0.07442096620798111, -0.7948941588401794, -0.09487979114055634, -1.2323087453842163, -0.01755563542246...
func (s BlobSet) List() BlobHandles { list := make(BlobHandles, 0, len(s)) for h := range s { list = append(list, h) } sort.Sort(list) return list }
[ 0.8099812269210815, -0.9276886582374573, 0.33948707580566406, 0.0406164713203907, 0.21604330837726593, 0.4094107747077942, 0.20353898406028748, -1.2217731475830078, 0.403341680765152, 0.19044509530067444, -0.32052895426750183, -0.16857463121414185, -0.6025331616401672, 0.33506670594215393,...
func (nsac KubeNodeCollector) Describe(ch chan<- *prometheus.Desc) { disabledMetrics := nsac.metricsConfig.GetDisabledMetricsMap() if _, disabled := disabledMetrics["kube_node_status_capacity"]; !disabled { ch <- prometheus.NewDesc("kube_node_status_capacity", "Node resource capacity.", []string{}, nil) } if _, ...
[ 0.49641942977905273, 0.4421716630458832, 0.7037014365196228, -0.5766604542732239, 0.3658960163593292, 0.1348842978477478, -0.3219831585884094, -0.5905497670173645, -0.9575635194778442, 0.45894503593444824, 0.3508250117301941, 0.7796431183815002, -0.0528852641582489, 0.8835528492927551, 0...
func (nsac KubeNodeCollector) Collect(ch chan<- prometheus.Metric) { nodes := nsac.KubeClusterCache.GetAllNodes() disabledMetrics := nsac.metricsConfig.GetDisabledMetricsMap() for _, node := range nodes { nodeName := node.GetName() // Node Capacity for resourceName, quantity := range node.Status.Capacity { ...
[ -0.0019369145156815648, -0.17614474892616272, 0.5347366333007812, -0.4849349856376648, -0.1494693011045456, -0.06911159306764603, -0.35707005858421326, -0.24620382487773895, -1.1657066345214844, 0.6343206763267517, 0.7936162948608398, 0.29516658186912537, 0.5754725933074951, 1.026801228523...
func newKubeNodeStatusCapacityMetric(fqname, node, resource, unit string, value float64) KubeNodeStatusCapacityMetric { return KubeNodeStatusCapacityMetric{ fqName: fqname, help: "kube_node_status_capacity node capacity", node: node, resource: resource, unit: unit, value: value, } }
[ 0.39308565855026245, -0.11528240889310837, 0.1385672241449356, 0.33869683742523193, -0.9553625583648682, -0.0691831111907959, -0.724908709526062, -0.4704551100730896, -1.212172269821167, 0.38324323296546936, 0.6872549653053284, -0.016087884083390236, 0.8107869625091553, 0.19543610513210297...
func (kpcrr KubeNodeStatusCapacityMetric) Desc() *prometheus.Desc { l := prometheus.Labels{ "node": kpcrr.node, "resource": kpcrr.resource, "unit": kpcrr.unit, } return prometheus.NewDesc(kpcrr.fqName, kpcrr.help, []string{}, l) }
[ 1.445768117904663, -0.062363188713788986, 0.400246262550354, -0.3589169979095459, 0.474165141582489, 0.9148701429367065, -0.12620782852172852, -0.34774038195610046, -1.0498183965682983, 0.2904433310031891, 1.4930185079574585, 0.7181953191757202, 0.38917967677116394, 0.24412496387958527, ...
func (kpcrr KubeNodeStatusCapacityMetric) Write(m *dto.Metric) error { m.Gauge = &dto.Gauge{ Value: &kpcrr.value, } m.Label = []*dto.LabelPair{ { Name: toStringPtr("node"), Value: &kpcrr.node, }, { Name: toStringPtr("resource"), Value: &kpcrr.resource, }, { Name: toStringPtr("unit"), ...
[ -0.7955271005630493, 0.40871790051460266, 0.2988796830177307, -0.5936522483825684, 0.9722712635993958, 0.7076217532157898, 0.2689554691314697, -0.20455612242221832, -1.2622238397598267, 0.4441366493701935, 0.22436852753162384, -0.0935039073228836, 0.43501386046409607, 0.16684368252754211, ...
func newKubeNodeStatusCapacityMemoryBytesMetric(fqname string, node string, bytes float64) KubeNodeStatusCapacityMemoryBytesMetric { return KubeNodeStatusCapacityMemoryBytesMetric{ fqName: fqname, help: "kube_node_status_capacity_memory_bytes Node Capacity Memory Bytes", node: node, bytes: bytes, } }
[ 0.8104994297027588, 0.15786905586719513, 0.288670152425766, -0.1301898956298828, -0.7921968698501587, -0.046590209007263184, -0.8169057965278625, -0.2270955592393875, -0.833098292350769, 0.7093679904937744, 0.2535249590873718, 0.13620775938034058, -0.14008718729019165, 0.4703696370124817, ...
func (nam KubeNodeStatusCapacityMemoryBytesMetric) Desc() *prometheus.Desc { l := prometheus.Labels{"node": nam.node} return prometheus.NewDesc(nam.fqName, nam.help, []string{}, l) }
[ 1.9593883752822876, 0.11866825819015503, 0.38377439975738525, -0.32358014583587646, 0.06922725588083267, 0.7267191410064697, 0.007596525829285383, -0.37741515040397644, -1.0611635446548462, 0.3382350504398346, 1.0821934938430786, 1.0397084951400757, 0.0007367635844275355, 0.141805455088615...
func (nam KubeNodeStatusCapacityMemoryBytesMetric) Write(m *dto.Metric) error { m.Gauge = &dto.Gauge{ Value: &nam.bytes, } m.Label = []*dto.LabelPair{ { Name: toStringPtr("node"), Value: &nam.node, }, } return nil }
[ -0.3670646846294403, 0.6572755575180054, 0.14670617878437042, -0.2773110270500183, 0.7164307832717896, 0.7515316605567932, 0.3700377345085144, -0.1107846200466156, -1.1771886348724365, 0.6159236431121826, 0.003063345095142722, 0.26989540457725525, 0.007937928661704063, 0.47642993927001953,...
func newKubeNodeStatusCapacityCPUCoresMetric(fqname string, node string, cores float64) KubeNodeStatusCapacityCPUCoresMetric { return KubeNodeStatusCapacityCPUCoresMetric{ fqName: fqname, help: "kube_node_status_capacity_cpu_cores Node Capacity CPU Cores", cores: cores, node: node, } }
[ 0.1544571816921234, 0.4738462567329407, 0.1420779675245285, 0.26280295848846436, -0.5157685875892639, 0.00010235512309009209, -0.5470932126045227, -0.3431236445903778, -0.9514838457107544, 0.7980142831802368, 0.2172531634569168, -0.09511543810367584, 0.21544280648231506, 0.5060586333274841...
func (nam KubeNodeStatusCapacityCPUCoresMetric) Desc() *prometheus.Desc { l := prometheus.Labels{"node": nam.node} return prometheus.NewDesc(nam.fqName, nam.help, []string{}, l) }
[ 1.5972532033920288, 0.33562877774238586, 0.3534125089645386, -0.03320698067545891, 0.3116030991077423, 0.6795279383659363, 0.247358039021492, -0.10327131301164627, -1.5062636137008667, 0.397413045167923, 1.1246594190597534, 0.8073333501815796, 0.359142929315567, 0.4027596712112427, 0.656...
func (nam KubeNodeStatusCapacityCPUCoresMetric) Write(m *dto.Metric) error { m.Gauge = &dto.Gauge{ Value: &nam.cores, } m.Label = []*dto.LabelPair{ { Name: toStringPtr("node"), Value: &nam.node, }, } return nil }
[ -0.7244588732719421, 0.800525963306427, 0.18253983557224274, -0.34585484862327576, 0.980896532535553, 0.6332231163978577, 0.6237406730651855, 0.1591063290834427, -1.2784019708633423, 0.7237622737884521, 0.07731319963932037, 0.08179335296154022, 0.12559570372104645, 0.6943291425704956, 0....
func newKubeNodeLabelsMetric(node string, fqname string, labelNames []string, labelValues []string) KubeNodeLabelsMetric { return KubeNodeLabelsMetric{ fqName: fqname, labelNames: labelNames, labelValues: labelValues, help: "kube_node_labels all labels for each node prefixed with label_", node: ...
[ -0.260038286447525, 0.17975355684757233, 0.13487808406352997, -0.8897718787193298, -0.7313733696937561, 0.39923229813575745, -1.7053334712982178, -0.9710208177566528, -1.4376164674758911, 0.6929940581321716, 1.0355331897735596, -0.1259087473154068, -0.4086054563522339, 0.3214706480503082, ...
func (nam KubeNodeLabelsMetric) Desc() *prometheus.Desc { l := prometheus.Labels{ "node": nam.node, } return prometheus.NewDesc(nam.fqName, nam.help, nam.labelNames, l) }
[ 1.191314935684204, 0.20843149721622467, 0.30330324172973633, -0.5287595391273499, 0.09579744935035706, 0.9115040898323059, -0.5866391658782959, -0.8487823009490967, -1.3998234272003174, 0.42577821016311646, 1.607045292854309, 0.5125692486763, -0.38610783219337463, -0.09373937547206879, -...
func (nam KubeNodeLabelsMetric) Write(m *dto.Metric) error { h := float64(1) m.Gauge = &dto.Gauge{ Value: &h, } var labels []*dto.LabelPair for i := range nam.labelNames { labels = append(labels, &dto.LabelPair{ Name: &nam.labelNames[i], Value: &nam.labelValues[i], }) } nodeString := "node" label...
[ -1.1866925954818726, 0.579897403717041, 0.307888925075531, -0.9168705344200134, 0.327366441488266, 0.8134089112281799, -0.14043459296226501, -0.43717068433761597, -1.3073989152908325, 0.6631962656974792, 0.7245383262634277, -0.12229162454605103, -0.2946983873844147, 0.28848862648010254, ...
func newKubeNodeStatusConditionMetric(node, fqname, condition, status string, value float64) KubeNodeStatusConditionMetric { return KubeNodeStatusConditionMetric{ fqName: fqname, help: "kube_node_status_condition condition status for nodes", node: node, condition: condition, status: status, ...
[ 0.2772168815135956, -0.38427847623825073, 0.041642870754003525, 0.1382867395877838, -1.1884578466415405, 0.16937056183815002, -0.9708842039108276, -0.0469810925424099, -1.3687784671783447, 0.6780406832695007, 0.7823513746261597, 0.1576436161994934, 0.4365949332714081, 0.09557215869426727, ...
func (nam KubeNodeStatusConditionMetric) Desc() *prometheus.Desc { l := prometheus.Labels{ "node": nam.node, "condition": nam.condition, "status": nam.status, } return prometheus.NewDesc(nam.fqName, nam.help, []string{}, l) }
[ 1.4730080366134644, -0.0700351670384407, 0.3915013372898102, 0.08300168812274933, -0.17601507902145386, 0.701649010181427, -0.23800835013389587, -0.19533343613147736, -1.515925407409668, 0.5148101449012756, 1.3208729028701782, 0.5754318237304688, 0.3423694372177124, 0.05741414055228233, ...
func (nam KubeNodeStatusConditionMetric) Write(m *dto.Metric) error { m.Gauge = &dto.Gauge{ Value: &nam.value, } m.Label = []*dto.LabelPair{ { Name: toStringPtr("node"), Value: &nam.node, }, { Name: toStringPtr("condition"), Value: &nam.condition, }, { Name: toStringPtr("status"), Va...
[ -0.6773014664649963, 0.30819180607795715, 0.23968085646629333, -0.3203539252281189, 0.45634540915489197, 0.6587978601455688, 0.15997785329818726, -0.09294307231903076, -1.501023769378662, 0.878985583782196, 0.2819327712059021, -0.05173083767294884, 0.16510692238807678, 0.2327784299850464, ...
func getConditions(cs v1.ConditionStatus) []*statusCondition { ms := make([]*statusCondition, len(conditionStatuses)) for i, status := range conditionStatuses { ms[i] = &statusCondition{ status: strings.ToLower(string(status)), value: boolFloat64(cs == status), } } return ms }
[ -0.2086687684059143, -0.680586040019989, 0.22404645383358002, 0.9117183685302734, 0.15984147787094116, -0.05704660341143608, -0.2984927296638489, -0.14374960958957672, 0.2826243042945862, 0.09067529439926147, -0.20473958551883698, 0.04014476761221886, 0.2776660919189453, 0.651923656463623,...
func newKubeNodeStatusAllocatableMetric(fqname, node, resource, unit string, value float64) KubeNodeStatusAllocatableMetric { return KubeNodeStatusAllocatableMetric{ fqName: fqname, help: "kube_node_status_allocatable node allocatable", node: node, resource: resource, unit: unit, value: va...
[ 1.002048373222351, 0.378582626581192, 0.31096145510673523, 0.09969198703765869, -1.3330802917480469, 0.43347179889678955, -0.9595760107040405, -0.18851053714752197, -0.518288791179657, 0.8813497424125671, 1.0257081985473633, 0.5573894381523132, 0.537911057472229, -0.379634290933609, -0.6...
func (kpcrr KubeNodeStatusAllocatableMetric) Desc() *prometheus.Desc { l := prometheus.Labels{ "node": kpcrr.node, "resource": kpcrr.resource, "unit": kpcrr.unit, } return prometheus.NewDesc(kpcrr.fqName, kpcrr.help, []string{}, l) }
[ 1.5685937404632568, 0.21910163760185242, 0.39762091636657715, -0.16942141950130463, -0.015619544312357903, 1.0089843273162842, -0.37664884328842163, -0.04766362905502319, -0.7478970289230347, 0.5198779702186584, 1.9166245460510254, 0.9047720432281494, 0.1214747428894043, 0.0138657093048095...
func (kpcrr KubeNodeStatusAllocatableMetric) Write(m *dto.Metric) error { m.Gauge = &dto.Gauge{ Value: &kpcrr.value, } m.Label = []*dto.LabelPair{ { Name: toStringPtr("node"), Value: &kpcrr.node, }, { Name: toStringPtr("resource"), Value: &kpcrr.resource, }, { Name: toStringPtr("unit")...
[ -0.6278969049453735, 0.532130777835846, 0.44850167632102966, -0.4940378665924072, 0.45283713936805725, 0.8009951114654541, 0.015976933762431145, 0.036539651453495026, -0.878168523311615, 0.7807130813598633, 0.5838555693626404, 0.2195223867893219, 0.2367289811372757, -0.09625523537397385, ...
func newKubeNodeStatusAllocatableCPUCoresMetric(fqname, node string, value float64) KubeNodeStatusAllocatableCPUCoresMetric { return KubeNodeStatusAllocatableCPUCoresMetric{ fqName: fqname, help: "kube_node_status_allocatable_cpu_cores node allocatable cpu cores", node: node, value: value, } }
[ 0.9403645396232605, 0.7751569747924805, 0.2725268304347992, 0.17231285572052002, -0.8697397708892822, 0.2955155372619629, -0.5545605421066284, -0.17490771412849426, -0.46293091773986816, 1.0220937728881836, 0.8134397268295288, 0.18081708252429962, 0.19775544106960297, 0.20898182690143585, ...
func (kpcrr KubeNodeStatusAllocatableCPUCoresMetric) Desc() *prometheus.Desc { l := prometheus.Labels{ "node": kpcrr.node, } return prometheus.NewDesc(kpcrr.fqName, kpcrr.help, []string{}, l) }
[ 1.4809056520462036, 0.5365170836448669, 0.3504107594490051, 0.04193897172808647, 0.16085924208164215, 0.8710111975669861, -0.1036175936460495, 0.08215586096048355, -1.0549029111862183, 0.5576428174972534, 1.7278878688812256, 0.9174759984016418, 0.004830607213079929, 0.40749698877334595, ...
func (kpcrr KubeNodeStatusAllocatableCPUCoresMetric) Write(m *dto.Metric) error { m.Gauge = &dto.Gauge{ Value: &kpcrr.value, } m.Label = []*dto.LabelPair{ { Name: toStringPtr("node"), Value: &kpcrr.node, }, } return nil }
[ -0.5260331034660339, 0.7180838584899902, 0.26769816875457764, -0.11254347860813141, 0.6602208614349365, 0.8205079436302185, 0.3916253447532654, 0.1949063539505005, -1.0452464818954468, 0.8651559352874756, 0.6024883389472961, 0.2774638235569, 0.03666916862130165, 0.3547128736972809, -0.03...
func newKubeNodeStatusAllocatableMemoryBytesMetric(fqname, node string, value float64) KubeNodeStatusAllocatableMemoryBytesMetric { return KubeNodeStatusAllocatableMemoryBytesMetric{ fqName: fqname, help: "kube_node_status_allocatable_memory_bytes node allocatable memory in bytes", node: node, value: valu...
[ 1.2312041521072388, 0.6530588865280151, 0.35568729043006897, -0.1834946870803833, -1.3019561767578125, 0.3834841847419739, -1.1070722341537476, -0.4095923900604248, -0.3913392424583435, 0.7795397043228149, 0.7070184946060181, 0.47563666105270386, -0.26634812355041504, 0.31596431136131287, ...
func (kpcrr KubeNodeStatusAllocatableMemoryBytesMetric) Desc() *prometheus.Desc { l := prometheus.Labels{ "node": kpcrr.node, } return prometheus.NewDesc(kpcrr.fqName, kpcrr.help, []string{}, l) }
[ 1.9124226570129395, 0.4592810273170471, 0.3898449242115021, -0.3722873032093048, -0.05893734470009804, 0.8735679984092712, -0.28395628929138184, -0.1526765078306198, -0.6356894373893738, 0.42830103635787964, 1.5416483879089355, 1.266231656074524, -0.26704078912734985, 0.2578243613243103, ...
func (kpcrr KubeNodeStatusAllocatableMemoryBytesMetric) Write(m *dto.Metric) error { m.Gauge = &dto.Gauge{ Value: &kpcrr.value, } m.Label = []*dto.LabelPair{ { Name: toStringPtr("node"), Value: &kpcrr.node, }, } return nil }
[ -0.3539993464946747, 0.8444010615348816, 0.26360756158828735, -0.35891932249069214, 0.28893420100212097, 0.8787804841995239, 0.17906230688095093, 0.004374637268483639, -0.751300036907196, 0.7848522067070007, 0.3590371608734131, 0.6069738268852234, -0.23070025444030762, 0.2602729797363281, ...
func (gf *GFile) GetGID() string { // TODO add function to parse URL to set this if nil return gf.GID }
[ 1.092113971710205, 0.08663872629404068, 0.5581357479095459, 0.1901988536119461, 0.7930086255073547, 1.0436948537826538, 0.8073863983154297, 0.47563639283180237, -1.084547519683838, -0.7378656268119812, 0.6860249638557434, 0.35782426595687866, -1.0261887311935425, 0.9791294932365417, 0.63...
func (gf *GFile) GetName() string { return gf.Name }
[ 0.8003779649734497, -0.22879204154014587, 0.3713488280773163, -0.09481948614120483, 0.6364389061927795, 0.6816365718841553, 0.46323785185813904, -0.5759726762771606, -2.0221188068389893, 0.17130745947360992, -0.30273008346557617, -0.13152891397476196, -0.501431405544281, 0.1015510484576225...
func NewUserProfileServiceServer() interface { api_pb.UserProfileServiceServer grapiserver.Server } { return &userProfileServiceServerImpl{} }
[ -0.6901785135269165, -0.847549557685852, 0.16757109761238098, 0.6531998515129089, -0.7593599557876587, 0.3120565414428711, 0.43992429971694946, -0.7001769542694092, 0.30695849657058716, 0.2892272472381592, -1.1319504976272583, 0.050732918083667755, -0.9463516473770142, 0.16260479390621185,...
func (mock *ResponseSenderMock) SendCalls() []struct { IP IPAddr Port uint16 Data []byte } { var calls []struct { IP IPAddr Port uint16 Data []byte } mock.lockSend.RLock() calls = mock.calls.Send mock.lockSend.RUnlock() return calls }
[ -0.11496856808662415, 0.40515071153640747, 0.21382172405719757, 0.22452470660209656, 0.1591462343931198, -0.05904277414083481, -0.20199069380760193, -1.9679186344146729, 0.5286567807197571, -0.1736181229352951, -0.1437261700630188, -0.8630841374397278, -0.988068699836731, 0.280749857425689...
func (dst *Polygon) Set(src interface{}) error { if src == nil { dst.Status = Null return nil } err := fmt.Errorf("cannot convert %v to Polygon", src) var p *Polygon switch value := src.(type) { case string: p, err = stringToPolygon(value) case []Vec2: p = &Polygon{Status: Present, P: value} err = nil ...
[ -0.5716707706451416, -0.1739874631166458, 0.5240691304206848, -0.7030033469200134, -0.67625892162323, 0.7492766976356506, -0.5344473123550415, -0.222727969288826, 0.23572322726249695, 0.7770764231681824, -0.9352890849113464, 1.236185073852539, 0.617856502532959, -0.10242291539907455, -0....
func (dst *Polygon) Scan(src interface{}) error { if src == nil { *dst = Polygon{Status: Null} return nil } switch src := src.(type) { case string: return dst.DecodeText(nil, []byte(src)) case []byte: srcCopy := make([]byte, len(src)) copy(srcCopy, src) return dst.DecodeText(nil, srcCopy) } return ...
[ -0.6099452972412109, 0.15071719884872437, 0.5309062004089355, -0.1168704405426979, -1.9586760997772217, -0.005468329414725304, -0.22056426107883453, -0.40877586603164673, 0.6207208037376404, -0.39733001589775085, -0.7157902121543884, 1.0838921070098877, 0.2955353260040283, -0.4403300583362...
func (src Polygon) Value() (driver.Value, error) { return EncodeValueText(src) }
[ -0.03855688124895096, -0.5803664922714233, 0.33722156286239624, -0.046292077749967575, -0.10709553211927414, 0.3108108937740326, -0.2653931975364685, -1.096441388130188, 1.0475358963012695, 0.7215582132339478, -0.22319358587265015, 0.6155533790588379, 0.1964278519153595, -0.167801618576049...
func (reporter *RedisReporter) Run() { reporter.running = true for { select { case t := <-reporter.channel.Channel(): receivers, err := report(reporter.client, t) if err != nil { reporter.running = false _, ok := err.(*retryingRedis.ClientClosedError) if ok { log.Println("retry client wa...
[ -0.14448295533657074, -0.1837746798992157, 0.5355381369590759, -0.9984411597251892, 0.8976114392280579, -0.31888389587402344, 0.17973592877388, 0.1600312441587448, -0.6216520071029663, -0.33200526237487793, 0.1259610801935196, -0.7493160367012024, -1.621065616607666, 0.792210042476654, 0...
func create() I { return B{ Struct: A{ Greeting: "Hello", Message: "translate this", Pi: 3.14, }, Ptr: &A{ Greeting: "What's up?", Message: "point here", Pi: 3.14, }, Map: map[string]string{ "Test": "translate this", }, StructMap: map[string]C{ "C": C{ String: "d...
[ 0.00477872509509325, -0.029804455116391182, 0.5783532857894897, -0.17012538015842438, -0.31166568398475647, 0.5225132703781128, 0.11954003572463989, -0.6721364259719849, -0.03895656019449234, -0.2371015101671219, -0.62933748960495, -0.3216928541660309, -0.45884212851524353, -0.200768023729...
func newDeck() deck { cards := deck{} cardSuits := []string{"Diamonds", "Clubs", "Hearts", "Spades"} cardValues := []string{"Ace", "Two", "Three", "Four"} // we input "_" to notify that we're not using index in for loop for _, suit := range cardSuits { for _, value := range cardValues { // append() add ons...
[ -0.3545694947242737, -0.6975882649421692, 0.7030193209648132, 0.12414298206567764, -0.7462964653968811, -0.17876943945884705, -0.9309205412864685, -0.3919948935508728, -0.24883002042770386, -0.5696215629577637, 0.37033042311668396, 0.4939999580383301, 0.8823281526565552, 1.0326507091522217...
func (d deck) print() { // assign index and value of every element in cards slice to the variables, idx and card. for idx, card := range d { fmt.Println(idx, card) } }
[ -0.9419044256210327, 0.17556676268577576, 0.12499194592237473, -0.13719972968101501, 0.3773140013217926, -0.10493764281272888, -0.6723097562789917, 0.09936202317476273, -0.7798036932945251, -0.7066649794578552, 0.380065381526947, 0.8225322365760803, 0.38554462790489197, 0.8367815613746643,...
func deal(d deck, handSize int) (deck, deck) { return d[:handSize], d[handSize:] // return dealed cards, and remaining }
[ -0.2551024854183197, -0.4230821132659912, 0.41920143365859985, -0.41651803255081177, -0.5014436841011047, 0.5198810696601868, -0.40723469853401184, 0.43356046080589294, 0.6529895067214966, -1.0547455549240112, -0.13530993461608887, -0.33247968554496765, -0.09613724052906036, 0.518820106983...
func (d deck) toString() string { return strings.Join([]string(d), ",") }
[ 0.03825625032186508, 0.08704175800085068, 0.4938202202320099, -0.8544940948486328, 0.5832382440567017, 0.48162421584129333, -1.0898544788360596, 0.02530517429113388, 0.5163640379905701, 0.1001271903514862, 0.4611752927303314, 0.24631258845329285, 0.2016797810792923, -0.06480340659618378, ...
func (d deck) saveToFile(filename string) error { return ioutil.WriteFile(filename, []byte(d.toString()), 0666) }
[ 0.031199153512716293, 0.35623452067375183, 0.5837563872337341, -0.3829543888568878, 0.5363433957099915, 0.12498531490564346, 0.20356310904026031, 0.292032390832901, -0.6715109348297119, 0.14314302802085876, -1.0636523962020874, -0.6916313171386719, -0.09846395254135132, 0.3101234436035156,...
func newDeckFromFile(filename string) deck { byteSlice, err := ioutil.ReadFile(filename) // docs states ReadFile returns to values ([]byte, error) if err != nil { // Option 1: log error and return a call to newDeck() // Option 2: log error and quit the program fmt.Println("Error: ", err) // Go with Option 2 o...
[ 0.834087610244751, -0.9924566149711609, 0.5034284591674805, 0.2005125731229782, -0.815356433391571, 0.40673258900642395, -0.471203088760376, 0.5503926277160645, -0.3063727915287018, -0.298414945602417, 0.6821094751358032, 0.11095786839723587, -0.19534102082252502, 0.8714202046394348, 0.0...
func (d deck) shuffle() { // type Rand is a source of random numbers. If we create a value of type Rand, we have the ability to specify the seed, or source of randomness for our number generator. // To make a value of type Rand, and to make a source, we have to call newSource() and passing in a random int64 number, a...
[ -1.2146730422973633, 0.359433114528656, 0.7394191026687622, -0.47188127040863037, -0.1776147186756134, -0.09873587638139725, 0.5611482858657837, 0.6869372725486755, 0.7590689063072205, -1.1618512868881226, -0.15460221469402313, 0.644244909286499, 0.5911200046539307, 1.1819019317626953, 0...
func (config *Config) Save(file string) error { bts, err := json.Marshal(*config) if err != nil { return err } var out bytes.Buffer json.Indent(&out, bts, "", "\t") return ioutil.WriteFile(file, out.Bytes(), 0600) }
[ -0.6671727299690247, -0.09027941524982452, 0.4161795675754547, -0.9274049401283264, 0.0442354790866375, 0.15460902452468872, -0.058750368654727936, -0.26304930448532104, -1.4421147108078003, 1.2006970643997192, -1.3118330240249634, -0.2876858413219452, 0.16816584765911102, 0.30347043275833...
func (c *CreditsService) All() ([]Credit, error) { req, err := c.client.newAuthenticatedRequest("GET", "credits", nil) if err != nil { return nil, err } credits := make([]Credit, 0) _, err = c.client.do(req, &credits) if err != nil { return nil, err } return credits, ni...
[ 0.23983895778656006, 0.15497665107250214, 0.6853443384170532, 0.4328426718711853, 0.9455550909042358, 0.659848153591156, -1.6162179708480835, 0.5676267743110657, 0.04894622042775154, 0.0842677652835846, 0.2851225435733795, 1.6558693647384644, -0.7464383840560913, 1.1627949476242065, 0.07...
func Constructor() MinStack { return MinStack{ data: make([]int, 0), min: make([]int, 0), } }
[ 0.18051677942276, 0.08083547651767731, 0.3528800308704376, 0.6740139722824097, -0.6803252696990967, -0.48032820224761963, 0.315726637840271, -0.5647643804550171, 0.1993281990289688, -0.6253350377082825, -1.2317782640457153, -0.12865029275417328, -0.21261225640773773, 0.4644690454006195, ...
func (c *ClientConn) preHandleShard(sql string) (bool, error) { //var rs []*mysql.Result var err error var executeDB *ExecuteDB if len(sql) == 0 { return false, fmt.Errorf("unsport command") } //TODOsql白名单处理 tokens := strings.FieldsFunc(sql, utils.IsSqlSep) fmt.Println(tokens) if len(tokens) == 0 { retur...
[ 0.044845182448625565, 0.8148449063301086, 1.4147263765335083, 0.10807158052921295, -0.32349029183387756, 0.3203314244747162, 0.37037375569343567, 0.19269798696041107, -0.24808473885059357, -0.021773777902126312, -0.4383852183818817, -0.1579156070947647, -0.7216043472290039, 0.5988496541976...
func (c *ClientConn) GetExecDB(tokens []string, sql string) (*ExecuteDB, error) { tokensLen := len(tokens) if 0 < tokensLen { tokenId, ok := mysql.PARSE_TOKEN_MAP[strings.ToLower(tokens[0])] if ok == true { switch tokenId { case mysql.TK_ID_SELECT: fmt.Println("select command") //return c.getSelectE...
[ 0.13739299774169922, -0.04415908083319664, 0.9817847609519958, -0.15443375706672668, 0.24821114540100098, -0.44927090406417847, -0.25724783539772034, -0.006240219343453646, 0.0164443701505661, -0.09574269503355026, 0.09239283949136734, 0.7659754157066345, -0.9310439825057983, 0.49738687276...
func GenerateToken(secretKey string, validDays int) string { if validDays < 1 { validDays = 1 } claims := sjwt.New() // Issuer of the token claims.SetIssuer("goUpload") /* claims.SetTokenID() // UUID generated claims.SetSubject("Bearer Token") ...
[ -0.11286972463130951, 0.37867531180381775, 0.7459981441497803, 0.10523133724927902, -0.5234959125518799, 0.15983031690120697, -1.157753348350525, 1.2550328969955444, 0.46791985630989075, -0.38849151134490967, -0.4231618642807007, 0.4292210638523102, 0.46836984157562256, -0.1650097072124481...
func ValidateToken(secretKey string, token string) error { if !sjwt.Verify(token, []byte(secretKey)) { return errors.New("Token isn't valid") } claims, err := sjwt.Parse(token) if err != nil { return err } issuer, err := claims.GetIssuer() if err != nil { return err } if issuer != "goUpload" { retu...
[ 0.3349471390247345, 0.012147457338869572, 0.6738733649253845, 0.4437844157218933, -0.07149355113506317, 0.31305384635925293, -0.77437424659729, 0.9776227474212646, 0.09336833655834198, -0.3414623737335205, -0.5557882785797119, 1.2686833143234253, 0.161121666431427, 0.6822014451026917, 0....
func main() { q := Queue{ items: make(chan int, 16), } q.Enqueue(1) q.Enqueue(2) fmt.Println(q.Dequeue()) fmt.Println(q.Dequeue()) }
[ 0.4725390076637268, -0.05594881623983383, 0.9664778113365173, -0.4236854016780853, 1.1902754306793213, -0.2037256956100464, -0.44416218996047974, -0.08274336904287338, -0.7640072107315063, -0.7537898421287537, -0.8423389792442322, 0.8145204186439514, 0.056811343878507614, 0.081350423395633...
func (h fractionalHex) Round() hex { roundToInt := func(a float64) int { if a < 0 { return int(a - 0.5) } return int(a + 0.5) } q := roundToInt(h.q) r := roundToInt(h.r) s := roundToInt(h.s) q_diff := math.Abs(float64(q) - h.q) r_diff := math.Abs(float64(r) - h.r) s_diff := math.Abs(float64(s) - h.s...
[ 0.507207453250885, -0.3070277273654938, 0.7171526551246643, -0.8056544661521912, -0.15481621026992798, 0.7420211434364319, 0.5650988221168518, -1.0749728679656982, -0.6440286040306091, -1.1457676887512207, 0.796848714351654, 0.1474212408065796, 0.3147103488445282, 0.6625417470932007, -0....
func HexScale(a hex, k int) hex { return NewHex(a.q*k, a.r*k) }
[ 0.7590590119361877, -1.0505822896957397, 0.5673609972000122, -0.77409428358078, -1.0134735107421875, 0.06497751176357269, -2.379279851913452, 0.4994065463542938, -0.09392131119966507, 0.5264480710029602, 0.42362287640571594, -0.8950302004814148, 0.4593549072742462, 0.35915887355804443, -...
func HexNeighbor(h hex, direction direction) hex { directionOffset := directions[direction] return NewHex(h.q+directionOffset.q, h.r+directionOffset.r) }
[ -0.12130376696586609, -0.8380271196365356, 0.4145224392414093, -0.5654625296592712, -1.1785669326782227, 1.0813757181167603, -0.7629993557929993, 0.7520366907119751, -0.31551289558410645, 0.04937326908111572, -0.6660084128379822, 0.14502157270908356, 0.2209952026605606, 0.379112184047699, ...
func HexLineDraw(a, b hex) []hex { hexLerp := func(a fractionalHex, b fractionalHex, t float64) fractionalHex { return NewFractionalHex(a.q*(1-t)+b.q*t, a.r*(1-t)+b.r*t) } N := HexDistance(a, b) // Sometimes the hexLerp will output a point that’s on an edge. // On some systems, the rounding code will push tha...
[ 0.11135948449373245, -0.410203218460083, 0.8893969058990479, -0.9222441911697388, 0.1307351440191269, 0.05644073337316513, -1.0947856903076172, 0.314225435256958, 0.4817008376121521, -0.08151756227016449, -0.26339030265808105, -0.9018957018852234, 0.9809501767158508, 0.3991243541240692, ...
func HexRange(center hex, radius int) []hex { var results = make([]hex, 0) if radius >= 0 { for dx := -radius; dx <= radius; dx++ { for dy := math.Max(float64(-radius), float64(-dx-radius)); dy <= math.Min(float64(radius), float64(-dx+radius)); dy++ { results = append(results, HexAdd(center, NewHex(int(dx...
[ -0.6898257732391357, -0.030658114701509476, 0.4775736629962921, -0.1435895413160324, -0.029903724789619446, -0.37192705273628235, -1.1194934844970703, 0.900264322757721, -0.14367800951004028, 0.3291209042072296, -0.38825973868370056, -0.19593626260757446, -0.0549979992210865, 0.57326948642...
func HexRectangleGrid(width, height int) []hex { results := make([]hex, 0) for q := 0; q < width; q++ { qOffset := int(math.Floor(float64(q) / 2.)) for r := -qOffset; r < height-qOffset; r++ { results = append(results, NewHex(q, r)) } } return results }
[ -0.17170479893684387, -0.1652611345052719, 0.651361882686615, -0.9106414318084717, 0.15302340686321259, -0.1131148412823677, -1.634750485420227, 0.5851651430130005, -0.1339084953069687, 0.6918439865112305, -0.01149655319750309, -0.30883461236953735, 0.0314047671854496, 0.9392136931419373, ...
func HexHasLineOfSight(center hex, target hex, blocking []hex) bool { contains := func(s []hex, e hex) bool { for _, a := range s { if a == e { return true } } return false } for _, h := range HexLineDraw(center, target) { if contains(blocking, h) { return false } } return true }
[ 0.6083390116691589, -0.07861141860485077, 0.600531280040741, -0.02745547704398632, -0.46514996886253357, -0.27340471744537354, -1.4699206352233887, 1.2329490184783936, 0.508502185344696, 0.175665482878685, -0.08125339448451996, -0.7958412170410156, 0.6144046187400818, 0.9306690692901611, ...
func HexFieldOfView(source hex, candidates []hex, blocking []hex) []hex { results := make([]hex, 0) for _, h := range candidates { distance := HexDistance(source, h) if len(blocking) == 0 || distance <= 1 || HexHasLineOfSight(source, h, blocking) { results = append(results, h) } } return results }
[ -0.5220590829849243, 0.4383600652217865, 0.325821191072464, -0.12808732688426971, -0.5562623143196106, -0.1840844750404358, -0.11244633793830872, 1.2004857063293457, 0.2529716491699219, 0.19939085841178894, 0.14312541484832764, -0.9108971953392029, 0.0758686363697052, 0.41046884655952454, ...
func resizeImage(i image.Image, max int) (image.Image) { if b := i.Bounds(); b.Dx() > max || b.Dy() > max { w, h := max, max if b.Dx() > b.Dy() { h = b.Dy() * h / b.Dx() } else { w = b.Dx() * w / b.Dy() } i = resize.Resize(i, i.Bounds(), w, h) } return i }
[ -0.7203962206840515, 0.909235954284668, 0.49542123079299927, 0.542259693145752, -0.050343286246061325, 0.23399163782596588, -0.2729451060295105, -0.37945273518562317, -0.37727466225624084, -0.05443683639168739, 0.564721941947937, -0.3886241018772125, -0.14995409548282623, -0.16219055652618...
func Store(key string, i image.Image, maxsize int, storename string) (image.Image) { // store big image i = resizeImage(i, maxsize) // Масштабируем пропорционально до maxsize пикселей, если какая-либо сторона больше. // Encode as a new JPEG image. buf := new(bytes.Buffer) buf.Reset() err := jpeg.Encode(b...
[ -0.9343657493591309, 1.0020338296890259, 0.5441871881484985, 0.08617721498012543, -0.6559942364692688, -0.015447028912603855, 0.6508089900016785, -0.11337050050497055, -0.015098570846021175, 0.5081665515899658, -1.0381498336791992, -0.14509762823581696, -0.3510024845600128, 0.3877761960029...
func Read(key string, storagename string) ([]byte) { mu.Lock() storage, _ :=gocask.NewGocask("images/" + storagename) buf, err := storage.Get(key) storage.Close() mu.Unlock() errors.Check(err) return buf }
[ -0.517595648765564, -0.18293902277946472, 0.4393433928489685, 0.6950990557670593, -0.09271784126758575, -0.22839809954166412, -0.10596577823162079, -0.7014952898025513, -0.6649076342582703, 0.25214624404907227, 0.055466897785663605, 0.7523260116577148, -0.7685194611549377, -0.0744830742478...
func basic_op(tasks []*task.Task) []*task.Task{ methods := map[string]func(tasks []*task.Task) []*task.Task{ "add":operations.Add, "query":operations.Query, "modify":operations.Modify , "delete":operations.Delete , } for { text := operations.Input("请输入操作(add/query/modify/delete/exit):") if text == "exit...
[ -0.5949991941452026, 0.7862259745597839, 1.000260591506958, 0.9318463206291199, -0.4747311472892761, 0.1466112732887268, 0.4533465504646301, -0.608511209487915, 0.3659539520740509, 0.4797362685203552, 0.11735616624355316, -0.7881489396095276, -0.24525710940361023, -0.6449058055877686, -0...
func (t *Terraform) preparePlugins(c interfaces.Cluster) error { binaryPath, err := osext.Executable() if err != nil { return fmt.Errorf("error finding tarmak executable: %s", err) } pluginPath := t.pluginPath(c) if err := utils.EnsureDirectory(pluginPath, 0755); err != nil { return err } for providerName,...
[ -0.34873461723327637, -0.10707153379917145, 0.5485565066337585, -0.3411898612976074, 1.126071572303772, -0.7260426878929138, 0.950164794921875, 0.402297705411911, 0.17515523731708527, 0.858279824256897, 0.24361349642276764, -0.12107338011264801, 0.15089724957942963, 0.3148426115512848, 0...
func (t *Terraform) pluginPath(c interfaces.Cluster) string { return filepath.Join(t.codePath(c), command.DefaultPluginVendorDir) }
[ 0.41026341915130615, -0.1383969485759735, 0.04176981747150421, 0.4208550453186035, 0.6293703317642212, 0.3090130686759949, 1.081307291984558, -0.7650889158248901, -0.08412767201662064, 0.7083414793014526, 0.19053462147712708, 0.08241087943315506, -0.393053263425827, 0.12411016970872879, ...
func (t *Terraform) codePath(c interfaces.Cluster) string { return filepath.Join(c.ConfigPath(), "terraform") }
[ 0.45765382051467896, 0.11879505217075348, 0.14649778604507446, -0.5757737159729004, 0.6860523223876953, 1.2873003482818604, 1.2462491989135742, -0.2740148603916168, -0.9040504693984985, 0.6751313805580139, 0.38093385100364685, -0.7794668078422546, -0.25365033745765686, 1.1674848794937134, ...
func tarmakSocketPath(clusterConfig string) string { return filepath.Join(clusterConfig, "tarmak.sock") }
[ 0.21174375712871552, 0.11087062209844589, 0.26272496581077576, -0.5565693378448486, 0.06738348305225372, 0.9024501442909241, 0.682130753993988, -0.19651632010936737, -0.3972882926464081, 0.61162930727005, 0.5583310127258301, 0.7988749146461487, 0.6088616847991943, 0.4273594319820404, -0....
func MapToTerraformTfvars(input map[string]interface{}) (output string, err error) { var buf bytes.Buffer for key, value := range input { switch v := value.(type) { case map[string]string: _, err := buf.WriteString(fmt.Sprintf("%s = {\n", key)) if err != nil { return "", err } keys := make([]str...
[ -0.6107822060585022, -0.6512572169303894, 0.8974711894989014, -1.0967916250228882, -0.47221827507019043, -0.1925281584262848, -0.47572892904281616, -1.080079436302185, -1.2618906497955322, 0.3704279363155365, -0.23796316981315613, 0.011099041439592838, 0.39235034584999084, 0.62096518278121...
func (lm *LeaveMessage) Exists() bool { return lm._exists }
[ -0.12415307760238647, -0.521625816822052, 0.5151071548461914, -1.3021591901779175, 0.8116583824157715, 0.7139458656311035, -0.9307960867881775, -0.31967416405677795, -0.16613245010375977, -0.25629281997680664, -0.27958008646965027, 0.23458844423294067, -1.1871974468231201, 0.72345685958862...
func (lm *LeaveMessage) Deleted() bool { return lm._deleted }
[ 0.9443576335906982, -0.9728603363037109, 0.6484269499778748, -0.6782206892967224, 0.7395188808441162, 1.320859432220459, -0.3077038526535034, -0.008811688050627708, 0.5277663469314575, -0.42364025115966797, -1.0641604661941528, 0.19446854293346405, -0.9954697489738464, 0.17534255981445312,...
func (lm *LeaveMessage) Insert(db XODB) error { var err error // sql insert query, primary key must be provided sqlstr := `INSERT INTO custmchat.leave_message (` + LeaveMessageFields + `) VALUES (` + `?, ?, ?, ?, ?, ?, ?, ?, ?` + `)` _, err = db.Exec(sqlstr, lm.ID, lm.EntID, lm.TrackID, lm.LastOptionAgent...
[ -0.07480558007955551, 0.5607877373695374, 0.678032398223877, -0.910735547542572, 0.5856904983520508, 1.0303643941879272, -0.27120429277420044, -0.27603989839553833, -1.1050548553466797, 0.3719008266925812, -0.5617704391479492, -1.175634503364563, -2.0138089656829834, 0.6461805701255798, ...
func (lm *LeaveMessage) Update(db XODB) error { var err error // sql query const sqlstr = `UPDATE custmchat.leave_message SET ` + `ent_id = ?, last_option_agent=?, mobile=?, content = ?, status = ?, created_at = ?, updated_at = ?` + ` WHERE id = ?` _, err = db.Exec(sqlstr, lm.EntID, lm.LastOptionAgent, lm.Mob...
[ -0.23291786015033722, -1.1467329263687134, 0.6086400151252747, -1.0722302198410034, 0.22524695098400116, 0.6821116805076599, -1.229354977607727, -0.4110504686832428, -0.5259048342704773, 0.5872690677642822, -0.11331456154584885, -0.7724713087081909, -1.2580589056015015, 0.5022907257080078,...
func (lm *LeaveMessage) Save(db XODB) error { if lm.Exists() { return lm.Update(db) } return lm.Insert(db) }
[ 0.4330562949180603, 0.5822554230690002, 0.5663629770278931, -0.9804003238677979, 0.6912684440612793, 0.46650364995002747, -0.6399832963943481, -0.4615771472454071, -0.1967683881521225, 0.884455680847168, -1.0586028099060059, -0.6824222207069397, -2.0481021404266357, 0.9777869582176208, -...
func (lm *LeaveMessage) Delete(db XODB) error { var err error // sql query const sqlstr = `DELETE FROM custmchat.leave_message WHERE id = ?` // run query XOLog(sqlstr, lm.ID) _, err = db.Exec(sqlstr, lm.ID) if err != nil { return err } return nil }
[ 1.0989912748336792, 0.09190282225608826, 0.6711443662643433, -0.5738619565963745, 0.36585912108421326, 0.5044506192207336, -0.5332067608833313, -0.03126748651266098, -0.41589078307151794, 0.48881396651268005, -0.12861084938049316, -0.5517081618309021, -1.706661343574524, 0.4256179928779602...
func LeaveMessagesByEntID(db XODB, entID string, offset, limit int) ([]*LeaveMessage, error) { var err error // sql query sqlstr := `SELECT ` + LeaveMessageFields + ` FROM custmchat.leave_message ` + `WHERE ent_id = ? ` + `LIMIT ?,?` // run query q, err := db.Query(sqlstr, entID, offset, limit) if err != ...
[ 0.33393192291259766, -0.8014070391654968, 0.846237063407898, -1.2196035385131836, 0.2199196219444275, 0.17264555394649506, -0.46770840883255005, -1.5555037260055542, -0.04361483454704285, 0.8710030317306519, 0.17756448686122894, -0.509808361530304, -0.8336483240127563, 0.9494931697845459, ...
func LeaveMessageByID(db XODB, id string) (*LeaveMessage, error) { var err error // sql query sqlstr := `SELECT ` + LeaveMessageFields + ` FROM custmchat.leave_message ` + `WHERE id = ?` // run query XOLog(sqlstr, id) lm := LeaveMessage{} err = db.QueryRow(sqlstr, id).Scan(&lm.ID, &lm.EntID, &lm.TrackID...
[ 0.31957027316093445, -0.4437839388847351, 0.5235278010368347, -1.1243209838867188, -0.28945019841194153, -0.26086777448654175, -0.5785163044929504, -1.537246823310852, -0.0458083339035511, 0.7067825198173523, -0.1815229058265686, -0.7530075907707214, -1.2721292972564697, 0.7362967133522034...
func TurnFast(d *turn.Dancing, l *tees.Tees) { if d.OnLeaf(l){ return } // YES We have to abort if d.OnGoal(l){ return } // YES We have a solution next, ok := d.OnFail(l); if !ok { return } // YES We have a failure // d.Level++ d.Dance(next) // d.Level-- }
[ 0.04510458931326866, 0.40962618589401245, 0.4869391918182373, 0.541612446308136, -0.3378966152667999, -0.5199472308158875, 0.09111430495977402, -0.13961732387542725, -0.05042022839188576, -0.693354606628418, -0.09151674807071686, -0.026859600096940994, 0.6850681900978088, 1.025716781616211...
func TurnEver(d *turn.Dancing, l *tees.Tees) { // if d.OnLeaf(l){ return } // YES We have to abort // if d.OnGoal(l){ return } // YES We have a solution if l.IsEmpty(){ return } // YES We have a solution - but we don't tell anyone next, ok := d.OnFail(l); if !ok { return } // YES We have a failure // d.Lev...
[ -0.20920999348163605, 0.15051347017288208, 0.6856930255889893, 0.48443058133125305, 0.31322112679481506, 0.10480790585279465, 0.046472933143377304, 0.2735014259815216, -0.06255041807889938, -0.16140644252300262, -0.41107359528541565, -0.19761769473552704, -0.17186376452445984, 1.1033536195...