text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func SolvePuzzle() Solution {
nations := []byte{'E', 'S', 'U', 'J', 'N'}
drinks := []byte{'w', 'c', 't', 'o', 'm'}
houses := []byte{'r', 'g', 'b', 'y', 'i'}
smokes := []byte{'o', 'k', 'c', 'l', 'p'}
pets := []byte{'z', 's', 'f', 'h', 'd'}
for _, n := range permutations(nations) {
if bytes.IndexByte(n, 'N') != 0... | [
-0.7636787295341492,
-0.047137994319200516,
0.8642544150352478,
-0.556079626083374,
-0.8353791236877441,
-0.03518274426460266,
0.5357328653335571,
-0.04200010001659393,
0.23615102469921112,
0.33817481994628906,
-0.6596572399139404,
-0.43088045716285706,
-1.0174000263214111,
0.2182025313377... |
func New() consensus.Consenter {
return &consenter{}
} | [
0.20770575106143951,
-1.1662267446517944,
0.04034707322716713,
-0.10704059153795242,
-0.5398856997489929,
-0.1385963261127472,
-0.7019084692001343,
-0.25649726390838623,
-1.3510644435882568,
0.4727350175380707,
0.11002012342214584,
-0.08796853572130203,
0.5444558262825012,
1.04542422294616... |
func (ch *chain) Order(env *cb.Envelope, configSeq uint64) error {
// e, _ := protoutil.Marshal(env)
// var tmp cb.Envelope
// protoutil.UnmarshalEnvelopeOfType(e,_, tmp)
// go func() error {
// select {
// case ch.sendChan <- &message{
// configSeq: configSeq,
// normalMsg: env,
// }:
// return nil
... | [
-1.2355440855026245,
-0.0063988640904426575,
0.7201521992683411,
0.040664151310920715,
0.46007785201072693,
-0.22970420122146606,
0.2239643782377243,
-0.4353026747703552,
-0.3994707465171814,
0.6232608556747437,
-0.42893898487091064,
0.3579633831977844,
-0.38794898986816406,
0.819405615329... |
func (ch *chain) Configure(config *cb.Envelope, configSeq uint64) error {
select {
case ch.sendChan <- &message{
configSeq: configSeq,
configMsg: config,
}:
return nil
case <-ch.exitChan:
return fmt.Errorf("Exiting")
}
} | [
-0.6581558585166931,
0.6652683019638062,
0.7139036655426025,
0.5987420082092285,
0.4916791021823883,
-1.0483466386795044,
0.23811861872673035,
-0.2035118192434311,
-0.5790154337882996,
0.8182045817375183,
-0.5998798608779907,
-0.20362550020217896,
-0.8113300204277039,
0.8431172966957092,
... |
func (o *InlineObject869) GetX() AnyOfobject {
if o == nil || o.X == nil {
var ret AnyOfobject
return ret
}
return *o.X
} | [
0.0007979600341059268,
0.6797855496406555,
0.2333000749349594,
1.2781577110290527,
-0.274075984954834,
-0.6134833693504333,
0.24346408247947693,
-0.03437638655304909,
1.0486345291137695,
-1.3595768213272095,
-0.4153147339820862,
-0.27610573172569275,
-0.44608235359191895,
-0.22388635575771... |
func (o *InlineObject869) GetXOk() (AnyOfobject, bool) {
if o == nil || o.X == nil {
var ret AnyOfobject
return ret, false
}
return *o.X, true
} | [
0.21716204285621643,
0.6621479392051697,
0.4368514120578766,
0.7874277234077454,
-0.4174693524837494,
-0.8261726498603821,
0.6691277027130127,
0.09327472746372223,
0.26621946692466736,
-0.08254116773605347,
-1.053059458732605,
-0.7606080770492554,
-0.13659214973449707,
0.344244122505188,
... |
func (o *InlineObject869) HasX() bool {
if o != nil && o.X != nil {
return true
}
return false
} | [
0.2890867292881012,
0.7525222897529602,
0.32664284110069275,
0.6182941794395447,
-0.30336353182792664,
-0.23296542465686798,
-0.5285173654556274,
1.124237060546875,
0.8605497479438782,
-0.9266471862792969,
-0.8332231640815735,
-0.4807574450969696,
0.06980699300765991,
-0.5612863898277283,
... |
func (o *InlineObject869) SetX(v AnyOfobject) {
o.X = &v
} | [
-0.33918383717536926,
0.10049659758806229,
-0.18138565123081207,
0.6998202800750732,
-1.1870532035827637,
0.2798711657524109,
-0.5830811262130737,
-0.4096423089504242,
0.7509844899177551,
-0.6839322447776794,
-0.4570627510547638,
0.8534365296363831,
0.04014939069747925,
-0.9494494199752808... |
func (o *InlineObject869) SetXExplicitNull(b bool) {
o.X = nil
o.isExplicitNullX = b
} | [
-0.26273834705352783,
-0.17278246581554413,
0.44813913106918335,
-0.1557425707578659,
-0.5902163982391357,
0.5717997550964355,
-0.433483362197876,
0.6317230463027954,
0.646225094795227,
0.3012252748012543,
-1.1988930702209473,
0.04118042066693306,
0.5792573690414429,
-0.20342274010181427,
... |
func (o *InlineObject869) GetDegFreedom1() AnyOfobject {
if o == nil || o.DegFreedom1 == nil {
var ret AnyOfobject
return ret
}
return *o.DegFreedom1
} | [
-0.118936687707901,
1.1452715396881104,
0.6098729968070984,
0.9855858683586121,
0.11211172491312027,
0.0971532016992569,
1.0522078275680542,
0.04634027183055878,
-0.3953137993812561,
-0.5935853123664856,
-0.03563160449266434,
-0.14967578649520874,
-0.572816014289856,
0.935764729976654,
-... |
func (o *InlineObject869) GetDegFreedom1Ok() (AnyOfobject, bool) {
if o == nil || o.DegFreedom1 == nil {
var ret AnyOfobject
return ret, false
}
return *o.DegFreedom1, true
} | [
-0.139993816614151,
0.9965588450431824,
0.6561050415039062,
0.8811492323875427,
-0.21046750247478485,
0.0579182505607605,
1.286961317062378,
0.18381671607494354,
-0.5332333445549011,
-0.005536362528800964,
-0.4797036945819855,
-0.4750552475452423,
-0.19105929136276245,
1.743636131286621,
... |
func (o *InlineObject869) HasDegFreedom1() bool {
if o != nil && o.DegFreedom1 != nil {
return true
}
return false
} | [
-0.011370804160833359,
1.474371314048767,
0.553196907043457,
0.18844246864318848,
0.7018675208091736,
0.04517432674765587,
0.7489001154899597,
0.9039067029953003,
-0.9682892560958862,
-0.5197769403457642,
-0.5935174226760864,
-0.07741618156433105,
-0.18267685174942017,
1.3532445430755615,
... |
func (o *InlineObject869) SetDegFreedom1(v AnyOfobject) {
o.DegFreedom1 = &v
} | [
-0.311913400888443,
0.7456663846969604,
0.21939368546009064,
0.4130251705646515,
-0.1088242381811142,
0.29717525839805603,
1.0435281991958618,
-0.1454838067293167,
-0.9390697479248047,
-0.13181602954864502,
-0.1739249974489212,
0.46578365564346313,
-0.043192584067583084,
0.64272141456604,
... |
func (o *InlineObject869) SetDegFreedom1ExplicitNull(b bool) {
o.DegFreedom1 = nil
o.isExplicitNullDegFreedom1 = b
} | [
0.11621157079935074,
0.3565887212753296,
0.5416015982627869,
-0.17737343907356262,
-0.23518110811710358,
0.4615464210510254,
0.8810874819755554,
1.220555067062378,
0.1093376874923706,
0.14077672362327576,
-0.6060663461685181,
0.5941990613937378,
0.5540592670440674,
1.027883768081665,
-0.... |
func (o *InlineObject869) GetDegFreedom2() AnyOfobject {
if o == nil || o.DegFreedom2 == nil {
var ret AnyOfobject
return ret
}
return *o.DegFreedom2
} | [
-0.23451697826385498,
0.07295950502157211,
0.34118080139160156,
0.5817667841911316,
-0.5559290051460266,
-0.7210934162139893,
0.2955241799354553,
-0.7212589979171753,
-0.7118067145347595,
-1.0426335334777832,
-0.4385887086391449,
-0.21635572612285614,
-0.5095875263214111,
1.364485144615173... |
func (o *InlineObject869) GetDegFreedom2Ok() (AnyOfobject, bool) {
if o == nil || o.DegFreedom2 == nil {
var ret AnyOfobject
return ret, false
}
return *o.DegFreedom2, true
} | [
-0.3978657126426697,
0.07345442473888397,
0.6034265160560608,
0.680391788482666,
-0.6838779449462891,
-0.4500614404678345,
1.0160415172576904,
-0.12495741993188858,
-1.2082905769348145,
-0.4705301523208618,
-0.8213894963264465,
-0.2220151126384735,
0.5298683643341064,
1.5225683450698853,
... |
func (o *InlineObject869) HasDegFreedom2() bool {
if o != nil && o.DegFreedom2 != nil {
return true
}
return false
} | [
-0.014083742164075375,
0.10849343240261078,
0.28629112243652344,
-0.3244785964488983,
-0.01898178458213806,
-0.7211877703666687,
0.05098039656877518,
0.37662309408187866,
-1.2169501781463623,
-1.0528337955474854,
-1.0804136991500854,
0.15176557004451752,
0.0117693692445755,
1.9522209167480... |
func (o *InlineObject869) SetDegFreedom2(v AnyOfobject) {
o.DegFreedom2 = &v
} | [
-0.3817877769470215,
-0.27434980869293213,
-0.015744179487228394,
-0.22197838127613068,
-0.6141642332077026,
-0.2605649530887604,
0.3187110722064972,
-0.7096036076545715,
-1.247652292251587,
-0.664682149887085,
-0.7405140399932861,
0.5561657547950745,
0.10299260169267654,
1.124995946884155... |
func (o *InlineObject869) SetDegFreedom2ExplicitNull(b bool) {
o.DegFreedom2 = nil
o.isExplicitNullDegFreedom2 = b
} | [
-0.11404269933700562,
-0.33773988485336304,
0.5003373622894287,
-0.6096205115318298,
-0.6627206802368164,
-0.00902801938354969,
0.6012341976165771,
0.8860783576965332,
-0.12999296188354492,
-0.18994580209255219,
-0.9296936988830566,
0.7953999638557434,
0.8173866868019104,
1.056276321411132... |
func (o *InlineObject869) GetCumulative() AnyOfobject {
if o == nil || o.Cumulative == nil {
var ret AnyOfobject
return ret
}
return *o.Cumulative
} | [
0.6875273585319519,
-0.1551717221736908,
0.4611380696296692,
0.9295719861984253,
-0.40587887167930603,
-0.9006707072257996,
0.6000722646713257,
-0.2472580224275589,
-0.14777182042598724,
-0.8093785643577576,
0.055896591395139694,
-0.00729341059923172,
-0.304274320602417,
-0.402956932783126... |
func (o *InlineObject869) GetCumulativeOk() (AnyOfobject, bool) {
if o == nil || o.Cumulative == nil {
var ret AnyOfobject
return ret, false
}
return *o.Cumulative, true
} | [
0.7018256187438965,
-0.22025126218795776,
0.521178126335144,
1.0394798517227173,
-0.6068663597106934,
-0.21934811770915985,
0.8438407182693481,
0.6812258362770081,
-0.6119035482406616,
0.08610521256923676,
-0.6627820730209351,
-0.7198354601860046,
0.20314352214336395,
0.33927851915359497,
... |
func (o *InlineObject869) HasCumulative() bool {
if o != nil && o.Cumulative != nil {
return true
}
return false
} | [
1.0785878896713257,
0.08832602202892303,
0.4337548315525055,
0.26725494861602783,
0.12258847802877426,
-0.48333433270454407,
0.050686269998550415,
0.7986957430839539,
-0.6889945864677429,
-0.24429748952388763,
-0.5668579936027527,
-0.6094563007354736,
0.21392956376075745,
-0.20267720520496... |
func (o *InlineObject869) SetCumulative(v AnyOfobject) {
o.Cumulative = &v
} | [
0.8759385943412781,
-0.49950161576271057,
0.16065126657485962,
0.4643420875072479,
-0.7995483875274658,
-0.48103106021881104,
0.09104862809181213,
-1.0262008905410767,
-0.714670717716217,
-0.2271491438150406,
0.11172688007354736,
0.8818568587303162,
0.37403103709220886,
-0.6888996362686157... |
func (o *InlineObject869) SetCumulativeExplicitNull(b bool) {
o.Cumulative = nil
o.isExplicitNullCumulative = b
} | [
0.878727376461029,
-1.0157164335250854,
0.4286755919456482,
-0.014613404870033264,
-0.2948489785194397,
0.3624724745750427,
0.5507200360298157,
1.3297971487045288,
0.10093958675861359,
0.03199976310133934,
-0.6325134634971619,
-0.14245375990867615,
0.7125260233879089,
0.15448471903800964,
... |
func (o InlineObject869) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.X == nil {
if o.isExplicitNullX {
toSerialize["x"] = o.X
}
} else {
toSerialize["x"] = o.X
}
if o.DegFreedom1 == nil {
if o.isExplicitNullDegFreedom1 {
toSerialize["degFreedom1"] = o.DegFreedom1
}
... | [
0.5631334185600281,
-0.3683854639530182,
0.7429412603378296,
-0.6129650473594666,
-0.6466671228408813,
-0.1787242293357849,
0.46838080883026123,
0.43570539355278015,
-0.07124517112970352,
-0.2954668700695038,
-0.5871884226799011,
1.001188039779663,
0.13292552530765533,
-0.25631648302078247... |
func NewFormatReaders(stream io.ReadCloser, total uint64) (*FormatReaders, error) {
var err error
readers := &FormatReaders{
buf: make([]byte, image.MaxExpectedHdrSize),
}
if total > uint64(0) {
readers.progressReader = prometheusutil.NewProgressReader(stream, total, progress, ownerUID)
err = readers.construc... | [
-0.883453369140625,
-1.0845293998718262,
0.5278052687644958,
0.43807175755500793,
-0.5167850255966187,
-1.0931470394134521,
-0.5721672177314758,
-0.7573459148406982,
0.11851944029331207,
-0.053778037428855896,
1.361487865447998,
-0.20802171528339386,
-0.5443589687347412,
0.9270867109298706... |
func (fr *FormatReaders) appendReader(rType int, x interface{}) {
if x == nil {
return
}
r, ok := x.(io.Reader)
if !ok {
klog.Errorf("internal error: unexpected reader type passed to appendReader()")
return
}
if rType == rdrMulti {
r = io.MultiReader(r, fr.TopReader())
}
if _, ok := r.(io.Closer); !ok {... | [
-1.0937803983688354,
-0.4786253869533539,
0.7655049562454224,
-0.17851018905639648,
-0.8692607283592224,
0.2854999601840973,
-0.7386947274208069,
-0.343706876039505,
0.7497795820236206,
-0.5076807737350464,
0.6586612462997437,
0.030966514721512794,
-0.30656468868255615,
1.5580408573150635,... |
func (fr *FormatReaders) TopReader() io.ReadCloser {
return fr.readers[len(fr.readers)-1].rdr
} | [
-1.0123833417892456,
-1.4946627616882324,
0.6644322276115417,
-0.881075382232666,
-0.40900057554244995,
0.20400427281856537,
-0.3085271418094635,
-0.0025856923311948776,
0.08182160556316376,
-0.960004985332489,
2.089088201522827,
-0.251187264919281,
-0.7365449666976929,
0.6664997935295105,... |
func (fr *FormatReaders) fileFormatSelector(hdr *image.Header) {
var r io.Reader
var err error
fFmt := hdr.Format
switch fFmt {
case "gz":
r, err = fr.gzReader()
if err == nil {
fr.Archived = true
fr.ArchiveGz = true
}
case "zst":
r, err = fr.zstReader()
if err == nil {
fr.Archived = true
fr... | [
-0.0034955963492393494,
-1.3807470798492432,
0.6538463234901428,
-0.5672620534896851,
-0.10152333229780197,
-0.6269277930259705,
0.012638543732464314,
-0.2943505048751831,
0.1392224133014679,
-0.427191823720932,
0.809380829334259,
0.15736736357212067,
-0.47198235988616943,
0.99836409091949... |
func (fr *FormatReaders) gzReader() (io.ReadCloser, error) {
gz, err := gzip.NewReader(fr.TopReader())
if err != nil {
return nil, errors.Wrap(err, "could not create gzip reader")
}
klog.V(2).Infof("gzip: extracting %q\n", gz.Name)
return gz, nil
} | [
-0.03494121506810188,
-0.6842360496520996,
0.4235614836215973,
0.4245336651802063,
-0.5057699680328369,
-0.0524052232503891,
-0.3432164192199707,
-0.5915570855140686,
0.37121185660362244,
-0.3062029480934143,
0.9955711364746094,
0.015101687051355839,
-0.7512817978858948,
0.9190580248832703... |
func (fr *FormatReaders) zstReader() (io.ReadCloser, error) {
zst, err := zstd.NewReader(fr.TopReader())
if err != nil {
return nil, errors.Wrap(err, "could not create zst reader")
}
return zst.IOReadCloser(), nil
} | [
-0.6585504412651062,
-1.2252804040908813,
0.22141839563846588,
-0.5280992984771729,
-0.5213496685028076,
-0.2195984572172165,
-0.3395119607448578,
-0.29829081892967224,
0.20661680400371552,
-0.7892499566078186,
1.1197112798690796,
0.2668919563293457,
-0.6341460943222046,
0.6180291771888733... |
func (fr *FormatReaders) qcow2NopReader(h *image.Header) (io.Reader, error) {
s := hex.EncodeToString(fr.buf[h.SizeOff : h.SizeOff+h.SizeLen])
_, err := strconv.ParseInt(s, 16, 64)
if err != nil {
return nil, errors.Wrapf(err, "unable to determine original qcow2 file size from %+v", s)
}
return nil, nil
} | [
-0.14452148973941803,
-0.6161022782325745,
0.6951920986175537,
-0.9570884108543396,
-1.2184338569641113,
-0.49766266345977783,
-0.31903454661369324,
-0.4855862855911255,
-0.31740790605545044,
-0.8404359221458435,
-0.22059917449951172,
-0.07732290774583817,
-0.3889063596725464,
0.8401492834... |
func (fr *FormatReaders) xzReader() (io.Reader, error) {
xz, err := xz.NewReader(fr.TopReader())
if err != nil {
return nil, errors.Wrap(err, "could not create xz reader")
}
return xz, nil
} | [
0.07751371711492538,
-0.7890259623527527,
0.013972622342407703,
-0.020315447822213173,
-0.555826723575592,
-0.49609431624412537,
-0.7894916534423828,
-0.04285748675465584,
0.3660695254802704,
-0.36750805377960205,
0.9457342028617859,
0.4484364986419678,
-0.6079502105712891,
0.4945140480995... |
func (fr *FormatReaders) matchHeader(knownHdrs *image.Headers) (*image.Header, error) {
_, err := fr.read(fr.buf) // read current header
if err != nil {
return nil, err
}
// append multi-reader so that the header data can be re-read by subsequent readers
fr.appendReader(rdrMulti, bytes.NewReader(fr.buf))
// lo... | [
-0.24880962073802948,
-1.7544504404067993,
0.7054973840713501,
0.12593412399291992,
-0.43747660517692566,
-0.5773048400878906,
-0.5764451622962952,
-0.7858275771141052,
-0.05687631294131279,
-0.30276843905448914,
0.8202198147773743,
-0.16465577483177185,
-0.6898284554481506,
0.496845304965... |
func (fr *FormatReaders) read(buf []byte) (int, error) {
return io.ReadFull(fr.TopReader(), buf)
} | [
-0.5955210328102112,
-0.9027083516120911,
0.4651210904121399,
-0.3570553958415985,
-0.2234814614057541,
-0.42311450839042664,
0.22100552916526794,
-0.15711025893688202,
-0.2343398928642273,
-0.7920680642127991,
0.5501773357391357,
-0.2904071807861328,
-0.9850049614906311,
0.835406184196472... |
func (fr *FormatReaders) Close() (rtnerr error) {
var err error
for i := len(fr.readers) - 1; i >= 0; i-- {
err = fr.readers[i].rdr.Close()
if err != nil {
rtnerr = err // tracking last error
}
}
return rtnerr
} | [
-1.2537399530410767,
-1.074690580368042,
0.6694625616073608,
-0.5367279648780823,
0.14827390015125275,
0.10011999309062958,
-0.34009990096092224,
-0.8607981204986572,
-0.5667142868041992,
-0.5596207976341248,
1.7415052652359009,
-0.9603763222694397,
-1.5907206535339355,
1.4622275829315186,... |
func (fr *FormatReaders) StartProgressUpdate() {
if fr.progressReader != nil {
fr.progressReader.StartTimedUpdate()
}
} | [
0.3420032262802124,
-1.7130476236343384,
0.4834271967411041,
0.17998194694519043,
-0.16008809208869934,
-0.672665536403656,
-0.46023136377334595,
0.6253848671913147,
-0.44115978479385376,
-0.2616133987903595,
0.3725336790084839,
-0.2337353676557541,
-0.6644808650016785,
1.0034232139587402,... |
func GetPalette(n int) color.Palette {
var colors color.Palette
if n > round {
colors = pal[:]
} else {
colors = pal[:n]
}
return colors
} | [
-0.370951771736145,
0.8565911650657654,
0.4549711346626282,
-0.844229519367218,
0.10037031769752502,
-0.16794462502002716,
-0.4263426661491394,
-1.4728386402130127,
0.7880094647407532,
-0.04894144460558891,
-0.1658366322517395,
0.4333875775337219,
-0.026316432282328606,
0.08094320446252823... |
func NewDatabase(path string) *Database {
db, err := sql.Open("sqlite3", path)
if err != nil {
panic(err)
}
return &Database{db}
} | [
0.2094014436006546,
0.10527552664279938,
0.18292981386184692,
0.33287301659584045,
-0.6879196166992188,
0.46018481254577637,
-0.5763567090034485,
-0.24020294845104218,
0.7869061827659607,
-0.021657995879650116,
-0.2522904574871063,
0.09663698822259903,
-0.4425554573535919,
-0.1409066468477... |
func (this *Database) Close() {
this.db.Close()
} | [
-0.22627514600753784,
0.2170947939157486,
0.020385704934597015,
0.16094177961349487,
0.13834235072135925,
1.0612714290618896,
0.0787825882434845,
0.009396241046488285,
-0.5638735890388489,
-0.9405114054679871,
0.3700353801250458,
0.10702596604824066,
-1.491193175315857,
1.5186933279037476,... |
func (this *Database) Install() {
this.Exec(string(schema_sql()))
} | [
0.13504011929035187,
-0.2320917397737503,
0.29584890604019165,
0.874681293964386,
0.43171343207359314,
0.17268286645412445,
-0.2948494553565979,
1.3187685012817383,
-0.6279945969581604,
0.618431806564331,
-0.47588300704956055,
-0.045500580221414566,
-0.5022093653678894,
0.6245993375778198,... |
func (this *Database) Exec(sql string, args ...interface{}) {
//fmt.Printf("About to EXEC\n")
_, err := this.db.Exec(sql, args...)
//fmt.Printf("Done EXEC\n")
if err != nil {
panic(err)
}
} | [
-0.00014569060294888914,
0.685498058795929,
0.4857190251350403,
1.1617478132247925,
0.3146248459815979,
0.7112264633178711,
-0.6779085397720337,
0.026043441146612167,
-0.8180691599845886,
0.229915589094162,
-0.1666366010904312,
0.360170841217041,
0.03981791436672211,
0.4196518659591675,
... |
func (this *Database) SingleQuery(sql string, args ...interface{}) *sql.Row {
return this.db.QueryRow(sql, args...)
} | [
-0.12567369639873505,
0.5977526903152466,
0.37101253867149353,
0.5935081839561462,
-0.06446326524019241,
-0.392600417137146,
-0.4636012613773346,
0.44931361079216003,
0.6541590094566345,
-1.3458049297332764,
0.9488168954849243,
-0.26603588461875916,
-0.08654764294624329,
1.0046780109405518... |
func (this *Database) MultiQuery(sql string, args ...interface{}) *sql.Rows {
rows, err := this.db.Query(sql, args...)
if err != nil {
panic(err)
}
return rows
} | [
0.004286102019250393,
0.5650669932365417,
0.4578443467617035,
1.4901008605957031,
0.06733053922653198,
-0.971153736114502,
-1.770007848739624,
-0.1113259494304657,
0.9641748070716858,
-0.27779218554496765,
0.3441562354564667,
-0.2528436481952667,
0.18508310616016388,
1.0698275566101074,
... |
func (this *Database) Scan(row Row, vars ...interface{}) {
err := row.Scan(vars...)
if err != nil {
panic(err)
}
} | [
-0.5234700441360474,
0.8413376212120056,
0.2834428548812866,
1.3088384866714478,
-0.4436917304992676,
-0.3433476984500885,
-0.2967090606689453,
-0.25792303681373596,
0.23780399560928345,
-0.6481063365936279,
-0.3946680724620819,
0.12482181936502457,
0.4428952634334564,
0.4003479778766632,
... |
func (this *Database) MaybeScan(row Row, vars ...interface{}) bool {
err := row.Scan(vars...)
if err == sql.ErrNoRows {
return false
}
if err != nil {
panic(err)
}
return true
} | [
-0.442160040140152,
0.9602575898170471,
0.7449567317962646,
0.47692570090293884,
-0.4626080095767975,
-0.551999568939209,
-1.13007652759552,
-0.058602795004844666,
0.5048348307609558,
-0.71818608045578,
-0.10232260078191757,
-0.7588984966278076,
0.2639629542827606,
0.7418898940086365,
-0... |
func init() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
client, err := mongo.Connect(ctx, options.Client().ApplyURI(os.Getenv("BRAIN_DB")))
if err != nil {
log.Fatal(err)
}
db = client.Database(dbName)
} | [
0.7528015971183777,
0.4847696125507355,
0.8917114734649658,
0.07738733291625977,
0.934625506401062,
1.1590027809143066,
-0.46256041526794434,
0.3019602596759796,
-0.6857926845550537,
0.775137722492218,
0.0553424246609211,
1.4092434644699097,
-1.3369486331939697,
0.6691091656684875,
0.717... |
func GetContentItem(id string) (bson.M, error) {
objID, _ := primitive.ObjectIDFromHex(id)
result := db.Collection(contentCollection).FindOne(context.Background(), bson.M{"_id": objID})
if result.Err() != nil {
log.Fatal(result.Err())
return nil, result.Err()
}
doc := bson.M{}
err := result.Decode(&doc)
retu... | [
-0.07854922860860825,
-0.26787272095680237,
0.5491555333137512,
0.28821536898612976,
-0.3466693162918091,
0.6930283904075623,
-0.059988655149936676,
-0.945460319519043,
-0.8904721736907959,
0.4559195637702942,
-0.37605994939804077,
0.10375655442476273,
-1.2064595222473145,
-0.1077342256903... |
func UpdateContentItem(id string, item models.Content) (bson.M, error) {
item.SetUpdateDate(time.Now())
objID, _ := primitive.ObjectIDFromHex(id)
update := bson.M{"$set": item}
upsert := true
after := options.After
opt := options.FindOneAndUpdateOptions{
ReturnDocument: &after,
Upsert: &upsert,
}
re... | [
-0.8325214982032776,
-1.0351582765579224,
0.4132632315158844,
0.309836745262146,
-0.733115553855896,
0.9191153049468994,
0.14964079856872559,
-0.46234995126724243,
-0.7795623540878296,
1.2137144804000854,
-0.7246223092079163,
-0.3873269855976105,
-1.454484224319458,
-0.1810901165008545,
... |
func InsertContentItem(item models.Content) (bson.M, error) {
item.SetCreationDate(time.Now())
item.SetUpdateDate(time.Now())
result, err := db.Collection(contentCollection).InsertOne(context.Background(), item)
if err != nil {
log.Fatal(err)
return nil, err
}
newID := result.InsertedID
id := string(newID.(p... | [
-0.6356006264686584,
-0.33122408390045166,
0.41355955600738525,
0.630118727684021,
0.41994431614875793,
1.0965230464935303,
0.44501563906669617,
-0.2531893849372864,
-1.0894147157669067,
0.5136540532112122,
-1.0186225175857544,
-1.1669368743896484,
-2.028330087661743,
0.1685064435005188,
... |
func extensionToMimeType(path string) string {
if strings.HasSuffix(path, ".txt") {
// anyone uploading text in anything other than utf-8 needs to be
// re-educated.
return "text/plain; charset=utf-8"
}
if strings.HasSuffix(path, ".png") {
return "image/png"
}
if strings.HasSuffix(path, ".jpg") {
retur... | [
-0.518580436706543,
-0.30053025484085083,
0.7576923370361328,
-0.4563029408454895,
-1.2922438383102417,
0.07196733355522156,
-0.5009236335754395,
-0.3289204239845276,
1.2032955884933472,
0.9791707396507263,
-0.5623967051506042,
0.19407497346401215,
-0.13103559613227844,
0.9403034448623657,... |
func serveGzip(w http.ResponseWriter, r *http.Request, path string, size int64) {
f, err := os.Open(path)
if err != nil {
msg, code := toHTTPError(err)
http.Error(w, msg, code)
return
}
defer f.Close()
w.Header().Set("Content-Encoding", "gzip")
w.Header().Set("Content-Length", strconv.FormatInt(size, 10))
... | [
0.20316565036773682,
0.05149327218532562,
0.9068551063537598,
-0.5870418548583984,
-0.2577989399433136,
0.09858789294958115,
0.686792254447937,
-0.146420419216156,
0.03156508505344391,
0.8303744196891785,
-0.7012672424316406,
0.1343958079814911,
-0.5256258845329285,
-0.17188400030136108,
... |
func serveUngzipped(w http.ResponseWriter, r *http.Request, path string) {
f, err := os.Open(path)
if err != nil {
msg, code := toHTTPError(err)
http.Error(w, msg, code)
return
}
defer f.Close()
gz, err := gzip.NewReader(f)
if err != nil {
msg, code := toHTTPError(err)
http.Error(w, msg, code)
return... | [
-0.11673275381326675,
-0.46760687232017517,
0.986591637134552,
-0.6498288512229919,
-0.4012371003627777,
0.4892762303352356,
0.7893452048301697,
-0.24923382699489594,
-0.04101709648966789,
0.3885423243045807,
0.2600405216217041,
0.6435558199882507,
-0.41425809264183044,
-0.2774055898189544... |
func NewIdentityProvider(db DBConnector) *IdentityProvider {
return &IdentityProvider{db: db}
} | [
-0.1897815763950348,
-0.17729148268699646,
-0.1904955506324768,
0.4224822521209717,
-0.20607513189315796,
0.27310314774513245,
-0.6488602161407471,
-0.32955148816108704,
1.0721604824066162,
0.8089355230331421,
-0.9131650924682617,
-0.6740848422050476,
-1.3083710670471191,
0.554793834686279... |
func (i *IdentityProvider) GetOrganizations(uuid string, date time.Time) ([]string, error) {
query := fmt.Sprintf(`select distinct o.name
from enrollments e, organizations o
where e.organization_id = o.id and
e.uuid = '%s' and
'%s' between e.start and e.end order by e.id desc`,
uuid, date.Format(time.R... | [
-1.3176480531692505,
0.9949169158935547,
0.8544358611106873,
0.9056339263916016,
-0.27383333444595337,
0.08953334391117096,
-0.00492001511156559,
-0.4056038558483124,
0.40967464447021484,
0.6635029911994934,
-0.023881150409579277,
0.04386134073138237,
0.15058816969394684,
0.119881741702556... |
func uniqueData() string {
b := make([]rune, 10)
for e := range b {
b[e] = runes[rand.Intn(len(runes))]
}
return string(b)
} | [
0.36417528986930847,
0.5346079468727112,
0.3856697976589203,
-1.504763126373291,
0.6392113566398621,
1.1917359828948975,
-0.4046512842178345,
0.2966991364955902,
0.8204054236412048,
-0.14520786702632904,
-0.16217653453350067,
1.1206482648849487,
-0.13391050696372986,
-0.8374424576759338,
... |
func uniqueHashData() []byte {
currentTime := time.Now().Unix()
h := md5.New()
io.WriteString(h, strconv.FormatInt(currentTime, 10))
return h.Sum(nil)
} | [
0.2770805358886719,
-0.4554358720779419,
0.7211950421333313,
-0.4533703327178955,
-0.1403706669807434,
0.7932949662208557,
-0.2524963915348053,
0.05667262151837349,
-0.36810198426246643,
-0.3155517876148224,
-0.6685552597045898,
0.2573312520980835,
-0.5067616105079651,
-0.8490235805511475,... |
func NewBuildIDs(ctx context.Context, t time.Time, n int) []int64 {
// Build ID format [idTimeSegment] [random number] [buildIDVersion]
// Generate n build IDs by getting a random number R, then using the n
// integers in the range (R-n, R] as the random component while fixing
// the time and version components (se... | [
-0.9217626452445984,
-0.6688456535339355,
0.34567129611968994,
-0.09505655616521835,
0.10800110548734665,
0.28614580631256104,
-0.2609935700893402,
-0.8473479747772217,
0.35127773880958557,
0.36718934774398804,
-0.8813923597335815,
0.3028661012649536,
-0.2729862928390503,
-0.14335654675960... |
func MayContainBuilds(low, high time.Time) bool {
switch {
case !high.IsZero() && (high.Before(beginningOfTheWorld) || high.Equal(beginningOfTheWorld)):
return false
case !low.IsZero() && !high.IsZero() && high.Before(low):
return false
default:
return true
}
} | [
0.6876916289329529,
-0.05637652054429054,
0.5551976561546326,
1.1231664419174194,
-0.18302011489868164,
1.0100159645080566,
0.02538476511836052,
-1.134138584136963,
-0.07594642788171768,
-0.8013092279434204,
0.6252081394195557,
0.7937679290771484,
-1.2942566871643066,
0.8740106225013733,
... |
func IDRange(low, high time.Time) (int64, int64) {
// Convert the inclusive low time bound to the exclusive high id bound.
idHigh := idTimeSegment(low.Add(-timeResolution))
// Convert the exclusive high time bound to the inclusive low id bound.
idLow := idTimeSegment(high.Add(-timeResolution))
return idLow, idHigh... | [
-0.8962748050689697,
-0.13163580000400543,
0.3614417314529419,
-0.0651756152510643,
0.7254711389541626,
-0.47262629866600037,
-0.6847180724143982,
-0.2186536341905594,
-0.042363863438367844,
-0.03687760606408119,
-0.6758770942687988,
0.2751148045063019,
-0.4507819712162018,
0.4104655981063... |
func ConfigHome() string {
return alternate(os.Getenv(ConfigHomeEnv), os.Getenv("LOCALAPPDATA"))
} | [
0.2335977405309677,
-0.3241042196750641,
0.5632867217063904,
0.9022138714790344,
-0.21345454454421997,
0.7074178457260132,
-0.4384787976741791,
0.4334413409233093,
-0.7303845882415771,
1.1978423595428467,
-0.1471939980983734,
0.008132741786539555,
0.291677862405777,
0.7493122220039368,
0... |
func ConfigDirs() []string {
// XDG_CONFIG_DIRS
xdgDirs := filepath.SplitList(os.Getenv(ConfigDirsEnv))
if len(xdgDirs) != 0 {
return xdgDirs
}
return []string{
os.Getenv("PROGRAMDATA"),
}
} | [
-1.0356589555740356,
0.2523878812789917,
0.4901706874370575,
0.47982755303382874,
-0.4342167377471924,
0.6871756315231323,
0.1435326784849167,
0.22153440117835999,
0.13010500371456146,
0.7684555649757385,
-0.12446119636297226,
0.692818284034729,
-0.5361956357955933,
0.8964795470237732,
0... |
func NewDescriptor(name string, ikind Kind, nkind number.Kind, description, unit string) Descriptor {
return Descriptor{
Name: name,
Kind: ikind,
NumberKind: nkind,
Description: description,
Unit: unit,
}
} | [
0.5710458159446716,
-0.3221811056137085,
0.3283698856830597,
-0.2184179425239563,
-0.8732743859291077,
0.4837225377559662,
-1.1147985458374023,
-0.243634432554245,
0.06907527893781662,
0.15825003385543823,
0.5844655632972717,
0.5467218160629272,
-0.10875960439443588,
-0.10953482985496521,
... |
func (p TimeSlice) Len() int {
return len(p)
} | [
-0.6856900453567505,
0.12106786668300629,
-0.03281581401824951,
-0.7658421397209167,
0.16311413049697876,
-0.4680432379245758,
0.14861275255680084,
0.8959177732467651,
0.10320711135864258,
0.6637023091316223,
-1.1461942195892334,
0.3982328772544861,
0.3065706491470337,
0.7339299321174622,
... |
func (p TimeSlice) Swap(i, j int) {
p[i], p[j] = p[j], p[i]
} | [
-1.7815508842468262,
-0.1872979998588562,
0.3151295781135559,
-0.5163924694061279,
0.16891202330589294,
0.5330182909965515,
-0.6111079454421997,
0.04154382273554802,
-0.70799320936203,
0.9462954998016357,
-0.43683892488479614,
0.7140605449676514,
0.010991035029292107,
-0.0277412012219429,
... |
func write(text string, channel chan string) {
time.Sleep(time.Second * 5)
for i := 0; i < 5; i++ {
// this is the line that sends a value to the channel
channel <- text
time.Sleep(time.Second)
}
// we can use close() to close connections
} | [
-0.0402795784175396,
-0.5364947319030762,
0.35647618770599365,
-0.5290492177009583,
0.4402523636817932,
-0.07707156240940094,
-0.3102603554725647,
-0.08250896632671356,
-1.0225250720977783,
0.3328775465488434,
-0.5393332242965698,
0.34608402848243713,
-1.5833590030670166,
0.359612554311752... |
func (o GetAccountLoginsResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetAccountLoginsResult) string { return v.Id }).(pulumi.StringOutput)
} | [
0.14439785480499268,
-0.45790767669677734,
0.24994662404060364,
0.1992156058549881,
0.4911390542984009,
0.9361222982406616,
0.23876555263996124,
-0.20257899165153503,
1.770087480545044,
-0.21816357970237732,
0.5217716693878174,
1.1410623788833618,
-0.0066572995856404305,
-1.565556287765503... |
func isReplicated(pod *corev1.Pod) bool {
controllerRef := getControllerRef(pod)
if controllerRef == nil {
return false
}
return *controllerRef.Kind == "ReplicationController" ||
*controllerRef.Kind == "Job" ||
*controllerRef.Kind == "ReplicaSet" ||
*controllerRef.Kind == "StatefulSet"
} | [
-1.1390029191970825,
0.8621373176574707,
0.5992090106010437,
-0.05752122774720192,
0.30917835235595703,
-0.44054654240608215,
0.25053998827934265,
0.0002836795465555042,
1.1138150691986084,
-0.5672598481178284,
-0.731226921081543,
0.38263487815856934,
-0.450778067111969,
0.1113965287804603... |
func hasPodWhichPreventsNodeRemoval(node nodeInfo) bool {
for _, pod := range node.pods {
if pod.Metadata.Annotations[podSafeToEvictKey] == "false" {
return true
}
if *pod.Metadata.Namespace != "kube-system" && !isDaemonSetPod(pod) && hasLocalStorage(pod) && pod.Metadata.Annotations[podSafeToEvictKey] != "tr... | [
-0.35711124539375305,
0.18145804107189178,
0.7873229384422302,
-0.4856858253479004,
0.6242413520812988,
-0.1995430439710617,
-0.41015422344207764,
0.3696395754814148,
0.40262386202812195,
0.10164117068052292,
-0.08052012324333191,
-0.16387218236923218,
-0.1803540587425232,
0.37547472119331... |
func pickUnderutilizedNodeToRemove(nodes []nodeInfo) *nodeInfo {
var pick *nodeInfo
for i, n := range nodes {
if isNodeMarkedForRemovalLongEnough(n) && !hasPodWhichPreventsNodeRemoval(n) && (pick == nil || n.stats.utilizedCPURatio < pick.stats.utilizedCPURatio) {
pick = &nodes[i]
}
}
return pick
} | [
-0.046809181571006775,
-0.10160254687070847,
0.3460123836994171,
-1.165920615196228,
0.1386125087738037,
-0.11112406104803085,
0.8206649422645569,
-0.5632193684577942,
-0.1975679248571396,
-0.2115769237279892,
0.276716023683548,
1.0785536766052246,
-0.2530611455440521,
-0.385981023311615,
... |
func isNodeUnderutilizedCandidate(node nodeInfo) bool {
return node.config.Enabled &&
node.stats.utilizedCPURatio < node.config.ScaleDownCPURequestRatioLimit &&
!node.state.ScaleDownInProgress &&
*node.node.Metadata.CreationTimestamp.Seconds < time.Now().Unix()-*minimumNodeAgeSeconds
} | [
-0.9470746517181396,
-0.139370396733284,
0.3180592358112335,
-0.21465051174163818,
-0.6305145621299744,
0.7008205056190491,
0.1798887848854065,
-0.029379241168498993,
-0.5780991315841675,
-0.24864444136619568,
0.1872086375951767,
1.219855785369873,
-0.13830682635307312,
0.7466554641723633,... |
func Duration(t time.Duration) Option {
return func(s Source) Source {
s.Seconds = t.Seconds()
return s
}
} | [
0.49074405431747437,
0.6132570505142212,
0.1724293828010559,
-0.07071156799793243,
0.12546224892139435,
0.03350536897778511,
1.0491305589675903,
0.27747347950935364,
1.159391164779663,
-0.12533292174339294,
-1.0379623174667358,
0.3376380503177643,
1.757685661315918,
0.2440624088048935,
-... |
func Volume(v float64) Option {
return func(s Source) Source {
if v > 1.0 {
v = 1.0
} else if v < 0 {
v = 0
}
s.Volume = v
return s
}
} | [
0.04645983502268791,
0.6105591654777527,
0.38434934616088867,
-0.023885320872068405,
0.36966416239738464,
0.04352187365293503,
1.0276947021484375,
-0.029650375247001648,
0.4539445638656616,
-0.655183732509613,
0.15981413424015045,
-0.019524654373526573,
-0.09289436042308807,
0.175270795822... |
func AtPitch(p Pitch) Option {
return func(s Source) Source {
s.Pitch = p
return s
}
} | [
0.5041593909263611,
0.6273924112319946,
0.16613440215587616,
-1.0040134191513062,
0.13743917644023895,
0.8597496747970581,
0.5785036087036133,
-0.2710723280906677,
-0.42517486214637756,
0.7408592104911804,
-0.481575071811676,
0.23907867074012756,
0.5621182322502136,
-0.47260531783103943,
... |
func Mono() Option {
return func(s Source) Source {
s.Channels = 1
return s
}
} | [
-0.26599425077438354,
0.6997912526130676,
0.2159067541360855,
-0.28082847595214844,
0.3953484892845154,
-0.40687498450279236,
0.7298771739006042,
-0.06082760542631149,
0.6656668186187744,
-1.3190122842788696,
-0.23558452725410461,
0.5307264924049377,
0.6108800172805786,
-0.5249597430229187... |
func Stereo() Option {
return func(s Source) Source {
s.Channels = 2
return s
}
} | [
0.4869709014892578,
0.40573850274086,
0.3696195185184479,
0.5205843448638916,
-0.08174041658639908,
-0.30917888879776,
0.4168577194213867,
-0.4845643937587738,
-0.20412103831768036,
-1.4177379608154297,
-0.9351181387901306,
0.30894890427589417,
0.8122859001159668,
-0.5634561777114868,
-0... |
func plateHoles2D() (sdf.SDF2, error) {
d := 17.0
h, err := sdf.Circle2D(1.2)
if err != nil {
return nil, err
}
s0 := sdf.Transform2D(h, sdf.Translate2d(v2.Vec{d, d}))
s1 := sdf.Transform2D(h, sdf.Translate2d(v2.Vec{-d, -d}))
s2 := sdf.Transform2D(h, sdf.Translate2d(v2.Vec{-d, d}))
s3 := sdf.Transform2D(h, sd... | [
-0.4184291958808899,
-0.15669173002243042,
1.013879418373108,
-1.5445387363433838,
-0.39598292112350464,
0.7476180195808411,
-0.26254498958587646,
-0.4898099899291992,
-0.30113843083381653,
0.014626864343881607,
-0.30383092164993286,
0.04182431474328041,
-0.4142797887325287,
-0.58495247364... |
func Sha1Gen(pwd string) string {
salt := strconv.FormatInt(time.Now().UnixNano()%9000+1000, 10)
return Base64Encode(Sha1(Md5(pwd)+salt) + salt)
} | [
-0.6417326927185059,
0.4367647171020508,
0.5663347840309143,
0.6615571975708008,
-0.7805548310279846,
0.9402505159378052,
-0.2939396798610687,
0.9246114492416382,
0.1547435075044632,
0.7246381640434265,
-0.10624513030052185,
-0.528140127658844,
0.07340208441019058,
0.6979859471321106,
-0... |
func Gen(pwd string) string {
salt := strconv.FormatInt(time.Now().UnixNano()%9000+1000, 10)
return Base64Encode(Sha256(Md5(pwd)+salt) + salt)
} | [
-0.5500329732894897,
0.021294577047228813,
0.6214596629142761,
0.00672116968780756,
-0.39664503931999207,
1.0832239389419556,
-0.16593573987483978,
0.359472393989563,
-0.5988407731056213,
0.3551342785358429,
-0.5504568219184875,
-0.4413174092769623,
0.6727374792098999,
0.36322519183158875,... |
func BcryptCheck(hashedPwd, pwd string) bool {
err := bcrypt.CompareHashAndPassword([]byte(hashedPwd), []byte(pwd))
return err == nil
} | [
1.113022804260254,
-0.16359667479991913,
0.5636228322982788,
0.28412020206451416,
0.633700966835022,
0.4966472387313843,
-0.23740220069885254,
0.9848372936248779,
0.09310658276081085,
-0.33500900864601135,
0.38698434829711914,
0.40985891222953796,
-0.9618737697601318,
0.23217912018299103,
... |
func Sha1Check(hashed, pwd string) bool {
hashed = Base64Decode(hashed)
if len(hashed) < 4 {
return false
}
salt := hashed[len(hashed)-4:]
return Sha1(Md5(pwd)+salt)+salt == hashed
} | [
-0.0058354283683001995,
0.0697285383939743,
0.3550727069377899,
0.9455047845840454,
-0.23295150697231293,
1.0564428567886353,
-0.26797929406166077,
1.0745047330856323,
0.5565972924232483,
0.09636063873767853,
0.28374773263931274,
-0.0747435912489891,
-0.685025691986084,
-0.2392179369926452... |
func Check(hashed, pwd string) bool {
hashed = Base64Decode(hashed)
if len(hashed) < 4 {
return false
}
salt := hashed[len(hashed)-4:]
return Sha256(Md5(pwd)+salt)+salt == hashed
} | [
0.4193938672542572,
-0.2572554051876068,
0.3431091010570526,
0.594769299030304,
0.07423467189073563,
0.6131911277770996,
-0.48665639758110046,
0.6899715065956116,
-0.10681264847517014,
-0.06516770273447037,
-0.0558258481323719,
-0.15233637392520905,
-0.5955973267555237,
0.14508210122585297... |
func NewCrawler(config rpcclient.ConnConfig, startHeight uint64, prevBlockHash chainhash.Hash) (*Crawler, error) {
blockQueue := queue.New()
blockQueue.PushBack(prevBlockHash)
craw := &Crawler{
fetcherStop: nil,
fetcherBlocks: nil,
rpcConfig: config,
height: startHeight,
subscribers: make... | [
0.3543972969055176,
-0.4489123225212097,
0.6228455901145935,
0.6108462810516357,
-0.20407544076442719,
-0.2725851237773895,
0.32437703013420105,
-0.4380251467227936,
-0.8656661510467529,
0.06777340918779373,
-0.19021521508693695,
0.4187416434288025,
-1.3270982503890991,
0.8010497093200684,... |
func (c *Crawler) backtrackBlock() chainhash.Hash {
// BACKTRACK ONE BLOCK
if c.blockQueue.Len() == 1 {
log.Panic("Backtrack limit reached")
}
c.height -= 1
c.newFetcher(c.height) // Fetch previous block again
return c.blockQueue.PopBack().(chainhash.Hash)
} | [
0.3286869525909424,
0.6027718782424927,
0.9552887082099915,
-0.025795936584472656,
-0.12394161522388458,
-0.4462328553199768,
0.6245342493057251,
-0.8930674195289612,
-1.0413864850997925,
0.18776997923851013,
-0.18806830048561096,
-0.13638967275619507,
-0.9241308569908142,
0.02091840095818... |
func (c *Crawler) newBlock(block *wire.MsgBlock, hash *chainhash.Hash) {
c.height += 1
c.blockQueue.PushBack(*hash)
if c.blockQueue.Len() > BlockQueueSize {
c.blockQueue.PopFront()
}
} | [
0.8784151077270508,
0.3974669873714447,
0.681972086429596,
0.44879111647605896,
0.54349285364151,
0.05397947505116463,
0.15126408636569977,
-0.9056079387664795,
-0.4596344828605652,
0.10864461958408356,
0.19671452045440674,
0.5237833261489868,
-0.5682555437088013,
1.2006771564483643,
0.4... |
func (c *Crawler) processBlock(block *wire.MsgBlock, blockHash *chainhash.Hash) {
// Verify the block hash and retry if there was a transmission error
verifiedHash := block.BlockHash()
if verifiedHash != *blockHash {
log.Print("Crawler: Invalid hash ", *blockHash, verifiedHash)
c.newFetcher(c.height+1) // Fetch... | [
1.2549666166305542,
0.37209078669548035,
0.9348868727684021,
0.4250589907169342,
0.7074500918388367,
-0.4376286566257477,
0.10428638011217117,
-0.8005968332290649,
0.056259289383888245,
0.29437926411628723,
0.20148731768131256,
0.35332757234573364,
-0.9156515598297119,
1.1915801763534546,
... |
func (c *Crawler) newFetcher(height uint64) {
// Stop previous fetcher
if c.fetcherStop != nil {
c.fetcherStop <- true
}
// Both channels to be closed by fetcher task
c.fetcherStop = make(chan bool)
c.fetcherBlocks = make(chan blockRecord, FetcherBlockBufferSize)
//
go fetcher(c.rpcConfig, height, c.fe... | [
0.21711745858192444,
-0.6208409070968628,
0.42571893334388733,
0.11290210485458374,
-0.2569480240345001,
0.2013031393289566,
0.6736127138137817,
-0.5997459888458252,
-0.99765944480896,
0.3283720314502716,
-0.6586618423461914,
0.4180583655834198,
0.04796503856778145,
1.6346325874328613,
0... |
func (c *Crawler) notifySubscribers(update BlockUpdate) {
for subscriber, _ := range c.subscribers {
subscriber <- update
}
} | [
0.1856851428747177,
-1.0995242595672607,
0.20067782700061798,
0.39168423414230347,
0.3052750825881958,
-0.795574963092804,
-1.2954497337341309,
0.25838586688041687,
-0.697778582572937,
0.6157941818237305,
-0.4796096086502075,
0.8070918321609497,
-0.45506179332733154,
1.088628888130188,
-... |
func (c *Crawler) addSubscriber(subscriber UpdateChan) {
c.subscribers[subscriber] = true
} | [
0.03313722833991051,
-0.3476717472076416,
0.27234283089637756,
-0.4458138048648834,
-0.08505814522504807,
0.11962931603193283,
-0.5323352217674255,
0.5088901519775391,
0.10670487582683563,
-0.47588077187538147,
-0.700872540473938,
-0.2640358507633209,
-0.31854018568992615,
1.95073473453521... |
func (c *Crawler) delSubscriber(subscriber UpdateChan) {
delete(c.subscribers, subscriber)
} | [
0.3550049960613251,
-0.8690592646598816,
0.023414598777890205,
-0.3614995777606964,
-0.7513980865478516,
-0.44517096877098083,
-0.8533121347427368,
0.35986563563346863,
0.2993778586387634,
-0.01849282532930374,
-0.36554697155952454,
0.20467129349708557,
-0.14604796469211578,
1.832786560058... |
func (c *Crawler) Subscribe(chanSize uint) UpdateChan {
ch := make(UpdateChan, int(chanSize))
c.subscribeChan <- ch
return ch
} | [
0.10309619456529617,
0.37357813119888306,
0.5622411370277405,
-0.628180205821991,
-0.2342192679643631,
-0.5278882384300232,
-0.3482566177845001,
-0.6140379905700684,
0.1770772784948349,
-1.1027522087097168,
-1.0098495483398438,
0.4734940826892853,
-0.8165979981422424,
0.2628924250602722,
... |
func (c *Crawler) Start() {
ch := make(chan bool)
c.startChan <- ch
// Wait until it has started
<- ch
} | [
0.25017204880714417,
-0.2515934109687805,
0.1979762315750122,
-0.07771550863981247,
0.8501708507537842,
0.11694194376468658,
0.19659164547920227,
0.8297057747840881,
-0.8032869100570679,
-0.23085319995880127,
-0.9762902855873108,
0.5896220207214355,
-0.2530503571033478,
0.6496292352676392,... |
func (c *Crawler) Stop() {
ch := make(chan bool)
c.stopChan <- ch
// Wait until it has stopped
<- ch
} | [
-0.9062330722808838,
-0.022448020055890083,
0.11338239908218384,
-0.7118423581123352,
1.075236201286316,
0.5280753374099731,
0.1526760756969452,
0.5094597339630127,
-1.0965179204940796,
-0.1421186774969101,
-0.8263638019561768,
-0.07758008688688278,
-0.6449504494667053,
0.5137832164764404,... |
func (mp MultiplexedProcessor) Process(resp *exchange.Response) error {
contentType := resp.Header.Get("Content-Type")
if contentType == "" {
return nil
}
mediaType, _, err := mime.ParseMediaType(contentType)
if err != nil && err != mime.ErrInvalidMediaParameter {
log.Printf("warning: invalid Content-Type %q: ... | [
0.5367081761360168,
-1.0087358951568604,
0.7145550847053528,
-0.2524108290672302,
-0.5927596092224121,
-0.4971526265144348,
-0.1898299902677536,
-0.39134636521339417,
1.2867140769958496,
0.35661160945892334,
0.37162235379219055,
-0.33912184834480286,
-0.5888622403144836,
0.2754479348659515... |
func (config *ScrabblerConfiguration) Load() {
log.Do.Info("Load configuration...")
var configFilePath string
var tmpScreabblerConfiguration ScrabblerConfiguration
if config.ConfigFilePath != "" {
configFilePath = config.ConfigFilePath
} else {
configFilePath = DefaultConfigPath
}
if _, err := toml.DecodeF... | [
-0.7959849834442139,
0.1975412219762802,
0.5586097240447998,
-0.4066723585128784,
-0.43402400612831116,
0.38938429951667786,
1.3544776439666748,
0.2106316238641739,
-0.4886155426502228,
0.8987551331520081,
-1.0710653066635132,
-0.34684786200523376,
-0.5326564908027649,
0.3057323694229126,
... |
func isEmpty(object interface{}) bool {
if object == nil {
return true
} else if object == "" {
return true
} else if object == false {
return true
} else if object == nil {
return true
} else if object == 0 {
return true
}
//Then see if it's a struct
if reflect.ValueOf(object).Kind() == reflect.Stru... | [
-0.7783976793289185,
-0.19798168540000916,
0.9080513119697571,
0.2721564471721649,
-0.3772541880607605,
0.2697702646255493,
0.6984307169914246,
-0.16728951036930084,
0.8786333799362183,
0.3310048282146454,
-0.8448745608329773,
0.4323854148387909,
-0.42254045605659485,
0.4231472909450531,
... |
func (this *Map) Insert(key, value interface{}) {
node := this.tree.FindNode(key)
if node != nil {
node.SetValue(value)
return
}
this.tree.Insert(key, value)
} | [
-0.878017008304596,
0.5615731477737427,
0.623275101184845,
-0.3839838206768036,
-0.6171801090240479,
0.3923279047012329,
-0.3769553601741791,
0.8617035150527954,
-0.619251549243927,
0.36282289028167725,
-0.3758871555328369,
-0.15498638153076172,
-0.7388777136802673,
0.8480937480926514,
-... |
func (this *Map) Get(key interface{}) interface{} {
node := this.tree.FindNode(key)
if node != nil {
return node.Value()
}
return nil
} | [
-0.6711034178733826,
-0.14341044425964355,
0.6795598268508911,
0.20638702809810638,
-0.3705384433269501,
-0.2871307134628296,
-0.9790370464324951,
-0.19074390828609467,
-0.3952963650226593,
0.14895842969417572,
0.34724661707878113,
0.4678504168987274,
-0.15429338812828064,
0.66998493671417... |
func (this *Map) Erase(key interface{}) {
node := this.tree.FindNode(key)
if node != nil {
this.tree.Delete(node)
}
} | [
-0.9044120907783508,
-0.08615262061357498,
0.6857945919036865,
-0.42483246326446533,
-0.33833175897598267,
0.3582940399646759,
-0.26498010754585266,
0.5268498063087463,
-0.12777262926101685,
1.0946004390716553,
0.4880029559135437,
0.551338791847229,
-0.39477333426475525,
0.7644166946411133... |
func (this *Map) EraseIter(iter ConstKvIterator) {
mpIter, ok := iter.(*MapIterator)
if ok {
this.tree.Delete(mpIter.node)
}
} | [
-0.9424669146537781,
-0.2726844549179077,
0.36316943168640137,
-0.2207970917224884,
-1.043617606163025,
0.3143816292285919,
-0.39341244101524353,
0.561884880065918,
-0.06462755799293518,
1.6556854248046875,
0.7773861289024353,
0.33453428745269775,
-0.14472949504852295,
0.8038056492805481,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.