text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (chain *DataTypeChain) EnsureOneOf(options ...string) *DataTypeChain {
// use the value or empty to evaluate
strval := chain.StringValue()
// look for a match
found := false
for i := 0; i < len(options); i++ {
if options[i] == strval {
found = true
}
}
// if not found, clear strval and value
if !... | [
0.15687282383441925,
0.2576375901699066,
0.34228962659835815,
-0.5549302697181702,
0.9662991166114807,
-0.9451186060905457,
-0.9523957967758179,
-1.114301085472107,
0.39575159549713135,
-0.23772720992565155,
0.45482632517814636,
0.14050504565238953,
-1.3015120029449463,
-0.0021696111653000... |
func maxProbability(n int, edges [][]int, succProb []float64, start int, end int) float64 {
// form the graph
graph := make([][]pair, n)
for i := range edges {
from, to, prob := edges[i][0], edges[i][1], succProb[i]
graph[from] = append(graph[from], pair{to, prob})
graph[to] = append(graph[to], pair{from, prob... | [
0.6951463222503662,
0.38118863105773926,
0.9483540654182434,
0.047632090747356415,
-0.3845154643058777,
-0.09504089504480362,
-0.1714574545621872,
0.3822856545448303,
-0.08442448824644089,
1.1918704509735107,
0.3283539116382599,
-0.1833207607269287,
-0.8497886061668396,
-0.1644370853900909... |
func FizzBuzz(size int) []string {
var output []string
for i := 1; i < size+1; i++ {
ne := ""
switch {
case i%3 == 0 && i%5 == 0:
ne = "FizzBuzz"
case i%3 == 0:
ne = "Fizz"
case i%5 == 0:
ne = "Buzz"
default:
ne = fmt.Sprint(i)
}
output = append(output, ne)
}
fmt.Println(output)
return ... | [
0.19943682849407196,
-0.03356659784913063,
0.7436146140098572,
0.8315503001213074,
0.24901552498340607,
-0.057038839906454086,
0.017212528735399246,
-0.9223613142967224,
0.31306275725364685,
0.16318240761756897,
-0.9072722792625427,
0.11906831711530685,
-1.0774701833724976,
0.9071089029312... |
func LookupRegionAutoscaler(ctx *pulumi.Context, args *LookupRegionAutoscalerArgs, opts ...pulumi.InvokeOption) (*LookupRegionAutoscalerResult, error) {
var rv LookupRegionAutoscalerResult
err := ctx.Invoke("google-native:compute/v1:getRegionAutoscaler", args, &rv, opts...)
if err != nil {
return nil, err
}
retu... | [
-0.23279818892478943,
-0.14327630400657654,
0.6338114142417908,
-0.008928416296839714,
-0.35257792472839355,
-0.20839349925518036,
-0.4033501446247101,
-1.0905181169509888,
-0.073628269135952,
-0.2268444001674652,
0.07572392374277115,
1.0218991041183472,
-0.20746859908103943,
-0.3381821215... |
func NewCustomerTokenWithContactDetails() *CustomerTokenWithContactDetails {
return &CustomerTokenWithContactDetails{}
} | [
0.8471276760101318,
-1.5076911449432373,
0.32029783725738525,
-0.38329842686653137,
-0.8338131308555603,
0.46537789702415466,
0.3310728073120117,
-0.5698813199996948,
-0.43663352727890015,
-0.5210838317871094,
-1.0631846189498901,
-0.8566564917564392,
0.6081336736679077,
-0.069389596581459... |
func (s *Server) ListenAndServe() error {
if s.proxy == nil {
s.proxy = newProxy()
}
return http.ListenAndServe(s.Addr, s.proxy)
} | [
-0.07948296517133713,
-0.9525178670883179,
0.183782696723938,
-1.0432448387145996,
0.005338441114872694,
-0.747981607913971,
-0.9657041430473328,
1.2499383687973022,
0.5097849369049072,
-0.6909988522529602,
0.09195780754089355,
-0.1984017938375473,
-0.6519777178764343,
0.37409812211990356,... |
func (s *Server) SetupProfile(profile *Profile) {
if s.proxy == nil {
s.proxy = newProxy()
}
s.proxy.SetProfile(profile)
} | [
-0.12508387863636017,
0.35724782943725586,
0.6478518843650818,
-0.12833042442798615,
0.2275625467300415,
-0.18420830368995667,
0.15311762690544128,
0.5610916018486023,
0.956072986125946,
0.15259607136249542,
-0.5523456335067749,
-0.188760906457901,
-1.30724036693573,
0.9527812004089355,
... |
func NewMockCodeGenerator(ctrl *gomock.Controller) *MockCodeGenerator {
mock := &MockCodeGenerator{ctrl: ctrl}
mock.recorder = &MockCodeGeneratorMockRecorder{mock}
return mock
} | [
-0.3989638686180115,
0.2280445694923401,
0.26527583599090576,
0.16136689484119415,
-1.0616737604141235,
-0.6597862243652344,
0.3540431261062622,
0.18045614659786224,
0.17785823345184326,
-0.2785665988922119,
-0.5226471424102783,
-0.667384684085846,
-0.8259465098381042,
1.843491792678833,
... |
func (m *MockCodeGenerator) EXPECT() *MockCodeGeneratorMockRecorder {
return m.recorder
} | [
-0.2703016996383667,
0.32415634393692017,
0.3842952251434326,
-0.034980546683073044,
-0.1628432720899582,
0.12223120033740997,
0.34581929445266724,
0.28798118233680725,
-0.23003552854061127,
-0.7267594933509827,
0.7914330959320068,
0.7469022274017334,
-1.02675199508667,
0.9363914728164673,... |
func (m *MockCodeGenerator) Generate() (string, error) {
ret := m.ctrl.Call(m, "Generate")
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
-1.2742269039154053,
-0.07828295975923538,
0.17353586852550507,
0.8495042324066162,
0.618309497833252,
0.23012091219425201,
0.41433921456336975,
-0.5911283493041992,
-1.5874576568603516,
-0.3945271372795105,
-0.8274427652359009,
-1.1200058460235596,
-0.4103488028049469,
1.0806912183761597,... |
func (mr *MockCodeGeneratorMockRecorder) Generate() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Generate", reflect.TypeOf((*MockCodeGenerator)(nil).Generate))
} | [
-0.6069474816322327,
0.7770252823829651,
0.29213669896125793,
0.5580325722694397,
-0.1589840054512024,
0.40453141927719116,
-0.36365780234336853,
-0.9503506422042847,
-0.00828707218170166,
0.26756441593170166,
0.1864665299654007,
-0.023047015070915222,
-0.9682238101959229,
1.74117016792297... |
func NewTraceExporterProcessor(traceExporters ...exporter.TraceExporter) SpanProcessor {
return &exporterSpanProcessor{tes: exporter.MultiTraceExporters(traceExporters...)}
} | [
0.18283496797084808,
-0.40478014945983887,
0.5030196309089661,
0.5798571705818176,
-0.8874369263648987,
-0.2441152185201645,
0.2903999090194702,
-0.3915873169898987,
1.1902846097946167,
0.2154274582862854,
-0.3910045623779297,
-0.33133894205093384,
-0.5779666304588318,
0.18748772144317627,... |
func itob(x uint64) []byte {
b := make([]byte, 8)
binary.BigEndian.PutUint64(b, x)
return b
} | [
-0.8286839127540588,
1.1884781122207642,
0.702936053276062,
0.41957011818885803,
0.03873993456363678,
0.6006065607070923,
-0.8670807480812073,
-1.3865690231323242,
0.7807607650756836,
0.44879767298698425,
-1.0132697820663452,
0.699584424495697,
0.052664779126644135,
-0.6446653604507446,
... |
func RotN(n int, val string) string {
rotNVal := make([]byte, len(val))
n = n % 26
for i := 0; i < len(val); i++ {
tmp := val[i]
found := false
for j := 0; j < len(englishAlpha); j++ {
if tmp == englishAlpha[j] {
found = true
if (j + n) < len(englishAlpha) {
rotNVal[i] = englishAlpha[j+n]
... | [
-0.687483549118042,
-0.11784914135932922,
0.5514633059501648,
-0.5142748951911926,
0.0887262374162674,
-0.444443017244339,
0.01930348202586174,
-0.9305194616317749,
0.4017307162284851,
0.23871630430221558,
0.5873565673828125,
0.5400377511978149,
-0.7552794218063354,
-0.2683012783527374,
... |
func (game *Game) GetStatus(playerId int) (string, int) {
if !game.belongsToGame(playerId) {
// panic("ERRORRO")
return "Player doesn't belong to this game\n", 3
}
if !game.started {
return "Waiting for other players to join and the game to start\n", 1
}
if game.player1.passed && game.player2.passed {
retu... | [
-0.891851544380188,
-0.8157913088798523,
0.9122955799102783,
-0.05105976015329361,
0.01387611124664545,
-0.4255387485027313,
0.15043994784355164,
-0.1884862333536148,
-0.39866721630096436,
0.8652285933494568,
-0.5334964990615845,
-0.011587272398173809,
-0.6029679179191589,
0.54481023550033... |
func (t *MongoDBToken) IsExpired() bool {
return time.Now().UTC().Unix() >= t.Expired.Unix()
} | [
-0.1727704256772995,
-0.2665753960609436,
0.44861239194869995,
0.5462526082992554,
0.2897433042526245,
-0.16697655618190765,
-2.6426374912261963,
0.041813332587480545,
0.07923786342144012,
0.5509081482887268,
-0.905343770980835,
0.39021286368370056,
-0.7127358317375183,
0.35148146748542786... |
func GenerateIds(count int, service idserv.IDService) []string {
result := make([]string, count)
for i := 0; i < count; i++ {
result[i] = service.NewUUID("c1")
}
return result
} | [
-1.227124810218811,
0.6209585666656494,
0.5273177623748779,
-0.7161037921905518,
0.726335346698761,
0.683052659034729,
-0.636469841003418,
0.10172545164823532,
0.038167644292116165,
0.29024627804756165,
-0.4225357174873352,
-0.010169805958867073,
-0.9852684736251831,
-0.013345998711884022,... |
func NewPopUpMenu(menu *fyne.Menu, c fyne.Canvas) *PopUpMenu {
p := &PopUpMenu{Menu: NewMenu(menu), canvas: c}
p.Menu.Resize(p.Menu.MinSize())
p.Menu.customSized = true
o := widget.NewOverlayContainer(p.Menu, c, p.Dismiss)
o.Resize(o.MinSize())
p.overlay = o
p.OnDismiss = func() {
p.Hide()
}
return p
} | [
0.14087699353694916,
-0.07482638955116272,
0.7373714447021484,
-0.023407602682709694,
-1.039146900177002,
-0.3771326541900635,
0.2646644115447998,
-0.02945539727807045,
0.6074294447898865,
-0.5866634845733643,
-0.37425586581230164,
-0.4058946371078491,
-0.35715991258621216,
0.4084816575050... |
func ShowPopUpMenuAtPosition(menu *fyne.Menu, c fyne.Canvas, pos fyne.Position) {
m := NewPopUpMenu(menu, c)
m.ShowAtPosition(pos)
} | [
0.47326329350471497,
-0.8290261030197144,
0.5987177491188049,
-1.0115864276885986,
-0.9619627594947815,
-0.48588886857032776,
-0.4613686203956604,
0.7451029419898987,
-0.4420558214187622,
0.20317479968070984,
-0.12313957512378693,
-0.9642043113708496,
0.24413926899433136,
0.000171720981597... |
func (p *PopUpMenu) CreateRenderer() fyne.WidgetRenderer {
return p.overlay.CreateRenderer()
} | [
0.2774452865123749,
-0.0015414796071127057,
0.50761878490448,
-0.27524590492248535,
0.4514569640159607,
0.09336823970079422,
-0.9132921099662781,
0.2946311831474304,
0.003306672675535083,
-0.7493140697479248,
0.4974541962146759,
-1.6683329343795776,
-1.2196691036224365,
1.2578644752502441,... |
func (p *PopUpMenu) Hide() {
p.overlay.Hide()
p.Menu.Hide()
} | [
-0.22411592304706573,
0.08900245279073715,
0.6090932488441467,
0.37597227096557617,
-0.12927331030368805,
0.6983788013458252,
0.24715781211853027,
0.7088823914527893,
-0.6005812883377075,
-0.6101502776145935,
-0.05942324176430702,
-0.7470016479492188,
-0.9469072222709656,
0.155119583010673... |
func (p *PopUpMenu) Move(pos fyne.Position) {
widget.MoveWidget(&p.Base, p, p.adjustedPosition(pos, p.Size()))
} | [
-0.6398018002510071,
-0.3134581446647644,
0.3434349000453949,
-0.296594500541687,
-0.12041005492210388,
0.009078878909349442,
-0.6706311702728271,
0.7639598846435547,
-0.558418869972229,
-0.11856904625892639,
-0.414174348115921,
-0.947343111038208,
-0.7138096690177917,
-0.14708329737186432... |
func (p *PopUpMenu) Resize(size fyne.Size) {
widget.MoveWidget(&p.Base, p, p.adjustedPosition(p.Position(), size))
p.Menu.Resize(size)
} | [
-0.5248888731002808,
0.7397797703742981,
0.3995751142501831,
-0.03965175524353981,
0.22003228962421417,
-0.25455141067504883,
-0.7075823545455933,
0.9118034243583679,
-0.5432425737380981,
-0.4733186364173889,
-0.11520068347454071,
-0.9704996347427368,
-0.9234568476676941,
0.021905960515141... |
func (p *PopUpMenu) Show() {
p.overlay.Show()
p.Menu.Show()
} | [
0.36942222714424133,
0.28832003474235535,
0.3305319547653198,
-0.14046387374401093,
0.15199969708919525,
0.49749940633773804,
0.39433926343917847,
1.6085749864578247,
-0.05520165339112282,
0.2461278885602951,
-0.05421611666679382,
-0.14273187518119812,
-0.5471892952919006,
0.87668323516845... |
func (p *PopUpMenu) ShowAtPosition(pos fyne.Position) {
p.Move(pos)
p.Show()
} | [
0.012010069563984871,
-0.5572885870933533,
0.2869493365287781,
-0.978502094745636,
-0.9706639051437378,
-0.359772264957428,
-0.44278666377067566,
0.5114573240280151,
-0.538178563117981,
0.7764154672622681,
-0.42771267890930176,
-0.6475580334663391,
0.5278596878051758,
0.2621690630912781,
... |
func Sign(request *http.Request, accessKeyId, secretAccessKey string) *http.Request {
// Step 1. create canonical request
// The canonical request structure is
// HTTPRequestMethod + '\n' +
// CanonicalURI + '\n' +
// CanonicalQueryString + '\n' +
// CanonicalHeaders + '\n' +
// S... | [
-0.5575234889984131,
-0.6521556973457336,
0.8393486738204956,
0.16396740078926086,
-0.44610676169395447,
-0.2489173263311386,
-0.7127586603164673,
-0.20687982439994812,
-0.28990378975868225,
-0.25460171699523926,
0.19522897899150848,
0.3109443783760071,
0.48701202869415283,
0.5800607204437... |
func (t *FileType) BeforeUnmarshalYAML() (err error) {
t.MaxLength = 2147483647
return
} | [
1.122931718826294,
0.8096252679824829,
0.2861897945404053,
-0.750197172164917,
0.33971914649009705,
-0.6640880107879639,
0.2122156172990799,
0.6192618608474731,
0.2990594804286957,
0.026142874732613564,
-0.3370673358440399,
0.01739536225795746,
0.31986692547798157,
1.031957983970642,
-0.... |
func (t *FileType) IsEmpty() bool {
return len(t.FileTypes) < 1 &&
t.MinLength == 0 &&
t.MaxLength == 2147483647
} | [
-0.864722490310669,
-0.28359198570251465,
0.6017401814460754,
-0.3569619357585907,
1.1684497594833374,
0.29360589385032654,
-0.2858662009239197,
-0.31292325258255005,
-0.42302462458610535,
-0.005058181006461382,
-0.8436259627342224,
0.5092021226882935,
-0.5682593584060669,
0.60090833902359... |
func (generalRepo generalrepo) View(search string)(*model.General, *httperrors.HttpError) {
products,err1 := Productrepository.GetAll(search)
if err1 != nil {
return nil, err1
}
productcount, errs := Productrepository.Count()
if errs != nil {
return nil, errs
}
users,err2 := Userrepository.Count()
if err... | [
-0.4904230833053589,
-0.12512092292308807,
0.5200855731964111,
-0.9182295799255371,
0.4970525801181793,
0.7507854104042053,
0.66180819272995,
-0.741531252861023,
-0.24409930408000946,
-0.04470118135213852,
0.29920825362205505,
1.0182949304580688,
-0.4771355986595154,
0.24124209582805634,
... |
func TwoCitySchedCost(costs [][]int) int {
return twoCitySchedCost(costs)
} | [
-0.5091603398323059,
-0.5542871952056885,
0.5977694392204285,
0.5457220673561096,
-1.2275660037994385,
-0.8109135031700134,
-0.1868640035390854,
0.49905940890312195,
-0.3199809491634369,
0.11124540865421295,
-0.8108024597167969,
-0.0290797371417284,
0.8798918724060059,
0.1623401641845703,
... |
func ReconstructQueue(people [][]int) [][]int {
return reconstructQueue(people)
} | [
-1.7549972534179688,
-1.023031234741211,
0.5841602087020874,
-0.0401560440659523,
-0.6100703477859497,
-0.9203029274940491,
0.363017201423645,
0.4809563457965851,
-0.2291339635848999,
-0.1227872222661972,
0.4469732940196991,
-0.14942346513271332,
-0.12652407586574554,
0.20624755322933197,
... |
func (f fileauth) Terminate() {
f.fh.Close()
} | [
0.56259685754776,
-0.3069912791252136,
0.2882953882217407,
0.6655139327049255,
0.576405942440033,
0.7692721486091614,
-0.6698179841041565,
0.4215523898601532,
-0.7954733967781067,
-0.7130889296531677,
-0.13414916396141052,
-0.21343131363391876,
-0.18378709256649017,
0.3156546354293823,
0... |
func NewFileAuth(fpath string) auth.Auther {
file, err := os.Open(fpath)
if err != nil {
panic(err)
}
return &fileauth{
fh: file,
}
} | [
0.3487843871116638,
-0.878173828125,
0.2674129903316498,
0.29762735962867737,
-1.4706300497055054,
0.6412774920463562,
0.04998699203133583,
0.37266436219215393,
-0.25712159276008606,
0.097943976521492,
-0.04298875108361244,
0.23521766066551208,
0.31422343850135803,
0.10683488100767136,
-... |
func (f fileauth) IsValid(user string, pass string) bool {
scanner := bufio.NewScanner(f.fh)
for scanner.Scan() {
line := scanner.Text()
authStr := fmt.Sprintf("%s:%s", user, pass)
if strings.Contains(line, authStr) {
return true
}
}
return false
} | [
0.6139371991157532,
-1.5578721761703491,
0.6678381562232971,
0.6789536476135254,
-0.35774707794189453,
1.0101590156555176,
-0.7181175351142883,
1.0005699396133423,
-0.708041250705719,
-0.29925209283828735,
1.0773241519927979,
0.9879075288772583,
-0.06693828850984573,
-0.05496244132518768,
... |
func (f fileauth) IsUserAuthorizedForScope(user string, scope string) bool {
scanner := bufio.NewScanner(f.fh)
for scanner.Scan() {
line := scanner.Text()
if strings.Contains(line, user) {
userline := strings.SplitN(line, ":", 3)
scopes := userline[2]
for _, s := range strings.Split(scopes, ",") {
i... | [
0.0005328261177055538,
-1.2907280921936035,
0.634682834148407,
0.1977553516626358,
-0.7845624685287476,
-0.044130656868219376,
0.026108412072062492,
0.4839739203453064,
-0.18438969552516937,
0.1950281262397766,
0.6559223532676697,
1.1448428630828857,
0.13829347491264343,
0.1863567531108856... |
func Get(path string, handler http.Handler) Route {
return NewRoute("GET", path, handler)
} | [
0.187653586268425,
-0.4888656437397003,
0.12248840928077698,
-0.629270076751709,
0.04259936511516571,
0.36411020159721375,
-1.1699540615081787,
0.21817585825920105,
-1.6604019403457642,
-0.902622401714325,
-0.050816845148801804,
1.3931626081466675,
0.5332939624786377,
0.0798264592885971,
... |
func Post(path string, handler http.Handler) Route {
return NewRoute("POST", path, handler)
} | [
0.6969223618507385,
-0.23059184849262238,
0.24436518549919128,
0.5711278319358826,
-0.8499000072479248,
0.7231637835502625,
-0.9754015207290649,
0.025937043130397797,
-1.4867876768112183,
-1.5243926048278809,
-0.4796863794326782,
0.09536410868167877,
0.5227519273757935,
0.9316443204879761,... |
func Put(path string, handler http.Handler) Route {
return NewRoute("PUT", path, handler)
} | [
0.13510732352733612,
-0.08960940688848495,
0.17397917807102203,
-0.9333725571632385,
-0.5259695053100586,
0.9203574061393738,
0.053662098944187164,
0.31570717692375183,
-1.5258930921554565,
-0.1879989206790924,
-0.4196697175502777,
0.6555464863777161,
0.005283975508064032,
0.23415604233741... |
func Patch(path string, handler http.Handler) Route {
return NewRoute("PATCH", path, handler)
} | [
0.5796223878860474,
-0.779557466506958,
0.1555546522140503,
-0.7130212187767029,
-1.1677892208099365,
1.2615604400634766,
-0.5658389925956726,
0.4831445813179016,
-0.8776255249977112,
-0.9677010178565979,
0.0360751710832119,
1.0637617111206055,
0.6907681226730347,
0.6971169114112854,
-0.... |
func Delete(path string, handler http.Handler) Route {
return NewRoute("DELETE", path, handler)
} | [
0.9621873497962952,
-0.21549484133720398,
0.301095187664032,
0.29027387499809265,
-0.23160602152347565,
0.6858747601509094,
-0.3437282145023346,
0.4574815630912781,
-0.7564914226531982,
-0.39674028754234314,
-0.23649202287197113,
0.4926159083843231,
0.2580876350402832,
0.4538639187812805,
... |
func (cfg *config) crash1(i int) {
cfg.disconnect(i)
cfg.net.DeleteServer(i) // disable client connections to the server.
cfg.mu.Lock()
defer cfg.mu.Unlock()
// a fresh persister, in case old instance
// continues to update the Persister.
// but copy old persister's content so that we always
// pass Make() th... | [
-0.7137778997421265,
0.4420936107635498,
0.7101269960403442,
0.5579590201377869,
0.20577138662338257,
0.10700380057096481,
0.949755072593689,
-0.24394364655017853,
-0.3028585910797119,
0.6281701922416687,
-0.6532307863235474,
-0.36398541927337646,
-0.5809154510498047,
-0.12306896597146988,... |
func (cfg *config) checkConsistency(server int, index int, logEntry logEntry) {
for j := 0; j < len(cfg.logs); j++ {
e, ok := cfg.logs[j][index]
if ok && (e != logEntry) {
log.Fatalf("server %d is trying to commit logEntry: %+v at index: %d "+
"but server j: %d has already committed e: %+v for the same inde... | [
-0.028406325727701187,
-0.40502026677131653,
0.6108977794647217,
-0.4994935691356659,
1.3699201345443726,
-0.036468248814344406,
0.39511609077453613,
0.21176007390022278,
-0.24567264318466187,
1.5124573707580566,
0.32952648401260376,
0.6206597685813904,
-0.8073469996452332,
0.3244769871234... |
func (cfg *config) applier(server int, applyCh chan ApplyMsg, stopCh <-chan struct{}) {
stopped := false
for {
select {
case <-stopCh:
{
// When applier is stopped, it still continues to empty `applyCh`.
stopped = true
}
case m := <-applyCh:
{
if !stopped {
cfg.apply(server, m)
}
... | [
-0.27710816264152527,
-0.08174039423465729,
0.4652881622314453,
-0.6415836811065674,
-0.8538330793380737,
-0.10643680393695831,
-0.23413579165935516,
0.12038123607635498,
-0.431607723236084,
-0.8502054214477539,
-0.3885388970375061,
-0.40722617506980896,
-0.40264013409614563,
1.71644568443... |
func (cfg *config) checkCommitted(index int, command interface{}) {
for i := 0; i < len(cfg.logs); i++ {
e, ok := cfg.logs[i][index]
if ok {
if !e.valid {
log.Fatalf("snapshot with index %d has value %v but server %d stores a dummy "+
"entry for this index (snapshots are only created for indices with v... | [
0.5740966200828552,
0.023644421249628067,
0.6421017050743103,
-0.6203504800796509,
0.7732118964195251,
0.08501401543617249,
0.12603534758090973,
-0.13652892410755157,
0.1232604831457138,
0.4023236334323883,
-0.034165892750024796,
0.35846495628356934,
-0.320118248462677,
1.0235803127288818,... |
func (cfg *config) applierSnap(server int, applyCh chan ApplyMsg, stopCh <-chan struct{}) {
stopped := false
for {
select {
case <-stopCh:
{
// When applier is stopped, it still continues to empty `applyCh`.
stopped = true
}
case m := <-applyCh:
{
if !stopped {
cfg.applySnap(server, m)... | [
-1.04435133934021,
0.07232815772294998,
0.45471134781837463,
-0.5017129182815552,
-1.0466952323913574,
0.016031639650464058,
-0.3200964629650116,
0.2144099622964859,
0.1081642135977745,
-0.47589361667633057,
-0.27058905363082886,
-0.3762725293636322,
0.209771066904068,
1.1595971584320068,
... |
func (cfg *config) start1(i int, applier func(int, chan ApplyMsg, <-chan struct{})) {
cfg.crash1(i)
// a fresh set of outgoing ClientEnd names.
// so that old crashed instance's ClientEnds can't send.
cfg.endnames[i] = make([]string, cfg.n)
for j := 0; j < cfg.n; j++ {
cfg.endnames[i][j] = randstring(20)
}
/... | [
-0.7280983924865723,
0.3762555718421936,
0.8586860299110413,
-0.08766013383865356,
-0.19727414846420288,
-0.017791438847780228,
0.9122597575187683,
-0.4932647943496704,
-0.59012371301651,
-0.11625896394252777,
-0.3893004357814789,
0.356494277715683,
-0.419113427400589,
0.628031849861145,
... |
func (cfg *config) connect(i int) {
//fmt.Printf("connect(%d)\n\n\n", i)
cfg.connected[i] = true
// outgoing ClientEnds
for j := 0; j < cfg.n; j++ {
if cfg.connected[j] {
endname := cfg.endnames[i][j]
cfg.net.Enable(endname, true)
}
}
// incoming ClientEnds
for j := 0; j < cfg.n; j++ {
if cfg.conn... | [
-0.8350919485092163,
-0.1764305830001831,
0.631359338760376,
-0.7793815732002258,
-0.22446924448013306,
0.8113589286804199,
0.04946510121226311,
-0.21556565165519714,
-1.2279435396194458,
0.9172624349594116,
-1.0769374370574951,
-0.5809363126754761,
-0.2513359785079956,
0.6087700128555298,... |
func (cfg *config) disconnect(i int) {
//fmt.Printf("disconnect(%d)\n\n\n", i)
cfg.connected[i] = false
// outgoing ClientEnds
for j := 0; j < cfg.n; j++ {
if cfg.endnames[i] != nil {
endname := cfg.endnames[i][j]
cfg.net.Enable(endname, false)
}
}
// incoming ClientEnds
for j := 0; j < cfg.n; j++ {... | [
-0.7829738855361938,
-0.15811645984649658,
0.4471355378627777,
-1.1295732259750366,
-0.07920216023921967,
0.6954180002212524,
0.3901885449886322,
-0.0023406455293297768,
-0.8084024786949158,
1.1058470010757446,
-1.0199339389801025,
-0.5716875195503235,
-0.8052937984466553,
0.09929251670837... |
func (cfg *config) checkOneLeader() int {
for iters := 0; iters < 10; iters++ {
ms := 450 + (rand.Int63() % 100)
time.Sleep(time.Duration(ms) * time.Millisecond)
leaders := make(map[int][]int)
for i := 0; i < cfg.n; i++ {
if cfg.connected[i] {
if term, leader := cfg.rafts[i].GetState(); leader {
l... | [
-0.3670808970928192,
-0.2478189766407013,
0.9562025666236877,
-0.3335452973842621,
0.1628555804491043,
-0.38170912861824036,
-0.07219581305980682,
-0.11690559983253479,
0.28928014636039734,
0.3628145754337311,
0.3649066388607025,
0.1447288990020752,
-1.5964003801345825,
0.6069250702857971,... |
func (cfg *config) checkTerms() int {
term := -1
for i := 0; i < cfg.n; i++ {
if cfg.connected[i] {
xterm, _ := cfg.rafts[i].GetState()
if term == -1 {
term = xterm
} else if term != xterm {
cfg.t.Fatalf("servers disagree on term")
}
}
}
return term
} | [
-0.12462210655212402,
0.4233168959617615,
0.6487627625465393,
-0.06224733963608742,
0.1975560486316681,
-0.1253942996263504,
-0.2618755102157593,
0.013124758377671242,
-0.7701923251152039,
0.9439372420310974,
-0.039963360875844955,
0.007958823814988136,
-1.7368329763412476,
0.5143006443977... |
func (cfg *config) checkNoLeader() {
for i := 0; i < cfg.n; i++ {
if cfg.connected[i] {
_, is_leader := cfg.rafts[i].GetState()
if is_leader {
cfg.t.Fatalf("expected no leader, but %v claims to be leader", i)
}
}
}
} | [
0.10046420991420746,
0.3285894989967346,
0.38857942819595337,
0.03334207087755203,
1.001156210899353,
0.21492506563663483,
-0.1827915608882904,
0.05511273443698883,
-0.18107017874717712,
-0.24089635908603668,
0.09045950323343277,
0.35440143942832947,
-1.1409937143325806,
1.2538847923278809... |
func (cfg *config) nCommitted(index int) (int, logEntry) {
count := 0
var logEntry logEntry
for i := 0; i < len(cfg.rafts); i++ {
cfg.mu.Lock()
e, ok := cfg.logs[i][index]
nextIndex := cfg.nextIndex[i]
cfg.mu.Unlock()
if ok && (nextIndex > index) {
logEntry = e
count++
}
}
return count, logEntry... | [
0.624467670917511,
0.04823547601699829,
0.7300683856010437,
-0.8246833682060242,
0.04968671873211861,
-0.5103458762168884,
1.0639066696166992,
-0.5254947543144226,
-0.15875814855098724,
0.6297934055328369,
-0.4883752465248108,
0.4104486405849457,
-0.7182453870773315,
0.8790817260742188,
... |
func (cfg *config) wait(index int, n int, startTerm int) (bool, logEntry) {
to := 10 * time.Millisecond
for iters := 0; iters < 30; iters++ {
nd, _ := cfg.nCommitted(index)
if nd >= n {
break
}
time.Sleep(to)
if to < time.Second {
to *= 2
}
if startTerm > -1 {
for _, r := range cfg.rafts {
... | [
-0.3735376000404358,
0.5811576247215271,
0.6140605211257935,
-0.323948472738266,
0.3526691794395447,
0.10783340036869049,
0.24730056524276733,
-0.26382890343666077,
-0.3813357353210449,
0.2411886751651764,
-0.5367214679718018,
0.6747521758079529,
-0.40857329964637756,
0.15271635353565216,
... |
func (cfg *config) one(cmd interface{}, expectedServers int, retry bool) int {
t0 := time.Now()
starts := 0
for time.Since(t0).Seconds() < 10 {
// try all the servers, maybe one is the leader.
index := -1
for si := 0; si < cfg.n; si++ {
starts = (starts + 1) % cfg.n
var rf *Raft
cfg.mu.Lock()
if cf... | [
-0.855061948299408,
0.3364797532558441,
0.8983461260795593,
-0.021328004077076912,
0.38667595386505127,
-0.06131008639931679,
1.099255919456482,
0.3288012146949768,
-0.6531748175621033,
0.33472535014152527,
0.4164571464061737,
0.7060753703117371,
-0.8394020795822144,
0.7083948254585266,
... |
func (cfg *config) begin(description string) {
fmt.Printf("%s ...\n", description)
cfg.t0 = time.Now()
cfg.rpcs0 = cfg.rpcTotal()
cfg.bytes0 = cfg.bytesTotal()
cfg.maxIndex0 = cfg.maxIndex
} | [
0.05414195731282234,
0.27616533637046814,
0.43475279211997986,
-0.4529186487197876,
-0.09018343687057495,
-0.1391478180885315,
0.04612734168767929,
0.42218631505966187,
-0.5925180912017822,
0.3054976165294647,
-0.22815601527690887,
1.1728332042694092,
-0.22734346985816956,
1.24791204929351... |
func (cfg *config) end() {
cfg.checkTimeout()
if cfg.t.Failed() == false {
cfg.mu.Lock()
t := time.Since(cfg.t0).Seconds() // real time
npeers := cfg.n // number of Raft peers
nrpc := cfg.rpcTotal() - cfg.rpcs0 // number of RPC sends
nbytes := cfg.bytesTotal() - cfg.bytes0... | [
0.2060205638408661,
0.0866423025727272,
0.7106357216835022,
-0.8733595013618469,
0.47404658794403076,
0.651441216468811,
0.5533119440078735,
0.17994490265846252,
-1.5568631887435913,
0.9939280152320862,
-0.21624191105365753,
0.5021085739135742,
-0.7833046317100525,
1.0676854848861694,
1.... |
func (cfg *config) LogSize() int {
logsize := 0
for i := 0; i < cfg.n; i++ {
n := cfg.saved[i].RaftStateSize()
if n > logsize {
logsize = n
}
}
return logsize
} | [
-0.49369606375694275,
1.4919838905334473,
0.7992272973060608,
-0.1445392519235611,
0.15954335033893585,
-0.579568088054657,
0.7164131999015808,
0.19028010964393616,
-0.17226959764957428,
-0.23317137360572815,
-0.6359451413154602,
0.20116467773914337,
-0.8581738471984863,
0.4007247090339660... |
func KeynavCompiledEntity(pubID string, entityID AEID, uniqueID string) string {
return fmt.Sprintf("%v:%v:e:%v:%v", compiledNamespaceV2, pubID, entityID, uniqueID)
} | [
-0.13513071835041046,
-1.7175276279449463,
0.3332511782646179,
-1.0867884159088135,
0.27705276012420654,
0.6169372797012329,
-0.7428943514823914,
0.06915873289108276,
-0.12822513282299042,
0.09981989860534668,
-0.12672655284404755,
1.1461814641952515,
0.23123353719711304,
0.183855295181274... |
func KeynavCompiledDialogRootWithinActor(pubID, actorID string) string {
return fmt.Sprintf("%v:e:%v:i",
KeynavCompiledEntity(pubID, AEIDActor, actorID),
AEIDDialogNode)
} | [
0.20760898292064667,
-1.566724419593811,
0.26233547925949097,
-0.2644599974155426,
-0.5622438192367554,
0.1089770495891571,
-0.32204627990722656,
0.25207504630088806,
0.43259376287460327,
0.12896105647087097,
0.08519351482391357,
1.232177734375,
0.40304380655288696,
0.3868054449558258,
-... |
func KeynavCompiledDialogNodeUnknown(pubID, parentDialogID string) string {
return fmt.Sprintf("%v:%v:e:%v:%v:u", compiledNamespaceV2,
pubID, AEIDDialogNode, parentDialogID)
} | [
-0.11285743862390518,
-1.2097700834274292,
0.4009830951690674,
-1.2830055952072144,
0.11685964465141296,
0.4247148633003235,
-0.8036924600601196,
0.5056418180465698,
-0.5804215669631958,
-0.5602197647094727,
-0.48690879344940186,
1.056298017501831,
0.4400215148925781,
0.341311514377594,
... |
func KeynavCompiledDialogRootUnknownWithinActor(pubID, actorID string) string {
return fmt.Sprintf("%v:e:%v:u",
KeynavCompiledEntity(pubID, AEIDActor, actorID),
AEIDDialogNode)
} | [
-0.13755106925964355,
-1.4283002614974976,
0.2637811303138733,
-0.45404449105262756,
-0.04912295192480087,
-0.09681184589862823,
-0.26224657893180847,
0.617986261844635,
0.0990496277809143,
-0.29851481318473816,
-0.15055511891841888,
1.0832027196884155,
0.6470811367034912,
0.64815962314605... |
func KeynavCompiledDialogNode(pubID, parentDialogID string) string {
return fmt.Sprintf("%v:%v:e:%v:%v:i", compiledNamespaceV2,
pubID, AEIDDialogNode, parentDialogID)
} | [
0.1418682038784027,
-1.146409034729004,
0.30405253171920776,
-0.7902578115463257,
-0.3853389322757721,
0.4273419678211212,
-0.9600738286972046,
-0.0013266678433865309,
-0.48706838488578796,
0.24021050333976746,
-0.4656541049480438,
1.1351933479309082,
0.13403835892677307,
0.217079550027847... |
func KeynavCompiledDialogNodeActionBundle(pubID, dialogID string, bundleID uint64) string {
return fmt.Sprintf("%v:e:%v:%v",
KeynavCompiledEntity(pubID, AEIDDialogNode, dialogID),
AEIDActionBundle, bundleID)
} | [
-0.03431386500597,
-1.0616612434387207,
0.2702781856060028,
-0.7464653849601746,
0.03487064689397812,
0.34377309679985046,
-0.00005121792128193192,
0.4399242699146271,
-0.3440810441970825,
-0.13279573619365692,
0.2909223437309265,
0.1647403985261917,
0.02995229698717594,
0.4182702600955963... |
func KeynavProjectMetadataStatic(pubID string) string {
return fmt.Sprintf("%v:%v:m:s",
compiledNamespaceV2,
pubID)
} | [
0.021569348871707916,
-0.7692267298698425,
0.08522377908229828,
-0.9842411279678345,
-0.21749019622802734,
1.2174601554870605,
-1.6159694194793701,
-0.08611100912094116,
-0.6398971080780029,
1.2937512397766113,
0.07069225609302521,
1.4624154567718506,
0.364376038312912,
-0.1194454655051231... |
func KeynavProjectMetadataDynamic(pubID string) string {
return fmt.Sprintf("%v:%v:m:d",
compiledNamespaceV2,
pubID)
} | [
0.000004887580871582031,
-0.6953451037406921,
0.14765074849128723,
-0.718198299407959,
0.08225417882204056,
0.9787721633911133,
-1.4960248470306396,
-0.4868094325065613,
-0.9520623087882996,
0.8024721145629883,
0.5237036943435669,
1.37186598777771,
0.14637182652950287,
-0.21077892184257507... |
func KeynavGlobalMetaProjects() string {
return fmt.Sprintf("%v:live:projects", compiledNamespaceV2)
} | [
0.1311989724636078,
-0.5328838229179382,
0.3293619751930237,
-0.36792340874671936,
-0.026587268337607384,
1.705209732055664,
-0.19734513759613037,
-0.42824625968933105,
-0.2374468296766281,
0.6243605613708496,
-0.045624442398548126,
0.9040548205375671,
-1.1014565229415894,
-0.2185954302549... |
func KeynavParseFromKeyBundleID(key string) string {
fmt.Println(key)
return ""
} | [
0.3459723889827728,
-0.9212729334831238,
0.23069296777248383,
0.595521867275238,
-0.5241493582725525,
0.42018789052963257,
-0.03304540365934372,
0.051456671208143234,
-0.3316437304019928,
0.04991862550377846,
0.19977310299873352,
0.20668093860149384,
-0.16661852598190308,
0.716716527938842... |
func KeynavCompiledTriggerActionBundle(pubID, zoneID string, triggerType, bundleID uint64) string {
return fmt.Sprintf("%v:e:%v:%v:e:%v:%v",
KeynavCompiledEntity(pubID, AEIDZone, zoneID),
AEIDTrigger, triggerType,
AEIDActionBundle, bundleID)
} | [
0.22118927538394928,
-1.5949734449386597,
0.27626940608024597,
-0.46206751465797424,
0.3788001239299774,
0.3618302345275879,
0.7252699732780457,
0.19716274738311768,
-0.18532107770442963,
0.3488619327545166,
0.012106608599424362,
0.17153146862983704,
-0.21292509138584137,
0.223307296633720... |
func KeynavCompiledTriggersWithinZone(pubID, zoneID string) string {
return fmt.Sprintf("%v:e:%v",
KeynavCompiledEntity(pubID, AEIDZone, zoneID),
AEIDTrigger)
} | [
0.4845426678657532,
-1.956461787223816,
0.25435003638267517,
-0.4154326319694519,
0.39186379313468933,
0.28393077850341797,
0.1684177964925766,
0.1584087610244751,
0.32144632935523987,
0.09700322896242142,
-0.6169912219047546,
0.4756399393081665,
-0.21966250240802765,
0.2118518203496933,
... |
func (l *list) dumpList() {
n := l
for n != nil {
marked, p := n.succs[0].Get()
if marked{
fmt.Printf("<%d>[%d], ", n.data, len(n.succs))
}else{
fmt.Printf("%d[%d], ", n.data, len(n.succs))
}
n = (*list)(p)
}
fmt.Printf("\n")
} | [
-0.4894629120826721,
0.39636150002479553,
0.4504757225513458,
-0.18706725537776947,
0.5224132537841797,
0.018632857128977776,
0.0018380852416157722,
1.1033328771591187,
0.41074490547180176,
-0.46361398696899414,
-1.4527015686035156,
0.30132901668548584,
0.6269232034683228,
1.90261101722717... |
func localIP() string {
addrs, err := net.InterfaceAddrs()
if err != nil {
panic(err)
}
for _, addr := range addrs {
if strings.HasPrefix(addr.String(), "192") {
address := strings.TrimSuffix(addr.String(), "/24")
if len(Port) > 0 {
address = fmt.Sprintf("%v:%v", address, Port)
}
return address
... | [
-0.16217298805713654,
-0.9472593069076538,
0.7650611400604248,
-0.15817111730575562,
-0.9374521970748901,
-0.47035908699035645,
0.07511337101459503,
0.0484706275165081,
0.23572832345962524,
0.045393988490104675,
0.8829385042190552,
-0.3301103711128235,
-0.22073961794376373,
-0.756860136985... |
func myGame(c *gin.Context, playerName string) {
data, err := game_data.ForPlayer(playerName)
if err != nil {
c.JSON(http.StatusBadRequest, err)
return
}
c.JSON(http.StatusOK, data)
} | [
-1.6304254531860352,
-0.42056897282600403,
0.7723621726036072,
0.04288632422685623,
-0.4098568558692932,
0.13627460598945618,
-1.1356377601623535,
-0.21180365979671478,
-1.2183008193969727,
1.1867955923080444,
-0.056027792394161224,
-0.6357666254043579,
-0.5441622138023376,
0.1842274516820... |
func postAnswer(c *gin.Context) {
player := c.PostForm("player")
slide, err := strconv.Atoi(c.Param("slide"))
if err != nil {
c.String(http.StatusBadRequest, fmt.Sprintf("Invalid slide param: %v: %v", c.Param("slide"), err))
return
}
answer, err := strconv.Atoi(c.PostForm("answer"))
if err != nil {
c.String... | [
-0.4485878050327301,
-0.554574191570282,
1.1093748807907104,
-0.22773878276348114,
-0.23394131660461426,
0.2897326350212097,
0.35075822472572327,
-0.30590981245040894,
-0.217964306473732,
0.3906432092189789,
-0.5143519639968872,
-0.277169793844223,
-1.0199605226516724,
0.8460346460342407,
... |
func NewRepo(gormDB *gorm.DB) Repo {
return &repo{
gormDB: gormDB,
}
} | [
1.1706591844558716,
0.17199595272541046,
0.2458600252866745,
0.8403499722480774,
-0.7695232033729553,
-0.1253185272216797,
-0.12963858246803284,
0.4645175039768219,
-0.37606287002563477,
-0.01421317271888256,
0.21143066883087158,
-0.12009738385677338,
-0.09447365999221802,
0.69954657554626... |
func HasAPIKeyHeader(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
msgResponse := utils.ResponseMessage{}
APIKEY := os.Getenv("GENERAL_API_KEY")
apiKeyVal := c.Request().Header.Get("API_KEY")
if apiKeyVal == "" {
log.Println("API_KEY: Missing Header")
msgResponse.AddErro... | [
-0.4392518401145935,
-0.9879601001739502,
0.7863553762435913,
0.32604843378067017,
-0.6438089609146118,
-0.34868940711021423,
-0.3128061294555664,
0.07746787369251251,
-0.5751754641532898,
0.43429988622665405,
0.07751946151256561,
-0.14049065113067627,
-0.21302852034568787,
0.5003114342689... |
func (w *MqttWrapper) maintainMqttConnection() {
retries := -1 // First connection is free
for {
if !(*w.mqttClient).IsConnected() {
retries++
}
}
} | [
-0.10885752737522125,
-0.890142023563385,
0.31518101692199707,
-0.3460288643836975,
-0.3721003234386444,
-0.10284595936536789,
-0.5376770496368408,
-0.8610963821411133,
0.0738198384642601,
-0.04133635386824608,
0.0893726795911789,
-0.2305537462234497,
-0.9663703441619873,
1.405208587646484... |
func (r *Remote) PublishCarrierStatus(carrier string) error {
return nil
} | [
-0.7335885763168335,
-0.9649273753166199,
0.1199478805065155,
-0.6773455739021301,
-0.0149241853505373,
0.30037596821784973,
-0.4764072000980377,
0.6319247484207153,
-0.07854607701301575,
-0.14351436495780945,
-0.678885281085968,
0.6041224598884583,
-0.30937471985816956,
0.8708876371383667... |
func Encrypt(aead cipher.AEAD, plain, footer []byte) (token string, err error) {
nonce := make([]byte, randNonceSize)
_, err = rand.Read(nonce)
if err != nil {
return "", err
}
return encrypt(aead, nonce, plain, footer)
} | [
-0.20635287463665009,
1.4468317031860352,
0.5871992707252502,
-0.48367324471473694,
-0.716211199760437,
0.16501197218894958,
0.6035679578781128,
-0.4436417520046234,
0.8450568914413452,
0.05015305057168007,
0.49257853627204895,
-0.0033158103469759226,
-0.8847245573997498,
0.254427194595336... |
func Decrypt(aead cipher.AEAD, token string) (plain, footer []byte, err error) {
pieces := strings.Split(token, ".")
if len(pieces) < 3 || len(pieces) > 4 {
return nil, nil, errors.New("invalid token format")
}
if pieces[0] != "v2" {
return nil, nil, fmt.Errorf("unsupported protocol version " + pieces[0])
}
i... | [
-0.26606759428977966,
0.7815850973129272,
0.8796206712722778,
-0.3476811647415161,
-1.149755835533142,
-0.18485566973686218,
0.44822975993156433,
-0.4323280155658722,
0.46273913979530334,
0.4149377942085266,
0.05124292150139809,
0.21374380588531494,
-0.5802041888237,
0.0951184332370758,
... |
func Sign(sk ed25519.PrivateKey, m, f []byte) (token string, err error) {
pieces := [][]byte{headerModePublic, m, f}
m2, err := pae(pieces)
if err != nil {
return "", err
}
sig := ed25519.Sign(sk, m2)
var buf bytes.Buffer
_, err = buf.Write(headerModePublic)
if err != nil {
return "", err
}
sm := mak... | [
-0.6050747632980347,
-0.2884332835674286,
0.8463234305381775,
0.1948586255311966,
-1.2986729145050049,
-0.1321253925561905,
-0.5127034783363342,
0.22928734123706818,
-0.6613600850105286,
0.4639485478401184,
-0.1305217146873474,
0.4551504850387573,
0.05335623398423195,
-0.22781239449977875,... |
func Verify(pk ed25519.PublicKey, sm, f []byte) (msg []byte, err error) {
if len(sm) <= 64 {
return nil, fmt.Errorf("invalid signed message length")
}
msg = sm[:len(sm)-64]
sig := sm[len(sm)-64:]
pieces := [][]byte{headerModePublic, msg, f}
msg2, err := pae(pieces)
if err != nil {
return nil, err
}
if !... | [
0.293573796749115,
0.48836323618888855,
0.5412645936012268,
0.864872932434082,
-0.39922934770584106,
-0.03244408220052719,
0.03247882425785065,
-0.46756842732429504,
-0.5391823053359985,
0.4473545551300049,
-0.6128934621810913,
0.6840021014213562,
-0.7820259928703308,
0.8157578706741333,
... |
func newHashRange(start common.Hash, num uint64) *hashRange {
left := new(big.Int).Sub(hashSpace, start.Big())
step := new(big.Int).Div(
new(big.Int).Add(left, new(big.Int).SetUint64(num-1)),
new(big.Int).SetUint64(num),
)
step256 := new(uint256.Int)
step256.SetFromBig(step)
return &hashRange{
current: new... | [
0.06540966033935547,
0.03633838891983032,
0.4099324941635132,
0.3354644775390625,
-0.9794574975967407,
-0.2644443213939667,
-0.4786127209663391,
-0.33258122205734253,
-1.0587550401687622,
-0.4437967836856842,
-0.5289465188980103,
0.1013198047876358,
-0.5074997544288635,
0.2915406823158264,... |
func (r *hashRange) Next() bool {
next, overflow := new(uint256.Int).AddOverflow(r.current, r.step)
if overflow {
return false
}
r.current = next
return true
} | [
-0.535269021987915,
0.6995810270309448,
0.3496662676334381,
0.2956429123878479,
-0.6674807667732239,
0.6677514314651489,
0.007600291166454554,
-0.016320230439305305,
-0.10140195488929749,
-0.6646883487701416,
-0.381635457277298,
-0.28923866152763367,
-0.9679672122001648,
0.3865679800510406... |
func (r *hashRange) Start() common.Hash {
return r.current.Bytes32()
} | [
0.7345044612884521,
-0.4839138090610504,
0.2477509081363678,
0.1102658286690712,
-0.0753818228840828,
0.9858003258705139,
0.1769937127828598,
-0.4886038899421692,
-0.865720808506012,
-0.5840405225753784,
-0.6081501841545105,
0.7370554208755493,
-0.6218727231025696,
-0.6516551971435547,
0... |
func (r *hashRange) End() common.Hash {
// If the end overflows (non divisible range), return a shorter interval
next, overflow := new(uint256.Int).AddOverflow(r.current, r.step)
if overflow {
return common.HexToHash("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
}
return next.SubUint64(ne... | [
0.1527090221643448,
0.25236523151397705,
0.6029202938079834,
-0.3619403541088104,
-0.32229065895080566,
0.8019450902938843,
-0.7212066054344177,
-0.19893451035022736,
-0.709831178188324,
-0.0694858729839325,
-0.33053824305534363,
-0.4929693043231964,
-1.1503338813781738,
0.7064428329467773... |
func incHash(h common.Hash) common.Hash {
var a uint256.Int
a.SetBytes32(h[:])
a.AddUint64(&a, 1)
return common.Hash(a.Bytes32())
} | [
0.37985512614250183,
0.3609057068824768,
0.5013744831085205,
-0.022948749363422394,
-0.43504437804222107,
0.8299798369407654,
-0.02111785300076008,
0.03917594626545906,
0.04753275215625763,
-0.1409735381603241,
-0.36660313606262207,
0.5296859741210938,
-0.9791944026947021,
0.23103825747966... |
func uploadSingle(w http.ResponseWriter, r *http.Request) (*os.File, string) {
// Check if "tmp" dir exists; if not, make tmp dir
if _, err := os.Stat("tmp"); os.IsNotExist(err) {
err := os.Mkdir("tmp", 0755)
if err != nil {
log.Fatal("Unable to create tmp folder - ", err)
}
}
// Gets the file, and filehe... | [
-0.11281139403581619,
-0.21392148733139038,
0.9558348655700684,
0.0706714540719986,
0.12207383662462234,
0.4188903570175171,
0.2591710686683655,
0.08064723759889603,
-0.4211077094078064,
0.13560256361961365,
0.2953459322452545,
-0.19102738797664642,
-0.5503950715065002,
0.33978569507598877... |
func uploadMultiple(w http.ResponseWriter, r *http.Request) []*os.File {
var xfiles []*os.File
// Check if "tmp" dir exists; if not, make tmp dir
if _, err := os.Stat("tmp"); os.IsNotExist(err) {
err := os.Mkdir("tmp", 0755)
if err != nil {
log.Fatal("Unable to create tmp folder - ", err)
}
}
// Get fil... | [
-0.5625139474868774,
0.27616292238235474,
1.0891815423965454,
0.7048113942146301,
0.6128385066986084,
0.5411216616630554,
0.04803755134344101,
-0.37561097741127014,
-0.9005829691886902,
0.45684579014778137,
0.22935158014297485,
-0.7953041791915894,
-0.5367113947868347,
0.5624514222145081,
... |
func NewContext(base string) *Context {
u, err := url.Parse(base)
if err != nil {
panic(fmt.Sprintf("Could not parse URL: %s", base))
}
return &Context{
internalAPI: u,
remoteServiceAPI: u,
}
} | [
-0.2928661108016968,
-0.5476173162460327,
0.23651659488677979,
-0.08159545809030533,
-0.8596151471138,
0.01893502101302147,
-0.8205277919769287,
-0.02919538877904415,
0.6399615406990051,
-0.28803887963294983,
0.0714697614312172,
-0.2002388834953308,
-0.45688706636428833,
-0.614281415939331... |
func (c *Context) InternalAPI() *url.URL { return c.internalAPI } | [
-0.4492911994457245,
-1.2746505737304688,
0.1725810170173645,
0.00302029587328434,
-1.0156198740005493,
0.6807594299316406,
0.5560595989227295,
0.9329059720039368,
0.04984048008918762,
-0.9395326972007751,
0.4391579329967499,
0.6401895880699158,
-1.0135685205459595,
-0.4218974709510803,
... |
func (c *Context) RemoteServiceAPI() *url.URL { return c.remoteServiceAPI } | [
-0.6346016526222229,
-1.2490227222442627,
0.1553209125995636,
-0.46143507957458496,
-0.6395679712295532,
1.2937536239624023,
0.07070966064929962,
-0.27138444781303406,
0.5493224263191223,
0.3992293179035187,
-0.2716241478919983,
0.6484931111335754,
-0.7743768692016602,
0.536467969417572,
... |
func (c *Context) Organization() string { return c.orgName } | [
-0.19640858471393585,
-0.16573041677474976,
0.1717960238456726,
0.9530916213989258,
-0.1742890626192093,
0.3956635892391205,
0.5430039763450623,
-0.6361271739006042,
0.19175328314304352,
0.3872036039829254,
0.25811895728111267,
0.04966907948255539,
1.0515857934951782,
-0.04345463588833809,... |
func (c *Context) Environment() string { return c.envName } | [
-0.0020566489547491074,
-0.7084164619445801,
0.06728564202785492,
0.08991005271673203,
0.11133784055709839,
0.8761520385742188,
0.9323264956474304,
-0.9175443053245544,
0.057705752551555634,
0.7016618847846985,
0.008319471962749958,
0.23166774213314056,
0.24855276942253113,
0.4142931401729... |
func (c *Context) SetOrganization(o string) { c.orgName = o } | [
-0.02811770886182785,
0.4063524305820465,
-0.12414862960577011,
0.7695720791816711,
-0.25466659665107727,
-0.6342371106147766,
0.7527500987052917,
0.15540513396263123,
0.051828280091285706,
0.5427218079566956,
-0.8441615700721741,
0.021769165992736816,
0.9393360614776611,
0.239872276782989... |
func (c *Context) SetEnvironment(e string) { c.envName = e } | [
-0.18594291806221008,
-0.3094102442264557,
0.0648021399974823,
0.06810518354177475,
0.3321511745452881,
0.3832114636898041,
1.2045271396636963,
0.29606202244758606,
0.20929427444934845,
1.1342413425445557,
-0.8960884809494019,
-0.4726146459579468,
0.6012038588523865,
0.7247592210769653,
... |
func Asset(name string) ([]byte, error) {
canonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[canonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not found"... | [
-1.0117802619934082,
-1.1598913669586182,
0.6830528974533081,
-0.6832774877548218,
-1.3779864311218262,
-0.04716435447335243,
0.3233034014701843,
-1.387198567390442,
-1.1437952518463135,
0.4887535572052002,
0.508706271648407,
0.4118397831916809,
-0.556188702583313,
-0.2793940007686615,
0... |
func AssetString(name string) (string, error) {
data, err := Asset(name)
return string(data), err
} | [
-1.247711420059204,
-0.7423804402351379,
0.39674192667007446,
-1.4730795621871948,
-1.8356839418411255,
0.45875734090805054,
-0.22362041473388672,
-1.3954719305038452,
-0.5910036563873291,
0.673730194568634,
0.5670546293258667,
0.45071396231651306,
0.12421981245279312,
-0.6748082637786865,... |
func MustAsset(name string) []byte {
a, err := Asset(name)
if err != nil {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
} | [
-0.012778956443071365,
0.11985661834478378,
0.4091298282146454,
-0.5268413424491882,
-0.8276715278625488,
0.4719155430793762,
-0.8186293840408325,
-1.5736604928970337,
0.16388541460037231,
0.6357062458992004,
-0.5354578495025635,
0.35693347454071045,
0.0057142809964716434,
-0.0248885955661... |
func MustAssetString(name string) string {
return string(MustAsset(name))
} | [
-0.7957004308700562,
-0.4993444085121155,
0.4154260754585266,
-0.059688813984394073,
-1.7780245542526245,
0.7658588886260986,
-0.5333529710769653,
-1.525808334350586,
-0.11369087547063828,
0.8382498025894165,
0.9579691290855408,
-0.4543590545654297,
0.2904685139656067,
0.30602753162384033,... |
func AssetInfo(name string) (os.FileInfo, error) {
canonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[canonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("AssetIn... | [
0.1966029703617096,
-0.9794570207595825,
0.5885098576545715,
-0.9617621302604675,
-1.2945103645324707,
0.0021701965015381575,
0.8489783406257629,
-0.8787258267402649,
-1.2970008850097656,
0.33993929624557495,
0.4047488272190094,
0.37507039308547974,
0.06526204943656921,
-0.2895668148994446... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.