text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func getReadySchedulableWorkerNode(ctx context.Context, c clientset.Interface) (*v1.Node, error) {
nodes, err := e2enode.GetReadySchedulableNodes(ctx, c)
if err != nil {
return nil, err
}
for i := range nodes.Items {
node := nodes.Items[i]
_, isMaster := node.Labels["node-role.kubernetes.io/master"]
_, isCo... | [
-0.20920902490615845,
0.08816811442375183,
0.6381112337112427,
-0.5823273658752441,
-0.045812834054231644,
0.10719147324562073,
-0.34372222423553467,
0.20193716883659363,
-0.22118084132671356,
0.6473773121833801,
-0.12082928419113159,
0.8856892585754395,
-0.2903125584125519,
0.048844899982... |
func (n *ns1) setupServiceZone(zoneName string) error {
zone, err := n.fetchZone(zoneName)
if err != nil {
return err
}
n.serviceZone = n.transformZone(zone)
return nil
} | [
-0.48424094915390015,
-0.0004203050339128822,
0.5118327736854553,
0.15715885162353516,
0.3546118438243866,
-0.2485712319612503,
0.8238233327865601,
0.5701988935470581,
0.20818272233009338,
0.1538950502872467,
-0.5005269646644592,
0.11268608272075653,
-0.5623533129692078,
0.6587850451469421... |
func (n *ns1) getServices() map[string]service {
n.lock.RLock()
copy := n.services
n.lock.RUnlock()
return copy
} | [
-1.1725448369979858,
0.12091176211833954,
0.42368775606155396,
0.6111133098602295,
-0.5109519362449646,
0.21029044687747955,
0.10349416732788086,
-1.690461277961731,
0.3075391352176666,
-0.7882848381996155,
-0.21748535335063934,
0.44191330671310425,
-1.1022253036499023,
0.6046186685562134,... |
func (n *ns1) setServices(services map[string]service) {
n.lock.Lock()
n.services = services
n.lock.Unlock()
} | [
-1.1396700143814087,
0.49450597167015076,
0.10884130001068115,
0.6150152683258057,
-0.415600448846817,
0.3573380410671234,
-0.1525341421365738,
-1.0419745445251465,
-0.11065682768821716,
-0.5304902791976929,
-0.7563985586166382,
0.30859294533729553,
-1.203349232673645,
1.0905448198318481,
... |
func (n *ns1) fetch() error {
n.log.Debug("Performing fetch from NS1", "zone", n.serviceZone.name)
zone, err := n.fetchZone(n.serviceZone.name)
if err != nil {
return err
}
services := n.transformZoneRecords(zone)
n.setServices(services)
return nil
} | [
0.25329387187957764,
0.04582659527659416,
0.175423726439476,
-0.11841338872909546,
-0.030500303953886032,
0.3626992404460907,
-0.20599834620952606,
-0.318631112575531,
0.3736192584037781,
0.04014499485492706,
-0.13611653447151184,
1.1327120065689087,
0.3954140543937683,
0.9439036846160889,... |
func (n *ns1) fetchZone(zoneName string) (*dns.Zone, error) {
ns1Zone, _, err := n.client.Zones.Get(zoneName)
if err != nil {
return nil, err
}
return ns1Zone, nil
} | [
-0.08971001952886581,
0.6917469501495361,
0.03169162943959236,
0.8621179461479187,
-0.5715179443359375,
-0.0542723648250103,
0.3349132537841797,
-0.6964753866195679,
0.7410567998886108,
-0.15103673934936523,
-0.2962423264980316,
0.8616645932197571,
-0.822883665561676,
0.4369712471961975,
... |
func (n *ns1) transformZone(ns1Zone *dns.Zone) zone {
return zone{id: ns1Zone.ID, name: ns1Zone.Zone}
} | [
-0.47487515211105347,
-0.18141910433769226,
0.09642991423606873,
0.05188538506627083,
-0.4405757784843445,
-0.36496996879577637,
0.19259048998355865,
0.4315558969974518,
1.5268867015838623,
-0.7457404732704163,
-1.227225422859192,
0.7794391512870789,
-0.1498730480670929,
0.3986414074897766... |
func (n *ns1) transformZoneRecords(ns1Zone *dns.Zone) map[string]service {
services := map[string]service{}
for _, record := range ns1Zone.Records {
if record.Type != "A" && record.Type != "SRV" {
n.log.Debug("Non-service record type found in zone, ignoring", "ID", fmt.Sprintf("%s", record.ID))
continue
}
... | [
-0.851534366607666,
0.10160914808511734,
0.5721725225448608,
-0.5891748666763306,
-0.46635696291923523,
-0.6145232915878296,
0.9857446551322937,
0.07792709022760391,
0.8003560900688171,
0.9611464738845825,
0.045579321682453156,
0.5360561609268188,
0.1456066071987152,
0.5942533016204834,
... |
func (n *ns1) upsertRecord(id string, rec *dns.Record) error {
var err error
if id == "" {
n.log.Debug("Creating record", "domain", rec.Domain, "type", rec.Type, "Answers", rec.Answers)
_, err = n.client.Records.Create(rec)
} else {
n.log.Debug("Updating record", "domain", rec.Domain, "type", rec.Type, "Answer... | [
-0.6602371335029602,
1.0681030750274658,
0.7066811323165894,
-0.21969732642173767,
0.3520679175853729,
0.4336533546447754,
-0.0101803969591856,
-0.11216296255588531,
-0.06372258812189102,
0.8636122941970825,
-0.33244985342025757,
0.02465789206326008,
-0.8296485543251038,
0.7836263179779053... |
func (n *ns1) generateRecord(id, name, t string) (*dns.Record, error) {
var err error
domain := name + "." + n.serviceZone.name
rec := &dns.Record{}
if id == "" {
rec = dns.NewRecord(n.serviceZone.name, domain, t)
} else {
rec, _, err = n.client.Records.Get(n.serviceZone.name, domain, t)
if err != nil {
r... | [
-0.08747967332601547,
1.1140426397323608,
0.4765666127204895,
-0.32268986105918884,
-0.11818641424179077,
0.5949974656105042,
-0.8730656504631042,
-0.3868428170681,
0.23327024281024933,
0.3733745813369751,
-0.3130854070186615,
0.08735154569149017,
-0.4204646646976471,
0.141965851187706,
... |
func (n *ns1) create(services map[string]service) int32 {
wg := sync.WaitGroup{}
var count int32
for k, s := range services {
name := n.ns1Prefix + k
aRec, err := n.generateRecord(s.ns1IDs.aRecID, name, "A")
if err != nil {
n.log.Error("cannot fetch A record for service, generating new record", "name", name... | [
-1.1356654167175293,
0.9381097555160522,
0.979330837726593,
-0.4008229672908783,
-0.4035630226135254,
0.39507871866226196,
0.5013660788536072,
-0.8436479568481445,
-0.4780923128128052,
0.9588906168937683,
-0.1598864048719406,
-0.4850693941116333,
-0.22211191058158875,
0.3573133051395416,
... |
func (n *ns1) upsertRecordWorker(wg *sync.WaitGroup, recID string, rec *dns.Record, count *int32) {
err := n.upsertRecord(recID, rec)
if err != nil {
n.log.Error("cannot create or update record for service", "domain", rec.Domain, "type", rec.Type, "error", err.Error())
} else {
atomic.AddInt32(count, 1)
}
wg.D... | [
-0.6438013315200806,
0.627825915813446,
0.8757888078689575,
-0.558562695980072,
0.1224820539355278,
0.18097814917564392,
0.3848302960395813,
-0.12784899771213531,
-0.6944252848625183,
0.925540030002594,
-0.5203099846839905,
-0.5229051113128662,
-0.9104121923446655,
0.6897299885749817,
0.... |
func (n *ns1) removeRecordWorker(wg *sync.WaitGroup, zone, domain, recType string, count *int32) {
n.log.Debug("Removing record", "zone", n.serviceZone.name, "domain", domain, "type", recType)
_, err := n.client.Records.Delete(zone, domain, recType)
if err != nil {
n.log.Error("Record for service could not be dele... | [
-0.17294031381607056,
0.3253748118877411,
0.5841543078422546,
-0.0401427336037159,
-0.40548813343048096,
-0.027520274743437767,
0.7791387438774109,
0.21679268777370453,
-0.4959101974964142,
0.3193105161190033,
-0.35158616304397583,
-0.007028603460639715,
-1.3419679403305054,
0.625390291213... |
func (n *ns1) remove(services map[string]service) int32 {
wg := sync.WaitGroup{}
var count int32
for k, s := range services {
domain := ""
if k == n.serviceZone.name {
// handle apex record
domain = n.serviceZone.name
} else {
name := n.ns1Prefix + k
domain = name + "." + n.serviceZone.name
}
i... | [
-1.115944504737854,
0.35964834690093994,
0.7759652733802795,
-0.19249244034290314,
-0.8917489051818848,
-0.16930238902568817,
0.74116051197052,
0.39491280913352966,
0.24704495072364807,
0.17083652317523956,
-0.37353089451789856,
0.04140552133321762,
-1.1752350330352783,
0.8293024897575378,... |
func NewTweet() Tweet {
return Tweet{
"me",
"some random text",
}
} | [
1.185917615890503,
-0.6626327037811279,
-0.06830395758152008,
-0.019193096086382866,
-0.4679366648197174,
0.21129761636257172,
-0.9557541012763977,
-0.6883822679519653,
-0.18092091381549835,
-1.1293474435806274,
-0.6108344793319702,
0.8696579933166504,
-0.06080794706940651,
-0.078434936702... |
func NewTweetArray(n int) []Tweet {
res := make([]Tweet, n)
for i := 0; i < n; i++ {
res[i] = NewTweet()
}
return res
} | [
-1.0723398923873901,
-0.7488035559654236,
0.247450590133667,
-0.11378149688243866,
0.4161461889743805,
-0.07925345003604889,
-0.02444644086062908,
-0.9083552956581116,
-0.4681561291217804,
0.35190072655677795,
-1.2088379859924316,
0.7391319274902344,
-0.578460693359375,
1.4833413362503052,... |
func (o *GetServicesServiceIDOperationsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetServicesServiceIDOperationsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil... | [
-0.28342872858047485,
-0.07152731716632843,
0.8593495488166809,
0.6009231805801392,
0.1105499267578125,
-1.0291156768798828,
0.7556688785552979,
-0.6325575709342957,
0.510774552822113,
0.21890251338481903,
0.7121400833129883,
-0.8070952296257019,
-0.820884644985199,
-0.47772255539894104,
... |
func NewGetServicesServiceIDOperationsOK() *GetServicesServiceIDOperationsOK {
return &GetServicesServiceIDOperationsOK{}
} | [
-0.06604913622140884,
0.8218116164207458,
0.5656032562255859,
1.3452541828155518,
0.508240282535553,
-0.5523778200149536,
0.8949485421180725,
-0.20557589828968048,
-0.13580526411533356,
-0.8208788633346558,
-0.04857488349080086,
-0.7264988422393799,
-0.289713591337204,
-0.7153993844985962,... |
func NewGetServicesServiceIDOperationsDefault(code int) *GetServicesServiceIDOperationsDefault {
return &GetServicesServiceIDOperationsDefault{
_statusCode: code,
}
} | [
0.4133773744106293,
0.6819216012954712,
0.5656890273094177,
0.7417291402816772,
0.7204147577285767,
-0.12012018263339996,
0.4184441864490509,
0.1983625292778015,
0.12328276038169861,
-0.11533261090517044,
-0.3268645405769348,
-0.40444454550743103,
-1.0616205930709839,
-0.9504877924919128,
... |
func (o *GetServicesServiceIDOperationsDefault) Code() int {
return o._statusCode
} | [
0.15433675050735474,
1.1170748472213745,
0.3882197439670563,
1.035585880279541,
0.5373885631561279,
-0.15838544070720673,
0.5116036534309387,
0.555371105670929,
-0.041253842413425446,
-0.17572565376758575,
-0.02218831330537796,
-0.4836151897907257,
-0.6188241243362427,
-0.1544404774904251,... |
func Connect(device string, dbg bool) (*DV4Mini, error) {
var err error
d := &DV4Mini{}
debug = dbg
// Set up options.
options := serial.Config{
Name: device,
Baud: 115200,
Parity: serial.ParityNone,
Size: 8,
StopBits: serial.Stop1,
ReadTimeout: time.Millisecond * 250,
}... | [
-0.24544109404087067,
0.11604905873537064,
0.8070443272590637,
0.08153960853815079,
-1.063744068145752,
-0.5833511352539062,
0.069375179708004,
-0.8978138566017151,
0.2847425937652588,
-0.48969918489456177,
0.22943955659866333,
0.22718483209609985,
-0.5914741158485413,
0.144867405295372,
... |
func (d *DV4Mini) Close() {
d.FlushTXBuffer()
d.Port.Flush()
d.Port.Close()
} | [
0.2725948691368103,
0.4373961091041565,
0.2101234644651413,
-0.7220498323440552,
-0.23244215548038483,
0.530407726764679,
0.1363292634487152,
-1.2520487308502197,
-0.4950092136859894,
-0.8133435845375061,
0.01382648665457964,
-0.13466507196426392,
-0.9066754579544067,
0.3612942099571228,
... |
func (d *DV4Mini) FlushSerial() error {
err := d.Port.Flush()
if err != nil {
return err
}
return nil
} | [
-0.53745037317276,
0.22428838908672333,
0.26540982723236084,
-0.07815635204315186,
0.5360279083251953,
0.5829591155052185,
0.6007756590843201,
-0.5974897146224976,
0.3836304247379303,
-0.41521432995796204,
0.11832896620035172,
1.8509081602096558,
-1.1901224851608276,
-0.28899985551834106,
... |
func (d *DV4Mini) GreenLedOn() {
// []byte{ADFGREENLED, 0x01, 0x01}
d.sendCmd([]byte{ADFGREENLED, 0x01})
} | [
0.3960382640361786,
-0.11643457412719727,
0.5665304064750671,
-0.560670018196106,
0.15932467579841614,
1.3493068218231201,
-1.3183990716934204,
0.495082288980484,
0.5985733270645142,
-0.1655384600162506,
-1.1768887042999268,
1.0054055452346802,
-1.1153481006622314,
0.356473833322525,
0.7... |
func (d *DV4Mini) GreenLedOff() {
// []byte{ADFGREENLED, 0x01, 0x00}
d.sendCmd([]byte{ADFGREENLED, 0x00})
} | [
0.40315476059913635,
0.09721330553293228,
0.4894202947616577,
-0.9520283937454224,
0.2063974142074585,
1.7661244869232178,
-0.7105093598365784,
0.16996896266937256,
0.040150050073862076,
-0.45024779438972473,
-0.5188553929328918,
0.9753309488296509,
-1.1033766269683838,
0.3557124435901642,... |
func (d *DV4Mini) Watchdog() ([]byte, error) {
// []byte{0x05}
d.sendCmd([]byte{ADFWATCHDOG})
bHead := make([]byte, 6)
_, err := d.Port.Read(bHead)
if err != nil {
return bHead, err
}
if debug {
log.Printf("\t[*] serial.read: %#v (len: %d)\n", bHead, len(bHead))
}
bParams := make([]byte, int(bHead[5]))
... | [
0.8216767907142639,
-0.3226338028907776,
0.8952124714851379,
-0.5940871238708496,
0.19431741535663605,
0.18805250525474548,
-0.5127409100532532,
-0.7380821704864502,
-0.6645873188972473,
0.35024967789649963,
-0.14731836318969727,
0.9279167056083679,
-1.4334622621536255,
0.3572438359260559,... |
func (d *DV4Mini) Version() ([]byte, error) {
// []byte{0x18}
d.sendCmd([]byte{ADFVERSION})
bHead := make([]byte, 6)
_, err := d.Port.Read(bHead)
if err != nil {
return bHead, err
}
if debug {
log.Printf("\t[*] serial.read: %#v (len: %d)\n", bHead, len(bHead))
}
bParams := make([]byte, int(bHead[5]))
_... | [
-0.2959679365158081,
-0.49434295296669006,
0.8134879469871521,
-0.0961117073893547,
0.2636665105819702,
-0.18686632812023163,
-0.13432824611663818,
-0.7319000363349915,
-0.07188547402620316,
0.7890164256095886,
-0.5626642107963562,
0.4574413597583771,
-1.7178577184677124,
0.195115551352500... |
func (d *DV4Mini) WriteTXBufferData(data []byte) {
var packetSize int = 34 // full 36
// var counter int = 0
// var crcValue byte
// []byte{0x04, data}
cmd := []byte{ADFWRITE}
for i := 0; i < len(data); i += packetSize {
time.Sleep(time.Millisecond * 30)
batch := data[i:min(i+packetSize, len(data))]
// ... | [
0.06298598647117615,
0.3047925531864166,
0.8844857215881348,
-0.15262481570243835,
0.19246920943260193,
0.4485558867454529,
-0.33127838373184204,
-0.22332921624183655,
0.556100070476532,
-0.42537057399749756,
-1.1196174621582031,
-0.16023166477680206,
-0.9850307106971741,
0.607243835926055... |
func (d *DV4Mini) sendCmd(data []byte) {
b := CmdPreamble
params := data[1:]
cmd := data[0]
// Set command
b = append(b, cmd)
// Set param length
b = append(b, byte(len(params)))
// Set params
b = append(b, params...)
if debug {
log.Printf("\t[*] serial.write: %#v (len: %d)\n", b, len(b))
}
_, err := d... | [
-0.4796593189239502,
-0.45389649271965027,
0.6953526139259338,
0.09623636305332184,
0.3872555196285248,
0.12011986970901489,
0.14850416779518127,
-0.3181735575199127,
0.4934220314025879,
-0.5561754703521729,
-0.061014074832201004,
0.373735636472702,
-0.5308107137680054,
0.8159064054489136,... |
func GetRandBytes(size int) (b []byte, err error) {
b = make([]byte, size)
_, err = rand.Read(b)
if err != nil {
return
}
return
} | [
-0.13773633539676666,
1.1930118799209595,
0.5860816836357117,
0.1244916021823883,
0.11634130030870438,
-0.1277308166027069,
-0.1777295023202896,
-0.814573347568512,
0.8903385400772095,
0.12652862071990967,
-0.7201020121574402,
0.44865715503692627,
-1.537118673324585,
0.1811964213848114,
... |
func (code Code) Caused() CausedBy {
return CausedBy(code & 0xff000000)
} | [
1.4511544704437256,
0.8789961338043213,
0.4114207625389099,
0.22440196573734283,
1.0706647634506226,
0.034136608242988586,
0.9652879238128662,
0.08440122753381729,
0.6702958941459656,
-1.3712948560714722,
-0.6459478735923767,
0.5927722454071045,
0.16995833814144135,
0.3080764412879944,
1... |
func NewCode(cause CausedBy, low uint32) Code {
return Code(uint32(cause) + low)
} | [
1.2137309312820435,
0.04251224547624588,
0.20073801279067993,
0.27761462330818176,
-0.633953332901001,
-0.241301491856575,
-0.1685437262058258,
-0.17909589409828186,
0.4962203800678253,
-1.0285881757736206,
0.49399441480636597,
0.5807470679283142,
-0.14440631866455078,
-0.30103644728660583... |
func (*CollectRequest) Descriptor() ([]byte, []int) {
return file_orc8r_cloud_go_services_analytics_protos_collector_proto_rawDescGZIP(), []int{0}
} | [
-0.4882703423500061,
0.08904321491718292,
0.5372246503829956,
0.03804025053977966,
-0.0007242041174322367,
-0.06123952940106392,
0.22547894716262817,
-0.4483553171157837,
-0.24565625190734863,
0.18874461948871613,
0.2668720781803131,
0.3158820867538452,
0.8422439098358154,
0.58847868442535... |
func (*CollectResponse) Descriptor() ([]byte, []int) {
return file_orc8r_cloud_go_services_analytics_protos_collector_proto_rawDescGZIP(), []int{1}
} | [
0.14393530786037445,
-0.21406574547290802,
0.22752860188484192,
0.07465524971485138,
0.6499010324478149,
-0.5744153261184692,
0.9769534468650818,
-0.6354914903640747,
0.15578636527061462,
-0.03751320391893387,
-0.278270959854126,
-0.48858442902565,
0.03468666970729828,
-0.21823933720588684... |
func (*CalculationResult) Descriptor() ([]byte, []int) {
return file_orc8r_cloud_go_services_analytics_protos_collector_proto_rawDescGZIP(), []int{2}
} | [
0.26542508602142334,
1.1647754907608032,
0.286065012216568,
0.09210088104009628,
0.1587829738855362,
0.24288035929203033,
0.6353504657745361,
-0.07126586139202118,
-0.9103031754493713,
-0.024439198896288872,
-0.3965664207935333,
-0.7352955341339111,
-0.07109275460243225,
0.532455325126648,... |
func (store *rethinkStore) GetRealtimeBetween(start, end *time.Time) (trains []Train, err error) {
var res *r.Cursor
if res, err = r.DB(store.db).Table(store.realtimeTable).
Between(start, end, r.BetweenOpts{Index: db.RealtimeTimeIndex}).
EqJoin("id", r.DB(store.db).Table(store.trainTable)).Zip().
OrderBy(db.Re... | [
0.3675501346588135,
0.1452304571866989,
0.7264583706855774,
0.6019967198371887,
0.01871231198310852,
-0.6135857701301575,
-0.7692698240280151,
-0.41302043199539185,
-0.7256132960319519,
0.22908973693847656,
-0.33267220854759216,
-0.03877266123890877,
-1.070243000984192,
-0.3051740229129791... |
func writeFundsThroughCache(userId string, fundsAmount int) error {
// Get current val from redis, if it will go negative, return before running more queries
c := Pool.Get()
defer c.Close()
if c == nil {
return errors.New("Error connecting to redis")
}
res, rediserr := redis.Int(c.Do("GET", userId))
// If t... | [
-0.265269935131073,
0.3736591041088104,
0.8912704586982727,
0.12255804240703583,
-0.44718798995018005,
-0.18510879576206207,
0.5108727812767029,
-0.4129408895969391,
0.6200132369995117,
0.17500640451908112,
0.08444203436374664,
-0.2135578691959381,
0.14752982556819916,
0.8459622859954834,
... |
func writeStocksThroughCache(userId string, stockSymbol string, stockAmount int) error {
// Get current val from redis, if it will go negative, return before running more queries
c := Pool.Get()
defer c.Close()
if c == nil {
return errors.New("Error connecting to redis")
}
res, rediserr := redis.Int(c.Do("GET"... | [
-0.4092785120010376,
0.47025004029273987,
0.8493018746376038,
0.16115275025367737,
0.2889592945575714,
-0.24127379059791565,
0.5543951392173767,
-0.6298744082450867,
0.5644731521606445,
0.269461065530777,
-0.5086199641227722,
-0.012706184759736061,
0.3196597993373871,
0.5650056004524231,
... |
func NewGasPriceOracle(chain *blockchainCore.BlockChain, db database.Database, siotmux *subscribe.TypeMux, params *GpoParams) *GasPriceOracle {
minprice := params.GpoMinGasPrice
if minprice == nil {
minprice = big.NewInt(gpoDefaultMinGasPrice)
}
minbase := new(big.Int).Mul(minprice, big.NewInt(100))
if params.Gp... | [
-0.16013358533382416,
-0.24279171228408813,
0.4510936439037323,
0.2316797375679016,
-0.240815669298172,
-0.7907845973968506,
-0.6127904653549194,
-0.21925726532936096,
-0.564537763595581,
0.8192158937454224,
0.1446048766374588,
0.3330550193786621,
-0.3048301339149475,
-0.3127782344818115,
... |
func (self *GasPriceOracle) lowestPrice(block *types.Block) *big.Int {
gasUsed := big.NewInt(0)
receipts := blockchainCore.GetBlockReceipts(self.db, block.Hash(), block.NumberU64())
if len(receipts) > 0 {
if cgu := receipts[len(receipts)-1].CumulativeGasUsed; cgu != nil {
gasUsed = receipts[len(receipts)-1].Cu... | [
0.7247409224510193,
-0.8352282047271729,
0.8747347593307495,
-0.373690128326416,
-0.5941428542137146,
-1.3121528625488281,
-0.07881592214107513,
0.13409267365932465,
-0.18950478732585907,
0.2159804254770279,
0.40306830406188965,
-0.5911708474159241,
-1.1522607803344727,
0.8364285826683044,... |
func (self *GasPriceOracle) SuggestPrice() *big.Int {
self.init()
self.lastBaseMutex.Lock()
price := new(big.Int).Set(self.lastBase)
self.lastBaseMutex.Unlock()
price.Mul(price, big.NewInt(int64(self.params.GpobaseCorrectionFactor)))
price.Div(price, big.NewInt(100))
if price.Cmp(self.minPrice) < 0 {
price.Se... | [
-0.8088731169700623,
-0.0020656080450862646,
0.4654812216758728,
0.12840759754180908,
0.3273248076438904,
-0.7891319990158081,
0.22004811465740204,
-1.0121300220489502,
-0.2329099327325821,
0.6866687536239624,
0.6388998031616211,
0.21050934493541718,
-1.00583016872406,
0.1457243114709854,
... |
func (d *database) UserForAuth(email string) (*sidebar.User, error) {
var authUser sidebar.User
err := psql.Select("id", "password").
From("users").Where(sq.Eq{"email": email}).RunWith(d).QueryRow().
Scan(&authUser.ID, &authUser.Password)
if err != nil {
return nil, err
}
return &authUser, nil
} | [
-0.3403635323047638,
0.5296459197998047,
0.21061035990715027,
-0.45055195689201355,
-0.16471518576145172,
-0.19384171068668365,
0.5498102903366089,
-0.33986762166023254,
0.14375929534435272,
0.14320673048496246,
0.1727016717195511,
0.3315010666847229,
0.26967647671699524,
0.004111990332603... |
func (d *database) UserInWorkspace(uid, wid string) error {
var id string
err := psql.Select("user_id").From("workspaces_users").Where(sq.Eq{"workspace_id": wid}).Where(sq.Eq{"user_id": uid}).
RunWith(d).QueryRow().Scan(&id)
if err != nil {
return err
}
if id != uid {
return errors.Errorf("User %v not found... | [
0.09344673156738281,
-0.8552184104919434,
0.49548855423927307,
-0.7399550080299377,
-0.9048901796340942,
-0.11118845641613007,
0.27526983618736267,
-0.9859260320663452,
0.4268048107624054,
0.6386248469352722,
-0.18300111591815948,
0.8057145476341248,
-0.5575734376907349,
0.9014966487884521... |
func (d *database) ChannelInWorkspace(cid, wid string) error {
var id string
err := psql.Select("channel_id").From("workspaces_channels").Where(sq.Eq{"workspace_id": wid}).Where(sq.Eq{"channel_id": cid}).
RunWith(d).QueryRow().Scan(&id)
if err != nil {
return err
}
if id != cid {
return errors.Errorf("User ... | [
0.8119845390319824,
-0.7349548935890198,
0.2737901210784912,
-1.0175577402114868,
-0.19725027680397034,
0.04344966262578964,
-0.34500545263290405,
-0.8170422911643982,
-0.2205371856689453,
0.406046062707901,
0.6054418683052063,
1.2457369565963745,
-0.8844420313835144,
0.7500492930412292,
... |
func newFont(owner *Manager, fontFilepath string, scaleInt int, glyphs string) (f *Font, e error) {
// Load the font used for UI interaction
fontFile, err := os.Open(fontFilepath)
if err != nil {
return f, fmt.Errorf("Failed to open the font file.\n%v", err)
}
defer fontFile.Close()
// load in the font
fontBy... | [
0.9612211585044861,
-0.2032591700553894,
0.3687499761581421,
-0.3250419795513153,
-0.7223353385925293,
-0.2969549894332886,
0.3463517129421234,
-0.5782667994499207,
-0.3711053431034088,
-0.5655757188796997,
0.16071169078350067,
0.5904799699783325,
-0.4662715196609497,
-0.20543797314167023,... |
func newFontBytes(owner *Manager, fontBytes []byte, scaleInt int, glyphs string) (f *Font, e error) {
f = new(Font)
scale := fixed.I(scaleInt)
// allocate the location map
f.locations = make(map[rune]runeData)
// parse the truetype font data
ttfData, err := ft.ParseFont(fontBytes)
if err != nil {
return f, f... | [
0.12565094232559204,
0.09469868242740631,
0.6222575902938843,
-1.0636014938354492,
-0.9038861393928528,
-0.7102555632591248,
0.19891130924224854,
-0.33466386795043945,
0.22399044036865234,
0.11585008352994919,
-0.5356147289276123,
0.14564158022403717,
-0.45465701818466187,
0.00978324841707... |
func (f *Font) Destroy() {
f.Owner.gfx.DeleteTexture(f.Texture)
} | [
0.5056622624397278,
-0.4283340573310852,
0.2147679477930069,
-0.41329139471054077,
-0.4532982409000397,
0.004455702845007181,
-0.42538097500801086,
0.2037767469882965,
0.19444893300533295,
-0.3036404252052307,
0.05026228353381157,
-0.12353343516588211,
-0.39006975293159485,
0.7754966616630... |
func (f *Font) GetCurrentScale() float32 {
_, uiHeight := f.Owner.GetResolution()
designHeight := f.Owner.GetDesignHeight()
return float32(uiHeight) / float32(designHeight)
} | [
0.05445662885904312,
-0.38619786500930786,
0.5971119403839111,
0.7955479621887207,
-0.5613256096839905,
0.003348349593579769,
-0.3117658495903015,
-0.9837112426757812,
-0.7548604607582092,
-0.05262330546975136,
-0.11590903252363205,
-0.0698799341917038,
-0.37104305624961853,
0.802513659000... |
func (f *Font) GetRenderSize(msg string) (float32, float32, float32) {
var w, h float32
// see how much to scale the size based on current resolution vs desgin resolution
fontScale := f.GetCurrentScale()
for _, ch := range msg {
bounds, _, _ := f.face.GlyphBounds(ch)
glyphDimensions := bounds.Max.Sub(bounds.M... | [
0.23127149045467377,
0.4204939603805542,
0.7725016474723816,
-1.4350675344467163,
-0.10067051649093628,
-0.4756154417991638,
-0.06238061562180519,
-0.9266105890274048,
-0.31210193037986755,
-0.23798079788684845,
-0.24117352068424225,
0.10054322332143784,
-0.9655264019966125,
1.211112618446... |
func (f *Font) OffsetFloor(msg string, offset float32) float32 {
var w float32
// see how much to scale the size based on current resolution vs desgin resolution
fontScale := f.GetCurrentScale()
for _, ch := range msg {
adv, ok := f.face.GlyphAdvance(ch)
if !ok {
fmt.Printf("ERROR on glyphadvance for %c!\n... | [
0.28275150060653687,
0.010106890462338924,
0.5974457859992981,
-0.9216310381889343,
-1.0730879306793213,
0.3159608542919159,
0.4581622779369354,
-0.5314233899116516,
-0.4268065392971039,
0.006065295543521643,
0.4068039655685425,
-0.1546439826488495,
-0.9722235798835754,
1.7414214611053467,... |
func (f *Font) OffsetForIndex(msg string, stopIndex int) float32 {
return f.OffsetForIndexAdv(msg, 0, stopIndex)
} | [
-0.7895669937133789,
0.3775164484977722,
0.2428634911775589,
-1.2437489032745361,
-0.4730573296546936,
0.16016346216201782,
0.7480875849723816,
-0.37530267238616943,
0.16127315163612366,
-0.5692785978317261,
0.4579683840274811,
0.21132151782512665,
0.06907138973474503,
-0.18770134449005127... |
func (f *Font) OffsetForIndexAdv(msg string, charStartIndex int, stopIndex int) float32 {
var w float32
// sanity test the input
if len(msg) < 1 {
return 0.0
}
if charStartIndex > stopIndex {
return 0.0
}
// see how much to scale the size based on current resolution vs desgin resolution
fontScale := f.Get... | [
-0.4671816825866699,
0.0009455445106141269,
0.6470493078231812,
-1.373751163482666,
-0.7178704142570496,
-0.4078856408596039,
0.20800983905792236,
-0.5856002569198608,
-0.05233703553676605,
0.25061511993408203,
0.6158596277236938,
0.6791434288024902,
-0.15537205338478088,
0.009452674537897... |
func fixedInt26ToFloat(fixedInt fixed.Int26_6) float32 {
var result float32
i := int32(fixedInt)
result += float32(i >> 6)
result += float32(i&0x003F) / float32(64.0)
return result
} | [
0.7411011457443237,
-0.7328388690948486,
0.2850990891456604,
0.13059964776039124,
-0.25151970982551575,
-0.5262518525123596,
-0.061720140278339386,
-0.5195274353027344,
0.2878371775150299,
-1.2652866840362549,
-0.725669264793396,
0.004976482130587101,
-0.7958159446716309,
0.471474230289459... |
func (f *Font) CreateText(pos mgl.Vec3, color mgl.Vec4, msg string) TextRenderData {
return f.CreateTextAdv(pos, color, -1.0, -1, -1, msg)
} | [
0.286013126373291,
0.1983351856470108,
0.4366941750049591,
-0.9796554446220398,
0.4907858371734619,
-0.04873562604188919,
-0.9761552214622498,
-0.12912949919700623,
0.1810535043478012,
0.3167818486690521,
-0.13122685253620148,
-0.4913685619831085,
-0.45728230476379395,
0.12978342175483704,... |
func (f *Font) CreateTextAdv(pos mgl.Vec3, color mgl.Vec4, maxWidth float32, charOffset int, cursorPosition int, msg string) TextRenderData {
// this is the texture ID of the font to use in the shader; by default
// the library always binds the font to the first texture sampler.
const floatTexturePosition = 0.0
//... | [
0.6582561731338501,
0.24751953780651093,
0.9017176628112793,
-1.1857863664627075,
-0.48727551102638245,
-0.33681246638298035,
-0.49984464049339294,
-0.20686911046504974,
0.13632744550704956,
0.26957884430885315,
0.16638414561748505,
0.6665891408920288,
-0.41629400849342346,
0.2647799253463... |
func (f *Font) loadRGBAToTexture(rgba []byte, imageSize int32) graphics.Texture {
return f.loadRGBAToTextureExt(rgba, imageSize, graphics.LINEAR, graphics.LINEAR, graphics.CLAMP_TO_EDGE, graphics.CLAMP_TO_EDGE)
} | [
-0.2259300947189331,
-0.3937242329120636,
0.6620304584503174,
-0.8449023365974426,
-0.3082927167415619,
-0.22051861882209778,
-0.08276385813951492,
-0.968316912651062,
0.24249766767024994,
0.1686592847108841,
-0.2908405363559723,
-0.09549422562122345,
-1.0019214153289795,
0.500964760780334... |
func (f *Font) loadRGBAToTextureExt(rgba []byte, imageSize, magFilter, minFilter, wrapS, wrapT int32) graphics.Texture {
tex := f.Owner.gfx.GenTexture()
f.Owner.gfx.ActiveTexture(graphics.TEXTURE0)
f.Owner.gfx.BindTexture(graphics.TEXTURE_2D, tex)
f.Owner.gfx.TexParameteri(graphics.TEXTURE_2D, graphics.TEXTURE_MAG_... | [
0.011372336186468601,
-0.500904381275177,
1.1727408170700073,
-1.1500517129898071,
-0.5354306697845459,
0.1459059715270996,
-0.6187430024147034,
-0.6764883399009705,
-0.0800284817814827,
0.39075255393981934,
-0.17433209717273712,
0.3138616383075714,
-0.37399908900260925,
0.1094931587576866... |
func Encode(s string) []byte {
var out bytes.Buffer
start := 0
for i := 0; i < len(s); {
if b := s[i]; b < utf8.RuneSelf {
if 0x20 <= b && b != '\\' && b != '"' {
i++
continue
}
if start < i {
out.WriteString(s[start:i])
}
switch b {
case '\\', '"':
out.WriteByte('\\')
out.Wr... | [
-0.2775982618331909,
-0.4279278516769409,
0.7888285517692566,
0.005936151836067438,
-0.896756112575531,
-0.8612174987792969,
0.11540067195892334,
-0.43557706475257874,
-0.1213112622499466,
0.5877810120582581,
-0.09136094152927399,
-0.03205239027738571,
0.06337376683950424,
-0.4028938412666... |
func Decode(s []byte) string {
s, _ = decode(s)
return string(s)
} | [
1.0599714517593384,
-0.417655885219574,
-0.0604398138821125,
0.29439446330070496,
-0.4812273383140564,
-0.6191226840019226,
-0.4737921953201294,
-0.3539643883705139,
0.8880916237831116,
-0.5956405401229858,
-0.34432482719421387,
-0.18233077228069305,
-0.5270584225654602,
-0.502453625202179... |
func getu4(s []byte) rune {
if len(s) < 6 || s[0] != '\\' || s[1] != 'u' {
return -1
}
r, err := strconv.ParseUint(string(s[2:6]), 16, 64)
if err != nil {
return -1
}
return rune(r)
} | [
-0.2518560588359833,
-0.03834176063537598,
0.5991618633270264,
1.002859115600586,
-0.04689842090010643,
-1.1612787246704102,
0.6326839923858643,
0.4571577310562134,
-0.46615299582481384,
-0.46102651953697205,
0.2255852222442627,
0.15994605422019958,
-0.5895670652389526,
-0.5456162691116333... |
func (remoteStatus *RemoteStatus) Update() *RemoteStatus {
remoteStatus.Online = time.Now().Before(remoteStatus.LastTransferredLifeSignDate.Add(1*time.Minute + 30*time.Second))
remoteStatus.Lifesign = Time{remoteStatus.LastTransferredLifeSignDate}.ToIso8601()
return remoteStatus
} | [
-0.1231769397854805,
-1.2965736389160156,
0.48629334568977356,
-1.294222354888916,
-0.7307453155517578,
1.4241379499435425,
-1.431905746459961,
0.13864275813102722,
0.2557675540447235,
0.3840008080005646,
-0.42908796668052673,
-0.007028411608189344,
-0.5017057657241821,
-0.2102576643228531... |
func WithinPolygon(target models.Planet, polygon ...models.Planet) bool {
if len(polygon) < 3 {
return false
}
sortedPolygon := make([]models.Planet, len(polygon))
copy(sortedPolygon, polygon)
sort.Slice(sortedPolygon, func(i, j int) bool {
return polygon[i].Degrees < polygon[j].Degrees
})
for i := 0; i <... | [
-0.7859905362129211,
-0.6458554267883301,
0.6502758264541626,
-0.40598350763320923,
-0.12875226140022278,
1.1154104471206665,
-0.8812334537506104,
-0.47190603613853455,
-0.4938306212425232,
-0.19564953446388245,
0.03148571774363518,
-0.091911181807518,
-0.8529072999954224,
-0.7401730418205... |
func initAuth() {
if authInitialized {
return
}
authInitialized = true
// Set up the credentials file
InitCredentialsFile()
// Add base auth commands
authCommand = &cobra.Command{
Use: "auth",
Short: "Authentication settings",
}
Root.AddCommand(authCommand)
authAddCommand = &cobra.Command{
Use: ... | [
0.3209021985530853,
0.0050467923283576965,
0.8297167420387268,
0.2505921423435211,
0.277682363986969,
0.03256171569228172,
1.1053035259246826,
-0.46042805910110474,
-0.11819449812173843,
0.15996147692203522,
0.3244224190711975,
0.9230517148971558,
0.35214272141456604,
0.8264706134796143,
... |
func UseAuth(typeName string, handler AuthHandler) {
// Initialize auth system if it isn't already set up.
initAuth()
// Register the handler by its type.
AuthHandlers[typeName] = handler
// Set up the add-profile command.
keys := handler.ProfileKeys()
use := " [flags] <name>"
for _, name := range keys {
u... | [
0.04716620594263077,
-0.008419066667556763,
0.9578600525856018,
0.8017259240150452,
0.5195155739784241,
-0.3627816140651703,
0.5852652788162231,
-0.447015643119812,
-0.22598136961460114,
0.07777933776378632,
-0.6141130924224854,
0.5220276117324829,
-0.08990900963544846,
0.8677958250045776,... |
func GetProfile() map[string]string {
return Creds.GetStringMapString("profiles." + strings.Replace(viper.GetString("profile"), ".", "-", -1))
} | [
0.3164292573928833,
-0.03210754320025444,
0.6214507818222046,
0.8702763319015503,
1.0133087635040283,
-0.5012713670730591,
-0.3997651934623718,
-0.15891693532466888,
-0.533187210559845,
0.40544989705085754,
0.08324022591114044,
-0.018521329388022423,
-0.3105810880661011,
0.2061462253332138... |
func ProfileKeys(keys ...string) func(*CredentialsFile) error {
return func(cf *CredentialsFile) error {
cf.keys = keys
return nil
}
} | [
-0.21228578686714172,
0.6066530346870422,
0.261148065328598,
0.7374047636985779,
0.521656334400177,
-0.12152385711669922,
-0.24174010753631592,
-0.26309627294540405,
-0.7394826412200928,
0.20601342618465424,
-0.7100887298583984,
0.18682946264743805,
-0.684939980506897,
-0.22177556157112122... |
func ProfileListKeys(keys ...string) func(*CredentialsFile) error {
return func(cf *CredentialsFile) error {
cf.listKeys = keys
return nil
}
} | [
-0.23082409799098969,
-0.28726720809936523,
0.2721046805381775,
0.903325617313385,
0.1558753252029419,
0.02278367429971695,
-0.8073538541793823,
-0.07413536310195923,
0.16863766312599182,
0.09187056869268417,
-1.0431807041168213,
0.2415584772825241,
-0.45883768796920776,
0.0601117759943008... |
func InitCredentialsFile() {
// Setup a credentials file, kept separate from configuration which might
// get checked into source control.
Creds = &CredentialsFile{viper.New(), []string{}, []string{}}
Creds.SetConfigName("credentials")
Creds.AddConfigPath("$HOME/." + viper.GetString("app-name") + "/")
Creds.Read... | [
1.349599838256836,
-0.008374256081879139,
0.660253643989563,
0.2920416295528412,
1.1965080499649048,
0.41982561349868774,
0.2230876386165619,
0.6605747938156128,
-1.2762672901153564,
-0.3883097171783447,
-0.6823544502258301,
-0.08464748412370682,
0.39619988203048706,
0.46483781933784485,
... |
func InitCredentials(options ...func(*CredentialsFile) error) {
InitCredentialsFile()
for _, option := range options {
option(Creds)
}
// Register auth management commands to create and list profiles.
cmd := &cobra.Command{
Use: "auth",
Short: "Authentication settings",
}
Root.AddCommand(cmd)
use := ... | [
0.17745116353034973,
0.0822906643152237,
0.8452226519584656,
0.22296012938022614,
0.6834986209869385,
-0.315841943025589,
0.5644225478172302,
-0.24419105052947998,
-0.17264683544635773,
0.22188010811805725,
-0.6255019903182983,
0.519324004650116,
0.2850002646446228,
0.8353800773620605,
0... |
func makePostalCodeToGBLOC(db *pop.Connection, postalCode string, gbloc string) models.PostalCodeToGBLOC {
postalCodeToGBLOC := models.PostalCodeToGBLOC{
ID: uuid.Must(uuid.NewV4()),
PostalCode: postalCode,
GBLOC: gbloc,
}
// There's no reason to stub this model because it is only used in queries... | [
-0.2800320088863373,
-0.16140420734882355,
0.5160410404205322,
-0.6413257718086243,
0.1023353636264801,
0.6993591785430908,
0.634397566318512,
0.2773790955543518,
-0.37623560428619385,
0.3752768039703369,
-0.30650418996810913,
-0.08300414681434631,
-0.08491101115942001,
-1.3284873962402344... |
func better(a, b, color int) bool {
if color == core.WHITE {
return a > b
} else {
return a < b
}
} | [
-0.8541242480278015,
0.01784558594226837,
0.5908005833625793,
-0.3820866048336029,
0.42090755701065063,
0.08766431361436844,
-1.0762094259262085,
-0.7249540686607361,
-0.7785706520080566,
0.3228108584880829,
0.019960131496191025,
1.2368850708007812,
0.7133083939552307,
0.808265745639801,
... |
func chainBonus(arrIdx int) int {
if arrIdx == 1 || arrIdx == 4 {
return chainBonusMiddle
} else {
return chainBonusOuter
}
} | [
-0.2481282651424408,
-0.7150045037269592,
0.602124035358429,
1.2726166248321533,
0.9359146356582642,
0.12499372661113739,
-0.8361831307411194,
-0.4276101887226105,
0.3959241211414337,
-0.1618705540895462,
-0.8092883229255676,
1.3448607921600342,
-0.9343652725219727,
0.20305371284484863,
... |
func Target() *eacl.Target {
x := eacl.NewTarget()
x.SetRole(eacl.RoleSystem)
x.SetBinaryKeys([][]byte{
{1, 2, 3},
{4, 5, 6},
})
return x
} | [
-0.33915504813194275,
0.2631721794605255,
0.41842716932296753,
-0.6097667813301086,
0.09527748823165894,
-0.1382056176662445,
-0.41388437151908875,
-0.5769919157028198,
0.17621271312236786,
-0.2943110167980194,
-0.5464819073677063,
0.9813757538795471,
-0.17796266078948975,
-0.8635756373405... |
func Record() *eacl.Record {
x := eacl.NewRecord()
x.SetAction(eacl.ActionAllow)
x.SetOperation(eacl.OperationRangeHash)
x.SetTargets(Target(), Target())
x.AddObjectContainerIDFilter(eacl.MatchStringEqual, cidtest.Generate())
x.AddObjectOwnerIDFilter(eacl.MatchStringNotEqual, ownertest.Generate())
return x
} | [
0.8778935074806213,
0.5283984541893005,
0.5065398812294006,
-0.12588630616664886,
-0.061434656381607056,
0.57183837890625,
0.34106430411338806,
-0.11819114536046982,
0.6917861104011536,
-0.5961084365844727,
0.200106680393219,
0.8484727740287781,
0.20248092710971832,
-0.09789577126502991,
... |
func ircManager(ircConn irc.IRCConn, newClients chan *ircClient) {
fmt.Println("*** Entering ircManager ***")
defer fmt.Println("*** Leaving ircManager ***")
var clients []*ircClient
fromServer := make(chan irc.Message)
fromClient := make(chan irc.Message)
errChan := make(chan error)
quitChan := make(chan bool... | [
-0.26252681016921997,
-1.269600510597229,
0.7910117506980896,
-0.5519174933433533,
0.13651113212108612,
0.018749987706542015,
0.42153316736221313,
-0.4408578872680664,
-0.45005011558532715,
-0.10718286782503128,
-0.23555868864059448,
0.5755221843719482,
-0.7029755711555481,
1.2383930683135... |
func ircServerListener(ircConn irc.IRCConn, msgChan chan<- irc.Message, errChan chan<- error, quitChan <-chan bool) {
fmt.Println("*** Entering ircListenerClient ***")
defer fmt.Println("*** Leaving ircListenerClient ***")
for {
select {
case <-quitChan:
return
default:
msg, err := ircConn.Read()
if ... | [
0.3222767114639282,
-1.2715126276016235,
0.5014629364013672,
-0.9977630376815796,
0.34315136075019836,
0.8573700785636902,
0.19456765055656433,
-0.6543439030647278,
-0.41805583238601685,
0.1613319218158722,
-0.47746503353118896,
0.4094599485397339,
-0.8978415727615356,
0.8385387659072876,
... |
func ircClientListener(client ircClient, to_server chan<- irc.Message, quit <-chan bool) {
for {
select {
case <-quit:
fmt.Println("Exiting ircClientListener")
return
default:
msg, err := client.ReceiveMessage()
if err != nil {
//fmt.Println(fmt.Sprintf("ircClientListener %v, error: %v", client, ... | [
0.245511993765831,
-1.0949002504348755,
0.48660069704055786,
-1.0736024379730225,
-0.3313158452510834,
0.9779327511787415,
0.35003939270973206,
-0.5217084288597107,
-0.7585058808326721,
0.6540368795394897,
0.12794388830661774,
0.3799915313720703,
-0.5853022336959839,
0.2997148633003235,
... |
func NewCertificateManager(hosts string, validity string) (*CertificateManager, error) {
return tls.NewCertificateManager(hosts, validity)
} | [
-0.32000988721847534,
-0.49240249395370483,
0.24665498733520508,
0.5293927192687988,
-0.7306578755378723,
0.18582968413829803,
-1.2277305126190186,
0.35642898082733154,
-0.07885129749774933,
-0.4470290243625641,
-1.0007153749465942,
-0.11984024941921234,
-0.9787319898605347,
1.279114246368... |
func NewSeparatedCertHosts(hosts string) *SeparatedCertHosts {
return tls.NewSeparatedCertHosts(hosts)
} | [
-0.3104630708694458,
0.15402869880199432,
0.12403604388237,
0.8516222238540649,
-1.2474443912506104,
-0.14581435918807983,
0.5566731095314026,
-0.13922421634197235,
-0.5701891779899597,
-0.6054648756980896,
-1.283390998840332,
-0.3229798376560211,
-0.7502332329750061,
0.15038545429706573,
... |
func GetCertExpirationDate(certPEM []byte) (time.Time, error) {
return tls.GetCertExpirationDate(certPEM)
} | [
1.294798493385315,
-0.08711173385381699,
0.21203036606311798,
1.2766954898834229,
-0.6524327993392944,
-0.45487669110298157,
0.021869588643312454,
1.063854455947876,
0.2766437232494354,
0.6494019031524658,
-0.9678564667701721,
-0.772388756275177,
-0.53003990650177,
0.6244721412658691,
0.... |
func PEMToCertificate(certPEM []byte) (*x509.Certificate, error) {
return tls.PEMToCertificate(certPEM)
} | [
0.7350013256072998,
-0.02738194540143013,
0.4050672948360443,
-0.13779594004154205,
-0.4491298496723175,
0.06562933325767517,
-0.4602327346801758,
-0.2110922932624817,
0.19045990705490112,
-0.0781349390745163,
-0.4640769362449646,
-0.9595962166786194,
-0.6333990693092346,
-0.19613800942897... |
func GenerateTLS(hosts string, validity string) (*CertificateChain, error) {
return tls.GenerateTLS(hosts, validity)
} | [
-0.46555817127227783,
0.9036210179328918,
0.2749617397785187,
0.38229134678840637,
-0.6379782557487488,
0.7817195057868958,
-1.0289324522018433,
0.0191336739808321,
-0.42147865891456604,
0.05314185097813606,
-0.7164435982704163,
-0.07271955162286758,
-0.4269344210624695,
-0.149925902485847... |
func (node *Node) ServiceManagerSetup() {
node.serviceManager = &service.Manager{}
node.serviceMessageChan = make(map[service.Type]chan *msg_pb.Message)
switch node.NodeConfig.Role() {
case nodeconfig.Validator:
node.setupForValidator()
case nodeconfig.ClientNode:
node.setupForClientNode()
case nodeconfig.Exp... | [
-0.6435397267341614,
0.0775282233953476,
0.538460910320282,
-0.7088894844055176,
0.1909998655319214,
-0.1838361918926239,
0.22326821088790894,
-0.22445759177207947,
-0.12385311722755432,
0.08305539190769196,
0.39729321002960205,
0.9108678698539734,
-0.47264784574508667,
1.2187155485153198,... |
func (node *Node) RunServices() {
if node.serviceManager == nil {
utils.Logger().Info().Msg("Service manager is not set up yet.")
return
}
node.serviceManager.RunServices()
} | [
-0.9226317405700684,
0.47272753715515137,
0.5812512040138245,
-0.5386903882026672,
-0.19550654292106628,
-0.07761286199092865,
0.2327437698841095,
-0.32406824827194214,
-0.40853366255760193,
-0.721872091293335,
0.869465708732605,
0.3769031763076782,
-0.9908851981163025,
1.3359977006912231,... |
func (node *Node) StopServices() {
if node.serviceManager == nil {
utils.Logger().Info().Msg("Service manager is not set up yet.")
return
}
node.serviceManager.StopServicesByRole([]service.Type{})
} | [
-1.3813716173171997,
0.5836666822433472,
0.5346280932426453,
-0.9970990419387817,
0.10852828621864319,
0.1835930198431015,
0.49808040261268616,
-0.5826717615127563,
-0.6130002737045288,
-0.35192006826400757,
0.9876064658164978,
0.04203876852989197,
-0.904876708984375,
1.2805861234664917,
... |
func (p *Processor) queryDatadogExternal(ddQueries []string, timeWindow time.Duration) (map[string]Point, error) {
ddQueriesLen := len(ddQueries)
if ddQueriesLen == 0 {
log.Tracef("No query in input - nothing to do")
return nil, nil
}
query := strings.Join(ddQueries, ",")
currentTime := time.Now()
currentTim... | [
-0.6127042770385742,
0.6674686670303345,
0.843376636505127,
-0.5647132396697998,
-0.4682326316833496,
0.15914303064346313,
-0.6724770069122314,
-1.161910057067871,
-0.5745507478713989,
0.2621481716632843,
0.4287446439266205,
0.9483674168586731,
-0.1429881751537323,
0.38150039315223694,
-... |
func setTelemetryMetric(val string, metric telemetry.Gauge) error {
valFloat, err := strconv.Atoi(val)
if err == nil {
metric.Set(float64(valFloat), queryEndpoint, le.JoinLeaderValue)
}
return err
} | [
-0.2086021602153778,
0.4505282938480377,
0.21013113856315613,
-0.5776821970939636,
-0.5579153895378113,
0.670425534248352,
-0.21336238086223602,
-0.3443479835987091,
-0.7841296792030334,
0.9124810695648193,
-0.239515483379364,
-1.054572343826294,
-0.31743553280830383,
0.22449782490730286,
... |
func (wsServer *WsServer) Start() error {
if atomic.AddInt32(&wsServer.started, 1) != 1 {
return NewRPCError(ErrAlreadyStarted, nil)
}
wsServeMux := http.NewServeMux()
wsServer.server = &http.Server{
Handler: wsServeMux,
// Timeout connections which don't complete the initial
// handshake within the allowed... | [
-0.5975863337516785,
-0.6594187021255493,
0.5492024421691895,
-0.5158600211143494,
0.11384925991296768,
0.2554190456867218,
0.5430377721786499,
-0.29774075746536255,
0.004267361480742693,
0.3147011995315552,
-0.27650055289268494,
1.0011340379714966,
-0.6404621005058289,
0.7587668299674988,... |
func (wsServer *WsServer) Stop() {
if atomic.AddInt32(&wsServer.shutdown, 1) != 1 {
Logger.log.Info("RPC server is already in the process of shutting down")
}
Logger.log.Info("RPC server shutting down")
if wsServer.started != 0 {
wsServer.server.Close()
}
for _, listen := range wsServer.config.HttpListenters ... | [
-1.324429988861084,
-1.2818862199783325,
0.4993516504764557,
-0.8199924230575562,
0.19707484543323517,
0.7526353597640991,
0.6089332103729248,
-0.3208296298980713,
-0.16163352131843567,
0.9116279482841492,
-0.27345022559165955,
0.400025337934494,
-1.7333871126174927,
1.0675170421600342,
... |
func (wsServer *WsServer) handleWsRequest(w http.ResponseWriter, r *http.Request) {
if wsServer.limitWsConnections(w, r.RemoteAddr) {
return
}
// Keep track of the number of connected clients.
wsServer.IncrementWsClients()
defer wsServer.DecrementWsClients()
upgrader.CheckOrigin = func(r *http.Request) bool {
... | [
-0.7339431643486023,
-0.054576653987169266,
0.7693480849266052,
-0.5656533241271973,
-0.10334770381450653,
-0.39465925097465515,
-0.062070585787296295,
-0.8655710816383362,
0.6780548095703125,
0.18642070889472961,
0.12147967517375946,
0.30075621604919434,
-0.15568962693214417,
0.4459554851... |
func checkBuildTarget(path string, update bool) bool {
if f, err := os.Stat(path); err == nil {
if update && !f.IsDir() {
sylog.Fatalf("Only sandbox updating is supported.")
}
if !update && !force {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Build target already exists. Do you want to overwrite? [N/... | [
-0.8526520729064941,
-0.4763402044773102,
0.9891143441200256,
0.3371483087539673,
0.3408519923686981,
0.6578733325004578,
0.04421884939074516,
-0.2093043178319931,
-0.1499233841896057,
-0.3329194486141205,
0.7122379541397095,
0.4060724973678589,
-0.4315091669559479,
0.4021466076374054,
-... |
func definitionFromSpec(spec string) (def legacytypes.Definition, err error) {
// Try spec as URI first
def, err = legacytypes.NewDefinitionFromURI(spec)
if err == nil {
return
}
// Try spec as local file
var isValid bool
isValid, err = legacyparser.IsValidDefinition(spec)
if err != nil {
return
}
if i... | [
1.2978594303131104,
-0.7161616086959839,
0.6749153733253479,
0.39231523871421814,
-0.12071531265974045,
-0.34359461069107056,
0.1487649828195572,
0.08957929164171219,
0.5565807223320007,
-0.19612279534339905,
0.07848503440618515,
-1.1113324165344238,
1.0562653541564941,
1.6764938831329346,... |
func handleRemoteBuildFlags(cmd *cobra.Command) {
// if we can load config and if default endpoint is set, use that
// otherwise fall back on regular authtoken and URI behavior
endpoint, err := sylabsRemote(remoteConfig)
if err == scs.ErrNoDefault {
sylog.Warningf("No default remote in use, falling back to CLI de... | [
0.09452228248119354,
-0.436755508184433,
0.6089882850646973,
0.4455491900444031,
0.2612384855747223,
0.9925047159194946,
-0.3470011353492737,
0.3640817105770111,
-0.3134629726409912,
-0.13521148264408112,
-0.8280888199806213,
0.34700068831443787,
-0.7390025854110718,
0.8535218238830566,
... |
func PassMethod(param int) string {
return fmt.Sprintf("A valid string %d", param)
} | [
-0.31064051389694214,
-0.23810070753097534,
0.7194973826408386,
-0.690809965133667,
-0.3078601062297821,
0.23050273954868317,
0.6165032386779785,
-0.5199580192565918,
-0.6622341871261597,
0.5415926575660706,
1.5366508960723877,
-0.4135603606700897,
-0.12737154960632324,
-0.1297852247953415... |
func (hc *HuaweiPushClient) PushMsg(accessToken, deviceToken, payload string, timeToLive int) (string, error) {
reqUrl := PUSH_URL + "?nsp_ctx=" + url.QueryEscape(hc.NspCtx)
now := time.Now()
expireSecond := time.Duration(timeToLive * 1e9)
expireTime := now.Add(expireSecond)
var originParam = map[string]string{
... | [
-0.30647534132003784,
0.882446825504303,
1.1106678247451782,
-0.10092759132385254,
-0.700165867805481,
0.5455189347267151,
-1.0681921243667603,
-0.3276418447494507,
-0.8555017709732056,
0.6942552328109741,
0.2590313255786896,
0.29635944962501526,
0.06701777130365372,
0.9326207041740417,
... |
func (g Generator) String() string {
if g.b == nil {
g.b = &big.Int{}
}
sum := g.Sum(nil)
g.b.SetBytes(sum)
return toBase(g.b, g.Words)
} | [
0.24636796116828918,
0.22972112894058228,
0.4175370931625366,
-0.7468267679214478,
-0.5489070415496826,
0.03649740293622017,
1.4820804595947266,
-0.501355767250061,
-0.5899578332901001,
0.0978340208530426,
-0.4262503981590271,
-0.059460610151290894,
-0.9026229381561279,
0.17897790670394897... |
func (g Generator) FromString(s string) (string, error) {
g.Reset()
_, err := g.Write([]byte(s))
if err != nil {
return "", err
}
return g.String(), nil
} | [
0.7125145196914673,
0.14062005281448364,
0.21855629980564117,
-0.35842421650886536,
-1.469621181488037,
0.0813850462436676,
0.6633393168449402,
-0.7014855146408081,
0.01965288072824478,
-0.02401488833129406,
-0.08809468150138855,
0.38721075654029846,
-0.03246903419494629,
-1.14332187175750... |
func FromString(s string) string {
g := Generator{
Hash: crc32.NewIEEE(),
Words: defaultWords,
}
res, err := g.FromString(s)
if err != nil {
panic(err)
}
return res
} | [
1.523784875869751,
0.58650803565979,
0.1564113348722458,
-0.3692505359649658,
-0.6591358780860901,
0.34826815128326416,
-0.27241382002830505,
-0.44218286871910095,
-0.08059573918581009,
0.4149479866027832,
0.23220773041248322,
-0.08053160458803177,
-0.10071390867233276,
-0.6165919899940491... |
func toBase(bi *big.Int, destBase []string) string {
// Hack in order to "clone" the big.Int and avoid changing it.
src := big.NewInt(0)
src.Add(bi, big.NewInt(0))
if big.NewInt(0).Cmp(src) == 0 {
return destBase[0]
}
var digits []string
numericBase := big.NewInt(int64(len(destBase)))
// Keep going while b... | [
-0.8070645928382874,
-0.5745614767074585,
0.9074894785881042,
-0.35772913694381714,
0.038406528532505035,
-0.4907184839248657,
0.11756259202957153,
-0.26451513171195984,
-0.013643954880535603,
1.6144912242889404,
-0.2157895565032959,
0.23005840182304382,
-0.22624912858009338,
-0.2728489339... |
func (e EmployeeController) GetEmployees(c echo.Context) error {
result, err := e.EmpService.GetEmp()
if err != nil {
response.Code = utility.CodeFailed
response.Message = utility.ResponseFailed
response.Data = err
}
response.Code = utility.CodeSuccess
response.Message = utility.ResponseSuccess
response.Da... | [
-1.080310344696045,
-0.2374870330095291,
0.7476311326026917,
0.05214330926537514,
0.5732271671295166,
0.15201281011104584,
-0.470600962638855,
0.36100131273269653,
0.2334556132555008,
0.3784829080104828,
-0.7199141383171082,
0.8368993401527405,
-1.0957739353179932,
0.6721272468566895,
-0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.