text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func checkFlags() {
if command != "" {
cc := strings.Split(command, ":")
command = strings.ToLower(cc[0])
if len(cc) > 1 {
aggregateColumn = cc[1]
}
}
if find != "" {
command = "find"
} else if from != "" {
jq.From(from)
}
if columns != "*" {
a := strings.Split(columns, ",")
for i := 0; i < l... | [
0.029515892267227173,
0.30946850776672363,
0.9661489725112915,
0.044655941426754,
-0.30518895387649536,
-0.25314733386039734,
0.46281009912490845,
-0.7018994092941284,
-0.7830840945243835,
0.34558311104774475,
0.8657767176628113,
0.02576899155974388,
-0.1791466623544693,
0.9834094643592834... |
func checkCommands() {
switch command {
case "find":
output = jq.Find(find)
case "first":
output = jq.First()
case "last":
output = jq.Last()
case "count":
output = jq.Count()
case "pluck":
output = jq.Pluck(aggregateColumn)
case "avg":
if aggregateColumn != "" {
output = jq.Avg(aggregateColumn)
... | [
-0.6131719946861267,
0.13676802814006805,
0.7694399952888489,
-0.23838870227336884,
0.48060691356658936,
-0.5642662048339844,
0.7183236479759216,
-1.448410987854004,
-0.6424267888069153,
-0.02381376177072525,
0.3443334996700287,
-0.22980010509490967,
-0.11644211411476135,
0.211668059229850... |
func setDecoder() bool {
data := readFromStdin()
if data == "" {
fmt.Println("Empty input!")
return false
}
switch defaultDataType {
case "xml":
jq = gojsonq.New(gojsonq.SetDecoder(&xmlDecoder{}), gojsonq.SetSeparator(separator)).JSONString(data)
case "yml", "yaml":
jq = gojsonq.New(gojsonq.SetDecoder(... | [
-0.404198557138443,
-0.25934767723083496,
0.8085396885871887,
-0.3426644504070282,
-0.5674288868904114,
0.5654782652854919,
-0.9934474229812622,
-0.21451938152313232,
-1.0586284399032593,
-0.6540158987045288,
-0.1506824791431427,
-0.05153485760092735,
-0.07628101110458374,
1.33371567726135... |
func NewSnooperConn(addr string) (*Conn, error) {
return newConn(addr, newLinuxConn)
} | [
-0.48463934659957886,
-0.9829838275909424,
0.26205480098724365,
0.6871033906936646,
-1.7686573266983032,
-0.6364963054656982,
-0.616409420967102,
0.46106067299842834,
0.18563412129878998,
-0.6088559031486511,
-1.150994896888733,
0.8059741258621216,
0.15625853836536407,
0.8436921834945679,
... |
func asSingleton(provider internalProvider) *singletonWrapper {
return &singletonWrapper{internalProvider: provider}
} | [
-1.6556793451309204,
-0.5200474262237549,
0.11350351572036743,
-0.33126330375671387,
0.05449752137064934,
0.1524934321641922,
0.34644967317581177,
0.694099485874176,
0.7554289102554321,
0.43133628368377686,
-0.16885732114315033,
1.0689685344696045,
-0.37138256430625916,
-0.1848568320274353... |
func (c *ClusterSpec) GetField(field string) string {
r := reflect.ValueOf(c)
v := reflect.Indirect(r)
if v.IsValid() {
f := v.FieldByName(strings.Title(field))
if f.IsValid() {
k := f.Kind()
if k == reflect.Int {
return k.String()
}
if k == reflect.String {
return f.String()
}
} else ... | [
-0.16195257008075714,
0.46533140540122986,
0.5131841897964478,
-0.633642852306366,
-0.09629816561937332,
0.43841108679771423,
0.05999758094549179,
-1.0627063512802124,
-0.075942762196064,
0.15469972789287567,
0.6614999771118164,
0.0008568903431296349,
-0.2974916100502014,
-0.18742658197879... |
func (c *Clusters) GetClusterSpec(cluster string) (*ClusterSpec, error) {
if c == nil {
return nil, fmt.Errorf("uninitialized clusters object")
}
NameOrId := strings.ToLower(cluster)
for _, it := range c.Clusters {
if it.ClusterName == NameOrId || it.Id == NameOrId {
glog.Infof("Found cluster %v cluster i... | [
0.27362242341041565,
-0.43071630597114563,
0.37624967098236084,
-0.020490825176239014,
0.5475793480873108,
-0.24578626453876495,
-0.12936465442180634,
-0.8251619338989258,
0.0978061705827713,
0.5989845991134644,
0.1545034945011139,
1.114301085472107,
-0.2851216793060303,
0.3459820747375488... |
func (c *Clusters) GetClusterId(cluster string) (string, error) {
spec, err := c.GetClusterSpec(cluster)
if err != nil {
return "", err
}
return spec.Id, nil
} | [
0.12595678865909576,
-0.10383457690477371,
0.28706997632980347,
0.18036706745624542,
-0.26289355754852295,
0.35965263843536377,
0.11332237720489502,
-0.008710864931344986,
0.6944027543067932,
0.9469738602638245,
0.10019750893115997,
0.9376550912857056,
-1.0213587284088135,
0.98036861419677... |
func (c *Clusters) GetClusterIds() ([]string, error) {
if c == nil {
return nil, fmt.Errorf("uninitialized clusters object")
}
var ids []string
for _, cluster := range c.Clusters {
if len(cluster.Id) > 0 {
ids = append(ids, cluster.Id)
}
}
return ids, nil
} | [
-0.5955883860588074,
-0.4280387759208679,
0.25657618045806885,
-0.0007404015632346272,
0.9383103251457214,
0.15114228427410126,
-0.4922965466976166,
-0.17653124034404755,
0.29528915882110596,
1.0968431234359741,
-0.1984066367149353,
1.4319177865982056,
-1.690758466720581,
1.069084644317627... |
func ClustersSpecsFromString(str string) (*Clusters, error) {
r := strings.NewReader(str)
return ReadClustersSpec(r)
} | [
0.2876773774623871,
-0.9700829982757568,
-0.1598946899175644,
-0.25410857796669006,
-0.5944337248802185,
0.3016807436943054,
-0.043791793286800385,
-1.1192265748977661,
0.08499959111213684,
-0.012678590603172779,
-0.05364308878779411,
0.6164108514785767,
-0.6601910591125488,
-1.36543405055... |
func ReadClustersSpec(b io.Reader) (*Clusters, error) {
var spec Clusters
buffer, err := ioutil.ReadAll(b)
if err != nil {
return nil, err
}
err = json.Unmarshal(buffer, &spec)
if err == nil {
return &spec, nil
}
err = yaml.Unmarshal(buffer, &spec)
if err == nil {
return &spec, nil
}
return nil, &... | [
-0.0012121271574869752,
-0.5766434073448181,
0.16582170128822327,
-0.4644707441329956,
-0.5667969584465027,
-0.25063174962997437,
-0.03455473110079765,
-0.006442697253078222,
-0.6398345828056335,
0.7577425837516785,
0.009923149831593037,
0.577918291091919,
0.29683545231819153,
-0.269119441... |
func (c Clusters) InstanceSpecsFromString(s string) (interface{}, error) {
return ClustersSpecsFromString(s)
} | [
0.22762279212474823,
-1.0541619062423706,
0.03272278979420662,
-0.4389142394065857,
-0.7137373685836792,
0.19983696937561035,
0.23865166306495667,
-0.9406046867370605,
0.20996306836605072,
0.3149646818637848,
-0.11268908530473709,
0.7471946477890015,
-0.8252769708633423,
-0.624558448791503... |
func (c *Clusters) GetClusterIPs() map[string]ClusterEndpoint {
m := make(map[string]ClusterEndpoint)
for _, cluster := range c.Clusters {
u := cluster.ClusterUrl
if strings.HasPrefix(u, "https://") {
u = strings.TrimPrefix(u, "https://")
}
if strings.HasSuffix(u, ":6443") {
u = strings.TrimSuffix(u,... | [
-1.6145209074020386,
0.1657881736755371,
0.37332800030708313,
0.41798123717308044,
-0.5438312292098999,
-0.49521079659461975,
-0.05124522000551224,
0.2225152999162674,
0.5170696973800659,
0.48315000534057617,
-0.2942853569984436,
-0.3268548846244812,
-0.397932231426239,
-0.2106050848960876... |
func NewClustersSpecs(r io.Reader) (*Clusters, error) {
spec, err := ReadClustersSpec(r)
if err != nil {
return nil, err
}
return spec, nil
} | [
-0.3663405179977417,
-0.7324331998825073,
-0.09990884363651276,
0.4541673958301544,
-0.7637766003608704,
0.18666820228099823,
0.11386100202798843,
-1.2930408716201782,
-0.5378807187080383,
0.5546794533729553,
-0.1039380133152008,
-0.20094162225723267,
-0.33915138244628906,
-0.1167900785803... |
func ClusterSpecsFromFile(fileName string) (*ClusterSpec, error) {
file, err := os.Open(fileName)
if err != nil {
return nil, err
}
return ReadClusterSpec(file)
} | [
0.5466808080673218,
-0.3470477759838104,
0.0382271371781826,
-0.17347285151481628,
-0.5576903223991394,
1.0503350496292114,
0.46669891476631165,
-0.5389537215232849,
-0.9889774918556213,
0.7081263065338135,
0.5389554500579834,
0.2755051553249359,
-0.3793579936027527,
-0.2900410592556,
0.... |
func ClusterSpecsFromString(str string) (*ClusterSpec, error) {
r := strings.NewReader(str)
return ReadClusterSpec(r)
} | [
0.7693602442741394,
-0.9145801663398743,
-0.17199352383613586,
-0.28176987171173096,
-1.0142593383789062,
0.4505941569805145,
0.07951422780752182,
-0.9782845377922058,
0.023994211107492447,
0.29569149017333984,
0.44414040446281433,
0.7417818307876587,
-0.5691490769386292,
-1.31638920307159... |
func ReadClusterSpec(b io.Reader) (*ClusterSpec, error) {
var spec ClusterSpec
buffer, err := ioutil.ReadAll(b)
if err != nil {
return nil, err
}
err = json.Unmarshal(buffer, &spec)
if err == nil {
return &spec, nil
}
err = yaml.Unmarshal(buffer, &spec)
if err == nil {
return &spec, nil
}
return n... | [
0.19391153752803802,
-0.4580583870410919,
0.30206361413002014,
-0.41070854663848877,
-0.6491611003875732,
-0.3566911220550537,
0.21407389640808105,
0.220562145113945,
-0.779042661190033,
0.8933599591255188,
0.10209503769874573,
1.1693313121795654,
0.4614599645137787,
-0.10143005847930908,
... |
func (c ClusterSpec) InstanceSpecsFromString(s string) (interface{}, error) {
return ClusterSpecsFromString(s)
} | [
0.2801342010498047,
-1.046982765197754,
0.09364702552556992,
-0.505189836025238,
-0.8261207342147827,
0.24690845608711243,
0.3171807527542114,
-0.73087477684021,
0.18788395822048187,
0.46833372116088867,
0.037086889147758484,
0.669236421585083,
-0.6264739632606506,
-0.6820211410522461,
0... |
func NewClusterSpecs(r io.Reader) (*ClusterSpec, error) {
spec, err := ReadClusterSpec(r)
if err != nil {
return nil, err
}
return spec, nil
} | [
0.16407029330730438,
-0.4985867738723755,
0.045037731528282166,
0.6648247241973877,
-1.101835012435913,
0.23877505958080292,
0.334172785282135,
-1.0556782484054565,
-0.555528461933136,
0.6205555200576782,
0.013007964007556438,
0.08875573426485062,
-0.5358853936195374,
0.294705867767334,
... |
func UITaskNew(w http.ResponseWriter, r *http.Request) {
defer common.Recover()
var nodes []string
storage.DB.Table("nodes").Select("name").Scan(&nodes)
p := &ui.Page{
Title: "New Task",
URL: strings.Split(r.URL.Path, "/"),
Details: struct {
Plugins []string
Nodes []string
}{plugins.Host.GetPlug... | [
-0.6836125254631042,
0.6446899771690369,
0.8206939697265625,
0.3854708969593048,
0.20320646464824677,
-0.13426394760608673,
0.8776915669441223,
0.06270091980695724,
-0.7981888651847839,
0.4814029932022095,
-0.40176811814308167,
-0.15568110346794128,
1.0568392276763916,
0.04464242607355118,... |
func RegisterUIHandlers(r pure.IRouteGroup) {
r.Get("", uiTasks)
r.Get("/:task", uiTaskSingle)
} | [
-0.59238600730896,
0.9473193883895874,
0.25836706161499023,
0.3818805515766144,
0.4870816171169281,
0.3462556302547455,
0.37801966071128845,
0.5852125287055969,
-0.5703389048576355,
-0.3417342007160187,
-0.42671850323677063,
-0.4458461403846741,
-0.2841866612434387,
0.10073265433311462,
... |
func newServer() *traceServer {
return &traceServer{
events: make(map[string]*trace.Trace),
}
} | [
0.4221701920032501,
-1.0012297630310059,
0.36234816908836365,
0.002117272699251771,
0.028866048902273178,
0.2928341329097748,
0.3926882743835449,
-0.5784459114074707,
1.064789891242981,
-0.15063098073005676,
-1.046425700187683,
0.5364105105400085,
-0.7511807084083557,
-0.4274320900440216,
... |
func CreateHadoopCluster(resourceGroup, clusterName string, info StorageAccountInfo) (*hdinsight.Cluster, error) {
client, err := getClustersClient()
if err != nil {
return nil, err
}
// the default duration is 15 minutes which is just a tad too short
client.PollingDuration = 20 * time.Minute
util.PrintAndLog("... | [
0.5693219900131226,
0.25652021169662476,
0.6264095306396484,
0.35078373551368713,
0.35431531071662903,
0.053810909390449524,
-0.1430177390575409,
-0.2303914725780487,
0.14431232213974,
-0.07801144570112228,
0.024997258558869362,
0.44153353571891785,
-0.3208749294281006,
0.00364409387111663... |
func (o *SystemDetailFindByIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewSystemDetailFindByIDOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return r... | [
-0.10165535658597946,
-0.8433305621147156,
0.7722454071044922,
0.6126890778541565,
0.24580219388008118,
-0.9972432851791382,
0.0914175882935524,
-0.6938323378562927,
0.4696985185146332,
0.03169993683695793,
0.09606130421161652,
-0.49919572472572327,
-1.2092307806015015,
0.40220698714256287... |
func NewSystemDetailFindByIDOK() *SystemDetailFindByIDOK {
return &SystemDetailFindByIDOK{}
} | [
0.5911960005760193,
-0.003200060687959194,
0.2259448617696762,
1.307342290878296,
0.09329169243574142,
-0.44427376985549927,
0.6665518879890442,
-0.7992971539497375,
-0.8224161863327026,
-0.7081711888313293,
-0.489792138338089,
-0.5258448719978333,
0.30660825967788696,
1.5517832040786743,
... |
func NewSystemDetailFindByIDBadRequest() *SystemDetailFindByIDBadRequest {
return &SystemDetailFindByIDBadRequest{}
} | [
-0.38462957739830017,
0.004281534813344479,
0.38218599557876587,
0.7108191251754761,
0.283123254776001,
0.012734618037939072,
0.18032488226890564,
-0.9217004179954529,
-0.04816548153758049,
-0.6582009196281433,
0.16835060715675354,
0.30458498001098633,
-0.45399999618530273,
1.3672006130218... |
func NewSystemDetailFindByIDUnauthorized() *SystemDetailFindByIDUnauthorized {
return &SystemDetailFindByIDUnauthorized{}
} | [
-0.060800373554229736,
0.26883959770202637,
0.23372726142406464,
1.2035309076309204,
-0.2428247034549713,
0.028864776715636253,
0.5862881541252136,
0.19420623779296875,
0.009298534132540226,
-1.6974679231643677,
-0.265360563993454,
1.0016515254974365,
-0.1677057445049286,
1.197932958602905... |
func NewSystemDetailFindByIDNotFound() *SystemDetailFindByIDNotFound {
return &SystemDetailFindByIDNotFound{}
} | [
0.4527676999568939,
-1.1112366914749146,
-0.11013948172330856,
0.5049000382423401,
0.0882444903254509,
0.3696178197860718,
0.09524238109588623,
-0.23916038870811462,
-0.02940269373357296,
-0.7863758206367493,
-0.5924307107925415,
0.12459060549736023,
-0.04945912957191467,
0.952685713768005... |
func (r *RedisSession) Pool() *redis.Pool {
return r.pool
} | [
-0.7247326374053955,
0.035637639462947845,
0.23649828135967255,
0.1076439768075943,
0.31827449798583984,
0.9098304510116577,
0.20239584147930145,
-0.869681179523468,
1.9705677032470703,
-0.4861437976360321,
-0.12351803481578827,
1.09735906124115,
0.36866295337677,
-0.6335723996162415,
-0... |
func (r *RedisSession) Close() error {
return r.pool.Close()
} | [
-0.6883029341697693,
-0.07911138236522675,
0.37035802006721497,
-0.29378369450569153,
-0.13224700093269348,
0.5123592019081116,
-0.37691164016723633,
-1.673089623451233,
0.706753134727478,
-0.08811051398515701,
0.1800929754972458,
0.3112293779850006,
-0.6318346858024597,
0.2000662833452224... |
func (r *RedisSession) SetPrefix(name string) {
r.prefix = name + ":"
} | [
-0.6366047263145447,
0.059506457298994064,
0.4195687472820282,
-0.16965952515602112,
-0.6585811376571655,
0.3472258150577545,
-0.8670581579208374,
-0.4417301118373871,
1.2848625183105469,
0.7548156976699829,
-1.2406165599822998,
0.473316490650177,
0.2174469232559204,
0.658987820148468,
0... |
func (r *RedisSession) Do(cmd string, args ...interface{}) (interface{}, error) {
conn := r.pool.Get()
// conn.Close() returns an error but we are already returning regarding error
// while returning the Do(..) response
defer conn.Close()
return conn.Do(cmd, args...)
} | [
-0.6360222101211548,
-0.2595894932746887,
0.8558189272880554,
0.06897823512554169,
0.5062916278839111,
0.29851454496383667,
-0.48879474401474,
-1.647133708000183,
-0.13864314556121826,
0.20985198020935059,
0.1554143875837326,
0.49834001064300537,
-0.5908656716346741,
-0.12336262315511703,
... |
func (r *RedisSession) KeyTTL(key string) (time.Duration, error) {
reply, err := redis.Int(r.Do("TTL", r.AddPrefix(key)))
if err != nil {
return 0, err
}
if reply == -1 {
return 0, ErrTTLNotSet
}
if reply == -2 {
return 0, ErrKeyNotExist
}
return time.Duration(reply) * time.Second, nil
} | [
-0.5656761527061462,
0.3836444616317749,
0.5147483348846436,
-1.0605401992797852,
-0.5270190238952637,
-0.2530643343925476,
-0.5986486673355103,
-0.8558202385902405,
0.6364339590072632,
1.5543712377548218,
-0.7019476294517517,
-0.7085833549499512,
-0.18539215624332428,
0.038238003849983215... |
func (r *RedisSession) KeyPTTL(key string) (time.Duration, error) {
reply, err := redis.Int(r.Do("PTTL", r.AddPrefix(key)))
if err != nil {
return 0, err
}
if reply == -1 {
return 0, ErrTTLNotSet
}
if reply == -2 {
return 0, ErrKeyNotExist
}
return time.Duration(reply) * time.Second, nil
} | [
-0.4267013669013977,
0.2516964077949524,
0.5536456108093262,
-0.8061729669570923,
-0.9440945982933044,
0.17568080127239227,
-1.3201348781585693,
-1.2446049451828003,
0.5479102730751038,
1.6016238927841187,
-0.45998308062553406,
-0.8699524998664856,
-0.7184799909591675,
0.44565555453300476,... |
func (r *RedisSession) KeyDelete(args ...interface{}) (int, error) {
prefixed := make([]interface{}, 0)
for _, arg := range args {
prefixed = append(prefixed, r.AddPrefix(arg.(string)))
}
return redis.Int(r.Do("DEL", prefixed...))
} | [
-0.2962372601032257,
0.6782897710800171,
0.7169795036315918,
-0.5107411742210388,
0.5693013668060303,
-0.41093528270721436,
-0.5423011779785156,
-0.353462815284729,
0.241673082113266,
0.8418917655944824,
0.10336548835039139,
-0.05629786476492882,
-0.9366528391838074,
-0.0632554441690445,
... |
func (r *RedisSession) KeyExists(key string) bool {
// does not have any err message to be checked, it return either 1 or 0
reply, _ := redis.Int(r.Do("EXISTS", r.AddPrefix(key)))
return reply == 1 // false means key does not exist
} | [
-2.1228179931640625,
0.08373095095157623,
0.6329301595687866,
-0.303352415561676,
0.13422627747058868,
0.17306411266326904,
-1.1965018510818481,
-0.316781222820282,
0.5573501586914062,
0.5401080250740051,
0.1389339119195938,
-0.5772870182991028,
-0.79202800989151,
0.39853283762931824,
-0... |
func (r *RedisSession) KeyKeys(key string) ([]interface{}, error) {
return redis.Values(r.Do("KEYS", r.AddPrefix(key)))
} | [
-1.5287468433380127,
0.5178702473640442,
0.18570417165756226,
-0.2674793303012848,
-0.5882353186607361,
-1.2035562992095947,
-1.7340129613876343,
-0.8122548460960388,
0.9403930902481079,
0.8252245187759399,
-0.6643601655960083,
0.43323591351509094,
-0.5029523968696594,
0.09479030966758728,... |
func (r *RedisSession) StringSet(key, value string) error {
reply, err := r.Do("SET", r.AddPrefix(key), value)
if err != nil {
return err
}
if reply != "OK" {
return fmt.Errorf("reply string is wrong!: %s", reply)
}
return nil
} | [
-0.7767469882965088,
0.0882580429315567,
0.44060617685317993,
-1.3837895393371582,
-0.34299397468566895,
0.06919374316930771,
-1.1727848052978516,
-1.7185001373291016,
0.37736648321151733,
1.4262032508850098,
0.28620705008506775,
0.9302104115486145,
-0.8581382036209106,
-0.4679938852787018... |
func (r *RedisSession) StringSetex(key string, timeout time.Duration, item interface{}) error {
reply, err := redis.String(r.Do("SETEX", r.AddPrefix(key), strconv.Itoa(int(timeout.Seconds())), item))
if err != nil {
return err
}
if reply != "OK" {
return fmt.Errorf("reply string is wrong!: %s", reply)
}
ret... | [
-0.6103478670120239,
0.05927274748682976,
0.7152391672134399,
-0.6063089966773987,
-0.6367415189743042,
-0.03986242040991783,
-1.5106606483459473,
-0.6720108389854431,
0.8104846477508545,
1.7479417324066162,
-0.7578287720680237,
0.9440764784812927,
-0.7841032147407532,
-1.0002700090408325,... |
func (r *RedisSession) StringGet(key string) (string, error) {
reply, err := redis.String(r.Do("GET", r.AddPrefix(key)))
if err != nil {
return "", err
}
return reply, nil
} | [
-1.1303925514221191,
0.18987463414669037,
0.49042150378227234,
-0.9729143977165222,
-0.5543369054794312,
-0.21293111145496368,
-1.629335641860962,
-1.3435724973678589,
0.37754693627357483,
1.2764053344726562,
0.07227472215890884,
0.4676388204097748,
-0.8215963840484619,
-0.6533363461494446... |
func (r *RedisSession) prepareArgsWithKey(key string, rest ...interface{}) []interface{} {
prefixedReq := make([]interface{}, len(rest)+1)
// prepend prefixed key
prefixedReq[0] = r.AddPrefix(key)
for key, el := range rest {
prefixedReq[key+1] = el
}
return prefixedReq
} | [
-1.1529333591461182,
0.3698713779449463,
0.5259323120117188,
-0.20583508908748627,
-0.15945351123809814,
-0.5408302545547485,
-0.926194429397583,
-0.5876633524894714,
0.6311708092689514,
1.3955012559890747,
-0.2358420193195343,
-0.16184377670288086,
-0.4118233621120453,
0.5666939616203308,... |
func (r *RedisSession) SetSadd(key string, rest ...interface{}) (int, error) {
return redis.Int(r.Do("SADD", r.prepareArgsWithKey(key, rest...)...))
} | [
-0.9604715704917908,
0.10684536397457123,
0.46041885018348694,
0.4069124162197113,
-0.5462796688079834,
0.2636466324329376,
-0.5194214582443237,
-0.7848010063171387,
0.33185556530952454,
0.06624891608953476,
0.08384430408477783,
0.23336271941661835,
-0.9698371887207031,
0.4979677200317383,... |
func (r *RedisSession) SetScard(key string) (int, error) {
return redis.Int(r.Do("SCARD", r.AddPrefix(key)))
} | [
-1.5635889768600464,
0.9442071914672852,
0.4608628749847412,
-0.5143952369689941,
-0.18227621912956238,
-0.7526359558105469,
-0.8971012830734253,
-0.20121505856513977,
1.015950322151184,
0.644524872303009,
-0.9006816744804382,
0.06870150566101074,
-0.38924703001976013,
0.47983014583587646,... |
func (r *RedisSession) SortedSetsUnion(destination string, keys []string, weights []interface{}, aggregate string) (int64, error) {
if destination == "" {
return 0, ErrDestinationNotSet
}
lengthOfKeys := len(keys)
if lengthOfKeys == 0 {
return 0, ErrKeysNotSet
}
prefixed := []interface{}{
r.AddPrefix(dest... | [
-0.8569918274879456,
0.6729509234428406,
0.781413733959198,
-0.48593929409980774,
-0.46653226017951965,
-0.6903406381607056,
-0.13089710474014282,
-0.25383076071739197,
0.2184160053730011,
0.15902911126613617,
0.06376667320728302,
0.10142704099416733,
-0.20135508477687836,
-0.2135294973850... |
func (r *RedisSession) SortedSetScore(key string, member interface{}) (float64, error) {
return redis.Float64(r.Do("ZSCORE", r.AddPrefix(key), member))
} | [
0.20448094606399536,
-0.08477475494146347,
0.2719646692276001,
-0.24403102695941925,
-0.777656078338623,
-0.7208166122436523,
-0.8777433633804321,
-1.3645297288894653,
0.0652598887681961,
0.42061498761177063,
0.5526249408721924,
0.3029821813106537,
-1.0409529209136963,
0.08064432442188263,... |
func (r *RedisSession) SortedSetRem(key string, members ...interface{}) (int64, error) {
prefixed := []interface{}{r.AddPrefix(key)}
prefixed = append(prefixed, members...)
return redis.Int64(r.Do("ZREM", prefixed...))
} | [
-0.1221650168299675,
0.28827497363090515,
0.42757153511047363,
-0.17189499735832214,
-0.8507258296012878,
-1.053648829460144,
-0.4130494296550751,
-0.7723262906074524,
0.6667177677154541,
-0.06260768324136734,
-0.5705521702766418,
0.16669820249080658,
-1.37216055393219,
-0.1159273535013198... |
func (r *RedisSession) SortedSetRangebyScore(key string, rest ...interface{}) ([]interface{}, error) {
prefixed := []interface{}{r.AddPrefix(key)}
prefixed = append(prefixed, rest...)
return redis.Values(r.Do("ZRANGEBYSCORE", prefixed...))
} | [
-0.43373268842697144,
0.020888959988951683,
0.45948830246925354,
0.5498645901679993,
-0.13813267648220062,
-0.9409123063087463,
0.05362315848469734,
-1.635915994644165,
0.2973794639110565,
0.6747176051139832,
-0.6186800599098206,
0.5912423729896545,
-0.7611914873123169,
0.4194468855857849,... |
func (r *RedisSession) Bool(reply interface{}) (bool, error) {
return redis.Bool(reply, nil)
} | [
-0.5014951825141907,
0.5424250364303589,
0.44888508319854736,
0.011963296681642532,
-0.1005367860198021,
-0.24289879202842712,
-0.5446946024894714,
-0.12163318693637848,
1.6836875677108765,
0.775898814201355,
-0.5408576726913452,
0.5515373945236206,
-0.06840962171554565,
-1.141722679138183... |
func (r *RedisSession) Int(reply interface{}) (int, error) {
return redis.Int(reply, nil)
} | [
-0.546281099319458,
0.4445357918739319,
0.335006982088089,
-0.8422651886940002,
-0.28754091262817383,
-0.7702969908714294,
-0.4613828957080841,
-1.154217004776001,
0.8213019967079163,
0.659989058971405,
-0.490289568901062,
0.3903585374355316,
-0.3833213746547699,
-0.4356828033924103,
0.3... |
func (r *RedisSession) String(reply interface{}) (string, error) {
return redis.String(reply, nil)
} | [
-0.46475398540496826,
-0.223609060049057,
0.16997158527374268,
-0.380683571100235,
-0.7155942320823669,
-0.44671860337257385,
-0.5074123740196228,
-2.1417901515960693,
1.774614930152893,
0.643351137638092,
-0.26522141695022583,
0.8971249461174011,
-0.4695182144641876,
-0.8876833319664001,
... |
func (r *RedisSession) Int64(reply interface{}) (int64, error) {
return redis.Int64(reply, nil)
} | [
-1.2216715812683105,
0.3194577991962433,
0.18335984647274017,
0.24842222034931183,
0.2521737515926361,
-1.4081066846847534,
-0.5923383235931396,
-0.7052886486053467,
1.5624114274978638,
0.2882950007915497,
-0.0012743538245558739,
0.4156070351600647,
-1.04856276512146,
-0.20815275609493256,... |
func (c *Config) Parse(args []string) error {
if len(args) != 2 {
return errors.New("Expected one arg")
}
args = strings.Split(args[1], " (")
var err error
c.Size, err = c.dimensions(args[0])
if err != nil {
return err
}
c.Points, err = c.coordinates(args[1:])
if err != nil {
return err
}
if err :... | [
-0.3491188883781433,
0.8195345401763916,
0.54718017578125,
0.1998630315065384,
0.38626569509506226,
0.2079327255487442,
0.07808852195739746,
-0.16411587595939636,
-1.0124759674072266,
0.172676682472229,
-0.35160115361213684,
0.07263843715190887,
-0.5414712429046631,
0.27771323919296265,
... |
func (c *Config) dimensions(arg string) (*geometry.Size, error) {
values := strings.Split(arg, "x")
if len(values) != 2 {
return nil, errors.New("Expected size to be two-dimensional")
}
w, err := strconv.Atoi(values[0])
if err != nil {
return nil, err
}
h, err := strconv.Atoi(values[1])
if err != nil {
... | [
-0.4064026474952698,
0.6454566121101379,
0.7442728281021118,
-1.0604207515716553,
-0.33541256189346313,
-0.08635823428630829,
-0.26921138167381287,
-0.46520477533340454,
-0.6210521459579468,
-0.0931379422545433,
-0.29783517122268677,
0.46220120787620544,
0.08938317745923996,
0.275007933378... |
func (c *Config) coordinates(coords []string) ([]*geometry.Point, error) {
points := []*geometry.Point{}
for _, coord := range coords {
point := geometry.NewPoint(0, 0)
cmpnts := strings.Split(strings.TrimSpace(coord), ", ")
var err error
if len(cmpnts) != 2 {
text := "Expected coordinates to be in two-d... | [
-0.5469319224357605,
-0.6540751457214355,
0.42950907349586487,
-0.3601776957511902,
0.28425130248069763,
-0.07634739577770233,
-0.8246344923973083,
0.013356170617043972,
0.11736346781253815,
0.185317263007164,
0.33805039525032043,
0.03072570450603962,
-0.0564396046102047,
0.254218459129333... |
func (r *ReconcileCapability) fetch(err error) (reconcile.Result, error) {
if errors.IsNotFound(err) {
// Return and don't create
r.reqLogger.Info("component resource not found. Ignoring since object must be deleted")
return reconcile.Result{}, nil
}
// Error reading the object - create the request.
r.reqLogg... | [
0.05289136618375778,
-1.077970266342163,
0.45980334281921387,
0.21635359525680542,
0.6371226906776428,
0.28772038221359253,
-0.6276493668556213,
-0.24255892634391785,
0.6242006421089172,
-0.14087295532226562,
0.6177008748054504,
-0.1595792919397354,
0.19344490766525269,
0.38284677267074585... |
func UploadHandler(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" {
// return upload HTML view
file, err := ioutil.ReadFile("./static/view/index.html")
if err != nil {
// panic("could not find file")
io.WriteString(w, "internal server error: could not find file")
return
}
io.WriteStr... | [
0.31113478541374207,
-0.2240583747625351,
1.1256262063980103,
-0.007494817953556776,
0.2585165202617645,
0.9685726761817932,
1.061497688293457,
0.014430929906666279,
-1.0763280391693115,
0.11013814061880112,
0.6246148347854614,
-0.1915215700864792,
-0.249323770403862,
0.8371872901916504,
... |
func UploadSuccessHandler(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "uploaded successfully!")
} | [
0.3112305998802185,
-0.5396706461906433,
0.23595060408115387,
-0.09944605827331543,
-0.6368291974067688,
0.6286952495574951,
0.5555345416069031,
0.021280430257320404,
-0.8090522289276123,
0.8003017902374268,
-0.606803297996521,
-0.5325137972831726,
0.25127720832824707,
-0.04926685243844986... |
func GetFileMetaHandler(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
fileHash := r.Form["filehash"][0]
// fileMeta := meta.GetFileMeta(fileHash)
fileMeta, err := meta.GetFileMetaDB(fileHash)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
// any interface ---> json
data,... | [
-0.20803606510162354,
-0.43441662192344666,
0.9060714840888977,
0.22877158224582672,
0.2513291537761688,
0.28073030710220337,
0.10798459500074387,
0.3174188733100891,
-0.7304016947746277,
-0.08458268642425537,
0.35928797721862793,
0.07690101116895676,
0.10001202672719955,
0.645281076431274... |
func FileQueryHandler(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
username := r.Form.Get("username")
limitCount, _ := strconv.Atoi(r.Form.Get("limit"))
// fileMetas, err := meta.GetLastMetas(limitCount)
userFiles, err := dbLayer.QueryUserFileMetas(username, limitCount)
if err != nil {
w.WriteHeade... | [
-0.6071535348892212,
-0.1093987375497818,
0.5647339820861816,
0.033919692039489746,
-0.42127835750579834,
0.48529788851737976,
0.5158830285072327,
-0.03778131678700447,
-0.7316397428512573,
-0.012816967442631721,
0.27936261892318726,
-0.16004380583763123,
0.01597093977034092,
-0.2251100540... |
func DownloadHandler(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
fileMeta := meta.GetFileMeta(r.Form.Get("filehash"))
file, err := os.Open(fileMeta.FileAddr)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
defer file.Close()
// if the file is small, use following ioutil.R... | [
0.8931398391723633,
-0.6044583916664124,
0.824745237827301,
0.20299604535102844,
-0.06372826546430588,
0.22324882447719574,
0.38586926460266113,
0.414448082447052,
-0.3726726472377777,
-0.41076576709747314,
0.6949165463447571,
-0.5831284523010254,
-0.10780732333660126,
0.44706130027770996,... |
func UpdateHandler(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
opType := r.Form.Get("op")
fileSha1 := r.Form.Get("filehash")
newFileName := r.Form.Get("filename")
if opType != "0" {
w.WriteHeader(http.StatusForbidden)
return
}
if r.Method != "POST" {
w.WriteHeader(http.StatusMethodNotAllowed... | [
-0.5175958275794983,
-0.9007911086082458,
0.9023736119270325,
0.6346716284751892,
-0.4838199317455292,
0.8646957874298096,
0.5624852776527405,
0.6486005187034607,
-0.8533508777618408,
0.8083533644676208,
0.5002583265304565,
-0.08924254029989243,
0.09339796006679535,
-0.08926668018102646,
... |
func FileDeleteHandler(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
fileSha1 := r.Form.Get("filehash")
fileMeta := meta.GetFileMeta(fileSha1)
//delete file from disk
err := os.Remove(fileMeta.FileAddr)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
// delete file index
... | [
0.6411768794059753,
-0.5620335340499878,
0.5628379583358765,
0.332968145608902,
0.6599873900413513,
0.5512978434562683,
0.4844130873680115,
0.7174871563911438,
-0.4666764736175537,
-0.19450661540031433,
0.6459614038467407,
-0.6876004934310913,
0.45398595929145813,
0.11516395956277847,
-0... |
func (ts *TaskServiceImpl) QueryById(id uint32) (*Task, error) {
var (
task Task
)
rows, err := ts.DB.Query(taskSqls[sqlQuerybyId], id)
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
if err := rows.Scan(&task.Content, &task.Comment, &task.Started, &task.Ended, &task.Stoped, &task... | [
0.2756701111793518,
0.5100000500679016,
0.28200462460517883,
-0.16682153940200806,
-0.37645643949508667,
-0.2700985372066498,
0.14097313582897186,
-0.795728862285614,
-0.1819763332605362,
-0.020425867289304733,
-0.31084805727005005,
-0.08869142085313797,
-0.4507439136505127,
0.527415096759... |
func (ts *TaskServiceImpl) QueryByUserId(user_id string, page int) ([]*Task, error) {
var (
id uint32
content string
comment string
started time.Time
ended time.Time
stoped time.Time
status uint8
tasks []*Task
)
rows, err := ts.DB.Query(taskSqls[sqlQuerybyUserId], user_id, page)
if err !=... | [
0.10200438648462296,
0.11302413791418076,
0.5278879404067993,
0.2919127941131592,
-0.2881581783294678,
0.13699671626091003,
0.48070424795150757,
-0.22260530292987823,
-0.579365074634552,
0.43688255548477173,
-0.5148828625679016,
0.11633360385894775,
-0.22030311822891235,
1.0623183250427246... |
func (ts *TaskServiceImpl) QueryByStatus(user_id string, status uint8, page int) ([]*Task, error) {
var (
id uint32
content string
comment string
started time.Time
ended time.Time
stoped time.Time
tasks []*Task
)
rows, err := ts.DB.Query(taskSqls[sqlQuerybyStatus], user_id, status, page)
if ... | [
-0.12110033631324768,
-0.10694864392280579,
0.4313158690929413,
0.36751240491867065,
0.009474167600274086,
-0.11224832385778427,
-0.12928515672683716,
-0.05014722794294357,
-0.5728268027305603,
0.44192665815353394,
-0.5016907453536987,
0.15872612595558167,
-0.09619627147912979,
0.623929440... |
func (v Vertex) Scale(f int) {
v.x = v.x * f
v.y = v.y * f
} | [
-0.6212891340255737,
0.22915451228618622,
0.4797302782535553,
-0.4766250252723694,
0.021742139011621475,
0.29295846819877625,
-0.8171398639678955,
-0.29449987411499023,
-0.6418761610984802,
0.9089025259017944,
-0.6781917214393616,
-0.7155624628067017,
0.2634747326374054,
-0.668448865413665... |
func (v Vertex) Move(dx, dy int) {
v.x = v.x + dx
v.y = v.y + dy
} | [
-1.2846599817276,
0.2810450494289398,
0.48664310574531555,
-0.37951695919036865,
-0.139103502035141,
0.06694108247756958,
-0.5083322525024414,
-0.5824408531188965,
0.40066224336624146,
0.3159226179122925,
-0.44772979617118835,
0.33308637142181396,
0.15792937576770782,
-1.4675781726837158,
... |
func (r Describe) NewCommand(ctx context.Context, name string) *cobra.Command {
cmd := &cobra.Command{
Use: name[strings.LastIndex(name, ".")+1:] + " [NAME[:VERSION]] [RESOURCE] [FILTER]",
Short: "Describe registered releases with states information.",
Long: "Describe registered releases with states informati... | [
0.5346357226371765,
-0.6611016988754272,
0.7286263108253479,
-0.5030871033668518,
-0.14174754917621613,
-0.12173012644052505,
0.47276201844215393,
-0.24107001721858978,
-0.008413751609623432,
0.1279030442237854,
0.20141851902008057,
1.2737621068954468,
0.11031825095415115,
0.44119900465011... |
func (r Describe) Execute(name string, out io.Writer, args []string) error {
wrap := types.Executor{Name: name, Command: r}
ctx := context.WithValue(context.Background(), global.RefRoot, wrap)
cmd := r.NewCommand(ctx, name)
cmd.SetOut(out)
cmd.SetArgs(args)
if err := cmd.Execute(); err != nil {
return err
}
r... | [
0.6140689253807068,
0.19838839769363403,
0.8239259719848633,
0.2867378294467926,
0.4969536364078522,
-0.16985924541950226,
-0.25963911414146423,
-0.08373849093914032,
-1.2067161798477173,
0.4281311631202698,
0.2079501450061798,
0.0479348860681057,
-0.614048421382904,
0.07017742842435837,
... |
func (r Describe) validation(cmd *cobra.Command, args []string) error {
if err := require.MaxArgs(args, 3); err != nil {
return err
}
return nil
} | [
0.8879401087760925,
0.957633912563324,
0.40972551703453064,
0.0018790591275319457,
0.3334936499595642,
1.4531351327896118,
0.18670396506786346,
0.5808701515197754,
-0.743671715259552,
0.5849546194076538,
0.7255586981773376,
0.3102680444717407,
-1.2103946208953857,
0.8466018438339233,
0.4... |
func (r Describe) run(ctx context.Context, out io.Writer, opts describeOptions) error {
kubectl, err := GetK8sClientset(ctx, r.Driver, *r.Driver.Namespace())
if err != nil {
return err
}
var render string
table := tablewriter.NewWriter(out)
table.SetHeader([]string{"Name", "Version", "Kind", "Results"})
table... | [
-0.16431377828121185,
-0.051629677414894104,
0.9072526097297668,
0.49117711186408997,
-0.6641731262207031,
0.15425682067871094,
0.3548615872859955,
-0.331994891166687,
-0.38313648104667664,
0.8717842102050781,
0.2661007046699524,
0.44768381118774414,
-0.28119489550590515,
0.743013024330139... |
func mergeMaps(m1 *map[string]int, m2 *map[string]int) {
if *m1 == nil && m2 != nil {
*m1 = *m2
}
if m1 != nil && *m2 == nil {
return
}
for k, v := range *m2 {
existingWordCount, ok := (*m1)[k]
if !ok {
(*m1)[k] = v
} else {
(*m1)[k] = existingWordCount + v
}
}
} | [
-0.3019191026687622,
-0.25521039962768555,
0.5615130066871643,
-0.6140311360359192,
0.23659947514533997,
0.23150379955768585,
-0.8173850178718567,
-0.13824473321437836,
0.2086341232061386,
0.20230521261692047,
0.7334578633308411,
0.12712030112743378,
-0.73976731300354,
0.5030404329299927,
... |
func NewHTTPScraper() *HTTPScraper {
return &HTTPScraper{client: &http.Client{}}
} | [
-0.13645215332508087,
-0.49808111786842346,
0.20629368722438812,
-0.2078457623720169,
-1.0529887676239014,
0.2163543403148651,
-1.2515060901641846,
-0.48617520928382874,
-0.68621426820755,
0.22560252249240875,
-0.2853280305862427,
-0.41969648003578186,
0.15913794934749603,
1.17973506450653... |
func (hs *HTTPScraper) Get(url string) (string, error) {
req, err := http.NewRequest("GET", url, nil)
req.Header.Set("User-Agent", defaultUserAgent)
req.Header.Set("sec-ch-ua", "\"Chromium\";v=\"86\", \"\"Not\\A;Brand\";v=\"99\", \"Google Chrome\";v=\"86\"")
req.Header.Set("Accept-Language", "en-US,en;q=0.9")
if e... | [
-1.1857237815856934,
0.051060836762189865,
0.9141497015953064,
0.02878180332481861,
0.17472487688064575,
0.1053457260131836,
-0.9242270588874817,
-0.2891206443309784,
-0.3414849638938904,
1.3896039724349976,
-0.21712790429592133,
0.7245315909385681,
-0.5297609567642212,
0.2664872109889984,... |
func (hs *HTTPScraper) StartGetHTML(url string, rate time.Duration, onBody func(string)) {
ticker := time.NewTicker(rate)
for {
select {
case <-ticker.C:
body, err := hs.Get(url)
if err != nil {
fmt.Println(err)
} else {
onBody(body)
}
}
}
} | [
0.19244195520877838,
0.252302885055542,
0.7067753672599792,
0.8600828647613525,
-0.010175126604735851,
0.7613891959190369,
-0.033860087394714355,
-0.589027464389801,
-0.5292493104934692,
0.27367228269577026,
0.39973342418670654,
1.2838104963302612,
-0.1626230925321579,
0.9770278334617615,
... |
func Run(configPath string) {
if configPath == "" {
configPath = "data/config.yml"
}
setConfiguration(configPath)
conf := config.GetConfig()
web := router.Setup()
log.Println("text similarity running on port " + conf.Server.Port)
_ = web.Run(":" + conf.Server.Port)
} | [
0.08055181056261063,
-0.2311357706785202,
0.537167489528656,
-0.1239357441663742,
0.22547133266925812,
0.6219117045402527,
1.5747039318084717,
1.2177975177764893,
-0.07507359236478806,
0.8708975911140442,
-1.1764310598373413,
0.3545355796813965,
-0.7551619410514832,
0.562093198299408,
0.... |
func DocFactory() (blueprint.Module, []interface{}) {
dm := &goDocModule{}
return dm, []interface{}{&dm.SimpleName.Properties, &dm.properties}
} | [
-0.5006060004234314,
0.1913490742444992,
0.5673513412475586,
-0.23455487191677094,
-0.23301726579666138,
0.60675448179245,
-0.2186615914106369,
-0.21056188642978668,
-0.33976665139198303,
-0.394012987613678,
-0.21173614263534546,
0.29628366231918335,
0.3010631501674652,
0.4108484089374542,... |
func New() *Pool {
pool := &Pool{
NewQueue(),
}
return pool
} | [
-0.08205714821815491,
-1.3331298828125,
-0.05997025966644287,
-0.028907567262649536,
-0.21937990188598633,
0.2262980043888092,
0.06725431978702545,
-0.3372159004211426,
-0.1964954137802124,
-0.5469092130661011,
-0.3560790419578552,
1.1227344274520874,
0.5831575989723206,
0.4665092825889587... |
func (pool *Pool) Go(f func()) {
g := pool.get()
g.ch <- f
} | [
0.13850772380828857,
0.9761382937431335,
0.4403185248374939,
-0.36737963557243347,
1.1538844108581543,
0.5314540266990662,
0.547905445098877,
-0.4263623058795929,
-2.113497734069824,
-0.0496826246380806,
-0.6494215130805969,
1.1656887531280518,
1.0471291542053223,
-0.1821443736553192,
-1... |
func (g I915Backend) Round(value int) int {
const i915Alignment = 16
// Inspired by Chromium's base/bits.h:Align() function.
return (value + i915Alignment - 1) & ^(i915Alignment - 1)
} | [
0.21273627877235413,
0.6796901226043701,
0.20870590209960938,
-0.4987618327140808,
-0.3014584481716156,
0.4451617896556854,
2.036445379257202,
-1.1624728441238403,
0.4447433650493622,
0.3208741247653961,
0.5057727098464966,
0.0753616988658905,
-1.1002020835876465,
0.5839376449584961,
0.6... |
func (g I915Backend) ReadFramebufferCount(ctx context.Context, width, height int) (framebuffers int, e error) {
f, err := os.Open(i915FramebufferFile)
if err != nil {
return framebuffers, errors.Wrap(err, "failed to open dri file")
}
text, err := ioutil.ReadAll(f)
if err != nil {
return framebuffers, errors.Wr... | [
0.7812864780426025,
-0.016238732263445854,
0.7721936106681824,
0.3202000558376312,
-1.0652796030044556,
-0.9141634702682495,
0.779223620891571,
-0.28730684518814087,
-0.7061379551887512,
-0.14761845767498016,
-0.34543532133102417,
-0.6392868161201477,
-0.6669426560401917,
0.462296217679977... |
func (g GenericBackend) Round(value int) int {
const genericAlignment = 16
// Inspired by Chromium's base/bits.h:Align() function.
return (value + genericAlignment - 1) & ^(genericAlignment - 1)
} | [
-0.5358399748802185,
0.3760896921157837,
0.3233056962490082,
-0.6918606758117676,
0.21089962124824524,
0.8270877599716187,
1.4583839178085327,
-1.1138304471969604,
-0.4135149419307709,
0.5948264598846436,
0.7913938164710999,
0.6011678576469421,
-0.545939028263092,
0.7965911030769348,
0.7... |
func (g GenericBackend) ReadFramebufferCount(ctx context.Context, width, height int) (framebuffers int, e error) {
f, err := os.Open(fmt.Sprintf(genericFramebufferFilePattern, g.index))
if err != nil {
return framebuffers, errors.Wrap(err, "failed to open dri file")
}
text, err := ioutil.ReadAll(f)
if err != ni... | [
0.5227731466293335,
-0.18352799117565155,
0.8734542727470398,
-0.04680318757891655,
-0.6784926652908325,
-0.9111934304237366,
0.4965367913246155,
-0.28495174646377563,
-0.9764445424079895,
-0.010451065376400948,
-0.4142400026321411,
-0.4846942126750946,
-0.6092221140861511,
0.4848177731037... |
func GetBackend() (Backend, error) {
// TODO(mcasas): In the future we might want to support systems with several GPUs.
// Prefer the genericBackend.
if be := genericBackend(); be != nil {
return be, nil
}
if be := i915Backend(); be != nil {
return be, nil
}
return nil, errors.New("could not find any Graphic... | [
0.8254634141921997,
0.7165777087211609,
0.60124272108078,
0.6725050806999207,
0.4350525438785553,
-0.57347172498703,
-0.18198814988136292,
-1.240208387374878,
0.7679890990257263,
-0.38430264592170715,
0.8221094012260437,
1.1166678667068481,
-0.19166183471679688,
-0.23484449088573456,
0.5... |
func compareGraphicsMemoryBeforeAfter(ctx context.Context, payload func() error, backend Backend, roundedWidth, roundedHeight int) (err error) {
var before, during, after int
if before, err = readStableObjectCount(ctx, backend, roundedWidth, roundedHeight); err != nil {
return errors.Wrap(err, "failed to get the f... | [
0.7616854310035706,
-0.100894995033741,
0.9909114241600037,
-0.6131016612052917,
-0.4276643395423889,
-0.2973158359527588,
0.6942138075828552,
-1.709010362625122,
-0.29500511288642883,
-0.842907190322876,
-0.0697823092341423,
0.32887527346611023,
-0.2585006058216095,
0.38829901814460754,
... |
func monitorGraphicsMemoryDuring(ctx context.Context, payload func() error, backend Backend, roundedSizes []Size, threshold int) (err error) {
testing.ContextLog(ctx, "Running the payload() and measuring the number of graphics objects during its execution")
c := make(chan error)
go func(c chan error) {
c <- payloa... | [
0.6068395972251892,
-0.10199855268001556,
0.7761202454566956,
-1.0400817394256592,
-0.14803579449653625,
-0.34019315242767334,
0.5758258700370789,
-1.3642668724060059,
-0.10752876102924347,
-0.18486253917217255,
0.09873401373624802,
0.4362948536872864,
-0.017848527058959007,
0.193226754665... |
func VerifyGraphicsMemory(ctx context.Context, payload func() error, backend Backend, sizes []Size) (err error) {
testing.ContextLogf(ctx, "Cooling down %v after log in", coolDownTimeAfterLogin)
if err := testing.Sleep(ctx, coolDownTimeAfterLogin); err != nil {
return errors.Wrap(err, "error while cooling down afte... | [
0.36215272545814514,
0.03111390769481659,
0.6339443325996399,
-0.16689933836460114,
0.3172313868999481,
-0.008235089480876923,
0.8032589554786682,
-1.4532259702682495,
0.565331757068634,
-0.6077369451522827,
-0.2888118028640747,
0.9164096117019653,
-0.7345159649848938,
0.6098910570144653,
... |
func readStableObjectCount(ctx context.Context, backend Backend, width, height int) (objectCount int, err error) {
const (
pollingInterval = 1 * time.Second
// Time to wait for the object count to be stable.
waitTimeout = 120 * time.Second
// Threshold (in percentage) below which the object count is considered... | [
0.41163626313209534,
-0.22899332642555237,
0.8447340130805969,
0.1068577766418457,
-0.6521773338317871,
0.013273085467517376,
0.7827237248420715,
-1.2544306516647339,
-1.341965675354004,
-0.12881667912006378,
-0.3180174231529236,
-0.30102258920669556,
-0.22726282477378845,
-0.4410022795200... |
func waitForStableReadings(ctx context.Context, backend Backend, width, height int, timeout, interval time.Duration, threshold float64) (reading int, err error) {
// Keep the last numReadings for moving average purposes. Make it half the
// size that the current timeout and interval would allow.
numReadings := int(m... | [
0.32965514063835144,
0.46150532364845276,
0.6670616865158081,
-0.08243844658136368,
-1.1187162399291992,
-0.622161328792572,
-0.17900720238685608,
-1.1199586391448975,
-1.1098722219467163,
0.0018583511700853705,
0.8565182089805603,
-0.4310377836227417,
0.057838115841150284,
0.0613961815834... |
func mean(values []int) float64 {
var sum float64
for _, v := range values {
sum += float64(v)
}
return sum / float64(len(values))
} | [
-0.723633885383606,
0.7552818059921265,
0.15567423403263092,
-0.18524707853794098,
-0.018954049795866013,
0.3793807625770569,
0.03071792609989643,
-0.2248162180185318,
0.23061010241508484,
0.48920702934265137,
-0.18192262947559357,
-0.03781773895025253,
-0.8421496748924255,
0.7825857996940... |
func Pull(host string) (string, error) {
timeout := time.Duration(2 * time.Second)
client := http.Client{
Timeout: timeout,
}
resp, err := client.Get(host)
if err != nil {
return "", err
}
bytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
var response Remote
err = json.Unmarsh... | [
-0.6134557723999023,
-0.28261294960975647,
0.7820078730583191,
-0.5789480209350586,
-1.0350743532180786,
0.3894202411174774,
-0.7290018796920776,
-0.20442397892475128,
-0.5544496178627014,
0.06948214769363403,
-0.9375866651535034,
0.45287641882896423,
-0.661479651927948,
-0.025556948035955... |
func Setup(dryRun bool, repository repository.Repository) (string, error) {
resp, err := repository.Setup(dryRun)
if err != nil {
return "", err
}
return resp, nil
} | [
-0.677514910697937,
0.505175769329071,
0.3685283064842224,
-0.5946161150932312,
-0.3828187882900238,
-0.44402265548706055,
0.06635286659002304,
-0.48848867416381836,
0.31250593066215515,
0.7426722645759583,
-0.28152427077293396,
0.4601038694381714,
-0.6356292963027954,
0.17891408503055573,... |
func Setup(redirectURL, credFile string, scopes []string) {
var c Credentials
file, err := ioutil.ReadFile(credFile)
if err != nil {
glog.Fatalf("[Gin-OAuth] File error: %v\n", err)
}
json.Unmarshal(file, &c)
conf = &oauth2.Config{
ClientID: c.ClientID,
ClientSecret: c.ClientSecret,
RedirectURL: red... | [
-0.327206015586853,
-0.8040205240249634,
0.4522972106933594,
-0.6128926277160645,
-0.007419133093208075,
0.19613221287727356,
0.3555877208709717,
0.6430721282958984,
-0.707495927810669,
0.7837481498718262,
-0.18622323870658875,
0.9254236817359924,
0.1710081845521927,
0.1264466941356659,
... |
func LoginHandler(ctx *gin.Context) {
state = randToken()
session := sessions.Default(ctx)
session.Set("state", state)
session.Save()
fmt.Println("LOGIN SESSION:", session.Get("userid"))
// TODO create this page from a template
loginPage := fmt.Sprintf(`
<html>
<title>Google Login</title>
<body>
<h3>Google L... | [
-0.4356856644153595,
-0.1912909895181656,
0.5454865097999573,
-0.40130099654197693,
-0.1710430234670639,
0.7853608131408691,
0.08484549820423126,
0.3310079872608185,
0.8850423693656921,
-0.18467923998832703,
-0.9587767124176025,
-0.28909510374069214,
-0.2636432647705078,
-0.025359293445944... |
func GetLoginURL(state string) string {
return conf.AuthCodeURL(state)
} | [
-0.4335746467113495,
0.04939482361078262,
0.5225780606269836,
0.9565783739089966,
0.10178614407777786,
0.16405856609344482,
-0.42725497484207153,
0.39953386783599854,
0.6828622817993164,
0.4218558073043823,
-0.7006160020828247,
0.9561640024185181,
-0.08344025164842606,
-0.7765607237815857,... |
func CheckAuth() gin.HandlerFunc {
return func(ctx *gin.Context) {
_, err := seccookie.ReadSecureCookie(ctx, scookie)
if err != nil {
glog.Errorln("CHECK AUTH: not logged in")
}
ctx.Next()
}
} | [
0.012837721034884453,
-0.6200933456420898,
0.5491461157798767,
1.7743982076644897,
0.0147314528003335,
0.19628649950027466,
0.8566930294036865,
0.7679352164268494,
0.10357745736837387,
0.5167253613471985,
0.6436021327972412,
1.2436976432800293,
-0.0024612355045974255,
-0.28629451990127563,... |
func DoAuth(ctx *gin.Context) {
// Handle the exchange code to initiate a transport.
session := sessions.Default(ctx)
retrievedState := session.Get("state")
if session.Get("userid") != nil {
return
}
if retrievedState != ctx.Query("state") {
ctx.AbortWithError(http.StatusUnauthorized, fmt.Errorf("Invalid se... | [
-0.7503859996795654,
-0.1926514059305191,
0.7604047656059265,
-0.08615636080503464,
-0.28329965472221375,
0.41695404052734375,
0.3968265652656555,
-0.47638463973999023,
-0.014368007890880108,
0.1897890418767929,
-0.6377977132797241,
0.7658153176307678,
0.3554396331310272,
-0.15892532467842... |
func (c *Chain) Test() error {
return c.err
} | [
0.7370847463607788,
-0.2804047167301178,
0.04663091152906418,
-0.2725127637386322,
0.5045911073684692,
0.051071446388959885,
0.621781051158905,
-0.5934308171272278,
-0.26124611496925354,
-1.1916407346725464,
0.20717935264110565,
1.1515785455703735,
-1.3863815069198608,
0.093133345246315,
... |
func ReadOnce(next proto.Message) Handler {
return func(proto.Message, net.Conn) (proto.Message, proto.Message, error) {
return nil, next, nil
}
} | [
-0.5925610065460205,
0.4061245918273926,
0.4837653636932373,
0.605318546295166,
-0.006908034440129995,
0.17155055701732635,
0.3325539827346802,
-0.09120901674032211,
-0.37473905086517334,
-0.2257988154888153,
0.24804744124412537,
-0.4561551511287689,
-1.3705921173095703,
0.3556295335292816... |
func NewHamtSet() HamtSet {
return HamtSet{
set: hamt.NewSet(),
}
} | [
0.5288596749305725,
-0.37881729006767273,
0.13464424014091492,
-0.031537219882011414,
-0.9408084154129028,
-0.32910388708114624,
-0.3994327485561371,
-0.719407320022583,
-0.4355621039867401,
-0.4121280312538147,
-0.3422236740589142,
0.7231209874153137,
0.5115705132484436,
-0.05916527658700... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.