text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (x BalanceEventType) String() string {
if str, ok := _BalanceEventTypeMap[x]; ok {
return str
}
return fmt.Sprintf("BalanceEventType(%d)", x)
} | [
0.7467325329780579,
-0.787688672542572,
0.30332350730895996,
-0.2820371091365814,
0.7461291551589966,
0.8071803450584412,
0.41639062762260437,
-1.1754450798034668,
0.9214978218078613,
0.20737877488136292,
0.012058166787028313,
-0.2770630717277527,
-0.40678510069847107,
0.15688779950141907,... |
func ParseBalanceEventType(name string) (BalanceEventType, error) {
if x, ok := _BalanceEventTypeValue[name]; ok {
return x, nil
}
return BalanceEventType(0), fmt.Errorf("%s is not a valid BalanceEventType", name)
} | [
0.2993941605091095,
-0.7548187971115112,
0.604971706867218,
-0.4784555733203888,
0.06317639350891113,
-0.1491422951221466,
0.24319776892662048,
-0.3256066143512726,
1.1319606304168701,
0.10807760804891586,
-0.2047562152147293,
-0.37709829211235046,
-0.5843408703804016,
0.8695802688598633,
... |
func (s *Server) MakeDaemon() {
s.daemon = true
} | [
-0.3154295086860657,
-0.017385410144925117,
0.3065146505832672,
-0.42328718304634094,
-0.27019602060317993,
1.124159812927246,
0.6390306353569031,
1.0271674394607544,
0.3822218179702759,
-1.5692217350006104,
-1.3263801336288452,
0.6361076235771179,
-0.3037037253379822,
0.5826758146286011,
... |
func printCertificate(cert *x509.Certificate) bool {
fmt.Printf("Subject:%s\t%s%s\n", Green, cert.Subject, Reset)
fmt.Printf("Valid from:%s\t%s%s\n", Yellow, cert.NotBefore, Reset)
fmt.Printf("Valid until:%s\t%s%s\n", Yellow, cert.NotAfter, Reset)
fmt.Printf("Issuer:%s\t\t%s%s\n", Cyan, cert.Issuer.Organization[0]... | [
0.39414680004119873,
0.057538799941539764,
1.0175974369049072,
-0.617435097694397,
-0.16423092782497406,
0.5463582277297974,
-0.5635289549827576,
-0.26504844427108765,
-0.2680407464504242,
-0.061639975756406784,
-0.7477227449417114,
0.1963271200656891,
-0.4263225793838501,
0.23164966702461... |
func (t *tplate) loadContents(in io.Reader) ([]byte, error) {
if in == nil {
f, err := fs.OpenFile(t.name, os.O_RDONLY, 0)
if err != nil {
return nil, fmt.Errorf("failed to open %s: %w", t.name, err)
}
// nolint: errcheck
defer f.Close()
in = f
}
b, err := ioutil.ReadAll(in)
if err != nil {
return... | [
-0.7560106515884399,
-0.5586805939674377,
0.4347169101238251,
-0.9998981952667236,
-1.2832703590393066,
-0.5714155435562134,
0.035913195461034775,
-0.8072311282157898,
-0.18826724588871002,
0.41058090329170227,
0.10602521896362305,
-1.1513056755065918,
-1.0422171354293823,
0.08785301446914... |
func gatherTemplates(cfg *config.Config, outFileNamer func(string) (string, error)) (templates []*tplate, err error) {
mode, modeOverride, err := cfg.GetMode()
if err != nil {
return nil, err
}
switch {
// the arg-provided input string gets a special name
case cfg.Input != "":
templates = []*tplate{{
name... | [
-0.41510888934135437,
0.1377657800912857,
0.624721348285675,
0.3799854815006256,
-0.5732620358467102,
-0.08553146570920944,
0.6523637771606445,
0.0736350417137146,
-0.24365568161010742,
0.5632002353668213,
-0.0011405408149585128,
-0.14706911146640778,
-0.19451124966144562,
1.08857882022857... |
func processTemplates(cfg *config.Config, templates []*tplate) ([]*tplate, error) {
for _, t := range templates {
if t.contents == "" {
var in io.Reader
if t.name == "-" {
in = cfg.Stdin
}
b, err := t.loadContents(in)
if err != nil {
return nil, err
}
t.contents = string(b)
}
if t... | [
-0.7998621463775635,
-0.6880193948745728,
0.6042277216911316,
-0.28152698278427124,
-0.5032618641853333,
-0.4271180033683777,
0.018987834453582764,
-0.4430456757545471,
0.22593125700950623,
0.887729823589325,
0.2575574219226837,
-1.160849690437317,
-1.0464555025100708,
0.8243849277496338,
... |
func walkDir(dir string, outFileNamer func(string) (string, error), excludeGlob []string, mode os.FileMode, modeOverride bool) ([]*tplate, error) {
dir = filepath.Clean(dir)
dirStat, err := fs.Stat(dir)
if err != nil {
return nil, fmt.Errorf("couldn't stat %s: %w", dir, err)
}
dirMode := dirStat.Mode()
templa... | [
-0.31950798630714417,
0.2123820036649704,
1.0039997100830078,
-0.09223758429288864,
-0.8064643740653992,
0.218247190117836,
0.963578462600708,
0.00856911763548851,
0.41916313767433167,
0.22296172380447388,
-0.29241400957107544,
-0.738588273525238,
-0.05290365219116211,
0.4288310110569,
0... |
func DeleteVideoFile(ctx context.Context, userid int64, projectid int64, database *sql.DB) error {
prefix := fmt.Sprintf("%s%d%s%s%d%s%s", userdir, userid, "/", projectdir, projectid, "/", videodir)
var delimeter = "/"
bucket, err := GetBucket(ctx)
if err != nil {
log.Println("[ERR] failed to get bucket err : ",... | [
0.549995481967926,
-0.5722722411155701,
0.7760685086250305,
0.7887061238288879,
0.13197118043899536,
0.05021722614765167,
0.6688700318336487,
0.3707562983036041,
0.1114320158958435,
0.07975504547357559,
-0.25613194704055786,
0.8062454462051392,
-0.5642980933189392,
0.623051643371582,
-0.... |
func ReadVideoFileLink(projectid int64, database *sql.DB) (string, error) {
var videolink string
stmt, err := database.Prepare(`SELECT
video_link
FROM project
WHERE id = ?`)
defer stmt.Close()
rows, err := stmt.Query(projectid)
if err != nil {
log.Println("[ERR] prepare statment query er... | [
-0.12553025782108307,
-0.43319904804229736,
0.5760047435760498,
0.5672550797462463,
-0.1639537364244461,
-0.09637153148651123,
-0.3823454976081848,
0.4043191969394684,
-0.2865067720413208,
0.31010550260543823,
0.5010114908218384,
0.7296889424324036,
-0.8360532522201538,
0.3895944058895111,... |
func ScreenInstall(window fyne.Window) fyne.CanvasObject {
var namespace string
var deploymentName string
var installTypeOption string
var dryRunOption string
var secretsFile string
var secretsPasswords string
// Entries
namespaceSelectEntry = uielements.CreateNamespaceSelectEntry(namespaceErrorLabel)
var sec... | [
0.09008973836898804,
-0.09470102190971375,
0.9261136054992676,
-0.39317408204078674,
-0.05001281574368477,
0.5627509951591492,
0.46529996395111084,
-0.3188202977180481,
0.4701246917247772,
0.5241016745567322,
-0.24382764101028442,
-0.20876266062259674,
0.2839113175868988,
1.134549856185913... |
func NewDetectLanguageParams() *DetectLanguageParams {
var ()
return &DetectLanguageParams{
timeout: cr.DefaultTimeout,
}
} | [
0.5946279764175415,
-0.45716220140457153,
0.09084299951791763,
0.8851839303970337,
0.12902900576591492,
-0.09851974993944168,
-0.5194697976112366,
0.7083489298820496,
-0.5767880082130432,
0.01822577975690365,
-0.7879934906959534,
0.11612847447395325,
-0.5386756062507629,
1.2685378789901733... |
func NewDetectLanguageParamsWithTimeout(timeout time.Duration) *DetectLanguageParams {
var ()
return &DetectLanguageParams{
timeout: timeout,
}
} | [
1.0459586381912231,
-0.7021650075912476,
0.1523391455411911,
0.8101648092269897,
-0.11110036075115204,
0.6309756636619568,
-1.2477078437805176,
0.39122816920280457,
-0.6329641342163086,
0.8959091901779175,
-0.4295891225337982,
0.40601643919944763,
-0.24780230224132538,
1.4117101430892944,
... |
func NewDetectLanguageParamsWithContext(ctx context.Context) *DetectLanguageParams {
var ()
return &DetectLanguageParams{
Context: ctx,
}
} | [
0.6259325742721558,
-0.6885877251625061,
0.25427520275115967,
0.22392399609088898,
0.21586324274539948,
0.6912669539451599,
-1.2732752561569214,
-0.19584748148918152,
-0.05559304729104042,
0.47370287775993347,
-0.5712005496025085,
-0.03115895949304104,
-0.11663275212049484,
0.9978685379028... |
func (o *DetectLanguageParams) WithTimeout(timeout time.Duration) *DetectLanguageParams {
o.SetTimeout(timeout)
return o
} | [
0.8795783519744873,
-0.32806432247161865,
0.1252845823764801,
0.2366345375776291,
-0.10816740989685059,
0.33374863862991333,
-0.3643421530723572,
0.2507942318916321,
-0.08269558846950531,
0.8921521902084351,
-0.11774058640003204,
0.11796370148658752,
0.24954785406589508,
1.6112791299819946... |
func (o *DetectLanguageParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
} | [
0.38585853576660156,
-0.1904853880405426,
0.2081373780965805,
0.3641604483127594,
0.3478570580482483,
0.5659591555595398,
-0.07343760877847672,
0.6038509607315063,
-0.5928343534469604,
1.0455797910690308,
-0.3507911264896393,
0.06249295175075531,
-0.1850273311138153,
1.7392115592956543,
... |
func (o *DetectLanguageParams) WithContext(ctx context.Context) *DetectLanguageParams {
o.SetContext(ctx)
return o
} | [
0.08867526054382324,
-0.3939359784126282,
0.23234370350837708,
0.08444969356060028,
-0.18110160529613495,
0.24449066817760468,
-0.5728540420532227,
-0.2747982144355774,
0.2717750072479248,
0.33743542432785034,
-0.3027316629886627,
0.08781307190656662,
-0.2031712830066681,
0.960975944995880... |
func (o *DetectLanguageParams) SetContext(ctx context.Context) {
o.Context = ctx
} | [
-0.3400559723377228,
-0.2891888916492462,
0.1311560720205307,
0.3358806371688843,
0.4246571958065033,
0.28743666410446167,
-0.27404868602752686,
0.05442570149898529,
0.2972952723503113,
0.3676236569881439,
-0.7275104522705078,
0.0889911875128746,
-0.4869493246078491,
1.199906349182129,
-... |
func (o *DetectLanguageParams) WithOcpApimSubscriptionKey(ocpApimSubscriptionKey *string) *DetectLanguageParams {
o.SetOcpApimSubscriptionKey(ocpApimSubscriptionKey)
return o
} | [
1.2233176231384277,
-0.7783694863319397,
0.32633495330810547,
0.45003968477249146,
-0.37136662006378174,
-0.31490227580070496,
-0.49866363406181335,
-0.19556061923503876,
0.6609374284744263,
0.6801154017448425,
0.2722121775150299,
0.06605370342731476,
0.4963661730289459,
0.3503192961215973... |
func (o *DetectLanguageParams) SetOcpApimSubscriptionKey(ocpApimSubscriptionKey *string) {
o.OcpApimSubscriptionKey = ocpApimSubscriptionKey
} | [
1.0084848403930664,
-0.9096304774284363,
0.31561586260795593,
0.24049270153045654,
-0.027237072587013245,
-0.012221693992614746,
-0.5763280987739563,
-0.2309255748987198,
0.13891838490962982,
0.62013179063797,
-0.14158327877521515,
0.18107688426971436,
-0.009515159763395786,
0.308405280113... |
func (o *DetectLanguageParams) WithBatchInputV2(batchInputV2 *models.BatchInputV2) *DetectLanguageParams {
o.SetBatchInputV2(batchInputV2)
return o
} | [
0.17272670567035675,
-1.5573029518127441,
0.16604144871234894,
0.3888256251811981,
-1.0352939367294312,
0.2680721580982208,
-0.8825120329856873,
-0.16904963552951813,
-0.7616068720817566,
0.2949131429195404,
-0.6315077543258667,
0.5704389810562134,
-0.11409752815961838,
1.1707683801651,
... |
func (o *DetectLanguageParams) SetBatchInputV2(batchInputV2 *models.BatchInputV2) {
o.BatchInputV2 = batchInputV2
} | [
-0.12519660592079163,
-1.6370718479156494,
0.24396739900112152,
0.4074738025665283,
-0.5784315466880798,
0.5382644534111023,
-0.49816370010375977,
0.18794795870780945,
-1.0769340991973877,
0.22577175498008728,
-1.147690773010254,
1.219576358795166,
-0.518147349357605,
1.0299248695373535,
... |
func (o *DetectLanguageParams) WithNumberOfLanguagesToDetect(numberOfLanguagesToDetect *int64) *DetectLanguageParams {
o.SetNumberOfLanguagesToDetect(numberOfLanguagesToDetect)
return o
} | [
0.2657071352005005,
-0.15188811719417572,
0.23163512349128723,
-0.18346868455410004,
-0.07994463294744492,
-0.5836032032966614,
-0.2206086367368698,
-0.04529361054301262,
0.4165451228618622,
0.2186349779367447,
-0.37247344851493835,
-1.0953714847564697,
0.03306812793016434,
1.0660459995269... |
func (o *DetectLanguageParams) SetNumberOfLanguagesToDetect(numberOfLanguagesToDetect *int64) {
o.NumberOfLanguagesToDetect = numberOfLanguagesToDetect
} | [
-0.12732915580272675,
-0.10136575251817703,
0.3401585519313812,
-0.10657253861427307,
0.006680439691990614,
-0.35555532574653625,
-0.18549172580242157,
0.21512649953365326,
0.2151983380317688,
-0.05310643091797829,
-0.6095060110092163,
-0.6052802205085754,
-0.09312372654676437,
0.974465250... |
func (o *DetectLanguageParams) WithSubscriptionKey(subscriptionKey *string) *DetectLanguageParams {
o.SetSubscriptionKey(subscriptionKey)
return o
} | [
0.7154419422149658,
-0.5587385296821594,
0.1465683877468109,
0.9257906675338745,
-0.5043686032295227,
-0.2061976194381714,
-0.16890032589435577,
-0.2456456869840622,
0.3446313142776489,
0.9357160925865173,
-0.12497006356716156,
0.023436101153492928,
1.2606875896453857,
1.6429696083068848,
... |
func (o *DetectLanguageParams) SetSubscriptionKey(subscriptionKey *string) {
o.SubscriptionKey = subscriptionKey
} | [
0.28236231207847595,
-0.513615608215332,
0.17410245537757874,
0.8814870715141296,
0.15262547135353088,
-0.14543117582798004,
0.1441015601158142,
-0.11387607455253601,
-0.18953144550323486,
0.9233441352844238,
-0.7127453088760376,
0.43205738067626953,
0.5009574890136719,
1.9297997951507568,... |
func (o *DetectLanguageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
r.SetTimeout(o.timeout)
var res []error
if o.OcpApimSubscriptionKey != nil {
// header param Ocp-Apim-Subscription-Key
if err := r.SetHeaderParam("Ocp-Apim-Subscription-Key", *o.OcpApimSubscriptionKey); err != ... | [
-0.1628887802362442,
-0.4549412429332733,
1.1091409921646118,
-0.5107534527778625,
0.5059531331062317,
-0.5044847726821899,
0.15707837045192719,
-0.6414027810096741,
-0.16067783534526825,
0.25280165672302246,
-0.30398374795913696,
-0.05448572710156441,
-0.46740418672561646,
0.7652162313461... |
func GetEnvVar(key string) string {
godotenv.Load("./.env")
return os.Getenv(key)
} | [
-1.1335493326187134,
-0.1987040489912033,
0.47301021218299866,
-0.3527870774269104,
-0.5462775230407715,
0.9354460835456848,
0.03132851794362068,
-0.7667659521102905,
-1.4087402820587158,
0.8904376029968262,
-0.5384478569030762,
0.6478731632232666,
-0.0949908196926117,
0.7722659707069397,
... |
func Init() {
r := gin.New()
store := sessions.NewCookieStore([]byte("secret"))
corsConfig := cors.Config{
AllowAllOrigins: true,
AllowMethods: []string{"GET", "POST", "DELETE", "PATCH", "PUT"},
AllowHeaders: []string{"Origin", "Content-Length", "Content-Type", "Authorization"},
AllowCredentials: f... | [
-0.606971025466919,
0.24119241535663605,
0.883742094039917,
0.13712769746780396,
-0.1819811314344406,
0.33417025208473206,
0.2656857669353485,
-0.148086279630661,
-0.2486436814069748,
0.19495435059070587,
-0.1800011396408081,
1.3068790435791016,
0.37661731243133545,
0.4236007034778595,
1... |
func AuthRequired(c *gin.Context) {
session := sessions.Default(c)
session.Set("user", "aoki")
user := session.Get(userKey)
if user == nil {
// Abort the request with the appropriate error code
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "unauthorized"})
return
}
// Continue down the chain... | [
-0.6997761726379395,
-0.2142181098461151,
0.4075533151626587,
1.0119966268539429,
0.08940397948026657,
0.17801743745803833,
0.3305940330028534,
-0.714586615562439,
0.21332214772701263,
0.07900592684745789,
0.333753764629364,
1.0818724632263184,
0.4462539553642273,
0.16392000019550323,
0.... |
func (r *registrations) resetHighestNumConfirmationsValue() {
highestNumConfirmations := uint64(0)
for numConfirmations := range r.subscribers {
if numConfirmations > highestNumConfirmations {
highestNumConfirmations = numConfirmations
}
}
r.highestNumConfirmations = highestNumConfirmations
} | [
0.7443360686302185,
-0.014615446329116821,
0.4932587742805481,
0.7488651275634766,
0.7068797945976257,
-0.8368389010429382,
0.5678919553756714,
0.34586983919143677,
-0.9378232359886169,
-0.305884450674057,
-0.33314600586891174,
1.2093013525009155,
0.058065205812454224,
0.7505567073822021,
... |
func filtersContainValues(topicValues []common.Hash, filters [][]Topic) bool {
for i := 0; i < len(topicValues) && i < len(filters); i++ {
filterValues := filters[i]
valueFound := len(filterValues) == 0 // empty filter for given index means: all values allowed
for _, filterValue := range filterValues {
if com... | [
0.6791471242904663,
-0.06555279344320297,
0.7078768610954285,
0.36984381079673767,
0.0661604255437851,
0.5592495203018188,
-0.3326614499092102,
-0.38846608996391296,
-0.6270599365234375,
-0.26396796107292175,
0.6534815430641174,
-0.008675641380250454,
-0.6433374881744385,
0.589767098426818... |
func NewSources(dir string, ids chronograf.ID, logger chronograf.Logger) chronograf.SourcesStore {
return &Sources{
Dir: dir,
Load: load,
Create: create,
ReadDir: ioutil.ReadDir,
Remove: os.Remove,
IDs: ids,
Logger: logger,
}
} | [
0.1722954511642456,
-0.7465078234672546,
0.13595861196517944,
-0.8394714593887329,
-0.2816143333911896,
-0.7602429986000061,
-0.04083026573061943,
-0.6033191680908203,
0.7607240676879883,
-0.9686816930770874,
0.36831045150756836,
-0.35641929507255554,
-0.7495627403259277,
0.699591636657714... |
func (d *Sources) All(ctx context.Context) ([]chronograf.Source, error) {
files, err := d.ReadDir(d.Dir)
if err != nil {
return nil, err
}
sources := []chronograf.Source{}
for _, file := range files {
if path.Ext(file.Name()) != SrcExt {
continue
}
var source chronograf.Source
if err := d.Load(path.J... | [
0.04128751531243324,
-0.12396681308746338,
0.5455546975135803,
0.08487296849489212,
0.28629419207572937,
0.06786981970071793,
-0.28125786781311035,
0.059550974518060684,
-0.001989443087950349,
-0.06019144877791405,
-0.037531618028879166,
0.07061942666769028,
-0.17504453659057617,
1.1560605... |
func (d *Sources) Add(ctx context.Context, source chronograf.Source) (chronograf.Source, error) {
genID, err := d.IDs.Generate()
if err != nil {
d.Logger.
WithField("component", "source").
Error("Unable to generate ID")
return chronograf.Source{}, err
}
id, err := strconv.Atoi(genID)
if err != nil {
d... | [
-0.8109483122825623,
-0.39591652154922485,
0.6674469709396362,
-0.9754977822303772,
0.2303948849439621,
0.144595205783844,
0.13645406067371368,
0.02768554538488388,
0.5851645469665527,
-0.23888905346393585,
-0.2123234122991562,
-0.20638521015644073,
-0.501838207244873,
0.2590791583061218,
... |
func (d *Sources) Delete(ctx context.Context, source chronograf.Source) error {
_, file, err := d.idToFile(source.ID)
if err != nil {
return err
}
if err := d.Remove(file); err != nil {
d.Logger.
WithField("component", "source").
WithField("name", file).
Error("Unable to remove source:", err)
return... | [
0.34872737526893616,
0.3985828161239624,
0.4227006733417511,
-0.7243898510932922,
0.830346405506134,
-0.23754049837589264,
0.4341946244239807,
0.1584780514240265,
0.3313898742198944,
0.14843234419822693,
-0.5272661447525024,
-0.5736566185951233,
-0.7122752666473389,
0.4118606150150299,
0... |
func (d *Sources) Get(ctx context.Context, id int) (chronograf.Source, error) {
board, file, err := d.idToFile(id)
if err != nil {
if err == chronograf.ErrSourceNotFound {
d.Logger.
WithField("component", "source").
WithField("name", file).
Error("Unable to read file")
} else if err == chronograf.E... | [
-0.45999860763549805,
-0.003032014239579439,
0.5972676277160645,
-1.1510276794433594,
0.437224805355072,
-0.38248923420906067,
0.0038643579464405775,
-0.15819966793060303,
-0.015686791390180588,
-0.2898425757884979,
0.15094982087612152,
0.16114090383052826,
-0.42528167366981506,
0.03530872... |
func (d *Sources) Update(ctx context.Context, source chronograf.Source) error {
board, _, err := d.idToFile(source.ID)
if err != nil {
return err
}
if err := d.Delete(ctx, board); err != nil {
return err
}
file := sourceFile(d.Dir, source)
return d.Create(file, source)
} | [
-0.20670977234840393,
0.18778978288173676,
0.25150394439697266,
-1.0269557237625122,
0.005460723303258419,
0.09331758320331573,
0.20932751893997192,
-0.33801671862602234,
0.4172385036945343,
0.16797566413879395,
-0.43431076407432556,
-0.3000747561454773,
-0.4395551085472107,
0.123788207769... |
func (d *Sources) idToFile(id int) (chronograf.Source, string, error) {
// Because the entire source information is not known at this point, we need
// to try to find the name of the file through matching the ID in the source
// content with the ID passed.
files, err := d.ReadDir(d.Dir)
if err != nil {
return ch... | [
-0.14537787437438965,
-0.5961668491363525,
0.5389117002487183,
-1.488563895225525,
-0.18111802637577057,
-0.4927098751068115,
0.4031180739402771,
-0.3062041997909546,
0.012858317233622074,
0.18662011623382568,
0.04468955099582672,
-0.1184852123260498,
-0.045426756143569946,
0.3863421380519... |
func (a *app) getCmd() (*exec.Cmd, error) {
path, err := exec.LookPath(a.bin)
if err != nil {
if path , err= exec.LookPath(os.Expand(a.bin, func(key string)string{
if v,ok:=(*Env)[key];ok{
return v
}else{
return ""
}
})); err!=nil{
return nil, fmt.Errorf("installing %v is in your future...", ... | [
0.3994828760623932,
-0.9660266637802124,
0.978537380695343,
0.6303096413612366,
0.12667423486709595,
0.10262878239154816,
0.37483176589012146,
-0.10049885511398315,
0.049668844789266586,
-0.6581368446350098,
1.1204969882965088,
0.9624958634376526,
0.5198646187782288,
0.9774807691574097,
... |
func Stop(cmd string, spans ...[2]time.Time) error{
if cm,ok:= appMap[cmd]; ok {
timecheck:
for ts, c:=range cm{
for _,span:=range spans {
if ts.Before(span[0]) || ts.After(span[1]) {
continue timecheck
}
}
if p, err:= os.FindProcess(c.ProcessState.Pid());err!=nil{
return fmt.Errorf("Speci... | [
-0.1893656998872757,
-0.983829915523529,
0.9802325963973999,
-0.26591619849205017,
-0.8196864128112793,
0.7679649591445923,
-0.3282169699668884,
-0.237993523478508,
0.45348477363586426,
0.5214590430259705,
0.15354196727275848,
0.309163898229599,
0.18349134922027588,
0.42751345038414,
-0.... |
func (client *Client) Watch() <-chan AvailableServers {
if len(client.discoveryConfigs) == 0 {
return nil
}
client.once.Do(func() {
for _, sdConfig := range client.discoveryConfigs {
go func(sdConfig *DiscoveryConfig) {
if err := sdConfig.plan.Run(client.consulAddr); err != nil {
log.Printf("Consul ... | [
0.14765168726444244,
-0.1779157668352127,
0.6990765333175659,
-0.037610601633787155,
0.3386519253253937,
0.27486056089401245,
0.7307419776916504,
-0.5474997758865356,
0.2346756011247635,
-0.4943888485431671,
-0.17437240481376648,
1.0734058618545532,
0.21566611528396606,
0.09327249974012375... |
func SortSlow(arr []int, arrSize, maxNum int) []int {
var twoD = make([][]int, arrSize)
for i := range twoD {
twoD[i] = make([]int, maxNum)
}
for i := range twoD {
for j := 0; j < arr[i]; j++ {
twoD[i][j] = 1
}
}
for outIndex := arrSize-1; outIndex >= 0; outIndex-- {
for inIndex := maxN... | [
0.05671660974621773,
-0.05510877072811127,
1.0423269271850586,
0.028287740424275398,
-0.9068750739097595,
-0.6940920352935791,
1.4136849641799927,
-0.8160334825515747,
0.794104278087616,
-0.9394170045852661,
-0.051371339708566666,
0.5305366516113281,
0.026830295100808144,
0.471905469894409... |
func SortFast(arr []int, arrSize, maxNum int) []int {
const bead = 'o'
all := make([]byte, maxNum*len(arr))
abacus := make([][]byte, maxNum)
for pole, space := 0, all; pole < maxNum; pole++ {
abacus[pole] = space[:len(arr)]
space = space[len(arr):]
}
var wg sync.WaitGroup
... | [
0.5088073015213013,
0.2881803512573242,
0.9105610251426697,
0.26930397748947144,
-0.8199433088302612,
-0.2357930839061737,
1.4226042032241821,
-0.18277142941951752,
0.4274396598339081,
0.4743128716945648,
-0.05724836885929108,
0.4291802942752838,
-0.07254783064126968,
0.9394504427909851,
... |
func SortFastest(arr []int, _, _ int) []int {
max := maxVal(arr)
len := len(arr)
beads := make([]int, max*len)
for i := 0; i < len; i++ {
for j := 0; j < arr[i]; j++ {
beads[i * max + j] = 1
}
}
for j := 0; j < max; j++ {
sum := 0
f... | [
0.34189799427986145,
0.4747546315193176,
0.910637378692627,
0.4370729327201843,
-1.0792173147201538,
-0.6861221790313721,
1.308485507965088,
-0.32106813788414,
0.12594209611415863,
0.6478703618049622,
-0.6678519248962402,
0.4005029797554016,
-0.0886368378996849,
0.903226375579834,
-0.782... |
func New(opts ...Opt) *Client {
c := &Client{
codec: &encoding.ProtobufCodec,
do: With(DefaultConfigOpt...),
header: http.Header{},
errorMapper: defaultErrorMapper,
}
c.buildRequest = c.BuildRequest
c.handleResponse = c.HandleResponse
c.With(opts...)
return c
} | [
-0.2266722321510315,
-0.8373782634735107,
0.4821968674659729,
0.4090712368488312,
-0.23278342187404633,
0.08553909510374069,
-0.04267168045043945,
-0.28258970379829407,
-0.398131400346756,
-1.0403940677642822,
-0.3668671250343323,
0.095625139772892,
-0.2522391378879547,
-0.3192185759544372... |
func (c *Client) Endpoint() string {
return c.url
} | [
0.6593576669692993,
-0.25990352034568787,
-0.10349801927804947,
0.2510896921157837,
0.6630842089653015,
1.0518583059310913,
0.05045462027192116,
0.5333288908004761,
-0.10754817724227905,
-0.5496324896812439,
0.30588507652282715,
0.5354784727096558,
-1.2969383001327515,
-0.2849370241165161,... |
func (opts RequestOpts) Apply(req *http.Request) {
// apply per-request options
for _, o := range opts {
if o != nil {
o(req)
}
}
} | [
-1.0624068975448608,
-0.26525944471359253,
0.44963642954826355,
0.9031832218170166,
0.4799114763736725,
0.04573976621031761,
-0.48993363976478577,
-0.06723999977111816,
0.7015767097473145,
-0.3309302031993866,
1.0523710250854492,
0.01607542484998703,
-0.14554046094417572,
1.314052820205688... |
func (c *Client) With(opts ...Opt) Opt {
return Opts(opts).Merged().Apply(c)
} | [
0.441048800945282,
-0.42080390453338623,
0.5360320806503296,
-0.31644126772880554,
-0.29739588499069214,
0.06413750350475311,
-1.4955865144729614,
-0.8659706115722656,
0.2598229944705963,
-0.2937169373035431,
-0.23191162943840027,
0.45686134696006775,
-0.19415168464183807,
-0.2007854580879... |
func (c *Client) WithTemporary(opt Opt, f func() error) error {
if opt != nil {
undo := c.With(opt)
defer c.With(undo)
}
return f()
} | [
0.34811004996299744,
0.4613626003265381,
0.4980278015136719,
0.022849610075354576,
-0.6485019326210022,
-0.9057090878486633,
-0.3000028133392334,
0.05678535997867584,
-0.3342008888721466,
0.5106514692306519,
0.004083642270416021,
-0.4330110251903534,
0.5293641686439514,
-1.0447306632995605... |
func (c *Client) Mesos(opts ...RequestOpt) mesos.Client {
return mesos.ClientFunc(func(m encoding.Marshaler) (mesos.Response, error) {
return c.Do(m, opts...)
})
} | [
-0.09143304079771042,
0.05547504499554634,
0.48788905143737793,
-0.1689278483390808,
-0.4943622350692749,
-0.4549323618412018,
-0.7695833444595337,
-1.037455677986145,
0.037989575415849686,
-1.033096194267273,
-0.1700192093849182,
0.7637412548065186,
0.6861069798469543,
-0.3452940881252289... |
func (c *Client) BuildRequest(m encoding.Marshaler, opt ...RequestOpt) (*http.Request, error) {
var body bytes.Buffer //TODO(jdef): use a pool to allocate these (and reduce garbage)?
if err := c.codec.NewEncoder(&body).Encode(m); err != nil {
return nil, err
}
req, err := http.NewRequest("POST", c.url, &body)
i... | [
-0.5052830576896667,
-0.037590477615594864,
0.6881449818611145,
0.3237901031970978,
-0.08259998261928558,
-0.46935421228408813,
-0.42984825372695923,
-0.08658068627119064,
0.09711000323295593,
-0.2596985995769501,
0.48997583985328674,
0.7020038962364197,
-0.23942527174949646,
-0.4032899439... |
func (c *Client) HandleResponse(res *http.Response, err error) (mesos.Response, error) {
if err != nil {
if res != nil && res.Body != nil {
res.Body.Close()
}
return nil, err
}
result := &Response{
Closer: res.Body,
Header: res.Header,
}
if err = c.errorMapper(res); err != nil {
return result, err
... | [
0.05187063291668892,
-0.29037368297576904,
0.4875374734401703,
0.27553731203079224,
-0.5030645132064819,
-0.3249669671058655,
-0.4794626533985138,
-0.10943199694156647,
0.46610745787620544,
-0.6380444765090942,
0.09142373502254486,
-0.20285025238990784,
-0.4429485499858856,
-0.142576545476... |
func (c *Client) Do(m encoding.Marshaler, opt ...RequestOpt) (res mesos.Response, err error) {
var req *http.Request
req, err = c.buildRequest(m, opt...)
if err == nil {
res, err = c.handleResponse(c.do(req))
}
return
} | [
-0.025365496054291725,
0.20530879497528076,
0.8376392722129822,
0.5538271069526672,
0.09677798300981522,
0.4164874851703644,
-0.5844904780387878,
-0.9280787110328674,
-0.32508501410484314,
-0.6192333698272705,
-0.1909438520669937,
-0.08024519681930542,
0.04278125613927841,
0.15410119295120... |
func Endpoint(rawurl string) Opt {
return func(c *Client) Opt {
old := c.url
c.url = rawurl
return Endpoint(old)
}
} | [
0.02874705009162426,
0.362930566072464,
0.2680390179157257,
0.0919463261961937,
-0.1891051083803177,
-0.22181178629398346,
-0.17894957959651947,
0.4393483102321625,
0.617662787437439,
-0.2704141139984131,
-0.08626475185155869,
0.8715148568153381,
-0.4874488413333893,
-0.40312281250953674,
... |
func WrapDoer(f func(DoFunc) DoFunc) Opt {
return func(c *Client) Opt {
old := c.do
c.do = f(c.do)
return Do(old)
}
} | [
-0.1701033115386963,
-0.2514806389808655,
0.6645209789276123,
-0.40941548347473145,
-0.5552011728286743,
0.5211204290390015,
-0.28819769620895386,
-0.7469460368156433,
-0.631174623966217,
0.24299636483192444,
0.03394316881895065,
0.5248931646347046,
0.7522626519203186,
0.4669173061847687,
... |
func Do(do DoFunc) Opt {
return func(c *Client) Opt {
old := c.do
c.do = do
return Do(old)
}
} | [
0.5796324014663696,
1.0160704851150513,
0.7139474153518677,
-0.4061095118522644,
-0.13493268191814423,
0.17850905656814575,
-0.2042590230703354,
-1.215613603591919,
-0.4054291546344757,
-0.09863787144422531,
-0.4583810865879059,
1.1718554496765137,
0.5748299956321716,
-0.14997105300426483,... |
func Codec(codec *encoding.Codec) Opt {
return func(c *Client) Opt {
old := c.codec
c.codec = codec
return Codec(old)
}
} | [
1.0312451124191284,
-0.09462527930736542,
0.4603506624698639,
-0.5203394889831543,
-0.642230212688446,
-0.16538788378238678,
0.298675537109375,
-0.6038861274719238,
0.7246963381767273,
-1.0202887058258057,
0.501623809337616,
1.5293184518814087,
0.864013671875,
-0.6868456602096558,
0.1319... |
func DefaultHeader(k, v string) Opt {
return func(c *Client) Opt {
old, found := c.header[k]
old = append([]string{}, old...) // clone
c.header.Add(k, v)
return func(c *Client) Opt {
if found {
c.header[k] = old
} else {
c.header.Del(k)
}
return DefaultHeader(k, v)
}
}
} | [
0.27049288153648376,
0.1760544329881668,
0.5480135083198547,
0.15847894549369812,
-0.010911774821579456,
-0.069239042699337,
-0.9738935828208923,
-0.28463226556777954,
0.27443042397499084,
0.4665043354034424,
0.20890943706035614,
0.30939385294914246,
-0.836001455783844,
-0.1252196729183197... |
func HandleResponse(f ResponseHandler) Opt {
return func(c *Client) Opt {
old := c.handleResponse
c.handleResponse = f
return HandleResponse(old)
}
} | [
0.8722351789474487,
0.030368339270353317,
0.41028711199760437,
0.38461947441101074,
-0.0956718698143959,
-0.21473322808742523,
0.3549163341522217,
0.09070159494876862,
0.6142297983169556,
-1.1273226737976074,
-0.5602355003356934,
-1.5221210718154907,
-0.28170156478881836,
-0.63096833229064... |
func RequestOptions(opts ...RequestOpt) Opt {
if len(opts) == 0 {
return nil
}
return func(c *Client) Opt {
old := append([]RequestOpt{}, c.requestOpts...)
c.requestOpts = opts
return RequestOptions(old...)
}
} | [
-0.41622552275657654,
0.6368425488471985,
0.692320704460144,
1.372830867767334,
0.3966716229915619,
-0.626000702381134,
-0.5488215088844299,
-0.4972822964191437,
1.1126309633255005,
-1.1873626708984375,
-0.15452954173088074,
0.33657634258270264,
-0.7725350856781006,
-0.0723501592874527,
... |
func Header(k, v string) RequestOpt { return func(r *http.Request) { r.Header.Add(k, v) } } | [
-0.1537010222673416,
0.1457858830690384,
0.31057801842689514,
0.40301990509033203,
-0.3112429976463318,
0.5327456593513489,
-1.3813327550888062,
-0.3594476878643036,
0.6630746722221375,
-0.36046114563941956,
0.4632093608379364,
0.5223410725593567,
0.020621048286557198,
-1.0098881721496582,... |
func Close(b bool) RequestOpt { return func(r *http.Request) { r.Close = b } } | [
-0.6668135523796082,
0.490760862827301,
0.5136581659317017,
0.48589277267456055,
-0.23042812943458557,
1.0022852420806885,
-0.3904719054698944,
-0.48140648007392883,
0.01915213093161583,
-0.14734914898872375,
1.1062724590301514,
-0.5263038873672485,
-0.8803794980049133,
-0.0500358529388904... |
func With(opt ...ConfigOpt) DoFunc {
var (
dialer = &net.Dialer{
LocalAddr: &net.TCPAddr{IP: net.IPv4zero},
KeepAlive: 30 * time.Second,
Timeout: 5 * time.Second,
}
transport = &http.Transport{
Proxy: http.ProxyFromEnvironment,
Dial: dialer.Dial,
ResponseHeaderTimeout: 5 * time.Second,
TL... | [
0.38306522369384766,
-0.4998595714569092,
0.7527869343757629,
-0.3522101044654846,
-0.08233293145895004,
-0.05073843151330948,
-0.6658397316932678,
-0.5908038020133972,
-0.010746764950454235,
0.8245797753334045,
-0.2865517735481262,
-0.21151581406593323,
-0.0027788893785327673,
-0.00454579... |
func Timeout(d time.Duration) ConfigOpt {
return func(c *Config) {
c.transport.ResponseHeaderTimeout = d
c.transport.TLSHandshakeTimeout = d
c.dialer.Timeout = d
}
} | [
0.24529066681861877,
0.47405365109443665,
0.23702892661094666,
-0.7947092652320862,
-0.41984155774116516,
0.7087962031364441,
0.22054754197597504,
0.42910414934158325,
1.0036423206329346,
0.44707587361335754,
-0.06078827753663063,
-0.49356475472450256,
0.7340234518051147,
-0.47064149379730... |
func RoundTripper(rt http.RoundTripper) ConfigOpt {
return func(c *Config) {
c.client.Transport = rt
}
} | [
-0.02533368580043316,
-0.5107654333114624,
0.3236654996871948,
-0.6270015239715576,
-0.9062829613685608,
0.25316935777664185,
0.5324730277061462,
0.042946673929691315,
0.128440260887146,
0.37794312834739685,
-0.5343526005744934,
-0.7912752032279968,
0.49394989013671875,
-0.0697967186570167... |
func TLSConfig(tc *tls.Config) ConfigOpt {
return func(c *Config) {
c.transport.TLSClientConfig = tc
}
} | [
1.6390745639801025,
0.14282271265983582,
0.3044869005680084,
-1.5461089611053467,
-1.0958225727081299,
0.19345444440841675,
-0.19707177579402924,
0.9155275821685791,
0.5620098114013672,
0.7904384136199951,
-1.309133529663086,
-0.4944583773612976,
0.6107106804847717,
-0.08383376896381378,
... |
func Transport(modifyTransport func(*http.Transport)) ConfigOpt {
return func(c *Config) {
if modifyTransport != nil {
modifyTransport(c.transport)
}
}
} | [
-0.4774545729160309,
-0.04491174593567848,
0.37642210721969604,
-0.24611897766590118,
-0.5042604804039001,
0.08751893788576126,
0.44959160685539246,
-0.05389195680618286,
0.6673449873924255,
-0.011691587045788765,
-0.328266978263855,
-0.28867051005363464,
0.21075861155986786,
-0.1856227815... |
func WrapRoundTripper(f func(http.RoundTripper) http.RoundTripper) ConfigOpt {
return func(c *Config) {
if f != nil {
if rt := f(c.client.Transport); rt != nil {
c.client.Transport = rt
}
}
}
} | [
-0.9878815412521362,
-0.897731602191925,
0.40188857913017273,
-0.843756914138794,
-0.7295903563499451,
0.43482157588005066,
0.31171470880508423,
-0.12404339015483856,
-0.027819447219371796,
0.8126077651977539,
0.3222554922103882,
-0.34406647086143494,
0.7774710655212402,
0.4478474855422973... |
func Problem9(a, b, c uint) uint {
if 0 < a && a < 1000 && 0 < b && b < 1000 && 0 < c && c < 1000 {
if a+b+c == 1000 && a*a+b*b == c*c {
return a * b * c
}
}
return 0
} | [
0.9739935398101807,
-0.2473573535680771,
0.6425349712371826,
-0.3197917938232422,
0.4855874180793762,
0.3951363265514374,
0.7290211319923401,
0.056995928287506104,
1.1109988689422607,
0.19652852416038513,
0.8530341386795044,
-0.382249116897583,
-0.5448642373085022,
-0.4505394995212555,
-... |
func NewKorbitAPI(clientID, clientSecret, username, password string) *API {
api := API{
ClientID: clientID,
ClientSecret: clientSecret,
Username: username,
Password: password,
Client: &http.Client{},
Nonce: time.Now().Unix(),
}
return &api
} | [
0.13955457508563995,
-1.1837724447250366,
0.38685083389282227,
0.6372846961021423,
-0.8298870325088501,
0.379647821187973,
-0.6127747893333435,
-0.8360567092895508,
-0.6652434468269348,
0.8384723663330078,
-0.3446703851222992,
0.7081531882286072,
-0.7437462210655212,
0.18863394856452942,
... |
func (k *API) Login() error {
body := url.Values{
"client_id": {k.ClientID},
"client_secret": {k.ClientSecret},
"username": {k.Username},
"password": {k.Password},
"grant_type": {"password"},
}
resp, err := http.PostForm(LoginURL, body)
if err != nil {
return errors.Wrap(err, "korbit p... | [
-0.2568764388561249,
-0.6942808628082275,
0.7028641700744629,
-0.01668703183531761,
-0.12435168772935867,
0.2593468725681305,
-1.3715746402740479,
0.04930736869573593,
-0.4906350374221802,
-0.06994512677192688,
-0.9352383017539978,
1.134111762046814,
-0.17523688077926636,
-0.13844899833202... |
func (k *API) GetNonce() string {
k.Nonce++
return fmt.Sprintf("%d", k.Nonce)
} | [
-0.21721282601356506,
0.5346292853355408,
0.7425948977470398,
0.5221928358078003,
0.28174641728401184,
-0.6698436737060547,
-0.5728380680084229,
-0.5323056578636169,
-0.20092186331748962,
-0.8573454022407532,
0.6164348721504211,
0.06016332283616066,
-0.4727860987186432,
0.30340948700904846... |
func (k *API) ShouldRefresh() bool {
minusTen := time.Duration(k.Token.ExpiresIn - 600)
tenMinsLeft := k.Token.Timestamp.Add(minusTen * time.Second)
return time.Now().After(tenMinsLeft)
} | [
0.03216909244656563,
0.10653652250766754,
0.5661889314651489,
-0.19467782974243164,
-0.0862705335021019,
0.3837255537509918,
-1.3123180866241455,
-0.267280250787735,
0.6740996241569519,
0.09045404940843582,
-1.1091417074203491,
0.21380610764026642,
-0.28039246797561646,
-0.3432537019252777... |
func (k *API) NewRequest(url, method string, body url.Values) (*http.Request, error) {
b := bytes.NewBufferString(body.Encode())
req, err := http.NewRequest(method, url, b)
if err != nil {
return nil, errors.Wrap(err, "make korbit req")
}
token := fmt.Sprintf("%s %s", k.Token.TokenType, k.Token.AccessToken)
r... | [
0.0781412422657013,
0.05292333662509918,
0.7572098970413208,
0.08561249822378159,
-0.1411265879869461,
0.08609234541654587,
-1.7252768278121948,
-0.4833280146121979,
0.10335791856050491,
0.2738869786262512,
0.7839345932006836,
0.9872069358825684,
0.19492171704769135,
-0.0014213075628504157... |
func (k *API) RefreshToken() error {
body := url.Values{
"client_id": {k.ClientID},
"client_secret": {k.ClientSecret},
"refresh_token": {k.Token.RefreshToken},
"grant_type": {"refresh_token"},
}
resp, err := http.PostForm(LoginURL, body)
if err != nil {
return errors.Wrap(err, "korbit post login")... | [
-0.07212584465742111,
-0.5305002927780151,
0.5102213025093079,
0.674924910068512,
0.07938645780086517,
0.4315197169780731,
-1.0052828788757324,
-0.38310304284095764,
0.022857047617435455,
-0.0009836434619501233,
-0.9702889323234558,
1.89131760597229,
0.2613864541053772,
0.4733304977416992,... |
func Int32Value(i *int32) int32 {
if i != nil {
return *i
}
return 0
} | [
0.3509705066680908,
0.3326636850833893,
0.4668077230453491,
-0.2547246515750885,
-0.3482518792152405,
0.3812353312969208,
-0.23101826012134552,
-0.4399365782737732,
0.35429874062538147,
-0.32403242588043213,
0.14226442575454712,
-0.06152856722474098,
-0.4419483244419098,
0.8449010848999023... |
func (cd *Coredns) testDNS() {
var successCount int
//1. readEtcResolvConf -> compare nameserver with ClusterIP
//nameserver either should be coredns clusterIP or nodeLocalcache DNS IP
rc := &ResolvConf{}
dnstest := &Dnstest{}
err := rc.readResolvConf()
if err != nil {
log.Errorf("Failed to read /etc/resolv.... | [
-0.2647459805011749,
0.35642871260643005,
0.4524400532245636,
-0.1994028240442276,
0.04807032272219658,
-0.39250513911247253,
0.4403799772262573,
-0.5529371500015259,
0.26537278294563293,
-0.4557912349700928,
-0.6917510628700256,
-0.05885818600654602,
-0.5817703604698181,
0.388668984174728... |
func New() *Role {
return &Role{}
} | [
0.34073561429977417,
-1.096837043762207,
-0.33499929308891296,
-0.1698351800441742,
-0.4004131257534027,
-0.3314666152000427,
-0.7005466818809509,
-0.5151487588882446,
-0.3660837709903717,
-1.140647292137146,
0.13518641889095306,
0.5506068468093872,
0.4618632197380066,
0.7914131283760071,
... |
func Register(name string, fc func(request *http.Request, user interface{}) bool) {
role.Register(name, fc)
} | [
-0.9178597927093506,
0.5730763077735901,
0.36467498540878296,
0.3232116401195526,
0.1167980208992958,
-0.4137597382068634,
-0.5139759182929993,
0.19371618330478668,
-0.8754187226295471,
-0.33349791169166565,
-0.7284308075904846,
-0.4585579037666321,
0.46177956461906433,
0.12392742931842804... |
func (role *Role) Register(name string, fc func(req *http.Request, currentUser interface{}) bool) {
if role.definitions == nil {
role.definitions = map[string]func(req *http.Request, currentUser interface{}) bool{}
}
definition := role.definitions[name]
if definition != nil {
fmt.Printf("%v already defined, ov... | [
-0.7395461201667786,
0.07419203221797943,
0.7314494252204895,
0.14679400622844696,
0.9177414178848267,
-1.0315227508544922,
-0.42809057235717773,
0.010379528626799583,
-0.38649511337280273,
-0.4455448389053345,
-0.6597630977630615,
0.3507872521877289,
0.08999428898096085,
0.969141840934753... |
func Allow(mode PermissionMode, roles ...string) *Permission {
return role.Allow(mode, roles...)
} | [
-0.011042510159313679,
-0.18707175552845,
0.4487265646457672,
0.3766212463378906,
-0.8144421577453613,
0.5756059885025024,
-0.368061363697052,
0.1947723776102066,
-0.5535111427307129,
-0.033787619322538376,
1.0331664085388184,
-0.26656150817871094,
-0.3197305500507355,
-0.47164204716682434... |
func (role *Role) Allow(mode PermissionMode, roles ...string) *Permission {
return role.newPermission().Allow(mode, roles...)
} | [
-0.14021505415439606,
-0.23702825605869293,
0.46369102597236633,
0.11756762862205505,
-0.4991932511329651,
0.43625831604003906,
-0.2728694975376129,
-0.09328801184892654,
-0.21515020728111267,
0.11858319491147995,
0.876220703125,
-0.3358897864818573,
-0.2792428433895111,
-0.282361984252929... |
func Deny(mode PermissionMode, roles ...string) *Permission {
return role.Deny(mode, roles...)
} | [
0.3937620520591736,
-0.07939549535512924,
0.575888454914093,
0.612379252910614,
-0.5641549825668335,
0.7462103366851807,
-0.3656976521015167,
-0.7902270555496216,
-0.2367267608642578,
-0.8047435879707336,
0.7921937108039856,
-0.6389700174331665,
-0.7141127586364746,
-0.7948764562606812,
... |
func (role *Role) Deny(mode PermissionMode, roles ...string) *Permission {
return role.newPermission().Deny(mode, roles...)
} | [
0.2659611403942108,
-0.0881180465221405,
0.6029396057128906,
0.3238658010959625,
-0.14262256026268005,
0.6453470587730408,
-0.24888379871845245,
-1.0297187566757202,
0.03145111724734306,
-0.7344121932983398,
0.6317126750946045,
-0.8092883825302124,
-0.6212855577468872,
-0.7161476016044617,... |
func MatchedRoles(req *http.Request, user interface{}) []string {
return role.MatchedRoles(req, user)
} | [
-0.6245117783546448,
0.060025282204151154,
0.27847158908843994,
0.29739901423454285,
-0.495439738035202,
0.4402303993701935,
-0.5626753568649292,
-0.8462488055229187,
0.6764934062957764,
-0.3755759596824646,
-0.1434953361749649,
0.08839648962020874,
0.16577056050300598,
1.099294662475586,
... |
func (role *Role) MatchedRoles(req *http.Request, currentUser interface{}) (roles []string) {
if definitions := role.definitions; definitions != nil {
for name, definition := range definitions {
if definition(req, currentUser) {
roles = append(roles, name)
}
}
}
return
} | [
-0.5172692537307739,
-0.10034257918596268,
0.32360178232192993,
0.23932814598083496,
0.22451236844062805,
0.05315801501274109,
-0.49737441539764404,
-0.6598543524742126,
0.07724174857139587,
0.039028871804475784,
0.6855067014694214,
0.05956551432609558,
0.20921199023723602,
1.5964576005935... |
func NewDecoder(r io.Reader) (*Decoder, error) {
data, err := ioutil.ReadAll(r)
if err != nil {
return nil, errors.Wrap(err, "reading data before decoding")
}
return &Decoder{buf: bytes.NewReader(data)}, nil
} | [
0.09518088400363922,
-1.0675342082977295,
-0.004125652834773064,
-0.35075756907463074,
-1.0582281351089478,
-0.09233957529067993,
-0.976754367351532,
-0.20424777269363403,
0.016676615923643112,
-1.0068573951721191,
-0.027321169152855873,
-0.2728106379508972,
0.018851203843951225,
0.9151947... |
func NewController() *Controller {
controller := Controller{}
return &controller
} | [
0.5966566801071167,
-0.44640016555786133,
-0.017730139195919037,
0.6115607619285583,
-0.6485734581947327,
-0.008009178563952446,
0.05130765214562416,
-0.23887671530246735,
0.9935552477836609,
-1.2162669897079468,
-0.20082348585128784,
0.5955742597579956,
-0.3878434896469116,
0.199209168553... |
func main() {
ch := make(chan string, 150)
for i:=0; i<1000; i++ {
iActual:=i;
go func(){
ch <- fmt.Sprintf("%d:%d ", i, iActual)
}()
}
for i:=0; i<1000; i++ {
fmt.Printf(<-ch)
}
} | [
-0.4203469753265381,
-0.2650909125804901,
0.6311215758323669,
-0.01849500462412834,
0.16503168642520905,
0.3746435046195984,
0.7539555430412292,
-0.24989920854568481,
-0.8971707224845886,
0.24911122024059296,
0.18803171813488007,
0.987267017364502,
0.4596630930900574,
-0.2799021601676941,
... |
func (r *Resolver) MediaCharacter() MediaCharacterResolver { return &mediaCharacterResolver{r} } | [
-0.3586737811565399,
-1.3752859830856323,
0.2695237100124359,
-0.5128691792488098,
-0.8903274536132812,
-0.4221663773059845,
0.12327470630407333,
0.19910287857055664,
0.5091147422790527,
-1.186642050743103,
-0.15815676748752594,
0.21339021623134613,
-0.7381960153579712,
0.3083445429801941,... |
func TestRshExcludeFlags(t *testing.T) {
rsyncCmd := NewCmdRsync("rsync", "oc", nil, genericclioptions.NewTestIOStreamsDiscard())
rsyncCmd.Flags().VisitAll(func(flag *pflag.Flag) {
if !rshExcludeFlags.Has(flag.Name) && !rshAllowedFlags.Has(flag.Name) {
t.Errorf("Unknown flag %s. Please add to rshExcludeFlags or ... | [
1.3453550338745117,
1.1059166193008423,
0.6211689710617065,
0.19940336048603058,
0.34457021951675415,
0.9849732518196106,
0.21133920550346375,
0.26188021898269653,
0.18863876163959503,
-0.8447181582450867,
-0.29210519790649414,
0.277468204498291,
-0.7663838863372803,
1.0714941024780273,
... |
func TestRsyncEscapeCommand(t *testing.T) {
// the strings to run through rsyncEscapeCommand
stringsToEscape := []string{
`thisshouldnotgetescapedorquoted`,
`this should get quoted for spaces`,
`this" should get escaped and quoted`,
`"this should get escaped and quoted"`,
`this\ should get quoted`,
`this'... | [
0.2577333152294159,
-0.2862623631954193,
0.6286896467208862,
0.1547374576330185,
0.9590039849281311,
-0.19469469785690308,
0.24989254772663116,
-0.3999768793582916,
0.29330822825431824,
-0.11109210550785065,
-0.5746886730194092,
0.5954433083534241,
-0.44001471996307373,
-0.0833370015025138... |
func (m *DeprecatedMessage) GetDeprecatedField() string {
if m != nil {
return m.DeprecatedField
}
return ""
} | [
0.7203360795974731,
0.7597429156303406,
0.24971699714660645,
-0.06550798565149307,
0.5394927859306335,
0.5226935148239136,
-0.17568786442279816,
0.10661544650793076,
-0.09399913996458054,
-0.7980533838272095,
-0.5338082313537598,
-0.02067934349179268,
-1.137994408607483,
-0.095242738723754... |
func Listen(events chan string, done chan bool) {
log.L.Debugf("Listening to SALT...")
connection := createSaltConnection(done)
log.L.Debugf("Reading salt events...")
for {
select {
case <-done:
connection.Response.Body.Close()
return
default:
line, err := connection.Reader.ReadString('\n')
... | [
0.32301247119903564,
-0.8497444987297058,
0.6711519956588745,
-0.7389105558395386,
0.557586669921875,
-0.10483507066965103,
-0.2748965620994568,
-0.01858276128768921,
-0.28715914487838745,
0.5985822081565857,
0.4837951958179474,
-0.17648012936115265,
-0.5395893454551697,
-0.242133527994155... |
func AddRepoVolumesToPod(postgresCluster *v1beta1.PostgresCluster, template *corev1.PodTemplateSpec,
repoPVCNames map[string]string, containerNames ...string) error {
for _, repo := range postgresCluster.Spec.Backups.PGBackRest.Repos {
// we only care about repos created using PVCs
if repo.Volume == nil {
con... | [
-0.46727055311203003,
-0.3554251194000244,
0.8439440727233887,
-0.756320059299469,
1.1408894062042236,
-0.44561612606048584,
-0.653745710849762,
-0.7427244782447815,
-0.2623395025730133,
0.59491366147995,
0.22495895624160767,
-0.45845726132392883,
-0.09889733791351318,
-0.2325378954410553,... |
func AddConfigsToPod(postgresCluster *v1beta1.PostgresCluster, template *corev1.PodTemplateSpec,
configName string, containerNames ...string) error {
// grab user provided configs
pgBackRestConfigs := postgresCluster.Spec.Backups.PGBackRest.Configuration
// add default pgbackrest configs
defaultConfig := corev1.V... | [
-0.5514394640922546,
0.10581281036138535,
0.8304339051246643,
-0.09822079539299011,
0.7123518586158752,
-0.45876792073249817,
-0.37511464953422546,
-0.42664670944213867,
-0.5245864391326904,
0.6091235280036926,
0.03415185585618019,
-0.8286312222480774,
0.09500110894441605,
0.07069836556911... |
func AddSSHToPod(postgresCluster *v1beta1.PostgresCluster, template *corev1.PodTemplateSpec,
enableSSHD bool, resources corev1.ResourceRequirements,
additionalVolumeMountContainers ...string) error {
sshConfigs := []corev1.VolumeProjection{}
// stores all SSH configurations (ConfigMaps & Secrets)
if postgresClust... | [
0.07630088180303574,
-0.10997462272644043,
0.9429377913475037,
-0.14570337533950806,
0.6194080114364624,
-0.010766305029392242,
-0.7403969764709473,
0.11603008210659027,
-0.02513420395553112,
0.27157413959503174,
-0.19519950449466705,
-0.14936111867427826,
0.3130016028881073,
0.29356271028... |
func ReplicaCreateCommand(
cluster *v1beta1.PostgresCluster, instance *v1beta1.PostgresInstanceSetSpec,
) []string {
command := func(repoName string) []string {
return []string{
"pgbackrest", "restore", "--delta",
"--stanza=" + DefaultStanzaName,
"--repo=" + strings.TrimPrefix(repoName, "repo"),
"--link... | [
-0.06733706593513489,
-0.15260760486125946,
0.7611334919929504,
0.2136753648519516,
0.7091346383094788,
-0.001055943313986063,
-0.2734661102294922,
-0.03368687257170677,
-0.4869276285171509,
0.5524089932441711,
-0.4066292345523834,
0.14621488749980927,
-0.19083239138126373,
-0.342207878828... |
func RepoVolumeMount() corev1.VolumeMount {
return corev1.VolumeMount{Name: "pgbackrest-repo", MountPath: repoMountPath}
} | [
0.21908582746982574,
-0.2185811698436737,
0.3949441611766815,
-0.348143070936203,
0.41297802329063416,
-0.2820271849632263,
-0.8829909563064575,
-0.2755630314350128,
-0.4004257619380951,
0.3956604599952698,
-0.5802640914916992,
0.7014943957328796,
-0.34433993697166443,
-1.0107793807983398,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.