text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (self *Template) Expand(value interface{}) (string, error) {
values, ismap := value.(Values)
if !ismap {
if m, ismap := struct2map(value); !ismap {
return "", errors.New("expected Values, struct, or pointer to struct")
} else {
return self.Expand(m)
}
}
var buf bytes.Buffer
for _, p := range self.... | [
-0.3074037432670593,
0.45086973905563354,
0.7891279458999634,
-0.016576172783970833,
-1.3040372133255005,
0.03333325311541557,
0.07883267104625702,
-0.4882524907588959,
0.5750280022621155,
-0.4851834177970886,
0.3298645615577698,
-0.7497973442077637,
-0.6343883872032166,
0.6061148047447205... |
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
} | [
-0.0011544028529897332,
-0.9698054194450378,
0.47790923714637756,
0.3947250545024872,
0.07442084699869156,
0.6267186403274536,
-0.015806810930371284,
0.38189634680747986,
-0.21145063638687134,
-0.15180832147598267,
-0.8481018543243408,
0.23681211471557617,
-0.21461717784404755,
-0.42537471... |
func CSVHeader(withVerification bool, sep rune) string {
res := []string{"Index", "Verbatim", "Name", "Start", "End",
"OddsLog10", "Cardinality", "AnnotNomenType", "WordsBefore", "WordsAfter"}
if withVerification {
verif := []string{"VerifMatchType", "VerifSortScore", "VerifEditDistance",
"VerifMatchedName", "... | [
0.11639469861984253,
-0.628221869468689,
0.5334342122077942,
0.8828539252281189,
-0.15597835183143616,
-0.1398133486509323,
-0.4410686790943146,
-0.582958459854126,
0.22093388438224792,
0.22022777795791626,
-0.43427085876464844,
0.5864257216453552,
-0.10769253224134445,
0.04429096356034279... |
func HandleRequest(db *sql.DB) {
routes := chi.NewRouter()
// Route for user API
routes.Get("/v1/users", initRetrieveResolver(db).GetAllUsers)
routes.Post("/v1/users/create-user", initCreateResolver(db).CreateUser)
// Route for relationship API
routes.Post("/v1/friend/create-friend", initCreateResolver(db).MakeFr... | [
-0.5193384885787964,
0.07228974997997284,
0.6066917181015015,
0.5820080041885376,
1.4293017387390137,
0.28115105628967285,
0.5816651582717896,
0.1877855360507965,
-0.844179093837738,
-0.4906446039676666,
0.19275088608264923,
-0.7874886989593506,
0.0398428812623024,
0.6315523982048035,
0.... |
func initRetrieveResolver(db *sql.DB) v1.RetrieveResolver {
return v1.RetrieveResolver{
UserService: userService.ServiceImpl{
CreateRepo: userRepo.RepositoryImpl{DB: db},
RetrieveRepo: userRepo.RepositoryImpl{DB: db},
},
RelationshipService: relationshipService.ServiceImpl{
CreateRepo: relationshipR... | [
-0.12823405861854553,
-0.015034780837595463,
0.5916571617126465,
-0.8153978586196899,
0.2590793967247009,
-0.06805221736431122,
-0.46017420291900635,
0.3011472523212433,
0.40449535846710205,
-0.9370822906494141,
-0.1916004717350006,
-0.057006724178791046,
-0.581575334072113,
0.391729176044... |
func initCreateResolver(db *sql.DB) v1.CreateResolver {
return v1.CreateResolver{
UserService: userService.ServiceImpl{
CreateRepo: userRepo.RepositoryImpl{DB: db},
RetrieveRepo: userRepo.RepositoryImpl{DB: db},
},
RelationshipService: relationshipService.ServiceImpl{
CreateRepo: relationshipRepo.Re... | [
-0.22319155931472778,
-0.08297552913427353,
0.762518584728241,
-0.5070422887802124,
0.367803156375885,
0.49743708968162537,
-0.32861217856407166,
-0.09480950981378555,
-0.3015150725841522,
-0.4788343906402588,
-0.22091634571552277,
0.12447531521320343,
-0.16509059071540833,
0.7450506091117... |
func matchingHooks(hooks []*Webhook, rawurl string) *Webhook {
link, err := url.Parse(rawurl)
if err != nil {
return nil
}
for _, hook := range hooks {
hookurl, err := url.Parse(hook.HookURL)
if err == nil && hookurl.Host == link.Host {
return hook
}
}
return nil
} | [
0.16317148506641388,
-0.1965179443359375,
0.5637412667274475,
0.5963309407234192,
0.14781202375888824,
0.14366915822029114,
-0.023603735491633415,
0.5756251215934753,
-0.3276910185813904,
-0.15189935266971588,
0.5582961440086365,
0.1822507679462433,
-0.6159803867340088,
-0.311519593000412,... |
func NewPlaylist() Playlist {
return Playlist{
Image: SC_IMAGE,
}
} | [
0.3951857388019562,
-0.6586022973060608,
-0.06635196506977081,
0.6094716191291809,
-0.7998217940330505,
-0.27051860094070435,
0.029317686334252357,
-0.1013268381357193,
1.1708617210388184,
0.27223148941993713,
-0.33161553740501404,
0.5014086961746216,
0.3180331289768219,
0.5523514747619629... |
func GetApplicationGatewayProbe(host *string, path *string) n.ApplicationGatewayProbe {
if host == nil {
host = to.StringPtr(tests.Host)
}
if path == nil {
path = to.StringPtr("/foo")
}
encodedHost := strings.TrimRight(base64.StdEncoding.EncodeToString([]byte(*host)), "=")
encodedPath := strings.TrimRight(ba... | [
0.6980569362640381,
-0.23611213266849518,
0.5682487487792969,
-0.5845114588737488,
-0.8960183262825012,
-0.04542047530412674,
-1.0835678577423096,
-0.3420068621635437,
-0.15009446442127228,
0.9083354473114014,
0.6276010870933533,
0.7994586229324341,
-1.000522255897522,
0.3748037815093994,
... |
func (m *SessionSummary) UnmarshalJSON(data []byte) (e error) {
model := struct {
DisplayName *string `json:"displayName"`
TimeUpdated *common.SDKTime `json:"timeUpdated"`
LifecycleDetails *string `json:"lifecycleDetails"`
Id ... | [
-0.6680104732513428,
-0.7264078855514526,
0.7979375123977661,
-1.1122643947601318,
-0.9048783183097839,
-0.19303381443023682,
0.24133647978305817,
-0.894913375377655,
0.8562518358230591,
0.6704274415969849,
-0.6862905025482178,
0.11602748930454254,
0.1745758056640625,
-0.04317980632185936,... |
func NewDecoder(r io.Reader) *Decoder {
return &Decoder{r: r}
} | [
0.41236820816993713,
-1.2986711263656616,
-0.13231340050697327,
-0.3115198612213135,
-1.807461142539978,
-0.1521621197462082,
-0.7929801344871521,
-0.4178348779678345,
0.528832733631134,
-1.1019976139068604,
-0.04217538982629776,
-0.5868752598762512,
0.1315595805644989,
1.0498700141906738,... |
func checkPermission(ctx context.Context, verb, secretName string) (bool, error) {
sar := map[string]any{
"apiVersion": "authorization.k8s.io/v1",
"kind": "SelfSubjectAccessReview",
"spec": map[string]any{
"resourceAttributes": map[string]any{
"namespace": kubeNamespace,
"verb": verb,
"... | [
-0.3962501287460327,
0.2877592444419861,
1.0960534811019897,
0.02923271618783474,
-0.6956990361213684,
0.2584441900253296,
-0.7744075655937195,
0.10131139308214188,
-0.14219121634960175,
1.2937618494033813,
0.61785888671875,
0.9082988500595093,
-1.284149169921875,
0.6337451934814453,
0.4... |
func findKeyInKubeSecret(ctx context.Context, secretName string) (string, error) {
req, err := http.NewRequest("GET", fmt.Sprintf("/api/v1/namespaces/%s/secrets/%s", kubeNamespace, secretName), nil)
if err != nil {
return "", err
}
resp, err := doKubeRequest(ctx, req)
if err != nil {
if resp != nil && resp.Sta... | [
-0.49025392532348633,
-0.13461017608642578,
0.5686365962028503,
-0.19000382721424103,
-0.4031776785850525,
-0.8890270590782166,
-0.8313482403755188,
-0.8714839816093445,
0.05619402974843979,
0.7177252769470215,
0.416490375995636,
0.8454899787902832,
-0.9850113987922668,
0.7565038800239563,... |
func storeDeviceInfo(ctx context.Context, secretName string, deviceID tailcfg.StableNodeID, fqdn string) error {
// First check if the secret exists at all. Even if running on
// kubernetes, we do not necessarily store state in a k8s secret.
req, err := http.NewRequest("GET", fmt.Sprintf("/api/v1/namespaces/%s/secre... | [
-0.5273486971855164,
0.3082553446292877,
0.7389726638793945,
-0.434339314699173,
0.37082213163375854,
-0.48127269744873047,
-0.5895972847938538,
-1.4535623788833618,
0.26532062888145447,
-0.20085319876670837,
-0.5725323557853699,
0.5383560061454773,
-0.41712987422943115,
0.7787159085273743... |
func deleteAuthKey(ctx context.Context, secretName string) error {
// m is a JSON Patch data structure, see https://jsonpatch.com/ or RFC 6902.
m := []struct {
Op string `json:"op"`
Path string `json:"path"`
}{
{
Op: "remove",
Path: "/data/authkey",
},
}
var b bytes.Buffer
if err := json.NewEnco... | [
-0.20850925147533417,
0.08397993445396423,
0.6432366967201233,
-0.12342707812786102,
0.43133240938186646,
-0.6626118421554565,
0.023344432935118675,
-0.6448470950126648,
0.10557078570127487,
0.4189567267894745,
-0.4994054138660431,
1.0125385522842407,
-0.4271218776702881,
0.880901455879211... |
func doKubeRequest(ctx context.Context, r *http.Request) (*http.Response, error) {
if kubeHTTP == nil {
panic("not in kubernetes")
}
r.URL.Scheme = "https"
r.URL.Host = kubeHost
r.Header.Set("Authorization", "Bearer "+kubeToken)
r.Header.Set("Accept", "application/json")
resp, err := kubeHTTP.RoundTrip(r)
i... | [
-0.8924800157546997,
-0.2250634878873825,
0.8899632096290588,
0.4136544167995453,
0.48002657294273376,
0.04532866179943085,
-0.6294459104537964,
-0.6076407432556152,
0.032128408551216125,
0.5707266926765442,
0.6084160208702087,
0.27195873856544495,
-0.15374594926834106,
0.7770519256591797,... |
func NewServer(name string, config *rest.Config, kubeConfig, certFile, keyFile string) (*Server, error) {
kubeClient, err := kubernetes.NewForConfig(config)
if err != nil {
return nil, err
}
return &Server{
name: name,
kubeClient: kubeClient,
kubeConfig: kubeConfig,
certFile: certFile,
keyFile:... | [
0.18858219683170319,
-1.2805579900741577,
0.531636118888855,
0.46319374442100525,
-0.8112724423408508,
0.6585716009140015,
-0.7596051692962646,
-0.026489071547985077,
-0.5238061547279358,
0.3520842492580414,
-0.689200222492218,
0.11519978940486908,
-0.8862764835357666,
0.024248994886875153... |
func (s *Server) Run(ctx context.Context) error {
var server *genericapiserver.GenericAPIServer
servingInfo := configv1.HTTPServingInfo{}
configdefaults.SetRecommendedHTTPServingInfoDefaults(&servingInfo)
servingInfo.ServingInfo.CertInfo.CertFile = s.certFile
servingInfo.ServingInfo.CertInfo.KeyFile = s.keyFile
... | [
-0.9188913702964783,
-0.23864535987377167,
0.7769155502319336,
-0.001695765065960586,
0.2647615969181061,
1.0239827632904053,
0.21079771220684052,
-0.10018157958984375,
-0.2559976875782013,
0.3291437327861786,
-0.39476263523101807,
0.7887065410614014,
-0.2753095030784607,
0.632818400859832... |
func (r *patternPainter) Paint(ss []raster.Span, done bool) {
b := r.im.Bounds()
for _, s := range ss {
if s.Y < b.Min.Y {
continue
}
if s.Y >= b.Max.Y {
return
}
if s.X0 < b.Min.X {
s.X0 = b.Min.X
}
if s.X1 > b.Max.X {
s.X1 = b.Max.X
}
if s.X0 >= s.X1 {
continue
}
const m = 1<<16... | [
-0.7218242287635803,
0.2547018826007843,
0.8599516153335571,
-0.49273890256881714,
-0.14022764563560486,
0.2523823082447052,
1.0748740434646606,
-0.9963324666023254,
0.9719985127449036,
-0.03802928701043129,
0.5878366231918335,
-0.24856527149677277,
-0.2142016440629959,
0.7328824996948242,... |
func StartNode(c *Config, peers []Peer) Node {
r := newRaft(c)
// become the follower at term 1 and apply initial configuration
// entries of term 1
r.becomeFollower(1, 0)
// Mark these initial entries as committed.
r.raftLog.committed = r.raftLog.lastIndex()
n := newNode()
n.logger = c.Logger
go n.run(r)
re... | [
0.19416964054107666,
0.354672908782959,
0.40015295147895813,
-0.22757849097251892,
0.2670419216156006,
-0.03330114111304283,
0.7286298274993896,
0.6794562935829163,
-0.14092238247394562,
0.7681229114532471,
0.06135103479027748,
0.9336093068122864,
-0.8333080410957336,
0.01635931245982647,
... |
func RestartNode(c *Config) Node {
r := newRaft(c)
n := newNode()
n.logger = c.Logger
go n.run(r)
return &n
} | [
0.2307351529598236,
0.3372913599014282,
0.39051318168640137,
-1.0072880983352661,
0.02289990894496441,
-0.4189335107803345,
0.19628244638442993,
0.8511002659797668,
-0.13398577272891998,
0.2430497258901596,
-0.3927958011627197,
1.3679265975952148,
-0.9293344020843506,
-0.8708735704421997,
... |
func (n *node) Tick() {
select {
case n.tickc <- struct{}{}:
case <-n.done:
default:
n.logger.Printf("A tick missed to fire. Node blocks too long!")
}
} | [
0.6883365511894226,
1.269439697265625,
0.39827707409858704,
0.022703561931848526,
0.6628082394599915,
0.02005958743393421,
1.0309298038482666,
-0.5529397130012512,
-0.7145852446556091,
0.05870220810174942,
-0.3738965392112732,
0.6194694638252258,
0.2117643505334854,
0.2762032151222229,
0... |
func (d *Dao) OnlineListBakCache(c context.Context) (rs []*model.OnlineArc, err error) {
conn := d.redisBak.Get(c)
defer conn.Close()
var values []byte
if values, err = redis.Bytes(conn.Do("GET", _onlineListKey)); err != nil {
if err == redis.ErrNil {
err = nil
log.Warn("OnlineListBakCache redis (%s) return... | [
-0.7732514142990112,
-0.2707831561565399,
0.3363775610923767,
0.38381174206733704,
-0.3840447962284088,
-0.29309067130088806,
-0.7971085906028748,
0.13397371768951416,
0.26332321763038635,
0.9883043169975281,
-1.0929392576217651,
-0.18929456174373627,
-0.3208928108215332,
0.833438992500305... |
func (d *Dao) SetOnlineListBakCache(c context.Context, data []*model.OnlineArc) (err error) {
conn := d.redisBak.Get(c)
defer conn.Close()
var bs []byte
if bs, err = json.Marshal(data); err != nil {
log.Error("SetOnlineListBakCache json.Marshal(%v) error(%v)", data, err)
return
}
if err = conn.Send("SET", _on... | [
-0.4899117052555084,
-0.22950154542922974,
0.875760018825531,
0.38112473487854004,
-0.15564340353012085,
-0.23433473706245422,
-0.7762285470962524,
0.6081029176712036,
-0.31847530603408813,
0.32548102736473083,
-1.800017237663269,
-0.114522285759449,
-0.18201987445354462,
1.100119233131408... |
func NewUserRepo(conf config.IConfig, dbInstances *db.Instances) UserRepoInterface {
return &UserRepo{config: conf, db: dbInstances.RnrMongoDB}
} | [
0.7066642642021179,
0.017362579703330994,
0.3283936381340027,
-0.22064916789531708,
-1.430757999420166,
-0.3403201401233673,
0.5428177118301392,
0.06647937744855881,
0.430287629365921,
0.5096964240074158,
-0.8152172565460205,
-0.08760532736778259,
-0.788964033126831,
-0.04991305619478226,
... |
func (ur *UserRepo) Insert(u models.User) error {
_, err := ur.db.InsertOne(userColNmae, u)
if err != nil {
return err
}
return nil
} | [
-0.696858823299408,
1.723505973815918,
0.3008077144622803,
0.1776624470949173,
0.3432866632938385,
0.8715850710868835,
0.8534845113754272,
0.7695141434669495,
-0.5901166796684265,
-0.3867722153663635,
-1.0463756322860718,
-0.9744856953620911,
-1.2736083269119263,
0.516335666179657,
0.018... |
func atomicSwapContract(pkhMe, pkhThem *[ripemd160.Size]byte, locktime int64, secretHash []byte) ([]byte, error) {
builder := txscript.NewScriptBuilder()
builder.AddOp(txscript.OP_IF) // if top of stack value is not False, execute. The top stack value is removed.
{
// require initiator's secret to be a known leng... | [
0.5374196171760559,
-0.02289855107665062,
0.9974043369293213,
0.37355002760887146,
-0.23084886372089386,
-0.48619315028190613,
-0.10000139474868774,
0.1273244470357895,
0.3356019854545593,
0.37134289741516113,
-0.20241811871528625,
0.09769615530967712,
-0.25394850969314575,
0.0351469479501... |
func BitDesc(bit uint) (desc string) {
return _bits[bit]
} | [
0.31933873891830444,
0.1707078516483307,
0.3223567008972168,
-0.7461103200912476,
-0.4594714939594269,
0.3608725666999817,
0.27819713950157166,
-1.2399414777755737,
-0.2833002805709839,
-0.7493069171905518,
0.38564687967300415,
0.9071416854858398,
0.5254026055335999,
0.5214346051216125,
... |
func UpFrom(ufID int8) string {
return _upFromTypes[ufID]
} | [
-0.43576812744140625,
-0.23217391967773438,
0.2129732072353363,
-0.40706294775009155,
-0.46586722135543823,
-0.4196142256259918,
0.7702853679656982,
0.01980024203658104,
0.37060752511024475,
0.26793918013572693,
0.031711746007204056,
-0.4062598645687103,
0.2870820164680481,
-0.559308826923... |
func openAndSub(templateFile string, p Plugin) (string, error) {
t, err := ioutil.ReadFile(templateFile)
if err != nil {
return "", err
}
return template.RenderTrim(string(t), p)
} | [
0.26145273447036743,
-0.7265453934669495,
0.4723150432109833,
-1.1752827167510986,
-1.4376975297927856,
0.19234226644039154,
0.08580856025218964,
1.469445824623108,
0.16670450568199158,
-0.2710980176925659,
-0.12892353534698486,
-0.40323272347450256,
-0.38531494140625,
-0.5430470705032349,... |
func SetClock(c Clock) {
currentClock.Store(&clockWrapper{c})
} | [
-0.2567822337150574,
0.6126905679702759,
0.1792154312133789,
0.3271845281124115,
-0.10704705119132996,
1.079305648803711,
0.8987380862236023,
0.30207639932632446,
1.0007734298706055,
-0.5192992091178894,
-0.835709810256958,
0.866248369216919,
-0.13711348176002502,
1.0911457538604736,
0.6... |
func CurrentClock() Clock {
return currentClock.Load().(*clockWrapper).clock
} | [
-0.028431536629796028,
-1.0085554122924805,
0.2461080700159073,
0.5137810707092285,
-0.59654700756073,
0.2804449200630188,
0.4802932143211365,
-0.2466305047273636,
0.6802317500114441,
0.13880836963653564,
0.42120161652565,
0.9779154658317566,
-0.18049627542495728,
0.5052108764648438,
0.4... |
func SetTickerCreator(tc TickerCreator) {
currentTickerCreator.Store(&tickerCreatorWrapper{tc})
} | [
-0.02786099910736084,
0.2695547640323639,
0.10275445878505707,
-0.24037694931030273,
-0.28195151686668396,
0.48118454217910767,
0.7676663994789124,
-0.4515703022480011,
-0.8794295191764832,
-1.0902886390686035,
-0.98072749376297,
-0.36418646574020386,
0.14324702322483063,
1.441556572914123... |
func CurrentTickerCreator() TickerCreator {
return currentTickerCreator.Load().(*tickerCreatorWrapper).tickerCreator
} | [
0.07266057282686234,
-0.632858395576477,
0.06594189256429672,
0.37208932638168335,
-0.5906821489334106,
0.16944535076618195,
0.5174381732940674,
-0.6427407264709473,
-0.6652001142501831,
-1.0435633659362793,
0.6194044947624207,
0.14177142083644867,
-0.3338801860809326,
1.1114765405654907,
... |
func FormatTimeMillis(tsMillis uint64) string {
return time.Unix(0, int64(tsMillis*UnixTimeUnitOffset)).Format(TimeFormat)
} | [
-0.007588749285787344,
-0.35909590125083923,
0.4453156888484955,
-0.36617574095726013,
-0.9190677404403687,
0.11281169950962067,
-1.6224843263626099,
-0.13698260486125946,
0.8254793286323547,
0.1360955834388733,
0.6050204634666443,
0.17500977218151093,
0.07908827811479568,
0.91804873943328... |
func FormatDate(tsMillis uint64) string {
return time.Unix(0, int64(tsMillis*UnixTimeUnitOffset)).Format(DateFormat)
} | [
0.6596032977104187,
0.12848971784114838,
0.4757051467895508,
-0.0015435165259987116,
-0.9181539416313171,
0.4127480387687683,
-1.2199327945709229,
-0.0053612240590155125,
0.7767049670219421,
-0.8971138000488281,
0.7773734331130981,
0.2558007836341858,
0.2714860439300537,
0.7906712889671326... |
func CurrentTimeMillis() uint64 {
return CurrentClock().CurrentTimeMillis()
} | [
-0.9361875057220459,
-0.4703935980796814,
0.2743147909641266,
0.4140315651893616,
-0.9920192360877991,
-0.35768628120422363,
-0.6633639931678772,
0.5313252806663513,
0.05235610902309418,
0.8364793658256531,
0.0840223953127861,
0.6679477095603943,
-0.8702757954597473,
1.0207048654556274,
... |
func CurrentTimeNano() uint64 {
return CurrentClock().CurrentTimeNano()
} | [
-1.1115882396697998,
-0.5160670280456543,
0.26934584975242615,
0.8248292207717896,
-1.0060381889343262,
-0.29429301619529724,
0.18222931027412415,
0.19839425384998322,
-0.7314786314964294,
1.1616544723510742,
-0.43373358249664307,
0.10512226074934006,
0.022812092676758766,
1.31805408000946... |
func Now() time.Time {
return CurrentClock().Now()
} | [
0.14943945407867432,
-0.5905880331993103,
0.399076372385025,
0.294831246137619,
-0.23446018993854523,
0.2849118709564209,
0.26251670718193054,
0.22923456132411957,
-0.9835710525512695,
0.253149151802063,
-0.6077075004577637,
0.24616284668445587,
-0.1047310158610344,
0.3421022891998291,
-... |
func Sleep(d time.Duration) {
CurrentClock().Sleep(d)
} | [
-0.12172097712755203,
1.0467638969421387,
0.11964689195156097,
-0.021209023892879486,
-0.6662725806236267,
1.261972188949585,
1.1195521354675293,
-0.5565747618675232,
-0.05805574357509613,
0.08492919057607651,
0.28397074341773987,
0.8586711883544922,
0.01130206510424614,
0.0979192405939102... |
func Decode2(encoded []int) []int {
var l int = len(encoded)
var res []int = make([]int, l+1)
var xor int = 0
var total int = 0
for i := 1; i <= l+1; i++ {
total ^= i
}
for i := 0; i < l; i += 2 {
xor = xor ^ encoded[i]
}
res[l] = total ^ xor
for i := l - 1; i >= 0; i-- {
res[i] = res[i+1] ^ encoded[i]
... | [
-0.47879791259765625,
-0.33955127000808716,
0.963495135307312,
0.6329110860824585,
-1.0624902248382568,
-0.7842068076133728,
0.24673213064670563,
-0.008355055004358292,
0.5488335490226746,
0.15064504742622375,
-1.5800410509109497,
0.7459165453910828,
-0.378849059343338,
0.22624993324279785... |
func RegisterRoutes(srv *server.Server, accessGroup string, assets *rpcs.Assets) {
if !srv.Options.Prod {
srv.Routes.Static("/static", nil, http.Dir("./static"))
}
ui := UI{
prod: srv.Options.Prod,
version: srv.Options.ImageVersion(),
assets: assets,
}
mw := router.NewMiddlewareChain(
templates.Wit... | [
-0.7650139331817627,
0.34360072016716003,
0.5069883465766907,
-0.4722464978694916,
0.4765688478946686,
-0.6196942329406738,
0.2785361409187317,
-0.21865050494670868,
0.12499015033245087,
-0.30504754185676575,
0.8738703727722168,
0.7899414896965027,
0.04644034802913666,
0.6456736326217651,
... |
func (ui *UI) prepareTemplates() *templates.Bundle {
return &templates.Bundle{
Loader: templates.FileSystemLoader("templates"),
DebugMode: func(context.Context) bool { return !ui.prod },
DefaultTemplate: "base",
DefaultArgs: func(ctx context.Context, e *templates.Extra) (templates.Args, error) {... | [
-0.4660581350326538,
0.09177332371473312,
0.5583243370056152,
-0.18064016103744507,
-0.5891587138175964,
-0.46435943245887756,
-0.5571836233139038,
-0.19719383120536804,
0.8262497782707214,
0.3855455219745636,
-0.2231191098690033,
-0.5076703429222107,
-0.3845907151699066,
0.099661640822887... |
func checkAccess(accessGroup string) router.Middleware {
return func(ctx *router.Context, next router.Handler) {
// Redirect anonymous users to login first.
if auth.CurrentIdentity(ctx.Context) == identity.AnonymousIdentity {
loginURL, err := auth.LoginURL(ctx.Context, ctx.Request.URL.RequestURI())
if err !=... | [
-0.3249230980873108,
0.1510881632566452,
0.7093685865402222,
0.2472325712442398,
-0.7740070819854736,
0.11719444394111633,
0.4461067318916321,
-0.2978419363498688,
0.29732757806777954,
0.4538015127182007,
1.8515923023223877,
0.7052776217460632,
-0.1976148933172226,
0.0017982391873374581,
... |
func wrapErr(h func(*router.Context) error) router.Handler {
return func(ctx *router.Context) {
if err := h(ctx); err != nil {
replyErr(ctx, err)
}
}
} | [
-0.28548234701156616,
-0.26160892844200134,
0.43195825815200806,
-0.5486330986022949,
-1.1276943683624268,
0.7875457406044006,
-0.2948542833328247,
0.5792407989501953,
0.9764097929000854,
0.18595781922340393,
0.6693795919418335,
0.07729552686214447,
0.5399237275123596,
0.1961427927017212,
... |
func replyErr(ctx *router.Context, err error) {
s, _ := status.FromError(err)
message := s.Message()
if message != "" {
// Convert the first rune to upper case.
r, n := utf8.DecodeRuneInString(message)
message = string(unicode.ToUpper(r)) + message[n:]
} else {
message = "Unspecified error" // this should n... | [
-0.261772096157074,
0.2103012204170227,
0.5215988755226135,
-0.3913354277610779,
-0.26888415217399597,
0.13914017379283905,
-0.2696070671081543,
0.5890728831291199,
0.6132025122642517,
-0.09910836815834045,
0.6057018637657166,
0.22839172184467316,
-0.20609232783317566,
0.8546662330627441,
... |
func New(indexer cache.Store) *Manager {
logger := &bgplog.Logger{Entry: log}
c := &metallbctl.Controller{
Client: bgpk8s.New(logger.Logger),
IPs: metallballoc.New(),
}
f, err := os.Open(option.Config.BGPConfigPath)
if err != nil {
log.WithError(err).Fatal("Failed to open BGP config file")
}
defer f.Cl... | [
0.02240990474820137,
-0.6854086518287659,
0.3438243269920349,
-0.024346811696887016,
-0.5568324327468872,
-0.17667505145072937,
-0.21533945202827454,
0.07746735215187073,
-0.17736676335334778,
0.35611817240715027,
0.21144646406173706,
0.5011897683143616,
-0.18075111508369446,
0.65237414836... |
func (c *Manager) Logger() *bgplog.Logger {
return c.logger
} | [
0.4309625029563904,
-0.46889862418174744,
0.21247749030590057,
-0.16633816063404083,
-0.0789010301232338,
0.4071693420410156,
-0.22789539396762848,
0.6964054703712463,
0.2839165925979614,
-0.539165735244751,
0.36682605743408203,
0.35246169567108154,
-0.49558359384536743,
1.2334215641021729... |
func BuildBasePlan(pkgType resource.PkgType) plan.Resource {
b := plan.NewBuilder()
switch pkgType {
case resource.PkgTypeRPM, resource.PkgTypeRHEL:
// Package manager features
b.AddResource("install:yum-utils", &resource.RPM{Name: "yum-utils"})
b.AddResource("install:yum-versionlock", &resource.RPM{Name: "yu... | [
-0.5094690918922424,
-0.4818614721298218,
0.6220277547836304,
0.08923668414354324,
-0.5454453229904175,
0.2333833873271942,
-0.23478378355503082,
0.07580281049013138,
0.6801557540893555,
-0.10898889601230621,
-0.2774953842163086,
-0.1816367655992508,
-0.43018317222595215,
0.306708037853240... |
func BuildConfigPlan(files []*resource.File) plan.Resource {
b := plan.NewBuilder()
for idx, file := range files {
b.AddResource(fmt.Sprintf("install:config-file-%d", idx), file)
}
p, err := b.Plan()
if err != nil {
log.Fatalf("%v", err)
}
return &p
} | [
-0.5325612425804138,
-0.3509427309036255,
0.30859148502349854,
0.3689035475254059,
-0.14486542344093323,
0.38664719462394714,
0.37638458609580994,
0.798481822013855,
-0.7045098543167114,
0.3472074866294861,
-0.07887380570173264,
-1.1126675605773926,
-0.698954164981842,
0.47493842244148254,... |
func BuildConfigMapPlan(manifests map[string][]byte, namespace string) plan.Resource {
b := plan.NewBuilder()
for name, manifest := range manifests {
remoteName := fmt.Sprintf("config-map-%s", name)
b.AddResource("install:"+remoteName, &resource.KubectlApply{Filename: object.String(remoteName), Manifest: manifest... | [
-0.4766141474246979,
-0.9961209893226624,
0.40003907680511475,
0.12903718650341034,
-0.8050594329833984,
0.6731465458869934,
-0.9188382625579834,
0.8327335715293884,
0.33209988474845886,
0.5749142169952393,
0.036913368850946426,
-0.48153868317604065,
-0.32383978366851807,
0.499267309904098... |
func BuildCNIPlan(cni string, manifests [][]byte) plan.Resource {
b := plan.NewBuilder()
b.AddResource(
"install-cni:apply-manifests",
&resource.KubectlApply{Manifest: manifests[0], Filename: object.String(cni + ".yaml")},
)
if len(manifests) == 2 {
b.AddResource(
"install-cni:apply-manifests-ds",
&res... | [
0.35611265897750854,
-0.5254721641540527,
0.3348037004470825,
0.36305707693099976,
-0.9800121188163757,
-0.05029160901904106,
-0.6249678730964661,
0.8634012937545776,
0.7648111581802368,
-0.3598228991031647,
0.13948535919189453,
-0.008696629665791988,
-0.2646208703517914,
0.096773251891136... |
func BuildCRIPlan(ctx context.Context, criSpec *existinginfrav1.ContainerRuntime, cfg *envcfg.EnvSpecificConfig, pkgType resource.PkgType) plan.Resource {
b := plan.NewBuilder()
if criSpec.Kind != "docker" {
log.Fatalf("Unknown CRI - %s", criSpec.Kind)
}
IsDockerOnCentOS := false
// Docker runtime
switch pkg... | [
0.7041387557983398,
-0.21145418286323547,
0.656699538230896,
0.921232283115387,
0.17638902366161346,
0.0069139618426561356,
0.3049974739551544,
1.1065095663070679,
0.891498327255249,
-0.30939388275146484,
0.14345495402812958,
0.11878815293312073,
0.21583442389965057,
0.6434401869773865,
... |
func BinInstaller(pkgType resource.PkgType, f *eksd.EKSD) (func(string, string) plan.Resource, error) {
if f != nil {
log.Debugf("Using flavor %+v", f)
return func(binName, version string) plan.Resource {
// TODO (Mark) logic for the architecture
binURL, sha256, err := f.KubeBinURL(binName)
if err != nil ... | [
-0.08185544610023499,
-1.026053786277771,
0.5926167368888855,
0.20260241627693176,
-0.9148520231246948,
-0.30143165588378906,
0.04411313310265541,
-0.11330809444189072,
0.20802345871925354,
-0.02203492633998394,
-0.1171116903424263,
-0.3973535895347595,
-0.0028917542658746243,
0.6214218735... |
func BuildK8SPlan(kubernetesVersion string, kubeletNodeIP string, seLinuxInstalled, setSELinuxPermissive, disableSwap, lockYUMPkgs bool, pkgType resource.PkgType, cloudProvider string, extraArgs map[string]string, binInstaller func(string, string) plan.Resource, flavor *eksd.EKSD) plan.Resource {
b := plan.NewBuilder(... | [
-0.5508338212966919,
-0.19475004076957703,
0.4287336766719818,
-0.0048799067735672,
-0.6166086196899414,
-0.06310044974088669,
-0.39117535948753357,
0.6463018655776978,
0.7493805885314941,
0.2828313410282135,
0.10464849323034286,
0.37995684146881104,
0.3862933814525604,
0.17367658019065857... |
func buildDisableSwapPlan() plan.Resource {
b := plan.NewBuilder()
b.AddResource("configure:disable-swap-in-session", &resource.Run{Script: object.String("/sbin/swapoff -a")})
b.AddResource(
"configure:disable-swap-going-forward",
&resource.Run{Script: object.String(
// The ";" instead of "&&" below is becaus... | [
0.0199439637362957,
-0.5448092222213745,
0.43048930168151855,
-0.25756800174713135,
-1.2331801652908325,
0.8281592726707458,
0.6950236558914185,
0.8351888656616211,
0.6928185820579529,
-0.6477503776550293,
-0.058394905179739,
-0.2775975167751312,
-0.04974031075835228,
0.4213704466819763,
... |
func BuildKubeadmPrejoinPlan(useIPTables bool) plan.Resource {
b := plan.NewBuilder()
if useIPTables {
b.AddResource(
"configure:net.bridge",
&resource.Run{Script: object.String("sysctl net.bridge.bridge-nf-call-iptables=1")},
)
}
b.AddResource(
"configure:kubeadm-force-reset",
&resource.Run{Script: o... | [
-0.4669162631034851,
0.5541577339172363,
0.4563133418560028,
0.5839115381240845,
-0.5150386095046997,
0.349737286567688,
-0.2759256064891815,
-0.14959420263767242,
0.6067636013031006,
0.3786550462245941,
0.2635788917541504,
0.3604559302330017,
-1.5672235488891602,
-0.24847954511642456,
0... |
func BuildSealedSecretPlan(sealedSecretVersion, crdManifest, keyManifest, controllerManifest []byte) plan.Resource {
b := plan.NewBuilder()
b.AddResource("install:sealed-secret-crd",
&resource.KubectlApply{Manifest: crdManifest, Filename: object.String("SealedSecretCRD.yaml"),
WaitCondition: "condition=Establish... | [
0.47534555196762085,
-0.8792837262153625,
0.43552547693252563,
-0.042048003524541855,
-0.7278922200202942,
0.8346442580223083,
-0.23249849677085876,
0.7964980602264404,
0.7462225556373596,
-0.2538488209247589,
-0.5024799704551697,
0.4469800889492035,
-0.6616899371147156,
0.2360775023698806... |
func NewMetricsRecorder(clock *hlc.Clock) *MetricsRecorder {
mr := &MetricsRecorder{
nodeRegistry: metric.NewRegistry(),
}
mr.mu.storeRegistries = make(map[roachpb.StoreID]*metric.Registry)
mr.mu.stores = make(map[roachpb.StoreID]storeMetrics)
mr.mu.clock = clock
return mr
} | [
0.251871258020401,
0.6231552958488464,
0.19054727256298065,
-0.30904754996299744,
-0.27677345275878906,
-0.6311472058296204,
-0.40906235575675964,
-0.10098566114902496,
-0.5132061839103699,
-0.3991643488407135,
-0.45662081241607666,
0.6999143958091736,
-0.7925355434417725,
0.91488081216812... |
func (mr *MetricsRecorder) AddNodeRegistry(prefixFmt string, registry *metric.Registry) {
mr.nodeRegistry.MustAdd(prefixFmt, registry)
} | [
-0.4499373435974121,
0.7460973262786865,
0.15046852827072144,
-1.0451321601867676,
0.32611894607543945,
-0.08139636367559433,
-0.03737739846110344,
-0.013327306136488914,
0.03879804164171219,
-0.5975939631462097,
0.10063867270946503,
0.8926152586936951,
0.21031707525253296,
0.8564300537109... |
func (mr *MetricsRecorder) AddStore(store storeMetrics) {
mr.mu.Lock()
defer mr.mu.Unlock()
storeID := store.StoreID()
mr.mu.storeRegistries[storeID] = store.Registry()
mr.mu.stores[storeID] = store
} | [
-0.12253368645906448,
0.6846398115158081,
0.24130143225193024,
0.17467549443244934,
-0.07506286352872849,
0.5043289065361023,
0.1503220647573471,
-0.0036476883105933666,
0.8221680521965027,
-0.7392224073410034,
0.6554951667785645,
0.5548655986785889,
-1.2890177965164185,
0.3981191515922546... |
func (mr *MetricsRecorder) NodeStarted(desc roachpb.NodeDescriptor, startedAt int64) {
mr.mu.Lock()
defer mr.mu.Unlock()
mr.mu.desc = desc
mr.mu.nodeID = desc.NodeID
mr.mu.startedAt = startedAt
} | [
0.45404866337776184,
-0.31817737221717834,
0.23521935939788818,
-1.549697995185852,
0.48944127559661865,
0.11356747895479202,
-0.2513450086116791,
0.07550032436847687,
-0.7559801936149597,
-0.03371249884366989,
-0.5680686831474304,
1.4284234046936035,
0.33347296714782715,
0.231084197759628... |
func (mr *MetricsRecorder) MarshalJSON() ([]byte, error) {
mr.mu.Lock()
defer mr.mu.Unlock()
if mr.mu.nodeID == 0 {
// We haven't yet processed initialization information; return an empty
// JSON object.
if log.V(1) {
log.Warning("MetricsRecorder.MarshalJSON() called before NodeID allocation")
}
return ... | [
-0.17069947719573975,
0.17049971222877502,
0.38991519808769226,
-1.1437593698501587,
0.10806070268154144,
-0.05855009704828262,
0.8152344226837158,
-0.5302878022193909,
-0.18952514231204987,
-0.22048558294773102,
0.36349165439605713,
1.3852909803390503,
-0.5281322598457336,
0.4237441420555... |
func (mr *MetricsRecorder) GetTimeSeriesData() []ts.TimeSeriesData {
mr.mu.Lock()
defer mr.mu.Unlock()
if mr.mu.desc.NodeID == 0 {
// We haven't yet processed initialization information; do nothing.
if log.V(1) {
log.Warning("MetricsRecorder.GetTimeSeriesData() called before NodeID allocation")
}
return ... | [
-0.5479234457015991,
0.8251420855522156,
0.3349034786224365,
-0.9685382843017578,
0.8893076181411743,
0.009608219377696514,
-0.28805044293403625,
-0.8904054760932922,
-0.0222944188863039,
-0.08214762061834335,
0.620672881603241,
0.8453060388565063,
0.010925214737653732,
0.7159333229064941,... |
func (mr *MetricsRecorder) GetStatusSummaries() (*NodeStatus, []storage.StoreStatus) {
mr.mu.Lock()
defer mr.mu.Unlock()
if mr.mu.nodeID == 0 {
// We haven't yet processed initialization information; do nothing.
if log.V(1) {
log.Warning("MetricsRecorder.GetStatusSummaries called before NodeID allocation.")
... | [
-0.1929701566696167,
0.5919507145881653,
0.427404522895813,
-0.4244996905326843,
0.2928050458431244,
-0.33283740282058716,
0.26530468463897705,
-0.40526771545410156,
0.15966734290122986,
-0.17990468442440033,
-0.2459520399570465,
0.9073994159698486,
0.5617441534996033,
0.5722730159759521,
... |
func NewVectorMapFont() api.IVectorFont {
o := new(vectorMapFont)
o.vectors = []*vectorMapGlyph{}
o.glyphs = make(map[byte]int)
o.scale = 3.0
return o
} | [
0.2751747667789459,
-0.8180768489837646,
0.01738041080534458,
-0.20601977407932281,
-0.7367742657661438,
-0.8900314569473267,
-0.3403684198856354,
-0.35218346118927,
0.8585112690925598,
0.5227765440940857,
-1.5517520904541016,
-0.06521064043045044,
-0.20231586694717407,
-0.3652534484863281... |
func Diag(diag ...float64) Matrix {
array := SparseDiag(len(diag), len(diag))
for i, v := range diag {
array.ItemSet(v, i, i)
}
return array
} | [
-0.26867544651031494,
0.6826135516166687,
0.4339425563812256,
0.8004915714263916,
0.5106689929962158,
0.4715122580528259,
0.8999654054641724,
0.46932950615882874,
0.6741410493850708,
-0.6264330744743347,
-0.1156325563788414,
-0.05247597023844719,
0.4591888189315796,
0.27588951587677,
-0.... |
func Eye(size int) Matrix {
diag := make([]float64, size)
for i := 0; i < size; i++ {
diag[i] = 1.0
}
return Diag(diag...)
} | [
-0.7511214017868042,
0.21795447170734406,
0.5620553493499756,
-0.16628846526145935,
-0.07362950593233109,
-0.1200140193104744,
0.764859139919281,
-0.5023850202560425,
1.1411930322647095,
0.47064435482025146,
-0.20957058668136597,
0.20144198834896088,
-0.19472500681877136,
0.510494768619537... |
func M(rows, cols int, array ...float64) Matrix {
return A([]int{rows, cols}, array...).M()
} | [
-0.5281797051429749,
0.4124950170516968,
0.32381680607795715,
0.5996180176734924,
-0.7149243354797363,
0.18002916872501373,
-0.035272810608148575,
-0.1588640958070755,
0.3369823098182678,
-0.31785160303115845,
0.19761036336421967,
-0.20313027501106262,
0.4721043109893799,
0.470905631780624... |
func M2(array ...[]float64) Matrix {
return A2(array...).M()
} | [
-1.0646175146102905,
-1.1911357641220093,
0.5780581831932068,
0.6482512354850769,
-0.27941814064979553,
0.6814125180244446,
-0.6262022256851196,
-0.20144489407539368,
-0.31745609641075134,
-0.22958943247795105,
0.8185333609580994,
0.3151709735393524,
0.43624165654182434,
0.8004624843597412... |
func SparseCoo(rows, cols int, array ...float64) Matrix {
m := &sparseCooF64Matrix{
shape: []int{rows, cols},
values: make([]map[int]float64, rows),
}
for i := 0; i < rows; i++ {
m.values[i] = make(map[int]float64)
}
for idx, val := range array {
if val != 0 {
m.ItemSet(val, flatToNd(m.shape, idx)...)
... | [
0.6332049369812012,
0.06286800652742386,
0.5675654411315918,
0.35682880878448486,
-0.2790443003177643,
-0.11625204980373383,
0.2303202748298645,
0.26177510619163513,
-0.3429016172885895,
0.1471036821603775,
0.7294663190841675,
0.11536833643913269,
0.19838976860046387,
0.2844993770122528,
... |
func SparseDiag(rows, cols int, diag ...float64) Matrix {
if len(diag) > rows || len(diag) > cols {
panic(fmt.Sprintf("Can't use %d diag elements in a %dx%d matrix", len(diag), rows, cols))
}
size := rows
if cols < rows {
size = cols
}
array := &sparseDiagF64Matrix{
shape: []int{rows, cols},
diag: make([... | [
-0.004663106054067612,
0.8461359143257141,
0.22617298364639282,
-0.037655506283044815,
-0.1992798149585724,
0.09445689618587494,
-0.014245724305510521,
0.378346711397171,
0.9304859042167664,
-0.3639865815639496,
0.04448407515883446,
0.27852004766464233,
0.1800692230463028,
0.35496279597282... |
func SparseRand(rows, cols int, density float64) Matrix {
if density < 0 || density >= 1 {
panic(fmt.Sprintf("Can't create a SparseRand matrix: density %f should be in [0, 1)", density))
}
matrix := SparseCoo(rows, cols)
shape := []int{rows, cols}
size := rows * cols
count := int(float64(size) * density)
for i... | [
0.06266516447067261,
0.14483681321144104,
0.3776274621486664,
-1.0735423564910889,
-0.3148154020309448,
0.06678414344787598,
0.5913759469985962,
0.12411033362150192,
0.4415772259235382,
-0.34728896617889404,
1.3779270648956299,
-0.04147258773446083,
-0.4022163450717926,
-0.1080737262964248... |
func SparseRandN(rows, cols int, density float64) Matrix {
if density < 0 || density >= 1 {
panic(fmt.Sprintf("Can't create a SparseRandN matrix: density %f should be in [0, 1)", density))
}
matrix := SparseCoo(rows, cols)
shape := []int{rows, cols}
size := rows * cols
count := int(float64(size) * density)
for... | [
0.04121853783726692,
0.048220399767160416,
0.4019978940486908,
-0.6584796905517578,
0.045747388154268265,
-0.2384442389011383,
0.2706064283847809,
0.33288389444351196,
0.478756308555603,
-0.639767050743103,
0.8264046311378479,
-0.324623167514801,
-0.2189583033323288,
-0.33581700921058655,
... |
func ToMat64(m Matrix) *mat64.Dense {
return mat64.NewDense(m.Rows(), m.Cols(), m.Array())
} | [
-0.16955842077732086,
-0.37492862343788147,
0.49277594685554504,
0.6490408182144165,
-0.6477517485618591,
-0.20935013890266418,
-0.1450953483581543,
-0.14504742622375488,
0.5817089676856995,
0.29651132225990295,
0.500771164894104,
-0.2596777677536011,
0.5179682374000549,
-0.099933803081512... |
func ToMatrix(m mat64.Matrix) Matrix {
rows, cols := m.Dims()
array := &denseF64Array{
shape: []int{rows, cols},
array: make([]float64, rows*cols),
}
for i0 := 0; i0 < rows; i0++ {
for i1 := 0; i1 < cols; i1++ {
array.ItemSet(m.At(i0, i1), i0, i1)
}
}
return array
} | [
-0.8901828527450562,
-0.239496648311615,
0.6328400373458862,
-0.09856318682432175,
0.032395441085100174,
-1.0413771867752075,
0.3148850202560425,
-0.2055569887161255,
0.3218422830104828,
0.3492666780948639,
-0.07324234396219254,
0.00622220616787672,
0.09741640090942383,
0.10648471117019653... |
func Inverse(a Matrix) (Matrix, error) {
inv, err := mat64.Inverse(ToMat64(a))
if err != nil {
return nil, err
}
return ToMatrix(inv), nil
} | [
-0.9756514430046082,
0.04172738641500473,
0.4791059195995331,
0.3523552715778351,
-1.1347384452819824,
-0.19866319000720978,
0.07106727361679077,
0.8132820725440979,
0.4835846424102783,
-0.07784245163202286,
0.14670154452323914,
0.28298336267471313,
-0.04001782462000847,
-0.231086954474449... |
func LDivide(a, b Matrix) Matrix {
var x mat64.Dense
err := x.Solve(ToMat64(a), ToMat64(b))
if err != nil {
return WithValue(math.NaN(), a.Shape()[0], b.Shape()[1]).M()
}
return ToMatrix(&x)
} | [
0.1382545679807663,
0.4229212701320648,
0.9087339639663696,
-0.04598521813750267,
0.5772385001182556,
-0.15530520677566528,
-1.4059621095657349,
-0.2971440553665161,
-0.03381228446960449,
-0.28340408205986023,
0.6324666142463684,
0.171258807182312,
0.08076736330986023,
0.002327670343220234... |
func Norm(m Matrix, ord float64) float64 {
return ToMat64(m).Norm(ord)
} | [
-0.08957543969154358,
-0.7235198616981506,
0.10460785776376724,
-0.009856479242444038,
-1.6006805896759033,
-0.27380648255348206,
-0.20651379227638245,
0.6163576245307922,
0.28205406665802,
0.06738856434822083,
0.42141827940940857,
0.5008108615875244,
-0.08121474087238312,
-0.4307151734828... |
func Solve(a, b Matrix) Matrix {
return LDivide(a, b)
} | [
0.36648625135421753,
0.3204362094402313,
0.5541731119155884,
0.04236665740609169,
0.8227028846740723,
-0.4005276560783386,
-1.120492696762085,
-0.6793216466903687,
-0.41762852668762207,
-0.7984485030174255,
0.2888675034046173,
-0.020286640152335167,
-0.021787069737911224,
-0.31004408001899... |
func Migrate(tx *gorm.DB) error {
if err := tx.AutoMigrate(&user{}).Error; err != nil {
return errors.Wrap(err, "could not add fields 'TokenKey' and 'TokenSecreet' to table")
}
return nil
} | [
-0.3050778806209564,
1.0486829280853271,
0.49664995074272156,
0.7182053327560425,
0.1621754914522171,
-0.24309484660625458,
-0.6754801869392395,
-0.8599985241889954,
-0.6819607615470886,
0.30325859785079956,
-0.5378735661506653,
-0.6289253830909729,
0.06393275409936905,
0.31228598952293396... |
func NewCosmosSub(tmProvider, ethProvider string, registryContractAddress common.Address,
key *ecdsa.PrivateKey,
db *leveldb.DB, sugaredLogger *zap.SugaredLogger) CosmosSub {
return CosmosSub{
TmProvider: tmProvider,
EthProvider: ethProvider,
RegistryContractAddress: registryContractA... | [
-0.04850989952683449,
0.09692364931106567,
0.15598435699939728,
0.11751239746809006,
-0.8689196705818176,
-0.1298973560333252,
-0.5620464086532593,
0.7697902321815491,
0.158544659614563,
-0.48234060406684875,
-0.563114583492279,
0.7357798218727112,
-0.4374915361404419,
-0.07176248729228973... |
func (sub CosmosSub) Start(completionEvent *sync.WaitGroup, symbolTranslator *symbol_translator.SymbolTranslator) {
defer completionEvent.Done()
time.Sleep(time.Second)
client, err := tmClient.New(sub.TmProvider, "/websocket")
if err != nil {
sub.SugaredLogger.Errorw("failed to initialize a sifchain client.",
... | [
1.2631042003631592,
-0.01093413308262825,
0.718064546585083,
0.2254984974861145,
0.2855926752090454,
-1.1473701000213623,
0.29160451889038086,
-0.23901934921741486,
-0.9397270083427429,
0.1629636287689209,
-0.33033719658851624,
0.7126115560531616,
-0.3998330235481262,
0.5026828646659851,
... |
func GetAllProphecyClaim(client *ethclient.Client, ethereumAddress common.Address, ethFromBlock int64, ethToBlock int64) []types.ProphecyClaimUnique {
log.Printf("getAllProphecyClaim from %d block to %d block\n", ethFromBlock, ethToBlock)
var prophecyClaimArray []types.ProphecyClaimUnique
// Used to recover addres... | [
0.37711191177368164,
-0.3474293649196625,
1.0675048828125,
0.5374683141708374,
-0.3207501769065857,
-0.3800027370452881,
-0.4980853199958801,
0.348854124546051,
0.3851461708545685,
0.45098820328712463,
-0.18229912221431732,
0.07682177424430847,
-0.8639307022094727,
0.6268686652183533,
0.... |
func MyDecode(data []byte) (types.ProphecyClaimUnique, error) {
if len(data) < 32*7+42 {
return types.ProphecyClaimUnique{}, errors.New("tx data length not enough")
}
src := data[64:96]
dst := make([]byte, hex.EncodedLen(len(src)))
hex.Encode(dst, src)
sequence, err := strconv.ParseUint(string(dst), 16, 32)
... | [
0.5769219994544983,
0.10213253647089005,
0.5914288759231567,
-0.7180594205856323,
-0.7435346245765686,
-0.7853134870529175,
-0.8103054165840149,
1.5096435546875,
0.9429144263267517,
0.04430396854877472,
-0.3181709349155426,
0.13073550164699554,
-0.21612045168876648,
-0.2329929620027542,
... |
func MessageProcessed(message types.CosmosMsg, prophecyClaims []types.ProphecyClaimUnique) bool {
for _, prophecyClaim := range prophecyClaims {
if bytes.Compare(message.CosmosSender, prophecyClaim.CosmosSender) == 0 &&
message.CosmosSenderSequence.Cmp(prophecyClaim.CosmosSenderSequence) == 0 {
return true
}... | [
0.1681295484304428,
-0.47918596863746643,
0.6089912056922913,
-0.33117371797561646,
0.44052550196647644,
0.1056429073214531,
-0.5790587663650513,
0.7255222201347351,
-0.1784069687128067,
-0.09915808588266373,
0.19645008444786072,
0.5516840815544128,
-0.4774944484233856,
1.4034006595611572,... |
func (sub CosmosSub) Replay(symbolTranslator *symbol_translator.SymbolTranslator, fromBlock int64, toBlock int64, ethFromBlock int64, ethToBlock int64) {
// Start Ethereum client
ethClient, err := ethclient.Dial(sub.EthProvider)
if err != nil {
log.Printf("%s \n", err.Error())
return
}
clientChainID, err := e... | [
0.6469653844833374,
0.13946351408958435,
0.8690534830093384,
-0.4319644868373871,
0.42806532979011536,
-0.6621898412704468,
0.5778771638870239,
0.07311131060123444,
-0.49179762601852417,
0.1739080399274826,
-0.1550283282995224,
0.7819732427597046,
-0.26874756813049316,
-0.05354646965861320... |
func getOracleClaimType(eventType string) types.Event {
var claimType types.Event
switch eventType {
case types.MsgBurn.String():
claimType = types.MsgBurn
case types.MsgLock.String():
claimType = types.MsgLock
default:
claimType = types.Unsupported
}
return claimType
} | [
1.0168691873550415,
-0.40235644578933716,
0.5751014947891235,
-0.5760771632194519,
0.5238745808601379,
-0.033423058688640594,
-0.5965904593467712,
-0.4155404269695282,
1.8371464014053345,
0.3686676025390625,
0.6123100519180298,
1.2856478691101074,
-0.1599179357290268,
0.5232034921646118,
... |
func (sub CosmosSub) handleBurnLockMsg(
cosmosMsg types.CosmosMsg,
claimType types.Event,
) {
sub.SugaredLogger.Infow("handle burn lock message.",
"cosmosMessage", cosmosMsg.String())
sub.SugaredLogger.Infow(
"get the prophecy claim.",
"cosmosMsg", cosmosMsg,
)
client, auth, target, err := tryInitRelayCon... | [
0.13428916037082672,
0.3713487386703491,
0.7548152208328247,
0.14718209207057953,
-0.04655252769589424,
-0.21979591250419617,
0.38643819093704224,
-0.15806064009666443,
0.3118739128112793,
0.25588175654411316,
0.31429702043533325,
0.8995609879493713,
-0.8010085225105286,
0.6540942192077637... |
func ForwardProbs(h *HMM, obs []Obs) <-chan map[State]float64 {
if len(obs) == 0 {
res := make(chan map[State]float64)
close(res)
return res
}
return forwardProbs(newHMMCache(h), h, obs)
} | [
0.16711272299289703,
0.5780318975448608,
0.4537118673324585,
-0.2163296788930893,
-0.4560427963733673,
0.2550634741783142,
-0.23601330816745758,
-0.10424747318029404,
-0.15713797509670258,
0.089329294860363,
0.8662876486778259,
-0.09350837022066116,
-0.12343113124370575,
0.4894390106201172... |
func BackwardProbs(h *HMM, obs []Obs) <-chan map[State]float64 {
if len(obs) == 0 {
res := make(chan map[State]float64)
close(res)
return res
}
return backwardProbs(newHMMCache(h), h, obs)
} | [
-0.138454407453537,
0.2819089889526367,
0.6150429248809814,
0.05822017416357994,
0.028926335275173187,
-0.4497109353542328,
-0.39542850852012634,
-0.33441394567489624,
-0.32177868485450745,
0.08184068650007248,
0.5986541509628296,
0.2258649617433548,
-0.8541885018348694,
0.1600904166698455... |
func LogLikelihood(h *HMM, obs []Obs) float64 {
if len(obs) == 0 {
if h.TerminalState == nil {
return 0
} else {
if prob, ok := h.Init[h.TerminalState]; ok {
return prob
} else {
return math.Inf(-1)
}
}
}
cache := newHMMCache(h)
firstBwdFwd := initialBackwardDist(cache, h).Map()
lastFwd... | [
0.18120330572128296,
0.017094213515520096,
0.5556022524833679,
-0.1987539529800415,
-0.4148646891117096,
0.10462545603513718,
0.17412972450256348,
0.49882039427757263,
0.45919257402420044,
-0.18076646327972412,
-0.024030551314353943,
-0.04400087147951126,
-0.6147457361221313,
0.18380440771... |
func NewForwardBackward(h *HMM, obs []Obs) *ForwardBackward {
res := &ForwardBackward{
HMM: h,
Obs: obs,
cache: newHMMCache(h),
}
var wg sync.WaitGroup
wg.Add(2)
go func() {
for fwdOut := range forwardProbs(res.cache, h, obs) {
res.ForwardOut = append(res.ForwardOut, fwdOut)
}
wg.Done()
}()
go... | [
0.2953588366508484,
-0.26612356305122375,
0.5599194765090942,
0.08058842271566391,
-0.48262855410575867,
-0.5148922801017761,
-0.42939144372940063,
-0.02083505317568779,
-1.122251272201538,
-0.3369494080543518,
0.4082772731781006,
0.1461142897605896,
-0.28333374857902527,
0.747352421283721... |
func (f *ForwardBackward) LogLikelihood() float64 {
if len(f.Obs) == 0 {
if f.HMM.TerminalState == nil {
return 0
} else {
if prob, ok := f.HMM.Init[f.HMM.TerminalState]; ok {
return prob
} else {
return math.Inf(-1)
}
}
}
fwdDist := f.ForwardOut[len(f.ForwardOut)-1]
bwdDist := f.Backward... | [
0.6624193787574768,
-0.29695847630500793,
0.6694576144218445,
-0.9575340151786804,
-0.3579272925853729,
0.045513201504945755,
-0.28703054785728455,
0.41756120324134827,
0.11951825022697449,
0.020343193784356117,
0.046730607748031616,
-0.08658423274755478,
-0.6372802257537842,
-0.1550813764... |
func (f *ForwardBackward) Dist(t int) map[State]float64 {
res := map[State]float64{}
bwdDist := f.BackwardOut[len(f.BackwardOut)-(t+1)]
fwdDist := f.ForwardOut[t]
probsSum := math.Inf(-1)
for state, fwdProb := range fwdDist {
if bwdProb, ok := bwdDist[state]; ok {
prob := fwdProb + bwdProb
res[state] = pro... | [
0.2199712097644806,
-0.12470608949661255,
0.4722170829772949,
-0.989983320236206,
-0.5938834547996521,
-0.1710665225982666,
0.5139003992080688,
0.41715964674949646,
-0.13076850771903992,
0.3921748101711273,
-0.5996673107147217,
-0.46704646944999695,
0.3080979883670807,
-0.13817206025123596... |
func (f *ForwardBackward) CondDist(t int) map[State]map[State]float64 {
fastRes := f.fastCondDist(t)
res := map[State]map[State]float64{}
for i, state := range f.HMM.States {
if fastRes[i] != nil {
subMap := map[State]float64{}
fastRes[i].Iter(func(state int, val float64) {
subMap[f.HMM.States[state]] = ... | [
-0.4427441656589508,
-0.47670862078666687,
0.5205385088920593,
-0.9689353704452515,
-0.5450224876403809,
-0.19787980616092682,
0.05774253234267235,
0.9961045980453491,
-0.11334605515003204,
0.2763946056365967,
-0.23420187830924988,
-0.5365831255912781,
0.61748206615448,
0.8751363754272461,... |
func (f *ForwardBackward) fastCondDist(t int) []*fastStateMap {
if t == 0 || t > len(f.Obs) {
panic("time out of bounds")
}
// Two distributions that we only need if this is not
// the state after the final state.
var emissionDist []float64
var bwdDist *fastStateMap
if t < len(f.Obs) {
bwd := f.BackwardOut[... | [
-0.3606335520744324,
-0.5648167133331299,
0.8287707567214966,
0.25981399416923523,
-0.37670111656188965,
-0.2487679421901703,
0.3196409046649933,
0.9417933225631714,
-0.36636582016944885,
0.5633957982063293,
-0.5760988593101501,
-0.03811178356409073,
0.53562992811203,
0.48910292983055115,
... |
func ReadPipedInput() ([]byte, error) {
info, err := os.Stdin.Stat()
if err != nil {
return nil, err
}
pipedInput := info.Mode()&os.ModeNamedPipe != 0
if info.Size() == 0 && !pipedInput {
return []byte{}, nil
}
return ioutil.ReadAll(os.Stdin)
} | [
-1.049652338027954,
-0.10133156180381775,
0.8758235573768616,
0.12514716386795044,
-0.8589664697647095,
0.45425140857696533,
-0.2293398231267929,
-0.33862799406051636,
-0.49352210760116577,
0.576252818107605,
0.015004569664597511,
0.013249954208731651,
-0.611499547958374,
-0.12063122540712... |
func ReadString(prompt string) string {
fmt.Printf("%s: ", prompt)
r := bufio.NewReader(os.Stdin)
str, _ := r.ReadString('\n')
return strings.TrimSpace(str)
} | [
-0.06761442124843597,
-0.7199094295501709,
0.5426137447357178,
0.02888580597937107,
-0.4250790476799011,
0.9631639122962952,
0.01017451100051403,
-0.2266773134469986,
-0.19391043484210968,
-0.10311259329319,
0.3684428334236145,
0.5701939463615417,
-0.2135532647371292,
-1.0533983707427979,
... |
func ReadPassword(prompt string) (string, error) {
fmt.Printf("%s: ", prompt)
pwd, err := gopass.GetPasswd()
return string(pwd), err
} | [
-0.31495440006256104,
-0.7346622347831726,
0.8897938132286072,
0.635763943195343,
-0.29397937655448914,
1.1171609163284302,
0.39610594511032104,
0.3186359703540802,
-0.06442616879940033,
0.15562167763710022,
0.21553382277488708,
0.542195737361908,
-0.704191267490387,
-0.5777225494384766,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.