text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func GetBusLocation(LicenseNo string)(models.Location, error){
var result models.Location
err := getLocationStmt.QueryRow(LicenseNo).Scan(
&result.Latitude,
&result.Longitude,
&result.Heading,
&result.Speed)
if err != nil{
return result, err
}
return result, nil
} | [
-0.47043120861053467,
0.3322533369064331,
0.5483625531196594,
0.5493128299713135,
-0.31672728061676025,
-0.6044456362724304,
1.3671875,
0.5394784808158875,
-0.30428144335746765,
-0.46588966250419617,
-0.45644626021385193,
0.15389756858348846,
-0.9044957756996155,
0.1842249035835266,
0.66... |
func GetBusAttributes(LicenseNo string)(models.Attributes, error){
var result models.Attributes
err := DB.QueryRow("SELECT PathNo, AC, Availability FROM busattributes WHERE LicenseNo=?", LicenseNo).Scan(
&result.PathNo,
&result.AC,
&result.Availability,
)
if err != nil{
return result, err
}
return result,... | [
-0.26922884583473206,
-0.11184350401163101,
0.3196932375431061,
0.6925151944160461,
-0.45672300457954407,
0.12931112945079803,
0.2711697518825531,
1.5860546827316284,
-0.6276713609695435,
0.12325851619243622,
-0.46674439311027527,
0.06487927585840225,
-1.3761342763900757,
0.418980747461318... |
func CreateBus(bus models.Bus)(int64, error){
tx, err := DB.Begin()
if err != nil {
return 0, err
}
var result, result2 sql.Result
result, err = tx.Exec("INSERT INTO buslocation (LicenseNo, Latitude, Longitude, Speed, Heading) VALUES(?,?,?,?,?) ",
bus.LicenseNo,
bus.Location.Latitude,
bus.Location.Longitu... | [
-0.7922645211219788,
0.13156120479106903,
0.9430123567581177,
0.13727624714374542,
-0.13582299649715424,
0.37896183133125305,
1.0542454719543457,
0.7438477277755737,
-0.20914696156978607,
-0.25971999764442444,
-0.2649978697299957,
-0.7396034002304077,
-1.139074444770813,
0.4984846413135528... |
func New(credentials config.UserCredential) *RestAPI {
return &RestAPI{credentials: credentials}
//var api = new(RestAPI)
//api.credentials = credentials
//return api
} | [
-0.02420216053724289,
-1.6060075759887695,
0.184810608625412,
0.24116607010364532,
-1.2839875221252441,
0.6260531544685364,
-1.1166729927062988,
0.1582425832748413,
0.04855845868587494,
-0.4412824213504791,
-1.0867702960968018,
0.3978276252746582,
-0.4235830008983612,
0.05708961561322212,
... |
func (api *RestAPI) GetRelease(epicID string) ([]ReleaseItem, error) {
results := []ReleaseItem{}
issue, err := api.getIssue(epicID)
if err != nil {
return results, err
}
scanner := bufio.NewScanner(strings.NewReader(issue.Fields.Description.(string)))
for scanner.Scan() {
line := strings.ToLower(scanner.Tex... | [
-0.955558180809021,
-0.05972432717680931,
0.5612533688545227,
0.7801694273948669,
0.34100577235221863,
-0.6748162508010864,
-0.9462707042694092,
-0.002253750804811716,
-0.5282573103904724,
0.5955421328544617,
-0.11377861350774765,
-0.3782711625099182,
-0.6870245337486267,
0.553434908390045... |
func (api *RestAPI) CreateEpic(project string, summary string, releaseItems []ReleaseItem) (*Issue, error) {
i := issue{summary: summary, project: project1{key: project}, issuetype: issuetype{name: "epic"}}
b, _ := json.Marshal(i)
issue, err := api.createIssue(bytes.NewReader(b))
return issue, err
} | [
-0.7999330759048462,
-0.23912005126476288,
0.5573710203170776,
0.3681272268295288,
0.2525366246700287,
0.6645391583442688,
-0.9133762717247009,
-0.041735727339982986,
-0.9319839477539062,
0.8640775084495544,
-0.3702941834926605,
-0.11903377622365952,
-0.21458317339420319,
-0.89100152254104... |
func Load() (err error) {
conf := messaging.Config{
Address: brokers,
GroupID: groupID,
Topics: topics,
}
service := messaging.NewService(conf)
Client = new(ClientType)
Client.service = service
Client.Name = "Kafka session"
Client.Type = groupID
Client.ConnectionURLs = brokers
Client.topicProcessors... | [
0.20982010662555695,
-0.06314069777727127,
0.38335350155830383,
-0.5495874285697937,
0.019887808710336685,
-0.41460174322128296,
0.40764111280441284,
-0.3475739061832428,
-0.3791426420211792,
0.6813830137252808,
-0.15833894908428192,
0.6556990146636963,
-1.3254525661468506,
0.3324929177761... |
func RegisterProcessor(topic string, mp MessageProcessor) {
Client.topicProcessors[topic] = mp
} | [
-0.817009449005127,
-0.14805468916893005,
0.2802083194255829,
-0.7648916244506836,
-0.09396958351135254,
-0.01681404560804367,
-0.9368091225624084,
-0.09595107287168503,
-0.5102120637893677,
0.7418628334999084,
-0.3421792984008789,
0.8208038210868835,
-1.0897938013076782,
0.922887742519378... |
func StartProcessors() {
go func(Client *ClientType) {
var err error
for {
log.Println(" Kafka: Start listening")
err = Client.service.Listen(Client.messageDispatcher)
log.Printf("Kafka: Failed to start listening (err: %v)\nKafka: Reconnecting...", err)
time.Sleep(10 * time.Second)
}
}(Client)
} | [
0.40449419617652893,
-0.4051790237426758,
0.5388398170471191,
-0.409681111574173,
0.6083382368087769,
-0.2940481901168823,
0.32575154304504395,
0.254957377910614,
-0.24028687179088593,
0.26984110474586487,
0.1375589668750763,
1.2823328971862793,
-0.570920467376709,
0.34698665142059326,
0... |
func NewTSConnectionService() TSConnectionService {
return &defaultTSConnectionService{}
} | [
-0.6185719966888428,
-0.6211549043655396,
-0.27906206250190735,
-0.3496265113353729,
0.45052003860473633,
-0.7349333763122559,
-1.0095367431640625,
-1.263930320739746,
-0.14795240759849548,
0.2522925138473511,
-0.06900686025619507,
-0.48101216554641724,
-0.14759427309036255,
0.459335863590... |
func NewLicense() *License {
return &License{
xml.Name{},
true,
}
} | [
0.71025151014328,
-0.8110601305961609,
0.09727003425359726,
0.604527473449707,
-1.1460082530975342,
-0.6722766757011414,
-1.3131511211395264,
-0.4710943102836609,
0.5272400379180908,
-0.958712100982666,
-0.35228055715560913,
0.4882926940917969,
-0.862582802772522,
0.19752782583236694,
0.... |
func GetJobDefinitionSafeName(jobName string) string {
sb := strings.Builder{}
for _, c := range jobName {
if (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '_' {
sb.WriteRune(c)
} else {
sb.WriteRune('-')
}
}
if sb.Len() < 128 {
return sb.String()
}
... | [
-0.3479118347167969,
0.5484273433685303,
0.6961185336112976,
-0.3900780975818634,
-0.7549349069595337,
-0.21443620324134827,
-1.0045602321624756,
-0.542411744594574,
0.1964510828256607,
0.18010318279266357,
-0.33251914381980896,
-0.036029379814863205,
0.13329645991325378,
0.574628472328186... |
func New(path string) (*Storage, error) {
db, err := sql.Open(driver, path+"_cell.db")
if err != nil {
return nil, err
}
err = createTable(context.TODO(), db)
if err != nil {
return nil, err
}
err = createIndex(context.TODO(), db)
if err != nil {
return nil, err
}
logger, err := zap.NewProduction()
... | [
0.004701371770352125,
-0.18613016605377197,
0.5229809880256653,
0.7655429244041443,
-0.849385142326355,
-0.13020013272762299,
0.8964831233024597,
-0.4076646864414215,
-0.6570684909820557,
-0.12354643642902374,
0.020644955337047577,
-0.1877717673778534,
0.18948885798454285,
0.89388650655746... |
func InitRuntime(stderr io.Writer, p Paths, activate daemondefs.ActivateFunc) *eval.Evaler {
ev := eval.NewEvaler()
ev.SetLibDir(p.LibDir)
ev.AddModule("math", mathmod.Ns)
ev.AddModule("path", pathmod.Ns)
ev.AddModule("platform", platform.Ns)
ev.AddModule("re", re.Ns)
ev.AddModule("str", str.Ns)
ev.AddModule("f... | [
0.11549022048711777,
-0.632810115814209,
0.6275728940963745,
-0.21433141827583313,
-0.04172620177268982,
-0.41809430718421936,
-0.36968961358070374,
0.22228524088859558,
0.3292042315006256,
-0.22221320867538452,
-0.07710631191730499,
0.2577342987060547,
-0.5284243822097778,
0.7307991385459... |
func CleanupRuntime(stderr io.Writer, ev *eval.Evaler) {
daemon := ev.DaemonClient()
if daemon != nil {
err := daemon.Close()
if err != nil {
fmt.Fprintln(stderr,
"warning: failed to close connection to daemon:", err)
}
}
} | [
0.6790962815284729,
-1.0297850370407104,
0.6222941875457764,
-0.5358428955078125,
0.026589427143335342,
0.015073821879923344,
-0.11513465642929077,
0.06852814555168152,
-0.08614230155944824,
-0.6210446357727051,
1.0243457555770874,
-0.11497479677200317,
-0.36619025468826294,
1.692989587783... |
func adminmenuGroup() *xdominion.XTable {
t := xdominion.NewXTable("adminmenu_group", "adminmenu_grp_")
// Key of the accessgroup
t.AddField(xdominion.XFieldVarChar{Name: "key", Size: 30, Constraints: xdominion.XConstraints{
xdominion.XConstraint{Type: xdominion.PK},
}}) // PK
// Name of the group.
t.AddField... | [
-0.16964605450630188,
1.5810918807983398,
0.5801689028739929,
-0.9618427157402039,
-0.9347474575042725,
-0.4375278651714325,
-0.6672089099884033,
0.14298440515995026,
-0.6563659310340881,
0.5875877141952515,
-0.1352994740009308,
0.5849611759185791,
-0.5102828741073608,
0.5469827055931091,
... |
func SortMain() {
sortStructPersonByAge()
sortPersonByName()
} | [
-0.10744637995958328,
-0.7290879487991333,
0.290254145860672,
0.17349368333816528,
-0.5550482869148254,
0.5174978375434875,
0.5389218926429749,
-0.7379689812660217,
-0.8460559248924255,
-0.2782614231109619,
0.30997318029403687,
0.2168317288160324,
-0.19184164702892303,
0.7633220553398132,
... |
func NewRegenerateDeployKeyParams() *RegenerateDeployKeyParams {
return &RegenerateDeployKeyParams{
timeout: cr.DefaultTimeout,
}
} | [
-1.1992241144180298,
-0.030126672238111496,
0.24245595932006836,
0.6113445162773132,
0.050233982503414154,
-0.28767356276512146,
-0.024370893836021423,
0.7617327570915222,
-1.2597744464874268,
0.4406099319458008,
-1.0630711317062378,
0.17693781852722168,
-0.6717538833618164,
1.127186775207... |
func NewRegenerateDeployKeyParamsWithTimeout(timeout time.Duration) *RegenerateDeployKeyParams {
return &RegenerateDeployKeyParams{
timeout: timeout,
}
} | [
-0.22434374690055847,
-0.16904082894325256,
0.357907235622406,
0.37730997800827026,
-0.01005767472088337,
0.390419602394104,
-0.6585806012153625,
0.9106631875038147,
-0.9727256298065186,
1.6156052350997925,
-0.37613117694854736,
0.4805850684642792,
-0.5368325114250183,
0.9049769639968872,
... |
func NewRegenerateDeployKeyParamsWithContext(ctx context.Context) *RegenerateDeployKeyParams {
return &RegenerateDeployKeyParams{
Context: ctx,
}
} | [
-0.8469247221946716,
-0.18199187517166138,
0.4633994698524475,
-0.0689038559794426,
-0.07764190435409546,
0.7249786853790283,
-0.5914225578308105,
0.13242116570472717,
-0.6292400360107422,
1.2118102312088013,
-0.750544011592865,
0.18915987014770508,
-0.5326849222183228,
0.4101247191429138,... |
func NewRegenerateDeployKeyParamsWithHTTPClient(client *http.Client) *RegenerateDeployKeyParams {
return &RegenerateDeployKeyParams{
HTTPClient: client,
}
} | [
-0.704138994216919,
-0.3272911310195923,
0.5080711841583252,
0.19068582355976105,
0.3298364281654358,
0.4195684790611267,
0.2665378749370575,
0.4786103665828705,
-1.1138474941253662,
0.5228820443153381,
-0.7995763421058655,
0.05735843628644943,
-0.37650057673454285,
0.639785885810852,
-0... |
func (o *RegenerateDeployKeyParams) WithDefaults() *RegenerateDeployKeyParams {
o.SetDefaults()
return o
} | [
-0.6733138561248779,
0.38489940762519836,
0.0849587470293045,
-0.2937677204608917,
1.0165777206420898,
-0.6205100417137146,
-0.167936310172081,
-0.011780616827309132,
-0.4648863971233368,
0.21535436809062958,
-0.45687374472618103,
-0.5284494161605835,
-0.1776048243045807,
0.589453279972076... |
func (o *RegenerateDeployKeyParams) SetDefaults() {
// no default values defined for this parameter
} | [
-1.0587631464004517,
0.5290320515632629,
0.11191107332706451,
-0.4216462969779968,
1.5812082290649414,
-0.027190646156668663,
0.17452117800712585,
-0.043356217443943024,
-0.9795130491256714,
0.012268781661987305,
-0.5772666931152344,
0.1595725417137146,
-0.9733762145042419,
0.8077263832092... |
func (o *RegenerateDeployKeyParams) WithTimeout(timeout time.Duration) *RegenerateDeployKeyParams {
o.SetTimeout(timeout)
return o
} | [
-0.5506254434585571,
0.22675520181655884,
0.30982506275177,
-0.3207152783870697,
0.15876144170761108,
-0.016175074502825737,
-0.04420262575149536,
0.6490201950073242,
-0.4976167678833008,
1.2408078908920288,
-0.18978679180145264,
0.5044710636138916,
0.32096222043037415,
0.8073482513427734,... |
func (o *RegenerateDeployKeyParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
} | [
-0.917678952217102,
0.34193891286849976,
0.1641981154680252,
-0.3621997535228729,
0.7118135094642639,
0.4160904288291931,
0.013488514348864555,
0.9644544124603271,
-0.884762704372406,
1.0840702056884766,
-0.12716546654701233,
0.5392988920211792,
-0.27174344658851624,
1.1030197143554688,
... |
func (o *RegenerateDeployKeyParams) WithContext(ctx context.Context) *RegenerateDeployKeyParams {
o.SetContext(ctx)
return o
} | [
-1.3512367010116577,
0.11955061554908752,
0.34221017360687256,
-0.48430582880973816,
-0.07087903469800949,
0.14654730260372162,
-0.1587732583284378,
-0.02335720881819725,
0.014393667690455914,
0.7220664024353027,
-0.49272048473358154,
0.47327423095703125,
-0.24180054664611816,
0.2791768908... |
func (o *RegenerateDeployKeyParams) SetContext(ctx context.Context) {
o.Context = ctx
} | [
-1.447575330734253,
0.30939674377441406,
0.07943578064441681,
-0.2749658226966858,
0.6268126368522644,
0.37365639209747314,
0.05367505922913551,
0.23090432584285736,
-0.0473620630800724,
0.5747976899147034,
-0.4865991473197937,
0.48725268244743347,
-0.6661003828048706,
0.5608373284339905,
... |
func (o *RegenerateDeployKeyParams) WithHTTPClient(client *http.Client) *RegenerateDeployKeyParams {
o.SetHTTPClient(client)
return o
} | [
-1.005979061126709,
-0.5383541584014893,
0.34443268179893494,
-0.5586481094360352,
0.21472325921058655,
-0.06979850679636002,
0.6021541953086853,
0.037649210542440414,
-0.8055180907249451,
0.003710295772179961,
-0.4830220639705658,
0.19497092068195343,
0.3251981735229492,
0.232577830553054... |
func (o *RegenerateDeployKeyParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
} | [
-0.6805036067962646,
-0.2014385610818863,
0.2370908260345459,
-1.0024774074554443,
0.19921539723873138,
-0.1559658795595169,
0.7931734919548035,
0.13419146835803986,
-1.2263745069503784,
0.12017861753702164,
-0.5096685290336609,
0.47234997153282166,
-0.3957889974117279,
0.22690142691135406... |
func (o *RegenerateDeployKeyParams) WithImpersonateGroup(impersonateGroup []string) *RegenerateDeployKeyParams {
o.SetImpersonateGroup(impersonateGroup)
return o
} | [
-1.193682312965393,
0.2226192057132721,
0.24044205248355865,
0.2753039598464966,
-0.21106459200382233,
0.03191811591386795,
-0.2849096655845642,
0.05396941304206848,
-0.33701345324516296,
1.0914366245269775,
-0.26209962368011475,
0.40394437313079834,
-0.8010109663009644,
0.7928287982940674... |
func (o *RegenerateDeployKeyParams) SetImpersonateGroup(impersonateGroup []string) {
o.ImpersonateGroup = impersonateGroup
} | [
-1.5555915832519531,
0.2534855306148529,
0.3340926766395569,
-0.16390635073184967,
-0.1162634789943695,
0.2607265114784241,
0.02974000573158264,
0.3577016294002533,
-0.6162277460098267,
1.2068690061569214,
-0.6415736675262451,
0.7485654950141907,
-1.5262328386306763,
0.9134174585342407,
... |
func (o *RegenerateDeployKeyParams) WithImpersonateUser(impersonateUser *string) *RegenerateDeployKeyParams {
o.SetImpersonateUser(impersonateUser)
return o
} | [
-0.8279540538787842,
-0.0018607659731060266,
0.43836674094200134,
0.7321562170982361,
-0.35953542590141296,
0.035129059106111526,
0.12382802367210388,
0.2821018695831299,
-0.5928859114646912,
0.2743712365627289,
-0.5530229210853577,
0.2746528089046478,
-0.38013145327568054,
0.1982851773500... |
func (o *RegenerateDeployKeyParams) SetImpersonateUser(impersonateUser *string) {
o.ImpersonateUser = impersonateUser
} | [
-1.3729783296585083,
-0.026905454695224762,
0.5112060904502869,
0.5050873160362244,
-0.21321356296539307,
0.38031789660453796,
0.4723028540611267,
0.5213019251823425,
-0.9591376781463623,
0.3815929591655731,
-0.801415205001831,
0.5731282830238342,
-1.3288183212280273,
0.1704559326171875,
... |
func (o *RegenerateDeployKeyParams) WithAppName(appName string) *RegenerateDeployKeyParams {
o.SetAppName(appName)
return o
} | [
-0.881201446056366,
-0.24337893724441528,
0.33640947937965393,
0.41366511583328247,
-0.32737886905670166,
-0.21762795746326447,
-0.07865503430366516,
0.45070019364356995,
-0.30782535672187805,
0.9613296985626221,
0.15472829341888428,
-0.7752645611763,
0.6784940361976624,
0.5432309508323669... |
func (o *RegenerateDeployKeyParams) SetAppName(appName string) {
o.AppName = appName
} | [
-1.3073205947875977,
-0.44337955117225647,
0.2590106129646301,
0.5150794386863708,
-0.2100653052330017,
0.28053081035614014,
0.026051705703139305,
0.5052471160888672,
-0.5563132762908936,
0.8625053763389587,
-0.22396597266197205,
-0.5636775493621826,
-0.16431471705436707,
1.063918828964233... |
func (o *RegenerateDeployKeyParams) WithRegenerateDeployKeyAndSecretData(regenerateDeployKeyAndSecretData *models.RegenerateDeployKeyAndSecretData) *RegenerateDeployKeyParams {
o.SetRegenerateDeployKeyAndSecretData(regenerateDeployKeyAndSecretData)
return o
} | [
-1.1492925882339478,
-0.4753974676132202,
0.4270585775375366,
0.1938975602388382,
0.38584089279174805,
0.42116042971611023,
-0.3742493689060211,
0.07196567207574844,
-0.39070597290992737,
0.423267126083374,
-1.050671100616455,
0.3793559968471527,
0.36541664600372314,
1.1999726295471191,
... |
func (o *RegenerateDeployKeyParams) SetRegenerateDeployKeyAndSecretData(regenerateDeployKeyAndSecretData *models.RegenerateDeployKeyAndSecretData) {
o.RegenerateDeployKeyAndSecretData = regenerateDeployKeyAndSecretData
} | [
-1.3706254959106445,
-0.5013082027435303,
0.39188745617866516,
-0.0060226223431527615,
0.5072294473648071,
0.5489580631256104,
-0.12578749656677246,
0.2592677175998688,
-0.5281108617782593,
0.41827526688575745,
-1.2239375114440918,
0.6887932419776917,
0.19294071197509766,
1.294459104537963... |
func (o *RegenerateDeployKeyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.ImpersonateGroup != nil {
// binding items for Impersonate-Group
joinedImpersonateGroup := o.bindParamImpersonateGroup(r... | [
-1.5708128213882446,
-0.22935259342193604,
0.9962613582611084,
-0.2901953160762787,
0.7512080073356628,
0.1297086626291275,
0.7638202905654907,
0.22874324023723602,
-0.8395060896873474,
0.5272066593170166,
-0.008156125433743,
0.5261281132698059,
-0.6410418152809143,
0.8994867205619812,
0... |
func (o *RegenerateDeployKeyParams) bindParamImpersonateGroup(formats strfmt.Registry) []string {
impersonateGroupIR := o.ImpersonateGroup
var impersonateGroupIC []string
for _, impersonateGroupIIR := range impersonateGroupIR { // explode []string
impersonateGroupIIV := impersonateGroupIIR // string as string
... | [
-1.1135603189468384,
-0.6347271800041199,
0.5849182605743408,
-0.20085489749908447,
-0.24664758145809174,
0.4258648753166199,
0.020312990993261337,
0.3052177131175995,
-0.3041630685329437,
1.0090364217758179,
0.03701012581586838,
0.7587705254554749,
-1.6311659812927246,
0.9751360416412354,... |
func RemoveJob(id int) bool {
mainCron.RemoveJob(func(e *antcron.Entry) bool {
if v, ok := e.Job.(*Job); ok {
if v.id == id {
return true
}
}
return false
})
return true
} | [
0.6728572845458984,
0.2910160720348358,
0.7138190269470215,
0.42144644260406494,
-0.43420884013175964,
-0.09471452236175537,
-0.5854350328445435,
0.42506250739097595,
-0.09977535903453827,
0.20353099703788757,
-0.20265939831733704,
-0.7733170390129089,
-0.6607239246368408,
0.34557637572288... |
func (pt *Point) SetValues(x, y float64) (int, int) {
pt.X = x
pt.Y = y
if pt.X > pt.Y {
pt.Label = 1
return 1, 0
} else {
pt.Label = -1
return 0, 1
}
} | [
-0.9456672668457031,
-0.25517579913139343,
0.5441966652870178,
-0.3252642750740051,
0.5131586790084839,
0.5053402185440063,
-0.6044526696205139,
-0.2591933608055115,
-0.8534635901451111,
0.21604758501052856,
-0.20028725266456604,
0.15407583117485046,
0.3952079117298126,
0.4999490976333618,... |
func NewStatic() *Static {
return &Static{
HomeView: views.NewFiles("bootstrap", "static/home"),
ContactView: views.NewFiles("bootstrap", "static/contact"),
FAQView: views.NewFiles("bootstrap", "static/faq"),
NotFoundView: views.NewFiles("bootstrap", "static/notfound"),
}
} | [
-0.29037564992904663,
0.05641557648777962,
0.10634689778089523,
0.8894608020782471,
-0.8752884864807129,
-0.47792524099349976,
0.5133588910102844,
-0.7020961046218872,
-0.3000078499317169,
-0.5654324889183044,
0.023862199857831,
0.32566937804222107,
1.3913358449935913,
0.588262140750885,
... |
func Translate(from, to, text string, engines []string) ([]byte, error) {
var results []*result
for _, e := range engines {
switch e {
case Google:
results = append(results, newResult(Google, googleTranslate(from, to, text)))
case Baidu:
results = append(results, newResult(Baidu, baiduTranslate(from, to,... | [
-1.2119054794311523,
-0.24005569517612457,
0.656311571598053,
-0.23103067278862,
-0.7559941411018372,
-1.0585675239562988,
-0.9097943305969238,
-0.014722849242389202,
-0.5675926804542542,
0.2897098660469055,
-0.8621987104415894,
-0.04033250734210014,
-0.38869306445121765,
-0.57453703880310... |
func googleTranslate(from, to, text string) string {
reqURL := fmt.Sprintf("http://translate.google.com/translate_a/single?client=gtx&sl=%s&tl=%s&dt=t&q=%s", from, to, url.QueryEscape(text))
req, err := http.NewRequest(http.MethodGet, reqURL, nil)
if err != nil {
log.Println(err)
return ""
}
req.Header.Set("Us... | [
-0.6564646363258362,
0.06956367939710617,
0.8706539869308472,
-0.20468415319919586,
-0.9280089139938354,
-0.3271804749965668,
-1.1225403547286987,
-0.9234941601753235,
-0.6774415373802185,
0.7963943481445312,
-0.9148884415626526,
0.7557781934738159,
-0.9846627116203308,
-0.2733044326305389... |
func baiduTranslate(from, to, text string) string {
if bdLang[from] != "" {
from = bdLang[from]
}
if bdLang[to] != "" {
to = bdLang[to]
}
res, err := c.Get("https://fanyi.baidu.com")
if err != nil {
log.Println(err)
return ""
}
body, err := ioutil.ReadAll(res.Body)
res.Body.Close()
if err != nil {
l... | [
-0.7216319441795349,
0.22025541961193085,
0.8783095479011536,
0.10487323254346848,
-0.8314348459243774,
-0.33507439494132996,
-0.8805590867996216,
-0.44972190260887146,
-0.6849151253700256,
-0.18653687834739685,
-1.0603469610214233,
0.6565104126930237,
-0.9296368360519409,
-0.2468512803316... |
func NewProfile(info profileutil.ProvisioningProfileInfoModel, content []byte) autocodesign.Profile {
return Profile{
attributes: appstoreconnect.ProfileAttributes{
Name: info.Name,
UUID: info.UUID,
ProfileContent: content,
Platform: getBundleIDPlatform(info.Type),
Expiration... | [
0.37668928503990173,
-0.7264068126678467,
0.3169475793838501,
0.6590911149978638,
-0.8583230376243591,
0.27461233735084534,
-0.9967265129089355,
-0.3290398120880127,
0.1076914370059967,
0.7077390551567078,
0.22151735424995422,
-0.6482187509536743,
-0.8417645692825317,
-0.16345033049583435,... |
func UnbufferedChannel() {
/*
bufferred channel would be c := make(chan int, 50)
unbufferred channel
*/
c := make(chan int)
go func() {
for i := 0; i < 10; i++ {
// put number onto channel
// code stops until the value is taken from the channel
// like a relay race
c <- i
}
}() // self executin... | [
0.4686751067638397,
0.1868593990802765,
0.7774198055267334,
-1.2152891159057617,
0.38472113013267517,
0.17171867191791534,
0.7775587439537048,
-0.4423786699771881,
-0.30362755060195923,
-0.7840197086334229,
-0.5693985819816589,
1.3472806215286255,
-0.14881610870361328,
0.8751067519187927,
... |
func getClient(k8sconfig string) (*kubernetes.Clientset, error) {
config, err := clientcmd.BuildConfigFromFlags("", k8sconfig)
if err != nil {
return nil, err
}
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
return nil, err
}
return clientset, nil
} | [
0.6423210501670837,
0.1183716207742691,
0.47364896535873413,
-0.14316634833812714,
0.2850585877895355,
-0.2831589877605438,
0.09324844181537628,
-0.8754209280014038,
-0.0690477043390274,
-0.04965883865952492,
0.14838552474975586,
0.8700574040412903,
-0.3319108784198761,
-0.4655809700489044... |
func rollingDeploy(clientset *kubernetes.Clientset, namespace, name, image string) error {
fmt.Printf("rolling upgrade : %s \n", name)
updateClient := clientset.AppsV1().Deployments(namespace)
retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error {
// Retrieve the latest version of Deployment befor... | [
-0.6381161212921143,
-0.17923001945018768,
0.745098352432251,
-0.11006905883550644,
-0.14334236085414886,
-0.30625858902931213,
-0.7676652073860168,
0.010144086554646492,
0.057344645261764526,
1.4786895513534546,
0.083737812936306,
0.32167744636535645,
-0.43352988362312317,
-0.027951482683... |
func rollingStateful(clientset *kubernetes.Clientset, namespace, name, image string) error {
fmt.Printf("rolling upgrade : %s \n", name)
updateClient := clientset.AppsV1().StatefulSets(namespace)
retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error {
// Retrieve the latest version of Deployment be... | [
-0.1930946260690689,
0.01661255769431591,
0.6338748931884766,
-0.23553074896335602,
-0.3928651809692383,
-0.27031540870666504,
-0.8800442218780518,
-0.0492936410009861,
0.402480810880661,
1.6276824474334717,
-0.2852330505847931,
0.7692919969558716,
0.0653194859623909,
-0.11484568566083908,... |
func Merge(origData, fixedData []byte) ([]byte, error) {
origYaml, err := unmarshal(origData)
if err != nil {
return nil, err
}
fixedYaml, err := unmarshal(fixedData)
if err != nil {
return nil, err
}
// Create a new document node that contains the merged maps for the original and fixed yaml
mergedYaml :=... | [
-0.3171137273311615,
-0.4328693151473999,
0.7444796562194824,
-0.4442915618419647,
-0.4509213864803314,
-0.10917868465185165,
-0.4994468688964844,
0.9937465190887451,
-0.26560497283935547,
-0.6025232076644897,
-0.13532152771949768,
0.8603081703186035,
-0.8965749144554138,
-0.13513070344924... |
func mergeMaps(orig, fixed *goyaml.Node) *goyaml.Node {
merged := shallowCopyNode(orig)
origContent := orig.Content
fixedContent := fixed.Content
// Drop items from original if they are not in fixed
for i := 0; i < len(origContent); i += 2 {
origKey := origContent[i]
if isKeyInMap(origKey, fixed) {
origVal... | [
-0.4767727851867676,
-0.45931708812713623,
0.7760037779808044,
-0.424841970205307,
-0.27251920104026794,
-0.3529036045074463,
-0.49536842107772827,
0.3484072685241699,
-0.30863577127456665,
-0.2928963899612427,
-0.02335512638092041,
0.021966392174363136,
-0.21949364244937897,
-0.4050994217... |
func mergeSequences(sequenceKey string, orig, fixed *goyaml.Node) *goyaml.Node {
merged := shallowCopyNode(orig)
origContent := orig.Content
fixedContent := fixed.Content
// Drop items from original if they are not in fixed
for _, origItem := range origContent {
if isItemInSequence(sequenceKey, origItem, fixed)... | [
-0.572799563407898,
-0.8482270240783691,
0.8652521371841431,
-0.535130500793457,
-0.5186373591423035,
-0.8095381259918213,
-0.3594806492328644,
0.2989773452281952,
0.4924212396144867,
0.36483529210090637,
-0.39216476678848267,
0.08195018023252487,
-0.5561952590942383,
-0.21649318933486938,... |
func equalValueForKey(findKey string, map1, map2 *goyaml.Node) bool {
if map1.Kind != goyaml.MappingNode || map2.Kind != goyaml.MappingNode {
return false
}
if val1, index1 := findValInMap(findKey, map1); index1 != -1 {
if val2, index2 := findValInMap(findKey, map2); index2 != -1 {
return deepEqual(val1, val... | [
-0.5988189578056335,
0.002074863063171506,
0.7250807881355286,
0.35024720430374146,
-0.35587260127067566,
0.11993435025215149,
-0.23839198052883148,
0.2561139762401581,
-1.0532207489013672,
0.3772765100002289,
0.03987281769514084,
0.30153876543045044,
0.0034633514005690813,
0.6246912479400... |
func isKeyInMap(findKey *goyaml.Node, mapNode *goyaml.Node) bool {
return findKeyInMap(findKey, mapNode) != -1
} | [
-0.3895752429962158,
-0.4854544699192047,
0.771198034286499,
0.08886947482824326,
-0.525871217250824,
0.02558324672281742,
-0.6381767392158508,
0.20357805490493774,
-0.41558417677879333,
0.8673264980316162,
0.19056081771850586,
0.781768798828125,
-0.8114991188049316,
0.3927897810935974,
... |
func findKeyInMap(findKey *goyaml.Node, mapNode *goyaml.Node) int {
if mapNode.Kind != goyaml.MappingNode {
return -1
}
children := mapNode.Content
for i := 0; i < len(children); i += 2 {
key := children[i]
if deepEqual(key, findKey) {
return i
}
}
return -1
} | [
-0.7797901034355164,
-0.2801682949066162,
0.9122818112373352,
0.00797687191516161,
-0.7210962176322937,
-0.25619661808013916,
0.5410094857215881,
0.2605298161506653,
-1.0917861461639404,
0.7733217477798462,
-0.005499542225152254,
0.6210867166519165,
-1.0465205907821655,
0.5786145329475403,... |
func findValInMap(key string, mapNode *goyaml.Node) (*goyaml.Node, int) {
findKey := &goyaml.Node{
Kind: goyaml.ScalarNode,
Value: key,
Tag: strTag,
}
keyIndex := findKeyInMap(findKey, mapNode)
if keyIndex == -1 {
return nil, -1
}
valIndex := keyIndex + 1
return mapNode.Content[valIndex], valIndex
} | [
-0.3959042429924011,
-0.4274482727050781,
0.6548349857330322,
-0.042619168758392334,
-1.0273410081863403,
-0.730453610420227,
-0.30913639068603516,
-0.14847655594348907,
-1.075505256652832,
0.4161889851093292,
0.11978356540203094,
0.4324260652065277,
-0.40987783670425415,
0.604595541954040... |
func isItemInSequence(sequenceKey string, findVal *goyaml.Node, sequenceNode *goyaml.Node) bool {
return findItemInSequence(sequenceKey, findVal, sequenceNode) != -1
} | [
-1.1072099208831787,
-0.7228288054466248,
0.5139198899269104,
0.6974366307258606,
-0.019241049885749817,
-0.9055807590484619,
-0.35246041417121887,
-0.07707773894071579,
-0.1207410991191864,
1.0944758653640747,
-0.2399844080209732,
0.39952078461647034,
-0.15704451501369476,
0.1787328720092... |
func findItemInSequence(sequenceKey string, findVal *goyaml.Node, sequenceNode *goyaml.Node) int {
children := sequenceNode.Content
for i, val := range children {
if sequenceItemMatch(sequenceKey, val, findVal) {
return i
}
}
return -1
} | [
-0.9972959160804749,
-0.9031779766082764,
0.6375106573104858,
0.475544810295105,
-0.6865552067756653,
-0.8056726455688477,
0.2326723039150238,
0.06904024630784988,
-0.9413836002349854,
0.7831262946128845,
-0.22460244596004486,
-0.03383396938443184,
-0.2944330871105194,
0.4233722686767578,
... |
func sequenceItemMatch(sequenceKey string, item1, item2 *goyaml.Node) bool {
if item1.Kind != item2.Kind {
return false
}
if sequenceKey == "" || item1.Kind != goyaml.MappingNode {
return deepEqual(item1, item2)
}
if idKey, ok := identifyingKey[sequenceKey]; ok {
return equalValueForKey(idKey, item1, item2... | [
-0.6072340607643127,
-0.728519082069397,
0.6597597002983093,
0.2895929515361786,
0.07536540925502777,
0.16902966797351837,
-0.36737674474716187,
0.48013579845428467,
-0.22634485363960266,
0.9871729612350464,
-0.20254188776016235,
0.3528638482093811,
-0.4584007263183594,
-0.5700106024742126... |
func shallowCopyNode(orig *goyaml.Node) *goyaml.Node {
return &goyaml.Node{
Kind: orig.Kind,
Style: orig.Style,
Tag: orig.Tag,
Value: orig.Value,
Anchor: orig.Anchor,
Alias: orig.Alias,
Content: []*goyaml.Node{},
HeadComment: orig.HeadComment,
LineComment: or... | [
0.08561534434556961,
-0.7910411953926086,
0.7207778692245483,
-1.6180152893066406,
-0.6932417750358582,
0.09944338351488113,
0.627224326133728,
0.2173057645559311,
-0.22035638988018036,
0.09644896537065506,
-0.4205580949783325,
1.4183921813964844,
1.1963404417037964,
-0.342326283454895,
... |
func (db *DB) ReserveSample(
ctx context.Context,
anchor []byte,
storageRadius uint8,
consensusTime uint64,
minBatchBalance *big.Int,
) (Sample, error) {
g, ctx := errgroup.WithContext(ctx)
chunkC := make(chan reserve.ChunkItem, 64)
allStats := &SampleStats{}
statsLock := sync.Mutex{}
addStats := func(stats S... | [
0.8282890319824219,
0.16556231677532196,
0.8211557269096375,
0.04286911338567734,
0.2577872574329376,
-0.4662037193775177,
-0.04996025562286377,
-0.6606306433677673,
0.1429198682308197,
-0.24447914958000183,
-0.22123104333877563,
0.28648409247398376,
-0.28613680601119995,
-0.11261904239654... |
func le(a, b swarm.Address) bool {
return bytes.Compare(a.Bytes(), b.Bytes()) == -1
} | [
0.40993207693099976,
-0.2695113718509674,
0.5536215901374817,
-0.7772014737129211,
-0.23576191067695618,
-0.42081156373023987,
-0.825507402420044,
-0.05834227055311203,
0.6929475665092468,
-0.4221292734146118,
0.0894344374537468,
0.15564556419849396,
-0.5924134850502014,
-0.669167816638946... |
func NewSecret(l int) string {
return gotp.RandomSecret(l)
} | [
-0.11141270399093628,
0.20526541769504547,
0.19534194469451904,
-0.3481220304965973,
-0.9875280857086182,
-0.06081484258174896,
-0.9940043091773987,
-1.1579022407531738,
0.2807970941066742,
0.19822104275226593,
-1.2665350437164307,
-0.46128788590431213,
-0.14058849215507507,
0.463148295879... |
func New(options Options, optFns ...func(*Options)) *Client {
options = options.Copy()
resolveRetryer(&options)
resolveHTTPClient(&options)
resolveHTTPSignerV4(&options)
resolveDefaultEndpointConfiguration(&options)
resolveIdempotencyTokenProvider(&options)
for _, fn := range optFns {
fn(&options)
}
c... | [
-0.10456758737564087,
-0.4918808043003082,
0.45202749967575073,
0.34958237409591675,
0.37743106484413147,
-0.3549700081348419,
-0.3356775641441345,
-0.13398396968841553,
-0.1523335576057434,
-0.3705427348613739,
-0.33648234605789185,
0.09506388753652573,
-0.852199375629425,
-0.782353043556... |
func (o Options) Copy() Options {
to := o
to.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions))
copy(to.APIOptions, o.APIOptions)
return to
} | [
-0.768068253993988,
-0.4275628924369812,
0.45563802123069763,
0.1106836348772049,
-0.12317126244306564,
0.6145467162132263,
0.5148385763168335,
-0.7190501689910889,
0.7782415747642517,
1.0081450939178467,
-0.1680728644132614,
0.019235383719205856,
-0.3618941605091095,
-0.3865775465965271,
... |
func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client {
opts := Options{
Region: cfg.Region,
Retryer: cfg.Retryer,
HTTPClient: cfg.HTTPClient,
Credentials: cfg.Credentials,
APIOptions: cfg.APIOptions,
}
resolveAWSEndpointResolver(cfg, &opts)
return New(opts, optFns...)
} | [
0.7687574028968811,
-0.6524169445037842,
0.310279905796051,
-0.699494481086731,
-1.1671768426895142,
-0.2326151430606842,
-0.36159488558769226,
-0.3413831889629364,
0.09879530221223831,
0.2047087699174881,
-1.001644492149353,
0.5737364292144775,
0.3992255926132202,
-0.1601877510547638,
-... |
func (p *plugin) analyzeSourceFiles() error {
for _, f := range p.request.GetProtoFile() {
var generate bool
for _, g := range p.request.GetFileToGenerate() {
if g == f.GetName() {
generate = true
break
}
}
if generate {
if err := p.analyzeFile(f); err != nil {
return fmt.Errorf("failed t... | [
-0.8896390199661255,
0.023958520963788033,
0.6550256013870239,
0.5517453551292419,
1.153973937034607,
-0.39491406083106995,
0.6195791959762573,
-0.115594781935215,
-0.5161166191101074,
-0.13927584886550903,
0.07197574526071548,
-1.048241138458252,
-0.8097688555717468,
1.1625733375549316,
... |
func (p *plugin) analyzeFile(f *descriptor.FileDescriptorProto) error {
if f.GetSyntax() != "proto3" {
return fmt.Errorf("unsupported syntax '%s', must be 'proto3'", f.GetSyntax())
}
file := goFile{structs: map[string]goStruct{}}
for _, m := range f.GetMessageType() {
if err := p.analyzeMessageType(file, []st... | [
0.2686058580875397,
0.4934915602207184,
0.906367301940918,
0.011228303425014019,
1.5900071859359741,
0.32067355513572693,
0.7980701923370361,
-0.02569551207125187,
-0.9551073312759399,
0.03512687236070633,
-0.03685951977968216,
-0.013693936169147491,
-0.3705911636352539,
1.1341806650161743... |
func (p *plugin) analyzeMessageType(file goFile, parents []string, message *descriptor.DescriptorProto) error {
s := goStruct{}
goMes := p.toGolangStructName(parents, message.GetName())
if p.xxxTags != nil {
s["XXX_NoUnkeyedLiteral"] = p.xxxTags
s["XXX_unrecognized"] = p.xxxTags
s["XXX_sizecache"] = p.xxxTags... | [
0.22064656019210815,
0.45864641666412354,
0.9189649224281311,
-0.44845569133758545,
0.6972464323043823,
-0.9799009561538696,
-0.2688790261745453,
-0.5790697932243347,
-0.7838919758796692,
0.3760182857513428,
-0.659807562828064,
-0.26438960433006287,
-0.017201950773596764,
1.403475761413574... |
func (p *plugin) concatTags(tags1 *structtag.Tags, tags2 *structtag.Tags) (*structtag.Tags, error) {
if tags1.Len() == 0 {
return tags2, nil
}
if tags2.Len() == 0 {
return tags1, nil
}
for _, t2 := range tags2.Tags() {
var found bool
for _, t1 := range tags1.Tags() {
if t1.Key == t2.Key {
if len(t1... | [
0.43346938490867615,
-0.03639812394976616,
0.8372799754142761,
0.06131407245993614,
0.01762850396335125,
-0.7444783449172974,
-1.4987000226974487,
-1.161289930343628,
-0.8427655100822449,
0.42076703906059265,
-0.15445007383823395,
0.2349252849817276,
-0.33869290351867676,
0.856980204582214... |
func (p *plugin) getExtension(opts proto.Message, ext *proto.ExtensionDesc) (string, error) {
if opts == nil {
return "", nil
}
if !proto.HasExtension(opts, ext) {
return "", nil
}
val, err := proto.GetExtension(opts, ext)
if err != nil {
return "", fmt.Errorf("failed to get extension: %s", err.Error())
... | [
0.3218390941619873,
0.095366932451725,
0.6475111246109009,
0.5771363973617554,
-0.2723020017147064,
-1.098968505859375,
0.3022659420967102,
-0.6676350831985474,
0.7404321432113647,
0.48047155141830444,
0.1537780612707138,
1.036982536315918,
-0.8905261754989624,
0.1698829084634781,
0.5728... |
func (formatter JsonFormatter) Format(fields entries.Fields, level string, message string) string {
formattedMetadata := make([]string, len(fields)+2)
index := 2
formattedMetadata[0] = formatStringMessageAsJson("level", level)
formattedMetadata[1] = formatStringMessageAsJson("message", message)
for key, value := ... | [
-0.2493211179971695,
-1.2030227184295654,
0.709260880947113,
-0.9545129537582397,
-0.08955052495002747,
-0.03276761248707771,
-0.7037514448165894,
-0.7289513945579529,
-1.2212846279144287,
0.5815714001655579,
0.8407376408576965,
1.0272067785263062,
0.19141219556331635,
0.7451968789100647,
... |
func NewJsonFormatter() Formatter {
return JsonFormatter{}
} | [
-0.9777280688285828,
-1.5411971807479858,
0.23129944503307343,
-0.4721750319004059,
-2.691232919692993,
-1.3237377405166626,
-1.0508606433868408,
-0.4621657431125641,
0.570173442363739,
-1.112636923789978,
-1.0474967956542969,
0.23760004341602325,
0.15503831207752228,
1.347641944885254,
... |
func Hello() string {
return "hello from utility"
} | [
1.202312707901001,
-0.47508352994918823,
0.6500808000564575,
0.47428908944129944,
-0.06308864057064056,
0.7551079988479614,
-0.026272978633642197,
0.7156847715377808,
-1.0937942266464233,
-0.40128186345100403,
-0.15055570006370544,
0.9172438383102417,
1.1838825941085815,
-0.643209755420684... |
func Adder(args ...int) (sum int) {
for i := range args {
sum += i
}
return
} | [
-0.49853551387786865,
-0.24152597784996033,
0.7472184300422668,
0.40326008200645447,
0.06987924873828888,
0.670862078666687,
0.07487410306930542,
-0.5913311839103699,
-0.3585304021835327,
-0.8527243137359619,
-0.016576796770095825,
0.11133349686861038,
-0.6445435881614685,
1.09410965442657... |
func intFromStr(s string) (int, bool) {
var (
foundNum bool
r int
)
for i := 0; i < len(s); i++ {
if s[i] >= '0' && s[i] <= '9' {
foundNum = true
r = r*10 + int(s[i]-'0')
} else if foundNum {
return r, true
}
}
if foundNum {
return r, true
}
return 0, false
} | [
-0.11002025753259659,
-0.8890078067779541,
0.6579418182373047,
-0.318734735250473,
-0.3669378459453583,
-0.04736221954226494,
0.5867835283279419,
0.2132491171360016,
-0.0939573124051094,
0.11764925718307495,
-0.4366331696510315,
-0.200540691614151,
-0.4043419659137726,
-0.15358956158161163... |
func hasSSE42Asm() bool | [
0.3544177711009979,
-0.8914247155189514,
0.35461747646331787,
-0.15537860989570618,
-0.41717100143432617,
-0.43687352538108826,
-0.17721164226531982,
0.09515194594860077,
0.42753809690475464,
-1.3248326778411865,
-0.6659299731254578,
-0.1586488038301468,
1.1389614343643188,
1.7214374542236... |
func unpackedNibbleLookupTinyInplaceSSSE3Asm(main, tablePtr unsafe.Pointer) | [
-0.6212633848190308,
0.14461563527584076,
0.3600541055202484,
0.2490772157907486,
0.030718857422471046,
-0.2850750684738159,
0.36806750297546387,
-0.27926456928253174,
1.079129695892334,
0.43898481130599976,
0.023992424830794334,
-0.6152467131614685,
0.03287860378623009,
-0.047619026154279... |
func init() {
if !hasSSE42Asm() {
panic("SSE4.2 required.")
}
bytesPerVec = 16
log2BytesPerVec = 4
} | [
0.8775426149368286,
0.05141664296388626,
0.2912199795246124,
0.035467810928821564,
-0.30959248542785645,
0.06506241858005524,
-0.009035584516823292,
-0.0761382207274437,
-0.06431227922439575,
-0.29903966188430786,
-0.6414900422096252,
0.7268357872962952,
0.03612025827169418,
1.007812976837... |
func BytesPerVec() int {
return bytesPerVec
} | [
0.23594409227371216,
0.22533755004405975,
0.5834022760391235,
-0.5055122375488281,
-0.065646231174469,
0.4943520426750183,
1.0218079090118408,
-0.2749170660972595,
-0.7792888283729553,
-0.7202877998352051,
-0.6933042407035828,
0.5319072008132935,
0.09832513332366943,
0.13247856497764587,
... |
func RoundUpPow2(val, alignment int) int {
return (val + alignment - 1) & (^(alignment - 1))
} | [
-0.35105597972869873,
-0.8180773258209229,
0.4816622734069824,
-0.08076760917901993,
-1.746840000152588,
0.3733743131160736,
-0.13765832781791687,
0.3955298364162445,
-0.25934889912605286,
0.4067414104938507,
0.6023784279823303,
0.38764989376068115,
0.06640388071537018,
0.09998027235269547... |
func DivUpPow2(dividend, divisor int, log2Divisor uint) int {
return (dividend + divisor - 1) >> log2Divisor
} | [
-0.7064754962921143,
-0.2863026261329651,
0.7753363251686096,
-0.09439843893051147,
-1.3350536823272705,
-0.19520176947116852,
0.18098875880241394,
-0.642861008644104,
-0.23352289199829102,
-0.216872900724411,
0.165395125746727,
0.6850372552871704,
0.5232429504394531,
0.38821637630462646,
... |
func MakeUnsafe(len int) []byte {
// Although no planned function requires more than
// RoundUpPow2(len+1, bytesPerVec) capacity, it is necessary to add
// bytesPerVec instead to make subslicing safe.
return make([]byte, len, len+bytesPerVec)
} | [
0.6947090029716492,
0.452663391828537,
0.5556684136390686,
-0.1892978549003601,
-0.717827320098877,
-0.7044199705123901,
0.013720454648137093,
-0.4961490333080292,
-0.28829506039619446,
-0.3910868763923645,
-1.1079514026641846,
0.3185902535915375,
-0.19143931567668915,
-0.18609142303466797... |
func RemakeUnsafe(bufptr *[]byte, len int) {
minCap := len + bytesPerVec
if minCap <= cap(*bufptr) {
gunsafe.ExtendBytes(bufptr, len)
return
}
// This is likely to be called in an inner loop processing variable-size
// inputs, so mild exponential growth is appropriate.
*bufptr = make([]byte, len, RoundUpPow2(... | [
0.35517382621765137,
0.15638338029384613,
0.4799388349056244,
0.09363440424203873,
-0.4555855989456177,
-0.3265896439552307,
-0.1895703375339508,
-0.390767365694046,
-0.262239545583725,
-0.35889679193496704,
-1.2294319868087769,
0.5809178948402405,
-0.7257475256919861,
-0.9450545310974121,... |
func ResizeUnsafe(bufptr *[]byte, len int) {
minCap := len + bytesPerVec
if minCap <= cap(*bufptr) {
gunsafe.ExtendBytes(bufptr, len)
return
}
dst := make([]byte, len, RoundUpPow2(minCap+(minCap/8), bytesPerVec))
copy(dst, *bufptr)
*bufptr = dst
} | [
0.09923595190048218,
0.8876338601112366,
0.6628418564796448,
0.09728788584470749,
-0.14429999887943268,
-0.04888336732983589,
-0.3379715085029602,
-0.4278656244277954,
0.038382887840270996,
-0.09377890825271606,
-0.9285710453987122,
0.20904932916164398,
-0.7931850552558899,
-0.765767157077... |
func XcapUnsafe(bufptr *[]byte) {
// mid-stack inlining isn't yet working as I write this, but it should be
// available soon enough:
// https://github.com/golang/go/issues/19348
ResizeUnsafe(bufptr, len(*bufptr))
} | [
0.5236105918884277,
0.7739055156707764,
0.6078013777732849,
0.3732742369174957,
-0.3417781591415405,
-1.093900203704834,
0.15611174702644348,
-0.21024005115032196,
-0.013604044914245605,
0.6537094116210938,
-1.3062735795974731,
0.13062037527561188,
-0.7020753622055054,
-0.6502662301063538,... |
func Memset8(dst []byte, val byte) {
// This is ~2-8% slower than the unsafe version.
dstLen := len(dst)
if dstLen < BytesPerWord {
for pos := range dst {
dst[pos] = val
}
return
}
dstHeader := (*reflect.SliceHeader)(unsafe.Pointer(&dst))
valWord := uintptr(0x0101010101010101) * uintptr(val)
nWordMinus1... | [
-0.37132060527801514,
0.4143901765346527,
0.3862484395503998,
-1.0920021533966064,
-1.1951252222061157,
-0.44313156604766846,
-0.2972739636898041,
-0.7591200470924377,
0.0174124613404274,
0.723737359046936,
-0.18065306544303894,
1.1492083072662354,
0.14614297449588776,
0.03230295702815056,... |
func UnpackedNibbleLookupInplace(main []byte, tablePtr *[16]byte) {
// May want to define variants of these functions which have undefined
// results for input values in [16, 128); this will be useful for
// cross-platform ARM/x86 code.
mainLen := len(main)
if mainLen < 16 {
// Tried copying to and from a [16]by... | [
-0.3308241665363312,
0.18838343024253845,
0.575980544090271,
-0.45933598279953003,
-0.659938395023346,
-0.13366518914699554,
0.4355994462966919,
0.11676177382469177,
0.41121333837509155,
1.0490049123764038,
0.09446769952774048,
-0.5708351135253906,
-0.44104453921318054,
-0.4507590532302856... |
func UnpackedNibbleLookup(dst, src []byte, tablePtr *[16]byte) {
srcLen := len(src)
if len(dst) != srcLen {
panic("UnpackedNibbleLookup() requires len(src) == len(dst).")
}
if srcLen < 16 {
for pos, curByte := range src {
if curByte < 128 {
curByte = tablePtr[curByte&15]
} else {
curByte = 0
}
... | [
-0.8525730967521667,
0.8042040467262268,
0.6619842052459717,
-0.9139682650566101,
-0.7759234309196472,
-0.43269258737564087,
0.19960829615592957,
-0.2489951103925705,
0.6055048108100891,
1.018093466758728,
-0.05614256486296654,
-0.046453651040792465,
0.4256190061569214,
-0.5286457538604736... |
func PackedNibbleLookup(dst, src []byte, tablePtr *[16]byte) {
// This takes ~15% longer than the unsafe function on the short-array
// benchmark.
dstLen := len(dst)
nSrcFullByte := dstLen >> 1
srcOdd := dstLen & 1
if len(src) != nSrcFullByte+srcOdd {
panic("PackedNibbleLookup() requires len(src) == (len(dst) +... | [
-0.5424551367759705,
0.7441822290420532,
0.8315660953521729,
-0.4949370324611664,
-0.9613677859306335,
-0.47136494517326355,
0.4315969944000244,
-0.6579461693763733,
0.619459867477417,
1.1107466220855713,
-0.12414060533046722,
0.3614581823348999,
0.3245643973350525,
-0.4288029968738556,
... |
func Interleave8(dst, even, odd []byte) {
// This is ~6-20% slower than the unsafe function on the short-array
// benchmark.
dstLen := len(dst)
evenLen := (dstLen + 1) >> 1
oddLen := dstLen >> 1
if (len(even) != evenLen) || (len(odd) != oddLen) {
panic("Interleave8() requires len(even) == len(dst) + 1) / 2, and... | [
-0.7415748834609985,
0.18547329306602478,
0.7331865429878235,
-0.8447456359863281,
-0.5836883783340454,
-0.11972670257091522,
-0.301409512758255,
-0.2668788731098175,
0.6040095686912537,
0.19547730684280396,
-0.13927477598190308,
0.5493696331977844,
-0.23768572509288788,
0.0500148199498653... |
func Reverse8Inplace(main []byte) {
mainHeader := (*reflect.SliceHeader)(unsafe.Pointer(&main))
reverse8InplaceSSSE3Asm(unsafe.Pointer(mainHeader.Data), mainHeader.Len)
} | [
-0.5214559435844421,
-0.10085564851760864,
0.456621915102005,
-1.478845477104187,
0.2912534177303314,
-0.08680520951747894,
-0.05856187641620636,
1.1308974027633667,
0.4882860779762268,
0.5807182788848877,
0.03262173756957054,
0.4899671673774719,
-1.297387719154358,
-0.14897875487804413,
... |
func Reverse8Unsafe(dst, src []byte) {
nByte := len(src)
if nByte < BytesPerWord {
// could use bswap32 on two uint32s if nByte in 4..7
nByteMinus1 := nByte - 1
for idx := 0; idx != nByte; idx++ {
dst[nByteMinus1-idx] = src[idx]
}
return
}
srcHeader := (*reflect.SliceHeader)(unsafe.Pointer(&src))
dstH... | [
-0.312110960483551,
0.4347791075706482,
0.876196026802063,
-0.9323548078536987,
-0.5494948625564575,
-0.9948844313621521,
-0.5727599263191223,
-0.06584645062685013,
0.3388737440109253,
0.7162838578224182,
-0.015282844193279743,
0.41572314500808716,
-0.47081324458122253,
-0.2957676351070404... |
func Reverse8(dst, src []byte) {
nByte := len(src)
if nByte != len(dst) {
panic("Reverse8() requires len(src) == len(dst).")
}
if nByte < BytesPerWord {
// could use bswap32 on two uint32s if nByte in 4..7
nByteMinus1 := nByte - 1
for idx := 0; idx != nByte; idx++ {
dst[nByteMinus1-idx] = src[idx]
}
... | [
-0.9216352105140686,
0.6049729585647583,
0.7815712690353394,
-0.8896520733833313,
-0.9032939076423645,
-0.7440157532691956,
-0.1354164034128189,
0.2446403205394745,
0.16780143976211548,
0.6707086563110352,
0.003439396619796753,
0.629432737827301,
-0.29621002078056335,
0.20403626561164856,
... |
func (m *ForumPostSearchResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateQuery(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | [
-0.23221741616725922,
-0.252886563539505,
-0.0643780380487442,
0.4597362279891968,
0.14610904455184937,
-0.7851783037185669,
0.4421393871307373,
-0.1764197200536728,
-0.0969521701335907,
-0.22427797317504883,
-0.2056577056646347,
-1.3675830364227295,
-1.3904509544372559,
0.0420102551579475... |
func info() string {
goVersion := runtime.Version()
tstamp := time.Now()
return fmt.Sprintf("Build: git={{VERSION}} go=%s date=%s", goVersion, tstamp)
} | [
-0.07948397845029831,
-0.6837687492370605,
0.4907896816730499,
-0.24201135337352753,
0.0338897779583931,
0.5331203937530518,
-0.79289710521698,
0.243925541639328,
-1.2728402614593506,
0.9436832070350647,
-0.3022606372833252,
0.5693840980529785,
0.32242462038993835,
0.4165106415748596,
0.... |
func main() {
//address is set to my metamask account right now
go getBalancePeriodically("0x6cA9a0F319eC632fc21d4A16998f750923a50B32")
//intiailize Pin settings
//currently set to relay pin that can switch off entire board
// if err := rpio.Open(); err != nil {
// fmt.Println(err)
// os.Exit(1)
// }
// de... | [
0.15349318087100983,
-0.1782693713903427,
1.2471001148223877,
-0.36906006932258606,
-0.17334935069084167,
0.8299157619476318,
0.7224935293197632,
-0.21349108219146729,
0.26841720938682556,
0.08109116554260254,
-0.19067640602588654,
0.3398100435733795,
-0.4503117501735687,
-0.31436219811439... |
func sendRawTransaction(_privateKey string, recipientAddress string, methodName string, value int64, argAmount string) {
//connect to ropsten through infura
ec, err := ethclient.Dial("https://ropsten.infura.io/")
if err != nil {
log.Fatal(err)
}
chainID := big.NewInt(3) //Ropsten
//private key of sender
//TO... | [
-0.3628128170967102,
0.003476595040410757,
1.100428581237793,
-0.26749783754348755,
-0.3055693507194519,
-0.5977475047111511,
0.12093773484230042,
-0.34952250123023987,
-0.12489160895347595,
0.6213825941085815,
-0.9355170130729675,
0.34567272663116455,
0.6311654448509216,
0.450533777475357... |
func Encode(value []byte) []byte {
var length int = len(value)
encoded := make([]byte, base64.URLEncoding.EncodedLen(length))
base64.URLEncoding.Encode(encoded, value)
return encoded
} | [
-0.25518670678138733,
0.48563164472579956,
0.3086182773113251,
0.8538063168525696,
0.22037354111671448,
0.2750060260295868,
-0.4659351408481598,
0.23523658514022827,
0.9925640821456909,
0.28883522748947144,
0.0319635383784771,
0.5141267776489258,
-0.5905545353889465,
0.8081613183021545,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.