text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (c *Command) executeCommandView() string {
subCommand := strings.Fields(c.Args.Command)
bmarks, err := bookmarks.NewBookmarksWithUser(c.API, c.Args.UserId)
if err != nil {
return c.responsef(c.Args, "Unable to retrieve bookmarks for user %s", c.Args.UserId)
}
// bookmarks is nil if user has never added a ... | [
-0.20914816856384277,
0.0036384148988872766,
0.8168271780014038,
0.09010763466358185,
-0.09932474792003632,
-0.2028602957725525,
0.6110044121742249,
-0.19218489527702332,
-0.17189188301563263,
-0.5326023697853088,
0.30713120102882385,
0.9333844184875488,
-0.20918980240821838,
0.40735322237... |
func (c *Command) commandViewPostID(postID string, bmarks *bookmarks.Bookmarks) (string, error) {
postID = utils.GetPostIDFromLink(postID)
var bmark *bookmarks.Bookmark
bmark, err := bmarks.GetBookmark(postID)
if err != nil {
return "", err
}
var labelNames []string
labelNames, err = bmarks.GetBmarkLabelName... | [
0.26666194200515747,
0.04618121683597565,
0.6825727224349976,
-0.22216908633708954,
-0.5109129548072815,
-0.14935679733753204,
-0.17054922878742218,
-0.146217480301857,
0.18297192454338074,
-0.039915747940540314,
0.08182521909475327,
1.005841612815857,
-0.5324627161026001,
0.50643622875213... |
func (c *Camera) SetupProjection(aspect float32) {
c.ProjMat = types.Perspective4(c.FOV, aspect, 1, 1000)
c.Update()
} | [
-0.05032752454280853,
-0.4175969064235687,
0.4481036067008972,
-0.5375414490699768,
0.33166632056236267,
-0.37989938259124756,
-0.006566047668457031,
-0.2389923334121704,
0.9357606768608093,
0.6362897157669067,
0.17328651249408722,
-0.9461091756820679,
-0.7490885853767395,
0.64268171787261... |
func (c *Camera) Move(dir CameraDirection, offset float32) {
var delta types.Vec3
switch dir {
case Up:
delta = c.Up.Mul(offset)
case Down:
delta = c.Up.Mul(-offset)
case Left:
delta = c.LookAt.Sub(c.Position).Normalize().Cross(c.Up).Mul(-offset)
case Right:
delta = c.LookAt.Sub(c.Position).Normalize().C... | [
-0.7011817693710327,
-0.42364805936813354,
0.6753711700439453,
-0.323411762714386,
-0.519130527973175,
0.45105841755867004,
-0.0096511859446764,
0.23577934503555298,
0.5655437707901001,
-0.2091827392578125,
-0.2681673765182495,
0.5188314914703369,
-0.20153895020484924,
-0.04690448567271232... |
func (c *Camera) updateFrustrum() {
var v types.Vec4
invProjViewMat := c.InvViewProjMat()
var yUp float32 = 1.0
if c.InvertY {
yUp = -1.0
}
v = invProjViewMat.Mul4x1(types.XYZW(-1, yUp, -1, 1))
c.Frustrum[0] = v.Mul(1.0 / v[3]).Vec3().Sub(c.Position).Vec4(0)
v = invProjViewMat.Mul4x1(types.XYZW(1, yUp, -1,... | [
0.09404885768890381,
-0.689403235912323,
0.641217052936554,
-0.26475784182548523,
0.4730548560619354,
-0.44383177161216736,
0.6423447132110596,
0.027709919959306717,
0.10644569993019104,
-0.27022671699523926,
0.19570401310920715,
0.4303899109363556,
-0.43741223216056824,
0.4969019591808319... |
func GetEmailList() []Result {
clearSchedule()
updateSchedule()
query := `SELECT u.pid,
u.email,
s.subject,
s.catalog,
s.section,
s.title,
s.instructor,
s.class
FROM USER_INFO u INNER JOIN SECTION_INFO s
ON u.level = s.level
AND u.term = s.term
AND u.subject = s.subject
AND u.catalog =... | [
-0.5571022033691406,
-0.3111891746520996,
0.779813826084137,
-0.049758799374103546,
-0.6441578269004822,
0.33106285333633423,
-0.369364857673645,
-0.03710785135626793,
-0.5973213911056519,
0.6442316174507141,
-0.296916127204895,
0.2694750726222992,
0.31831973791122437,
0.4292270839214325,
... |
func DeleteUser(pid int) {
stmt, err := database.Prepare(`DELETE FROM USER_INFO WHERE pid = ?;`)
defer stmt.Close()
if err != nil {
println(err.Error())
}
_, err = stmt.Exec(pid)
if err != nil {
println(err.Error())
}
} | [
0.23062802851200104,
-0.30379530787467957,
0.6808869242668152,
0.11956558376550674,
0.008695815689861774,
0.7292399406433105,
0.36957091093063354,
0.18029174208641052,
-0.8618465662002563,
-0.26229965686798096,
-0.004149747546762228,
-0.09455668926239014,
-0.2194296270608902,
0.38601177930... |
func (t *ephemeralTracker) maybeUpdatePurgeInfo(ctx context.Context,
convID chat1.ConversationID, uid gregor1.UID, purgeInfo *chat1.EphemeralPurgeInfo) (err Error) {
t.Lock()
defer t.Unlock()
if purgeInfo == nil || purgeInfo.IsNil() {
return nil
}
curPurgeInfo, err := t.get(ctx, uid, convID)
if err != nil {
... | [
-0.1957094669342041,
-0.994978129863739,
0.8467951416969299,
-0.4526140093803406,
-0.5418915152549744,
0.11832544952630997,
-0.7840007543563843,
-0.49016451835632324,
0.5319665670394897,
0.27891379594802856,
0.1254252791404724,
0.4448279142379761,
-0.5201182961463928,
0.6155889630317688,
... |
func (o *DeleteAPIReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewDeleteAPINoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
cas... | [
-0.5929626226425171,
-1.292630910873413,
0.7338305711746216,
0.267147958278656,
-0.046406883746385574,
-1.4048527479171753,
-0.3822369873523712,
-0.03812854364514351,
0.7143444418907166,
0.47552675008773804,
0.3999568819999695,
-0.21664084494113922,
-1.1414889097213745,
-0.0212139431387186... |
func NewDeleteAPINoContent() *DeleteAPINoContent {
return &DeleteAPINoContent{}
} | [
-0.1769581288099289,
-1.878210186958313,
-0.29383766651153564,
0.14696963131427765,
-0.9264353513717651,
-0.3780156373977661,
-0.7774788737297058,
-0.2282436043024063,
0.1024104654788971,
0.15812794864177704,
-0.506530225276947,
-0.4400055706501007,
-0.6804585456848145,
-0.5503926277160645... |
func NewDeleteAPIUnauthorized() *DeleteAPIUnauthorized {
return &DeleteAPIUnauthorized{}
} | [
-1.1878135204315186,
-1.107478141784668,
0.29210761189460754,
0.03972193971276283,
-0.6998441219329834,
-0.6028696894645691,
-0.06171076372265816,
0.5204236507415771,
0.3603282570838928,
-0.18008258938789368,
-0.5276749134063721,
0.4405892789363861,
-0.25858432054519653,
0.1829074174165725... |
func NewDeleteAPIForbidden() *DeleteAPIForbidden {
return &DeleteAPIForbidden{}
} | [
0.10810072720050812,
-0.4785131812095642,
-0.31763747334480286,
0.6512117385864258,
-0.6842353343963623,
-0.8708053231239319,
-0.0943589061498642,
-0.5288602709770203,
0.07315463572740555,
-0.1392991989850998,
0.07220374047756195,
0.09164265543222427,
-0.5772815942764282,
-0.60033047199249... |
func NewDeleteAPINotFound() *DeleteAPINotFound {
return &DeleteAPINotFound{}
} | [
-0.5298238396644592,
-1.7814255952835083,
-0.04330190271139145,
0.08622296154499054,
-0.5534133911132812,
-0.13572773337364197,
-0.04012652486562729,
-0.09080570936203003,
-0.4231374263763428,
0.2826072871685028,
-0.7854006886482239,
-0.3015362620353699,
-1.0113648176193237,
0.583360433578... |
func NewInClusterClient(endpoint string) (Client, error) {
config, err := rest.InClusterConfig()
if err != nil {
return nil, fmt.Errorf("failed to create in-cluster configuration: %s", err)
}
if endpoint != "" {
config.Host = endpoint
}
return createClientFromConfig(config)
} | [
-0.19173961877822876,
-0.7315345406532288,
0.34669947624206543,
0.3863914906978607,
-1.0984392166137695,
-0.43150144815444946,
0.6608539819717407,
0.6795499324798584,
-0.547854483127594,
0.6707918643951416,
-0.023284459486603737,
0.729869544506073,
-1.6382896900177002,
-0.9579706192016602,... |
func NewExternalClusterClient(endpoint, token, caFilePath string) (Client, error) {
if endpoint == "" {
return nil, errors.New("endpoint missing for external cluster client")
}
config := &rest.Config{
Host: endpoint,
BearerToken: token,
}
if caFilePath != "" {
caData, err := ioutil.ReadFile(caFile... | [
0.21525409817695618,
-0.3419964909553528,
0.4335862994194031,
0.10254038870334625,
-1.369637370109558,
0.2911263108253479,
-0.24870923161506653,
0.5208795070648193,
-0.5238861441612244,
1.1156541109085083,
-0.1773393750190735,
0.742665708065033,
-0.7452166676521301,
-0.6206099390983582,
... |
func (c *clientImpl) WatchAll(namespaces Namespaces, labelSelector string, stopCh <-chan struct{}) (<-chan interface{}, error) {
eventCh := make(chan interface{}, 1)
kubeLabelSelector, err := labels.Parse(labelSelector)
if err != nil {
return nil, err
}
if len(namespaces) == 0 {
namespaces = Namespaces{api.N... | [
0.5423551797866821,
-0.2759835124015808,
0.5846716165542603,
0.010349585674703121,
0.011797177605330944,
0.49046462774276733,
0.18032225966453552,
-0.7606218457221985,
-0.11205295473337173,
-0.1538049876689911,
0.2813700735569,
0.4432981610298157,
0.10229439288377762,
0.9908437728881836,
... |
func (c *clientImpl) WatchIngresses(namespace string, labelSelector labels.Selector, watchCh chan<- interface{}) cache.SharedInformer {
listWatch := newListWatchFromClientWithLabelSelector(
c.clientset.ExtensionsV1beta1().RESTClient(),
kindIngresses,
namespace,
fields.Everything(),
labelSelector)
informer ... | [
-0.06639286875724792,
-0.05999366566538811,
0.27473434805870056,
-1.1337239742279053,
-0.542044997215271,
0.18851836025714874,
-0.09359141439199448,
-0.6201846599578857,
0.2597994804382324,
-0.17408043146133423,
-0.3168784976005554,
1.0240918397903442,
-0.7065433859825134,
0.28239902853965... |
func (c *clientImpl) WatchObjects(namespace, kind string, object runtime.Object, storeMap map[string]cache.Store, watchCh chan<- interface{}) cache.SharedInformer {
listWatch := cache.NewListWatchFromClient(
c.clientset.CoreV1().RESTClient(),
kind,
namespace,
fields.Everything())
informer := loadInformer(lis... | [
-0.3727570176124573,
-0.7828806042671204,
0.30180612206459045,
-0.9264588356018066,
-0.3442268669605255,
0.3694348633289337,
0.1574631929397583,
-0.2510962188243866,
0.043553758412599564,
-0.3956383168697357,
-1.2644271850585938,
0.9023065567016602,
-0.32690489292144775,
0.2644002139568329... |
func (c *clientImpl) GetIngresses() []*v1beta1.Ingress {
var result []*v1beta1.Ingress
for _, store := range c.ingStores {
for _, obj := range store.List() {
ing := obj.(*v1beta1.Ingress)
result = append(result, ing)
}
}
return result
} | [
-0.7659590244293213,
-0.047022782266139984,
0.5075204372406006,
0.8674556612968445,
0.5312247276306152,
0.1959606260061264,
0.397915780544281,
-0.6290797591209412,
0.08084017783403397,
0.1160590872168541,
0.018595121800899506,
1.1939940452575684,
-1.4187660217285156,
0.40698322653770447,
... |
func (c *clientImpl) GetService(namespace, name string) (*v1.Service, bool, error) {
var service *v1.Service
item, exists, err := c.svcStores[c.lookupNamespace(namespace)].GetByKey(namespace + "/" + name)
if item != nil {
service = item.(*v1.Service)
}
return service, exists, err
} | [
-0.3919373154640198,
0.3483869731426239,
0.48414093255996704,
0.4874565601348877,
0.19277946650981903,
-0.4670042097568512,
-0.6354950070381165,
-1.275524616241455,
0.3996083438396454,
0.39388754963874817,
-0.09417520463466644,
-0.12560749053955078,
-0.8762368559837341,
0.03711250051856041... |
func (c *clientImpl) GetEndpoints(namespace, name string) (*v1.Endpoints, bool, error) {
var endpoint *v1.Endpoints
item, exists, err := c.epStores[c.lookupNamespace(namespace)].GetByKey(namespace + "/" + name)
if item != nil {
endpoint = item.(*v1.Endpoints)
}
return endpoint, exists, err
} | [
-0.6396722197532654,
0.8078389167785645,
0.4990828335285187,
0.03341140225529671,
0.37577298283576965,
-0.5364478230476379,
-1.0955666303634644,
-0.6338031888008118,
0.7064274549484253,
0.7944753766059875,
-0.3539029359817505,
-0.4692530632019043,
-0.8812037706375122,
0.034667279571294785,... |
func (c *clientImpl) GetSecret(namespace, name string) (*v1.Secret, bool, error) {
var secret *v1.Secret
item, exists, err := c.secStores[c.lookupNamespace(namespace)].GetByKey(namespace + "/" + name)
if err == nil && item != nil {
secret = item.(*v1.Secret)
}
return secret, exists, err
} | [
-0.21796491742134094,
0.7313588261604309,
0.682476282119751,
0.8889127969741821,
0.0769989937543869,
-0.9777320623397827,
-0.8932363986968994,
-1.4473876953125,
0.4396781325340271,
0.31312623620033264,
-1.1790417432785034,
0.0628092885017395,
-0.47995343804359436,
-0.17574167251586914,
0... |
func (c *clientImpl) lookupNamespace(ns string) string {
if c.isNamespaceAll {
return api.NamespaceAll
}
return ns
} | [
-0.7603216767311096,
0.1586495041847229,
0.2382192611694336,
-0.2120049148797989,
-1.0051634311676025,
-0.047830525785684586,
-0.8441125154495239,
-1.355087161064148,
2.1996843814849854,
-0.42857450246810913,
0.2812928557395935,
0.05797376111149788,
-0.20595857501029968,
1.5878175497055054... |
func newListWatchFromClientWithLabelSelector(c cache.Getter, resource string, namespace string, fieldSelector fields.Selector, labelSelector labels.Selector) *cache.ListWatch {
listFunc := func(options api.ListOptions) (runtime.Object, error) {
return c.Get().
Namespace(namespace).
Resource(resource).
Versi... | [
0.41363072395324707,
-1.1825870275497437,
0.39143091440200806,
-0.629432737827301,
-0.39123067259788513,
-0.1709923893213272,
-0.8336415886878967,
-1.030867338180542,
0.06340741366147995,
-0.28546419739723206,
-0.09972770512104034,
0.8169130086898804,
0.5530167818069458,
0.5489934086799622... |
func eventHandlerFunc(events chan<- interface{}, obj interface{}) {
select {
case events <- obj:
default:
}
} | [
0.5446961522102356,
-0.11838216334581375,
0.5225210785865784,
0.5057337880134583,
0.1942582130432129,
0.01159187313169241,
0.8662675619125366,
0.44607603549957275,
0.6237317323684692,
0.16408997774124146,
-0.02320954203605652,
0.7994633316993713,
0.42937973141670227,
-0.6722438931465149,
... |
func GetInstallOperation(siteKey SiteKey, operator Operator) (op *SiteOperation, progress *ProgressEntry, err error) {
operations, err := operator.GetSiteOperations(siteKey, OperationsFilter{
Types: []string{OperationInstall},
})
if err != nil {
return nil, nil, trace.Wrap(err)
}
if len(operations) == 0 {
r... | [
-0.15530642867088318,
0.4229900538921356,
0.5911335349082947,
0.26845261454582214,
-0.4986461102962494,
-1.3216273784637451,
1.7039437294006348,
-0.00013224733993411064,
0.3939218819141388,
1.5945168733596802,
-0.2251213788986206,
-0.9677309393882751,
-0.35631850361824036,
0.51190382242202... |
func GetLastUninstallOperation(siteKey SiteKey, operator Operator) (op *SiteOperation, progress *ProgressEntry, err error) {
operations, err := operator.GetSiteOperations(siteKey, OperationsFilter{
Types: []string{OperationUninstall},
Last: true,
})
if err != nil {
return nil, nil, trace.Wrap(err)
}
if len... | [
-0.2676888406276703,
0.6412301063537598,
0.9060702919960022,
-0.49162182211875916,
-0.18828533589839935,
-1.1579614877700806,
1.2574117183685303,
0.5709012150764465,
0.7601760029792786,
1.0043104887008667,
-0.06997621804475784,
-0.996882438659668,
-0.6101999282836914,
-0.13774238526821136,... |
func GetLastCompletedUpdateOperation(siteKey SiteKey, operator Operator) (op *SiteOperation, err error) {
operations, err := operator.GetSiteOperations(siteKey, OperationsFilter{
Types: []string{OperationUpdate},
Last: true,
Complete: true,
})
if err != nil {
return nil, trace.Wrap(err)
}
if len(op... | [
-0.06181778386235237,
0.26373788714408875,
0.7329545021057129,
-0.3130500018596649,
-0.5799427628517151,
-1.1977406740188599,
0.9655604958534241,
-0.09562578797340393,
1.0509127378463745,
1.2239643335342407,
-0.35311445593833923,
-0.8950783610343933,
-0.2557317912578583,
-0.491980671882629... |
func GetCompletedInstallOperation(siteKey SiteKey, operator Operator) (*SiteOperation, error) {
operations, err := operator.GetSiteOperations(siteKey, OperationsFilter{
Types: []string{OperationInstall},
Last: true,
Complete: true,
})
if err != nil {
return nil, trace.Wrap(err)
}
if len(operations)... | [
0.04317551851272583,
0.008132865652441978,
0.42176103591918945,
0.5635040402412415,
-0.6745857000350952,
-1.326332449913025,
1.922357201576233,
0.0396934412419796,
0.5987734794616699,
1.5522565841674805,
-0.34007394313812256,
-1.23104727268219,
-0.3030078411102295,
0.23871713876724243,
-... |
func GetLastOperation(siteKey SiteKey, operator Operator) (op *SiteOperation, progress *ProgressEntry, err error) {
operations, err := operator.GetSiteOperations(siteKey, OperationsFilter{
Last: true,
})
if err != nil {
return nil, nil, trace.Wrap(err)
}
if len(operations) == 0 {
return nil, nil, trace.NotF... | [
-0.32699909806251526,
0.7935153245925903,
0.876602053642273,
-0.2577962279319763,
0.20161080360412598,
-1.4148823022842407,
1.1011297702789307,
-0.40191301703453064,
0.6471535563468933,
1.4057790040969849,
-0.29369911551475525,
-0.9214844107627869,
-0.6657804846763611,
0.09942852705717087,... |
func GetLastFinishedOperation(siteKey SiteKey, operator Operator) (op *SiteOperation, progress *ProgressEntry, err error) {
operations, err := operator.GetSiteOperations(siteKey, OperationsFilter{
Last: true,
Finished: true,
})
if err != nil {
return nil, nil, trace.Wrap(err)
}
if len(operations) == 0 {... | [
0.024318048730492592,
0.5784472823143005,
0.4128313362598419,
-0.42191120982170105,
0.21392802894115448,
-1.3250240087509155,
1.1405987739562988,
-0.412911057472229,
0.36220064759254456,
0.5254958868026733,
-0.813049852848053,
-0.7912011742591858,
-0.19099721312522888,
0.5541560649871826,
... |
func GetLastUpgradeOperation(siteKey SiteKey, operator Operator) (*SiteOperation, error) {
operations, err := operator.GetSiteOperations(siteKey, OperationsFilter{
Types: []string{OperationUpdate},
Last: true,
})
if err != nil {
return nil, trace.Wrap(err)
}
if len(operations) == 0 {
return nil, trace.No... | [
-0.8180872797966003,
0.9278772473335266,
0.895278811454773,
-0.22654670476913452,
-0.2537589967250824,
-1.2418417930603027,
0.5629367232322693,
0.0037765484303236008,
0.7029106020927429,
1.0365879535675049,
-0.35093626379966736,
-0.8986514806747437,
-0.6279504895210266,
-0.5883783102035522... |
func GetLastShrinkOperation(siteKey SiteKey, operator Operator) (*SiteOperation, error) {
operations, err := operator.GetSiteOperations(siteKey, OperationsFilter{
Types: []string{OperationShrink},
Last: true,
})
if err != nil {
return nil, trace.Wrap(err)
}
if len(operations) == 0 {
return nil, trace.Not... | [
-0.1054680347442627,
1.4223074913024902,
0.6882346272468567,
-0.10520039498806,
-0.18381650745868683,
-1.2503199577331543,
1.0578035116195679,
-0.33561018109321594,
1.303506851196289,
0.6994560956954956,
0.23730036616325378,
-0.508252739906311,
-0.23648640513420105,
-0.1330602765083313,
... |
func GetOperationWithProgress(opKey SiteOperationKey, operator Operator) (*SiteOperation, *ProgressEntry, error) {
operation, err := operator.GetSiteOperation(opKey)
if err != nil {
return nil, nil, trace.Wrap(err)
}
progress, err := operator.GetSiteOperationProgress(opKey)
if err != nil {
return nil, nil, tra... | [
-0.07450007647275925,
0.11255861818790436,
0.5884402990341187,
0.6176455020904541,
-0.7589124441146851,
-0.8347300291061401,
1.4079532623291016,
-0.6405696272850037,
0.645897626876831,
0.9799071550369263,
-0.40614211559295654,
-1.035671591758728,
-0.4202935993671417,
0.37041857838630676,
... |
func GetActiveOperations(siteKey SiteKey, operator Operator) (active []SiteOperation, err error) {
operations, err := operator.GetSiteOperations(siteKey, OperationsFilter{
Active: true,
})
if err != nil {
return nil, trace.Wrap(err)
}
if len(operations) == 0 {
return nil, trace.NotFound("no active operation... | [
-0.6480622887611389,
0.015220255590975285,
0.39473971724510193,
0.9434831142425537,
-0.10409566760063171,
-1.3754677772521973,
1.1181328296661377,
-0.218597874045372,
0.452922523021698,
0.6318717002868652,
-0.8277953863143921,
-0.0986560583114624,
-0.4415178894996643,
-0.2565964460372925,
... |
func GetActiveOperationsByType(siteKey SiteKey, operator Operator, opType string) (active []SiteOperation, err error) {
operations, err := operator.GetSiteOperations(siteKey, OperationsFilter{
Types: []string{opType},
Active: true,
})
if err != nil {
return nil, trace.Wrap(err)
}
if len(operations) == 0 {
... | [
-0.5751821398735046,
-0.31732413172721863,
0.4537852704524994,
0.5933456420898438,
0.1037270650267601,
-1.2219597101211548,
1.2218316793441772,
-0.743107259273529,
0.2462460994720459,
1.142654299736023,
-0.3844135105609894,
0.5385910272598267,
-0.6369155049324036,
-0.32610371708869934,
0... |
func GetWizardOperation(operator Operator) (*SiteOperation, error) {
// in wizard mode there is only 1 cluster
clusters, err := operator.GetSites(defaults.SystemAccountID)
if err != nil {
return nil, trace.Wrap(err)
}
if len(clusters) != 1 {
return nil, trace.BadParameter("expected 1 cluster, got: %v", cluster... | [
-0.3640540540218353,
0.9730719923973083,
0.5740761756896973,
0.9220462441444397,
0.09271048754453659,
-1.0612108707427979,
2.0610592365264893,
0.2399105280637741,
0.6745229959487915,
1.1444834470748901,
0.18996739387512207,
0.0900387167930603,
-0.8712116479873657,
-0.0053370618261396885,
... |
func GetWizardCluster(operator Operator) (*Site, error) {
// in wizard mode there is only 1 cluster
clusters, err := operator.GetSites(defaults.SystemAccountID)
if err != nil {
return nil, trace.Wrap(err)
}
if len(clusters) != 1 {
return nil, trace.BadParameter("expected 1 cluster, got: %v", clusters)
}
retu... | [
-0.37588462233543396,
0.7998566031455994,
0.3947640657424927,
0.20008422434329987,
0.24970845878124237,
-0.9042665362358093,
1.7402840852737427,
0.09414152055978775,
0.6456001400947571,
0.085589699447155,
0.5301152467727661,
1.5507413148880005,
-0.7560383081436157,
-0.23652131855487823,
... |
func FailOperationAndResetCluster(ctx context.Context, key SiteOperationKey, operator Operator, message string) error {
err := FailOperation(ctx, key, operator, message)
if err != nil {
return trace.Wrap(err)
}
err = operator.ActivateSite(ActivateSiteRequest{
AccountID: key.AccountID,
SiteDomain: key.SiteDom... | [
-0.6103734374046326,
0.543444037437439,
0.1995736062526703,
0.5988601446151733,
0.31016847491264343,
-1.1402132511138916,
1.3518203496932983,
-0.11291719228029251,
0.3010275959968567,
0.6734110713005066,
-0.015213200822472572,
0.6238194704055786,
-0.5274796485900879,
-0.5981041789054871,
... |
func CompleteOperation(ctx context.Context, key SiteOperationKey, operator OperationStateSetter) error {
return operator.SetOperationState(ctx, key, SetOperationStateRequest{
State: OperationStateCompleted,
Progress: &ProgressEntry{
SiteDomain: key.SiteDomain,
OperationID: key.OperationID,
Step: c... | [
-0.5855828523635864,
0.021313434466719627,
0.5431633591651917,
0.27270010113716125,
-0.871013879776001,
-0.3271182179450989,
1.4782633781433105,
0.017628155648708344,
0.9134160280227661,
1.0632574558258057,
-0.729360044002533,
-1.2923543453216553,
0.13624803721904755,
-0.2677069306373596,
... |
func FailOperation(ctx context.Context, key SiteOperationKey, operator OperationStateSetter, message string) error {
if message != "" {
message = fmt.Sprintf("Operation failure: %v", message)
} else {
message = "Operation failure"
}
return operator.SetOperationState(ctx, key, SetOperationStateRequest{
State: ... | [
-0.8596802949905396,
0.6237413883209229,
0.27996623516082764,
0.05507449805736542,
-0.5724943280220032,
-0.4145166277885437,
0.9707937836647034,
-0.45736733078956604,
0.14953535795211792,
0.6612119674682617,
-0.11431491374969482,
-0.9043184518814087,
-0.785324215888977,
0.5094895958900452,... |
func (r OperationStateFunc) SetOperationState(ctx context.Context, key SiteOperationKey, req SetOperationStateRequest) error {
return r(ctx, key, req)
} | [
-1.3205255270004272,
0.7086804509162903,
0.15239670872688293,
0.5422103404998779,
-0.42345762252807617,
-0.2327040731906891,
1.5981422662734985,
0.46890413761138916,
0.8960022926330566,
0.8870888948440552,
-0.45028477907180786,
-0.6862386465072632,
0.24792145192623138,
-0.26673418283462524... |
func VerifyLicense(packages pack.PackageService, license string) error {
parsed, err := licenseapi.ParseLicense(license)
if err != nil {
return trace.Wrap(err)
}
if len(parsed.GetPayload().EncryptionKey) != 0 {
packages = encryptedpack.New(packages, string(
parsed.GetPayload().EncryptionKey))
}
ca, err := ... | [
0.20658135414123535,
-0.12375693768262863,
0.6645890474319458,
0.7438257932662964,
0.18206240236759186,
-0.39928585290908813,
-0.8010304570198059,
-0.2497086077928543,
1.1112384796142578,
-0.014628522098064423,
-0.7715878486633301,
0.696761965751648,
-0.8752396106719971,
0.8086360096931458... |
func GetExpandOperation(backend storage.Backend) (*SiteOperation, error) {
cluster, err := backend.GetLocalSite(defaults.SystemAccountID)
if err != nil {
return nil, trace.Wrap(err)
}
operations, err := backend.GetSiteOperations(cluster.Domain)
if err != nil {
return nil, trace.Wrap(err)
}
for i, operation :... | [
0.4771766662597656,
1.5699872970581055,
0.6590615510940552,
0.9604003429412842,
0.05989035964012146,
-0.9451836943626404,
0.9140114784240723,
-0.16247665882110596,
0.8002926707267761,
0.6290161609649658,
0.0514778234064579,
0.043493010103702545,
-0.7389876246452332,
0.15042360126972198,
... |
func UpsertSystemAccount(operator Operator) (*Account, error) {
accounts, err := operator.GetAccounts()
if err != nil {
return nil, trace.Wrap(err)
}
for i := range accounts {
if accounts[i].Org == defaults.SystemAccountOrg {
return &accounts[i], nil
}
}
account, err := operator.CreateAccount(NewAccountR... | [
-0.1212724894285202,
0.3101199269294739,
0.5675280690193176,
0.8773906826972961,
0.12696711719036102,
-0.733817994594574,
0.8164655566215515,
0.2082139551639557,
-0.05414481461048126,
0.7285553216934204,
-0.5481141209602356,
-0.19419170916080475,
-0.976719081401825,
0.6520620584487915,
-... |
func MatchByType(opType string) OperationMatcher {
return func(op SiteOperation) bool {
return op.Type == opType
}
} | [
-0.30415335297584534,
0.3021599352359772,
0.4862675070762634,
0.8625453114509583,
-0.5150318145751953,
-0.6858708262443542,
1.2272905111312866,
-0.4705433249473572,
0.9007286429405212,
0.7317589521408081,
-0.4355291426181793,
-0.7577318549156189,
-0.36077871918678284,
-0.321261465549469,
... |
func UserFromContext(ctx context.Context) string {
user, ok := ctx.Value(userContext).(string)
if !ok {
return ""
}
return user
} | [
-0.1972646564245224,
-0.7088668346405029,
0.2243165820837021,
0.07779761403799057,
-0.6170333027839661,
0.689505934715271,
-0.6338116526603699,
-1.5766584873199463,
1.2560527324676514,
0.04738951846957207,
-0.1837923675775528,
-0.46047255396842957,
0.3096920847892761,
-0.3728107213973999,
... |
func NewUserContext(ctx context.Context, user string) context.Context {
return context.WithValue(ctx, userContext, user)
} | [
0.5707199573516846,
-0.6641222834587097,
0.215532585978508,
0.9218440651893616,
-2.265212059020996,
0.27976980805397034,
-0.36477601528167725,
-1.043990135192871,
1.0148413181304932,
-0.46778905391693115,
-0.5905694961547852,
0.42029711604118347,
0.41513368487358093,
-0.4235822856426239,
... |
func OperatorFromContext(ctx context.Context) Operator {
operator, ok := ctx.Value(operatorContext).(Operator)
if !ok {
return nil
}
return operator
} | [
-0.22430042922496796,
-0.49000924825668335,
-0.00017868711438495666,
-0.09747745096683502,
-1.0771278142929077,
-0.26429441571235657,
-0.8679155111312866,
-0.7815077304840088,
1.0995738506317139,
0.14099131524562836,
0.020233051851391792,
-0.43085819482803345,
-0.1838143914937973,
-0.41373... |
func NewOperatorContext(ctx context.Context, operator Operator) context.Context {
return context.WithValue(ctx, operatorContext, operator)
} | [
-0.7378979921340942,
-0.5655216574668884,
0.20996040105819702,
0.4505375325679779,
-2.1853747367858887,
-0.015519815497100353,
-0.315804123878479,
-0.6756717562675476,
1.5000697374343872,
0.31969985365867615,
0.054357536137104034,
-0.3159557282924652,
0.2636907994747162,
-0.148662105202674... |
func SessionFromContext(ctx context.Context) teleservices.WebSession {
session, ok := ctx.Value(webSessionContext).(teleservices.WebSession)
if !ok {
return nil
}
return session
} | [
0.024248050525784492,
-0.6566262245178223,
0.20553728938102722,
0.16333335638046265,
-0.5304301381111145,
-0.14330922067165375,
-0.09715782850980759,
-1.9916880130767822,
1.9190081357955933,
-0.14176610112190247,
0.03435607999563217,
-0.20143939554691315,
-0.10734199732542038,
0.3494091033... |
func NewSessionContext(ctx context.Context, session teleservices.WebSession) context.Context {
return context.WithValue(ctx, webSessionContext, session)
} | [
0.196273535490036,
-0.8853262662887573,
0.40784963965415955,
0.475763738155365,
-1.2455592155456543,
-0.21853768825531006,
-0.28617048263549805,
-1.3955992460250854,
2.246729612350464,
0.25931352376937866,
-0.46520957350730896,
0.16591963171958923,
0.9804570078849792,
0.4551107883453369,
... |
func NewSecureReader(r io.Reader, priv, pub *[keySize]byte) io.Reader {
return SecureReader{r, priv, pub}
} | [
0.2338440716266632,
-0.7680667042732239,
0.08442241698503494,
0.03147472068667412,
-1.2024105787277222,
-0.6879820227622986,
-1.6690177917480469,
-0.31109896302223206,
-0.0803951770067215,
-0.8935418128967285,
-0.5222151279449463,
0.8700478672981262,
-0.6264140009880066,
-0.156963258981704... |
func NewSecureWriter(w io.Writer, priv, pub *[keySize]byte) io.Writer {
return SecureWriter{w, priv, pub}
} | [
0.09516221284866333,
-0.35413405299186707,
0.1211962178349495,
0.704595685005188,
-0.5276753306388855,
-1.0828118324279785,
-1.1855107545852661,
-0.1572623997926712,
-0.33547458052635193,
-0.2916041910648346,
-0.6660587191581726,
0.30159562826156616,
-0.6072861552238464,
0.0946366637945175... |
func NewSecureConn(c io.ReadWriteCloser, localPub, remotePub, localPriv *[keySize]byte) io.ReadWriteCloser {
r := NewSecureReader(c, localPriv, remotePub)
w := NewSecureWriter(c, localPriv, remotePub)
return SecureConn{c, r, w}
} | [
0.09710212051868439,
-1.2427699565887451,
0.49868646264076233,
0.38085439801216125,
-0.9982372522354126,
-0.7969313859939575,
-0.8284589648246765,
0.49458280205726624,
-0.7231320142745972,
-0.8035910129547119,
-0.25331729650497437,
0.08614294975996017,
-0.46588948369026184,
0.4992747008800... |
func (s SecureConn) Close() error {
return s.c.Close()
} | [
0.6643297076225281,
-0.3634469509124756,
0.4341224431991577,
1.4715057611465454,
0.03341446444392204,
0.22899191081523895,
0.007795014418661594,
-0.14024561643600464,
-0.2500435411930084,
-1.3618873357772827,
-0.19611959159374237,
-0.3216044008731842,
-0.4984981417655945,
0.293501615524292... |
func Dial(addr string) (io.ReadWriteCloser, error) {
localPub, localPriv, err := box.GenerateKey(rand.Reader)
if err != nil {
return nil, err
}
conn, err := net.Dial("tcp", addr)
if err != nil {
return nil, err
}
// Send my public key.
_, err = conn.Write(localPub[:])
if err != nil {
return nil, err
}... | [
-0.007013439200818539,
0.1456661820411682,
0.8011566996574402,
-0.0700291097164154,
-0.3820679485797882,
0.252133846282959,
-0.48630937933921814,
0.16023632884025574,
-0.43803125619888306,
0.37470194697380066,
-0.19584372639656067,
0.854512095451355,
-0.1976451426744461,
1.0607138872146606... |
func Serve(l net.Listener) error {
for {
conn, err := l.Accept()
if err != nil {
return err
}
go handleConn(conn)
}
} | [
-0.1413029134273529,
0.18220016360282898,
0.7238519191741943,
0.0014437385834753513,
0.5411762595176697,
0.644078254699707,
-0.41407352685928345,
0.0333687923848629,
-1.4679256677627563,
0.31810829043388367,
-0.8782483339309692,
-0.6348543763160706,
-0.2063291370868683,
0.9374845623970032,... |
func Cors(wsContainer *restful.Container) {
// Add container filter to enable CORS
cors := restful.CrossOriginResourceSharing{
// ExposeHeaders: []string{"X-My-Header"},
AllowedHeaders: []string{"Content-Type", "Accept", "Authorization"},
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE"},
CookiesAllow... | [
0.4598689079284668,
-0.49437272548675537,
0.7422906160354614,
-0.5930343866348267,
-0.6475924253463745,
-0.01814570650458336,
-0.1404770314693451,
-0.26999348402023315,
0.4826289713382721,
0.213139608502388,
1.0704113245010376,
0.7738869190216064,
0.4795132875442505,
0.5255048274993896,
... |
func CreateTask(w http.ResponseWriter, request *http.Request) {
w.Header().Set("Context-Type", "application/x-www-form-urlencoded")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "POST")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
var task model... | [
-0.7059417963027954,
0.651032567024231,
0.7569822669029236,
0.5654836893081665,
0.24159805476665497,
0.535132884979248,
-0.04701494425535202,
0.03192812204360962,
-0.09163421392440796,
0.5094676613807678,
-1.0455819368362427,
-0.766231894493103,
0.3155538737773895,
0.24032245576381683,
-... |
func DeleteTask(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Context-Type", "application/x-www-form-urlencoded")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "DELETE")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
params := mux.Vars... | [
-0.300751268863678,
-0.46598002314567566,
0.8139638304710388,
0.8373553156852722,
-0.36227133870124817,
0.12435726821422577,
0.25462496280670166,
-0.41087600588798523,
0.0315379872918129,
0.13339515030384064,
-0.23016604781150818,
0.6376054883003235,
0.5967618823051453,
1.1122536659240723,... |
func DeleteAllTask(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Context-Type", "application/x-www-form-urlencoded")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "DELETE")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
// params := mu... | [
0.16445179283618927,
-0.610615074634552,
1.070242166519165,
1.2758702039718628,
-0.6355754733085632,
0.3276787996292114,
0.09729442000389099,
-0.6399035453796387,
0.21313613653182983,
-0.1185968667268753,
-0.5847450494766235,
0.4202827215194702,
0.8030461072921753,
1.5563970804214478,
-0... |
func TaskComplete(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Context-Type", "application/x-www-form-urlencoded")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "PUT")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
params := mux.Vars(... | [
-0.7483870983123779,
-0.4686719477176666,
0.8309113383293152,
0.24293537437915802,
-0.5072977542877197,
-0.00767598208039999,
0.023528024554252625,
-0.7288089394569397,
-0.8980293273925781,
1.7387917041778564,
-0.6957462430000305,
-0.4286799132823944,
0.4101801812648773,
0.7024630308151245... |
func UndoTask(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/x-www-form-urlencoded")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "PUT")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
params := mux.Vars(r)... | [
-0.5385981202125549,
-0.7998723983764648,
0.7639920711517334,
-0.31561386585235596,
-0.6986884474754333,
-0.3147238492965698,
0.1964321732521057,
0.09462394565343857,
-0.34871184825897217,
0.5279167890548706,
-0.6624513268470764,
0.47713547945022583,
0.557155430316925,
0.03315594419836998,... |
func getAllTask() []primitive.M {
cur, err := collection.Find(context.Background(), bson.D{{}})
if err != nil {
log.Fatal(err)
}
var results []primitive.M
for cur.Next(context.Background()) {
var result bson.M
e := cur.Decode(&result)
if e != nil {
log.Fatal(e)
}
// fmt.Println("cur..>", cur, "resu... | [
-0.4822622835636139,
-0.10858150571584702,
0.8161936402320862,
1.2466375827789307,
0.21129615604877472,
0.487868070602417,
-0.296024888753891,
-0.5231556296348572,
-0.628934919834137,
0.09931773692369461,
-0.7234562039375305,
0.21756424009799957,
-0.355040043592453,
1.1133863925933838,
-... |
func deleteOneTask(task string) {
log.Println(task)
id, _ := primitive.ObjectIDFromHex(task)
filter := bson.M{"_id": id}
d, err := collection.DeleteOne(context.Background(), filter)
if err != nil {
log.Fatal(err)
}
log.Println("Deleted Document", d.DeletedCount)
} | [
0.11256745457649231,
0.3941153883934021,
0.42796075344085693,
0.10649319738149643,
0.07575421035289764,
0.4061111807823181,
0.8618862628936768,
0.14053112268447876,
0.5088022351264954,
0.34907516837120056,
-0.9099700450897217,
0.06059001386165619,
-0.268279105424881,
0.9321255087852478,
... |
func deleteAllTask() {
log.Println("Deleting all tasks from db..")
// id, _ := primitive.ObjectIDFromHex(task)
filter := bson.M{}
d, err := collection.DeleteMany(context.Background(), filter)
if err != nil {
log.Fatal(err)
}
log.Println("all documents Deleted", d.DeletedCount)
} | [
0.9103054404258728,
-0.07498104870319366,
0.6680268049240112,
1.1555424928665161,
-0.0027171929832547903,
0.844144880771637,
0.3217492401599884,
0.4405200779438019,
0.40218281745910645,
-0.0904158279299736,
-0.8466116189956665,
-0.05722898617386818,
0.3943464756011963,
1.7422516345977783,
... |
func taskComplete(task string) {
log.Println(task)
id, _ := primitive.ObjectIDFromHex(task)
filter := bson.M{"_id": id}
update := bson.M{"$set": bson.M{"status": true}}
result, err := collection.UpdateOne(context.Background(), filter, update)
if err != nil {
log.Fatal(err)
}
log.Println("modified count: ", r... | [
-0.25204265117645264,
-0.08384228497743607,
0.6523003578186035,
-0.1940675526857376,
-0.10688218474388123,
0.4366632401943207,
0.5053560137748718,
0.762464165687561,
-0.7587348222732544,
1.8567558526992798,
-1.245305061340332,
-0.8639729022979736,
0.3205184042453766,
0.4213715195655823,
... |
func undoTask(task string) {
log.Println(task)
id, _ := primitive.ObjectIDFromHex(task)
filter := bson.M{"_id": id}
update := bson.M{"$set": bson.M{"status": false}}
result, err := collection.UpdateOne(context.Background(), filter, update)
if err != nil {
log.Fatal(err)
}
log.Println("modified count: ", resu... | [
-0.2962472438812256,
-0.02505161054432392,
0.6098341941833496,
-0.7016373872756958,
0.005705192685127258,
0.7281676530838013,
0.8977552056312561,
1.7224698066711426,
-0.4744390845298767,
0.413560152053833,
-0.7917193174362183,
0.08755534887313843,
-0.09041502326726913,
-0.03184554353356361... |
func TestIRC(t *testing.T) {
if c := New("test", "test", "Testing IRC"); c == nil {
t.FailNow()
}
} | [
0.8912407755851746,
-0.274172306060791,
0.39660388231277466,
-0.3448021411895752,
1.367213487625122,
-0.07389970123767853,
1.0937740802764893,
-0.8124908208847046,
-0.967208981513977,
-1.165219783782959,
-0.4166305959224701,
0.27654388546943665,
-0.7089505195617676,
0.7535616755485535,
-... |
func PostRealData(M []TransferpostData) { //转移任务结果异步汇报中央
b, err := json.Marshal(M)
if err != nil {
log.Error("jsondumps data is occur error is %s", err.Error())
}
body := bytes.NewBuffer([]byte(b))
for j := 0; j < 1; j++ {
var i int
center_list := getCENTERIPlist(CENTERIPLIST)
for i = 0; i < len(center_li... | [
-0.179376021027565,
0.11402682960033417,
1.2723439931869507,
0.06937113404273987,
-0.03911078721284866,
0.13002482056617737,
0.3203853666782379,
0.21506400406360626,
-0.21234367787837982,
0.41377949714660645,
-0.9244585633277893,
-0.30206647515296936,
-1.397341251373291,
0.4358436465263366... |
func DirSize(path string) (size int64, err error) {
err = filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
if !info.IsDir() {
size += info.Size()
}
return err
})
return size, err
} | [
-0.7846240401268005,
0.5757843255996704,
0.5968058705329895,
0.15911699831485748,
-0.6567533612251282,
-0.271910160779953,
0.985578179359436,
-0.29511070251464844,
0.187785342335701,
-0.40061408281326294,
-0.3796018064022064,
-0.5676643252372742,
-0.6836822032928467,
0.9687995314598083,
... |
func DirFilenames(path string) (info []string, err error) {
f, err := os.Open(path)
if err != nil {
return nil, err
}
fi, err := f.Stat()
if err != nil {
return nil, err
}
// If Not Directory return error
if !fi.IsDir() {
return nil, ErrNotDirectory
}
defer f.Close()
return f.Readdirnames(0)
} | [
-0.5525915026664734,
-0.23450389504432678,
0.9349761009216309,
0.4868828356266022,
-0.3426220417022705,
-0.07904136180877686,
-0.0787525400519371,
-0.44011273980140686,
-0.004313504323363304,
0.1347980946302414,
-0.511445164680481,
0.33307093381881714,
0.3287253677845001,
0.589836597442627... |
func getAPIResponse(site, UserAgent string) (response APIResponse) {
// Instantiate a new instance of the JSON data model.
data := APIResponse{}
// Format the request URL
url := fmt.Sprintf("http://isitup.org/%s.json", site)
// Instantiate a new client
client := &http.Client{}
// Retrieve the API response
re... | [
-0.7919660806655884,
-0.3352274000644684,
0.8457732200622559,
-0.5374933481216431,
0.012584563344717026,
-0.47188737988471985,
-0.35798951983451843,
0.09468019753694534,
0.25956398248672485,
0.6678019762039185,
-0.651035487651825,
-0.0589618906378746,
-0.8173219561576843,
-1.27276384830474... |
func GetDomain(site, UserAgent string) string {
return getAPIResponse(site, UserAgent).Domain
} | [
-0.6343274712562561,
0.03992059826850891,
0.2912848889827728,
0.9465632438659668,
0.010848350822925568,
-0.2595723271369934,
-0.10868551582098007,
-0.15518680214881897,
0.8703868389129639,
-0.6529061794281006,
-0.40377146005630493,
0.7480071187019348,
-0.3464653193950653,
0.114777632057666... |
func GetIP(site, UserAgent string) string {
return getAPIResponse(site, UserAgent).ResponseIP
} | [
-0.8171793818473816,
-0.1814981997013092,
0.366126149892807,
0.8731944561004639,
-0.9937026500701904,
-0.16181164979934692,
0.4677615761756897,
0.3691297769546509,
1.260780692100525,
0.19979755580425262,
0.024477310478687286,
-0.809198260307312,
-0.07481617480516434,
-1.3496785163879395,
... |
func GetPort(site, UserAgent string) int {
return getAPIResponse(site, UserAgent).Port
} | [
-0.04933852329850197,
0.4757695198059082,
0.21367999911308289,
0.3027440309524536,
0.2520062327384949,
-0.7233537435531616,
1.1130902767181396,
-0.16832159459590912,
1.0040535926818848,
-0.2564508020877838,
-0.41464313864707947,
-0.3215138018131256,
-0.855187177658081,
-0.12842145562171936... |
func GetStatusCode(site, UserAgent string) int {
return getAPIResponse(site, UserAgent).ResponseCode
} | [
-0.03523015230894089,
-0.5371061563491821,
0.5230109095573425,
0.5864666700363159,
-0.4500201642513275,
-0.6923462748527527,
0.6142673492431641,
0.5508356690406799,
1.1372532844543457,
-0.05896512046456337,
-0.6129772067070007,
0.12474988400936127,
-0.3536125123500824,
0.05158448964357376,... |
func GetResponseTime(site, UserAgent string) float64 {
return getAPIResponse(site, UserAgent).ResponseTime
} | [
0.036406371742486954,
-0.13279719650745392,
0.19398660957813263,
0.45904234051704407,
0.1354789435863495,
-0.7350863218307495,
0.277902752161026,
-0.4570201337337494,
1.1756178140640259,
0.19085469841957092,
-0.26397624611854553,
-1.0559431314468384,
-0.7919496893882751,
0.3487323820590973... |
func NewStore() *Store {
return &Store{
RaftDir: "",
RaftBindAddr: "",
data: make(map[string]string),
}
} | [
0.36529868841171265,
-0.42259126901626587,
0.08969476073980331,
0.16533711552619934,
-0.831819474697113,
0.17643244564533234,
0.39804568886756897,
-0.7098723649978638,
0.28411367535591125,
-1.4271414279937744,
0.12666082382202148,
1.0116755962371826,
-1.1899006366729736,
0.3982900083065033... |
func (s *Store) Open(enableSingle bool, localID string) error {
// Setup Raft configuration.
config := raft.DefaultConfig()
config.LocalID = raft.ServerID(localID) // LocalID is the unique ID for this node across all time. API: type ServerID string.
// Setup Raft network communication.
// Create a NetworkTranspor... | [
0.10694877058267593,
0.8904445767402649,
0.7536182403564453,
-0.13642825186252594,
0.29954907298088074,
0.36649513244628906,
1.1548831462860107,
0.7031837105751038,
-0.051772940903902054,
-0.19482123851776123,
-0.269060343503952,
0.8121533393859863,
-0.6442195177078247,
0.379738986492157,
... |
func (s *Store) Apply(log *raft.Log) interface{} {
var c command
if err := json.Unmarshal(log.Data, &c); err != nil {
panic(fmt.Sprintf("Failed to unmarshal command: %s", err.Error()))
}
switch c.Op {
case "SET":
return s.applySet(c.Key, c.Val)
case "DELETE":
return s.applyDelete(c.Key)
default:
return ... | [
0.3366491496562958,
0.5000895261764526,
0.7472512125968933,
0.21621772646903992,
-1.0874332189559937,
-0.7040544748306274,
0.19870209693908691,
0.20901642739772797,
0.6266232132911682,
-0.20868895947933197,
0.38861095905303955,
0.1202709972858429,
0.18337614834308624,
-0.20230744779109955,... |
func (s *Store) Snapshot() (raft.FSMSnapshot, error) {
// TODO
return nil, nil
} | [
0.07262558490037918,
0.7189117670059204,
0.31398701667785645,
0.4388197958469391,
-0.26923033595085144,
-0.814837634563446,
1.1121314764022827,
-0.06129738315939903,
1.0205804109573364,
-1.6686004400253296,
-0.4551408588886261,
-0.2461581528186798,
-0.49890124797821045,
-0.4000841081142425... |
func (s *Store) Restore(rc io.ReadCloser) error {
// TODO
return nil
} | [
0.3259682357311249,
-1.133337140083313,
0.2799878716468811,
0.10647567361593246,
-0.6516440510749817,
-0.07716512680053711,
0.3330027759075165,
-0.05646025761961937,
0.5471194982528687,
-0.6252487897872925,
0.2890239953994751,
-0.41004154086112976,
-1.7692780494689941,
-0.4827146828174591,... |
func Test_LogoutValidToken(t *testing.T) {
dir, err := tempConfig("")
if err != nil {
t.Error(err)
}
defer os.RemoveAll(dir)
mockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Wr... | [
0.16606959700584412,
-0.007284818682819605,
0.5145633816719055,
-0.8696627020835876,
0.18198132514953613,
0.044728800654411316,
-0.3099348545074463,
0.2338714301586151,
0.3242316246032715,
-0.18137310445308685,
-0.5254207253456116,
-0.2308625876903534,
-0.23757478594779968,
-0.367696315050... |
func Test_LogoutInvalidToken(t *testing.T) {
dir, err := tempConfig("")
if err != nil {
t.Error(err)
}
defer os.RemoveAll(dir)
mockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusUnauthor... | [
-0.5078855156898499,
0.20211990177631378,
0.46027886867523193,
-0.6129592657089233,
-0.4507542848587036,
0.0735410749912262,
-0.27925974130630493,
0.357489675283432,
-0.192186176776886,
-0.2946310341358185,
-0.5404700636863708,
0.2723371088504791,
-0.4152342975139618,
-0.19256938993930817,... |
func Test_LogoutCommand(t *testing.T) {
dir, err := tempConfig("")
if err != nil {
t.Error(err)
}
defer os.RemoveAll(dir)
mockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write... | [
-0.36783647537231445,
-0.7278315424919128,
0.559089183807373,
-0.9312440156936646,
0.7160218954086304,
-0.03560931235551834,
0.4648161232471466,
-0.16986796259880066,
0.5191456079483032,
-0.9875378608703613,
-0.19788219034671783,
0.31278669834136963,
-0.16887885332107544,
0.075798518955707... |
func setupV1alpha1(hncVersion string){
GinkgoT().Log("Set up v1alpha1")
MustRun("kubectl apply -f https://github.com/kubernetes-sigs/multi-tenancy/releases/download/hnc-"+hncVersion+"/hnc-manager.yaml")
// Wait for the validating webhooks to be ready.
ensureVWHReady()
// Verify there's no 'v1alpha2' in all three ... | [
0.5222126245498657,
-0.9157108068466187,
0.6415213346481323,
0.14679200947284698,
0.8290277719497681,
0.8829169869422913,
-0.28404155373573303,
0.7948811650276184,
-0.3495902419090271,
0.7625311017036438,
0.09732507169246674,
0.3811464309692383,
0.5031483769416809,
0.9944011569023132,
0.... |
func setupV1alpha2(){
GinkgoT().Log("Set up v1alpha2")
MustRun("kubectl apply -f ../../manifests/hnc-manager.yaml")
// Wait for the cert rotator to write caBundles in CRD conversion webhooks.
ensureCRDConvWHReady()
} | [
0.697337806224823,
-1.4896440505981445,
0.42464151978492737,
0.20252597332000732,
0.3255298137664795,
0.24470847845077515,
-0.07880619913339615,
0.5793201327323914,
-0.048212211579084396,
0.1024293601512909,
0.35656630992889404,
0.8627561926841736,
0.7132869362831116,
1.0842218399047852,
... |
func verifyCRDConversion(){
checkCRDVersionInField("v1alpha1", ".spec.versions", true)
checkCRDVersionInField("v1alpha2", ".spec.versions", true)
checkCRDVersionInField("v1alpha1", ".status.storedVersions", false)
checkCRDVersionInField("v1alpha2", ".status.storedVersions", true)
} | [
0.44371137022972107,
-0.40624114871025085,
0.6316666007041931,
0.4683475196361542,
1.1412111520767212,
0.9010481238365173,
0.5077134370803833,
0.27606406807899475,
-0.5442087650299072,
0.7657230496406555,
-1.0117048025131226,
0.042856257408857346,
0.22904707491397858,
1.0768201351165771,
... |
func checkCRDVersionInField(version, field string, expected bool) {
for _, crd := range crds {
if expected {
FieldShouldContainWithTimeout("crd", "", crd, field, version, crdConversionTime)
} else {
FieldShouldNotContainWithTimeout("crd", "", crd, field, version, crdConversionTime)
}
}
} | [
0.5514666438102722,
-0.009052359499037266,
0.5906679630279541,
0.20575611293315887,
0.10762914270162582,
0.41325613856315613,
-0.4635635018348694,
0.5256810784339905,
-1.1825796365737915,
1.4183281660079956,
-0.2535600960254669,
0.2011796534061432,
-0.9574131369590759,
0.8992928266525269,
... |
func ensureVWHReady(){
MustRunWithTimeout(certsReadyTime, "kubectl create ns check-webhook")
MustRun("kubectl delete ns check-webhook")
} | [
1.2068514823913574,
0.4804942011833191,
0.4225893020629883,
0.7011345624923706,
1.622625708580017,
-0.04749075695872307,
-1.2764111757278442,
-1.0857559442520142,
1.0987685918807983,
1.0216959714889526,
-0.4189987778663635,
0.9576238393783569,
0.5814014077186584,
1.3489545583724976,
-0.3... |
func (pointerToPerson *person) updateFirstName(newFirstName string) {
(*pointerToPerson).firstName = newFirstName
} | [
-0.2663264572620392,
-1.5496747493743896,
0.1977027803659439,
-0.11773604899644852,
-0.9782622456550598,
0.06454768776893616,
-0.1330871433019638,
0.10935087502002716,
0.3360689878463745,
0.7279261946678162,
0.34293127059936523,
0.26419544219970703,
-0.949406623840332,
1.3236035108566284,
... |
func (p person) print() {
fmt.Printf("%+v", p)
} | [
0.24616026878356934,
-0.10790727287530899,
0.439542293548584,
-0.4579220414161682,
-0.10420715808868408,
1.4359179735183716,
-1.0902358293533325,
0.4485272467136383,
-0.2113426774740219,
-0.7222721576690674,
0.452127069234848,
0.4544129967689514,
-0.858078122138977,
0.018058933317661285,
... |
func main() {
var keyType string
flag.StringVar(&keyType, "type", keyType, fmt.Sprintf("type of public key provided [%s]", strings.Join(ValidKeyTypes, ", ")))
flag.Parse()
if len(keyType) == 0 {
flag.Usage()
os.Exit(1)
}
if !isSupportedKeyType(keyType) {
fmt.Printf("error: invalid key type provided '%s'"... | [
0.11074487864971161,
-0.3362302780151367,
1.2697919607162476,
0.7514285445213318,
-0.34456682205200195,
0.662499189376831,
0.5396543741226196,
-0.2681812644004822,
-0.9917384386062622,
0.4069213271141052,
-0.0559142529964447,
1.1205549240112305,
-0.7157976031303406,
0.2962227761745453,
0... |
func NewArticleDetail(app *tview.Application, parent tview.Primitive) *ArticleDetail {
// Create the view
dd := &ArticleDetail{
Flex: tview.NewFlex(),
app: app,
parent: parent,
bodyText: tview.NewTextView(),
urlText: tview.NewTextView(),
}
dd.bodyText.
SetTextAlign(tview.AlignLeft).
SetTi... | [
0.9963470101356506,
0.4972466826438904,
0.4565308392047882,
-1.0823317766189575,
-1.5138007402420044,
0.19639070332050323,
-0.6129114031791687,
0.6028063893318176,
-0.13516153395175934,
-0.5751100778579712,
0.1961265206336975,
0.1351863592863083,
0.4005392789840698,
0.2858162522315979,
-... |
func (a *ArticleDetail) Refresh(article *news.Article) {
a.app.QueueUpdateDraw(func() {
a.article = article
a.SetTitle(a.article.Title)
a.bodyText.SetText(a.article.Description)
a.urlText.SetText(a.article.Link)
})
} | [
0.42505592107772827,
-0.01565355435013771,
0.12135803699493408,
-0.7364617586135864,
-0.4606917202472687,
0.3042632043361664,
-0.7749525904655457,
-0.47198286652565,
0.5696936249732971,
-0.07473377138376236,
-0.009801183827221394,
0.8772176504135132,
0.6889398694038391,
1.011846899986267,
... |
func Provision(
instance *ServiceInstance,
clusterConfig ClusterConfig,
log *logging.Logger,
) (string, *ExtractedCredentials, error) {
log.Notice("============================================================")
log.Notice(" PROVISIONING ")
log.Notice("================... | [
-0.060070570558309555,
-0.49996909499168396,
0.7959849834442139,
-0.12239052355289459,
-1.0291298627853394,
-0.34573790431022644,
-0.33821436762809753,
0.19671408832073212,
0.2296275645494461,
1.4616975784301758,
0.37704339623451233,
0.35307252407073975,
-0.02492627501487732,
0.55875962972... |
func RenameFile(fileName string) (string, error) {
f, err := os.Open(fileName)
if err != nil {
log.Error.Println(err)
return fileName, err
}
buffer := make([]byte, 512)
_, err = f.Read(buffer)
if err != nil {
f.Close()
return fileName, err
}
f.Close()
contentType := http.DetectContentType(buffer)
fi... | [
0.036029789596796036,
-1.1501632928848267,
1.1745742559432983,
0.037966445088386536,
0.015558109618723392,
0.5032042860984802,
0.8347158432006836,
-0.05104540288448334,
-0.04432274028658867,
0.546807587146759,
0.4187118411064148,
-0.024447200819849968,
-0.6585721373558044,
0.58024120330810... |
func NewMockElectionManager(ctrl *gomock.Controller) *MockElectionManager {
mock := &MockElectionManager{ctrl: ctrl}
mock.recorder = &MockElectionManagerMockRecorder{mock}
return mock
} | [
-1.1170928478240967,
0.09934526681900024,
0.1944211721420288,
0.044248782098293304,
0.06366807222366333,
-0.6808815002441406,
-0.018302392214536667,
0.039530761539936066,
1.4330722093582153,
-0.30727046728134155,
-0.7467985153198242,
-0.56484454870224,
-0.10092025250196457,
1.4123588800430... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.