text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func PostStudents(w http.ResponseWriter, r *http.Request) {
var response string
user := r.Header.Get("X-User")
resF := database.GetFacultyUser(user)
if resF.ID == 0 {
response = "Access denied."
w.WriteHeader(http.StatusBadRequest)
} else if !resF.Admin {
response = "Insuffient rights."
w.WriteHeader(http.... | [
-0.7362779974937439,
-0.32502102851867676,
0.9005033373832703,
0.6858900785446167,
-0.3486391007900238,
0.3487522602081299,
-0.01478240080177784,
-0.7021079063415527,
-0.04710893705487251,
0.13048669695854187,
-0.4764898121356964,
-0.0648847371339798,
-0.5490283966064453,
0.198617532849311... |
func PostFaculty(w http.ResponseWriter, r *http.Request) {
var response string
user := r.Header.Get("X-User")
resF := database.GetFacultyUser(user)
if resF.ID == 0 {
response = "Access denied."
w.WriteHeader(http.StatusBadRequest)
} else if !resF.Admin {
response = "Insuffient rights."
w.WriteHeader(http.S... | [
-0.07003462314605713,
0.0317489430308342,
0.8939118385314941,
0.6447761058807373,
0.1980338841676712,
-0.36094945669174194,
0.144048810005188,
-0.8087542057037354,
0.2255551815032959,
-0.3422448933124542,
-0.3959687650203705,
-0.056096866726875305,
-0.2526940703392029,
0.38927406072616577,... |
func PostCoursesCourseSegments(w http.ResponseWriter, r *http.Request) {
var response string
user := r.Header.Get("X-User")
resF := database.GetFacultyUser(user)
if resF.ID == 0 {
response = "Access denied."
w.WriteHeader(http.StatusBadRequest)
} else if !resF.Admin {
response = "Insuffient rights."
w.Writ... | [
-0.7182846665382385,
-0.1292797327041626,
0.7650193572044373,
-0.03743574768304825,
0.8949276804924011,
0.3572804629802704,
0.36100274324417114,
-0.6320561170578003,
-0.03216852992773056,
0.4084358215332031,
-0.39163753390312195,
-0.20063623785972595,
-0.15334761142730713,
0.22492165863513... |
func PostCoursesCourseSegmentsSegmentCategories(w http.ResponseWriter, r *http.Request) {
var response string
user := r.Header.Get("X-User")
resF := database.GetFacultyUser(user)
if resF.ID == 0 {
response = "Access denied."
w.WriteHeader(http.StatusBadRequest)
} else {
resJsonString, resJsonCode := databas... | [
-0.6524190306663513,
-0.0454527884721756,
0.5391933917999268,
-0.029428375884890556,
0.5476121306419373,
-0.15005649626255035,
0.5625754594802856,
-0.6226598024368286,
-0.4683564305305481,
-0.49887293577194214,
-0.0040442366153001785,
-0.7394187450408936,
0.2531002163887024,
0.398616313934... |
func Loader(fs afero.Fs, name string) (ContentLoader, error) {
fi, err := fs.Stat(name)
if err != nil {
return nil, err
}
// Is directory
if fi.IsDir() {
return &DirLoader{
fs: fs,
name: name,
}, nil
}
return nil, fmt.Errorf("only directory is supported as content loader")
} | [
-0.023595836013555527,
-0.1824682354927063,
0.32145196199417114,
0.516278862953186,
-0.9822845458984375,
-0.17720291018486023,
-0.2957364618778229,
-0.4278150498867035,
0.29374781250953674,
-0.6494724154472351,
0.6130362749099731,
0.01061647292226553,
0.5259826183319092,
0.9852241277694702... |
func NewConfig(apiDomain, apiKey string) *Config {
return &Config{apiDomain, apiKey}
} | [
0.2537482678890228,
-0.22176136076450348,
0.11472109705209732,
-0.11535175889730453,
-0.4338362216949463,
-0.5443929433822632,
-0.7999357581138611,
1.1135951280593872,
-0.10382400453090668,
0.08256424218416214,
0.3971214294433594,
0.7261923551559448,
0.014876214787364006,
0.310310304164886... |
func (c *Config) APIDomain() string {
return c.apiDomain
} | [
-1.0773996114730835,
-0.7748463749885559,
-0.09518527239561081,
-0.6564964056015015,
-0.6191882491111755,
0.5473077893257141,
-0.6121453642845154,
0.7301234602928162,
-0.2935687303543091,
-0.4258313775062561,
-0.8986744284629822,
0.6573825478553772,
-0.7798603177070618,
0.06564094126224518... |
func (c *Config) APIKey() string {
return c.apiKey
} | [
0.026527700945734978,
0.0007610321044921875,
-0.05144672095775604,
-0.2029104232788086,
-0.1421070396900177,
0.5382941961288452,
0.12800511717796326,
1.2421115636825562,
-0.09840447455644608,
1.2342716455459595,
-0.7016251087188721,
-0.6132463216781616,
-0.6757856011390686,
-0.090780206024... |
func ServiceAccount(iamClient *iam.Service, accountId *ServiceAccountId) (*iam.ServiceAccount, error) {
account, err := iamClient.Projects.ServiceAccounts.Get(accountId.ResourceName()).Do()
if err != nil {
return nil, fmt.Errorf("could not find service account '%s': %v", accountId.ResourceName(), err)
}
return a... | [
0.6912851929664612,
-0.5135401487350464,
0.19207528233528137,
-0.30412477254867554,
-0.2339106798171997,
-0.4403427541255951,
1.326432704925537,
-0.45565733313560486,
0.3569992780685425,
0.5044676065444946,
0.4249648153781891,
1.5883299112319946,
-0.5722334980964661,
-0.13046689331531525,
... |
func ServiceAccountKey(iamClient *iam.Service, keyId *ServiceAccountKeyId) (*iam.ServiceAccountKey, error) {
keyResource := keyId.ResourceName()
key, err := iamClient.Projects.ServiceAccounts.Keys.Get(keyId.ResourceName()).PublicKeyType(ServiceAccountKeyFileType).Do()
if err != nil {
return nil, fmt.Errorf("could ... | [
0.09265048056840897,
-0.5471086502075195,
0.15486621856689453,
0.0484188012778759,
-0.2085629105567932,
-0.2842084765434265,
1.137793779373169,
-0.8387483358383179,
-0.17666447162628174,
0.47627148032188416,
0.274082750082016,
1.1766552925109863,
-0.4839862585067749,
0.660794734954834,
-... |
func NewIndex(buf string) (*Index, error) {
index := &Index{}
err := yaml.Unmarshal([]byte(buf), index)
if err != nil {
return nil, err
}
return index, nil
} | [
0.5180846452713013,
-1.3838303089141846,
0.17623907327651978,
-0.2737448215484619,
-1.0540543794631958,
-0.6052298545837402,
0.3912973999977112,
0.8931615352630615,
0.314147025346756,
-0.46219101548194885,
-0.9016981720924377,
0.48339974880218506,
-0.5345782041549683,
-0.8461392521858215,
... |
func CopyIndex(from *Index) *Index {
to := &Index{
Files: map[string]Sourcefile{},
}
for k, v := range from.Files {
to.Add(k, v)
}
return to
} | [
-0.49028685688972473,
-0.6948110461235046,
0.4143712818622589,
-0.23335567116737366,
-0.8950884342193604,
1.0469748973846436,
0.3848949074745178,
0.013187511824071407,
-0.029347216710448265,
-0.15431012213230133,
-0.42537185549736023,
0.6672332286834717,
0.39917874336242676,
-0.78494691848... |
func (i *Index) Encode() (string, error) {
out, err := yaml.Marshal(i)
if err != nil {
return "", err
}
return string(out), nil
} | [
0.37610000371932983,
0.2564395070075989,
0.18728941679000854,
0.3738839328289032,
-0.3066270649433136,
-0.20309209823608398,
-0.2423846274614334,
0.37845832109451294,
0.47631850838661194,
0.592994749546051,
0.54322350025177,
0.37165454030036926,
-0.5179192423820496,
-0.5837885141372681,
... |
func (i *Index) Add(f string, src Sourcefile) {
i.Files[f] = src
} | [
-0.90430748462677,
0.22028079628944397,
0.13390648365020752,
-0.5122138261795044,
0.24703319370746613,
0.454791784286499,
0.15127386152744293,
0.4430849254131317,
-0.5360050201416016,
-0.1469288468360901,
-0.10997608304023743,
0.04204662889242172,
-0.05948884040117264,
-0.1393672078847885,... |
func (i *Index) GetNextN(n int) *Index {
result := &Index{
Files: map[string]Sourcefile{},
}
if len(i.Files) == 0 {
return result
}
for f, src := range i.Files {
if n == 0 {
break
}
result.Add(f, src)
n--
}
return result
} | [
-0.95688796043396,
0.40587711334228516,
0.3808651566505432,
0.1653139591217041,
-0.41130194067955017,
-0.6746765375137329,
0.30052611231803894,
-0.7668034434318542,
0.26177892088890076,
-0.996918797492981,
-0.9651519060134888,
-0.05561508983373642,
-0.19249701499938965,
0.41255879402160645... |
func (local *Index) Diff(remote *Index) *Index {
diff := &Index{Files: map[string]Sourcefile{}}
for f, v := range local.Files {
if _, found := remote.Files[f]; !found {
log.Printf("Found missing file %s\n", f)
diff.Files[f] = v
} else {
if v.Hash != remote.Files[f].Hash {
log.Printf("Found updated f... | [
-0.33249127864837646,
-0.8284248113632202,
0.4781620502471924,
-0.8353739380836487,
-0.2766476273536682,
1.0675625801086426,
0.2406901717185974,
-0.38185614347457886,
-0.09184254705905914,
-0.2642025053501129,
0.04326692223548889,
-0.05379410460591316,
-0.5302045941352844,
0.32518750429153... |
func FilePathWalker(root string, index *Index, hasher PathHasher) filepath.WalkFunc {
return func(path string, f os.FileInfo, err error) error {
if !f.IsDir() {
doLog("Add in file to index: %s", path)
key := normalisePath(path)
if root != "" {
key = fmt.Sprintf("%s/%s", root, key)
}
hash, errHash ... | [
0.17077843844890594,
-0.22744353115558624,
0.6195557713508606,
0.3655719459056854,
-0.06801953166723251,
0.22936390340328217,
0.9010856747627258,
0.0903642475605011,
-0.26909565925598145,
-0.4202285706996918,
0.21399347484111786,
-1.1487735509872437,
-0.14320503175258636,
0.000055885317124... |
func FileHasher(path string) (string, error) {
contents, err := ioutil.ReadFile(filepath.Clean(path))
if err != nil {
return "", err
}
h := sha256.Sum256(contents)
hash := base64.StdEncoding.EncodeToString(h[:])
return hash, nil
} | [
0.38094469904899597,
-0.6747193932533264,
0.5267916321754456,
0.25364720821380615,
-0.9079115390777588,
0.4845483899116516,
-0.3531230688095093,
0.4562512934207916,
-0.7427826523780823,
0.1795843243598938,
-0.005382999312132597,
-1.0181738138198853,
0.22155646979808807,
0.33417487144470215... |
func NewIndexFromRoot(
bucketRoot,
path string,
walker PathWalker,
hasher PathHasher,
) (*Index, error) {
i := &Index{
Files: map[string]Sourcefile{},
}
err := filepath.Walk(path, walker(bucketRoot, i, hasher))
if err != nil {
return nil, err
}
return i, nil
} | [
0.2753327488899231,
-1.41419517993927,
0.2213112860918045,
0.41066285967826843,
-0.879784882068634,
0.3705819547176361,
0.31104621291160583,
-0.6693347096443176,
-0.621989369392395,
-0.6909766793251038,
-0.32151663303375244,
0.07645236700773239,
0.04212065041065216,
0.15232862532138824,
... |
func UploadDifferences(localIndex, remoteIndex *Index, interval int, store IndexStore, getFile FileGetter) error {
diff := localIndex.Diff(remoteIndex)
toUpload := CopyIndex(remoteIndex)
count := 0
uploadIndex := func() error {
r, _ := toUpload.Encode()
doLog("Uploading index as %s\n", indexFile)
err := stor... | [
-0.6488184332847595,
0.2180868536233902,
0.9822523593902588,
-0.47036176919937134,
0.5738931894302368,
0.6049992442131042,
0.6997256278991699,
-0.5856983065605164,
-0.3541756868362427,
0.06896445900201797,
-0.6279428601264954,
-0.1663869023323059,
-0.5475353598594666,
0.21497558057308197,
... |
func (o *FeatureGateOptions) ApplyTo(featureGates featuregate.MutableFeatureGate) ([]string, error) {
return setFeatureGates(o.featureGateArgs, featureGates)
} | [
-0.43777939677238464,
0.03320532664656639,
0.6585795879364014,
0.6252049803733826,
0.24053619801998138,
-0.6131393313407898,
0.1226428747177124,
0.36041224002838135,
0.3472268283367157,
0.43450912833213806,
0.03980683535337448,
0.46214422583580017,
0.002452585380524397,
1.2940123081207275,... |
func SetFeatureGates(flags map[string][]string, featureGates featuregate.MutableFeatureGate) ([]string, error) {
featureGatesMap := map[string]bool{}
featureGateParser := flag.NewMapStringBool(&featureGatesMap)
for _, val := range flags["feature-gates"] {
if err := featureGateParser.Set(val); err != nil {
retur... | [
-0.3191896975040436,
-0.017517345026135445,
0.46348243951797485,
1.0765330791473389,
-0.3771549165248871,
-0.19390997290611267,
-0.684765636920929,
-0.13159815967082977,
-0.8070931434631348,
0.985499382019043,
-0.7439491152763367,
0.5287611484527588,
-0.9651018381118774,
1.393271803855896,... |
func InitializeFeatureGates(featureGates featuregate.MutableFeatureGate, usedFeatures ...configv1.FeatureGateName) error {
defaultFeatures := sets.String{}
enabledDefaultFeatures := sets.String{}
for _, enabled := range configv1.FeatureSets[configv1.Default].Enabled {
defaultFeatures.Insert(string(enabled.FeatureG... | [
-0.02348458021879196,
-0.20932932198047638,
0.6384961605072021,
0.41746020317077637,
0.061450473964214325,
-0.3657407760620117,
-0.41045668721199036,
0.9046890139579773,
-0.34887564182281494,
1.2630945444107056,
-0.4987708032131195,
0.4615054130554199,
-0.740373432636261,
1.000095248222351... |
func (d *Daemon) Listen() {
defer d.Socket.Close()
rpc.RegisterHandler()
for {
conn, err := d.Socket.Accept()
if err != nil {
utils.LogFatalf("Socket connection error: %+v\n", err)
}
utils.LogInfof("New socket connection from %s\n", conn.RemoteAddr().String())
go rpc.HandleConnection(conn)
}
} | [
-0.10937406867742538,
-0.5073866248130798,
0.6994089484214783,
-0.8046743273735046,
0.6234328746795654,
0.6186692118644714,
-0.285900354385376,
0.36077654361724854,
-0.5476972460746765,
-0.234721377491951,
-0.0020963381975889206,
0.7053536772727966,
-0.2514246702194214,
0.6366621851921082,... |
func GetDaemon(socketPath string) *Daemon {
if daemon == nil {
daemon = new(Daemon)
daemon.ID = 0
socket, err := CreateListener(socketPath)
if err != nil {
utils.LogFatalf("Failed to listen to socket at %s. %s", socketPath, err)
}
daemon.Socket = socket
}
return daemon
} | [
0.2252274453639984,
0.1831274926662445,
0.5977385640144348,
-0.4691399037837982,
0.4546940326690674,
-0.2237042337656021,
0.3025328814983368,
-0.36996540427207947,
0.8777179718017578,
-1.589680552482605,
-0.29879218339920044,
1.2797482013702393,
-0.504753828048706,
0.09778241068124771,
1... |
func Templ(target string) (t *template.Template) {
t = template.New("")
go func() {
for {
f, err := ioutil.ReadFile(target)
if err != nil {
log.Printf("%s, %v", target, err)
} else {
t.Parse(string(f))
}
sleep()
}
}()
return t
} | [
0.14335007965564728,
-0.11783222109079361,
0.4144376218318939,
-0.6468923091888428,
-0.11791452020406723,
-0.18309254944324493,
-0.3937360942363739,
-0.05951929837465286,
-0.555969774723053,
-0.40781038999557495,
-0.10127069056034088,
-0.2623597979545593,
0.2739219665527344,
-1.35731804370... |
func (n *Networks) UnmarshalYAML(unmarshal func(interface{}) error) error {
var sliceType []string
if err := unmarshal(&sliceType); err == nil {
for _, name := range sliceType {
n.Networks = append(n.Networks, &Network{
Name: name,
})
}
return nil
}
var mapType map[string]*Network
if err := unmars... | [
-0.21277348697185516,
0.8434260487556458,
0.49722805619239807,
-1.113319754600525,
-0.3218405842781067,
-0.7214006185531616,
0.4279851019382477,
0.10761257261037827,
0.9273185729980469,
0.06277479231357574,
-0.3058445453643799,
-0.4034304618835449,
0.7442209124565125,
0.34240779280662537,
... |
func ReadFile(path string) (Etats, error) {
var ee Etats
bb, err := ioutil.ReadFile(path)
if err != nil {
return ee, err
}
json.Unmarshal(bb, &ee)
return ee, nil
} | [
-0.7813517451286316,
0.06665240973234177,
0.7128467559814453,
-0.8905556797981262,
-0.5784810185432434,
0.11087727546691895,
-0.18004918098449707,
-0.38098862767219543,
-0.6489704847335815,
-0.00032440476934425533,
0.48920297622680664,
-0.34831002354621887,
0.47612249851226807,
-0.40180489... |
func New(
listenIP string,
port int,
conf gortsplib.ServerConf,
parent Parent) (*Server, error) {
address := listenIP + ":" + strconv.FormatInt(int64(port), 10)
srv, err := conf.Serve(address)
if err != nil {
return nil, err
}
s := &Server{
parent: parent,
srv: srv,
accept: make(chan *gortsplib.Se... | [
0.016965016722679138,
-0.8460047841072083,
0.33575767278671265,
-1.1758902072906494,
-0.2640202045440674,
0.5440670847892761,
-0.12024688720703125,
-0.15054164826869965,
-0.3313004970550537,
0.10271048545837402,
0.023648813366889954,
0.27035120129585266,
0.1990629881620407,
0.7987457513809... |
func (s *Server) Close() {
go func() {
for co := range s.accept {
co.Close()
}
}()
s.srv.Close()
<-s.done
} | [
-1.136662244796753,
0.4606615900993347,
0.5821176767349243,
-0.36519768834114075,
-0.3807314336299896,
0.4460678696632385,
0.6374297738075256,
-0.38521263003349304,
-0.6226792335510254,
-0.1240939125418663,
0.004330403637140989,
1.113291621208191,
-0.7569249868392944,
1.4519929885864258,
... |
func (s *Server) Accept() chan *gortsplib.ServerConn {
return s.accept
} | [
-0.4372674524784088,
-0.9205313920974731,
0.5237200260162354,
-0.652405321598053,
-0.6881155371665955,
0.8552529811859131,
0.3052874505519867,
0.7918264269828796,
-0.42055612802505493,
-0.19483259320259094,
-0.06011911481618881,
1.4578742980957031,
-0.9449260830879211,
0.846228837966919,
... |
func FuncHandler(fn func(r *Record) error) LogHandler {
return funcHandler(fn)
} | [
0.12648215889930725,
0.041870515793561935,
0.16388456523418427,
-0.6815097332000732,
-0.3824983835220337,
-0.09453920274972916,
0.27297475934028625,
0.5033001899719238,
0.3476034998893738,
-0.966353178024292,
0.16061271727085114,
0.3067840337753296,
0.45146703720092773,
0.01549239642918109... |
func (h funcHandler) Log(r *Record) error {
return h(r)
} | [
-0.13152185082435608,
0.6302199363708496,
0.12495803833007812,
0.20344412326812744,
-0.4696491062641144,
-0.1194259375333786,
0.8494417071342468,
0.6339982748031616,
-0.2180611789226532,
-0.7211899757385254,
-1.0500905513763428,
0.29971110820770264,
0.08235931396484375,
0.5475112795829773,... |
func HandlerFunc(log func(message string, time time.Time, level LogLevel, call CallStack, context ContextMap) error) LogHandler {
return remoteHandler(log)
} | [
1.202555537223816,
-0.17788450419902802,
0.3584808111190796,
-0.16805391013622284,
-1.014600396156311,
0.5782621502876282,
0.03728129714727402,
0.5497340559959412,
-0.6002744436264038,
-0.045668523758649826,
-0.1821933388710022,
0.6777342557907104,
0.4413999915122986,
-0.7530890107154846,
... |
func SyncHandler(h LogHandler) LogHandler {
var mu sync.Mutex
return FuncHandler(func(r *Record) error {
defer mu.Unlock()
mu.Lock()
return h.Log(r)
})
} | [
0.7628471255302429,
0.13914208114147186,
0.3205375671386719,
-0.005103530827909708,
-0.7921583652496338,
-0.16083988547325134,
0.14048025012016296,
-0.09142808616161346,
-0.17724472284317017,
-0.09391498565673828,
-0.1292506903409958,
0.6998090147972107,
-0.17354117333889008,
-0.1077048927... |
func LazyHandler(h LogHandler) LogHandler {
return FuncHandler(func(r *Record) error {
for k, v := range r.Context {
if lz, ok := v.(Lazy); ok {
_, err := evaluateLazy(lz)
if err != nil {
r.Context[errorKey] = "bad lazy " + k
}
}
}
return h.Log(r)
})
} | [
0.8513928055763245,
-0.07511995732784271,
0.4235456883907318,
-0.7877979278564453,
-0.30512887239456177,
0.10027027875185013,
-0.017026850953698158,
0.14044828712940216,
-0.054522208869457245,
-0.2573275864124298,
-0.37111636996269226,
0.3150595426559448,
-0.4470839202404022,
0.82535308599... |
func Setup() {
http.HandleFunc("/", handleRequest)
} | [
-0.2664681077003479,
-0.37302762269973755,
0.2404400259256363,
0.6312264800071716,
1.1458618640899658,
0.4570674002170563,
0.8828336596488953,
0.13937853276729584,
-0.6776797771453857,
-0.9338453412055969,
0.2843594253063202,
0.1203109547495842,
1.0258567333221436,
-0.08989959210157394,
... |
func NewLoginController(service *goa.Service, sessionStore security.SessionStore) *LoginController {
return &LoginController{
Controller: service.NewController("LoginController"),
SessionStore: sessionStore,
}
} | [
0.41232991218566895,
-0.6891767382621765,
-0.032709233462810516,
0.005165791139006615,
-1.2459840774536133,
-0.3126462996006012,
-0.39996758103370667,
-0.3282698690891266,
1.1394773721694946,
0.13283321261405945,
-0.44626927375793457,
0.5104430913925171,
-0.39250385761260986,
0.39307442307... |
func (c *LoginController) ShowLogin(ctx *app.ShowLoginLoginContext) error {
// LoginController_ShowLogin: start_implement
loginError := map[string]interface{}{}
c.SessionStore.GetAs("loginError", &loginError, ctx.Request)
templateContent, err := ioutil.ReadFile("public/login/login-form.html")
if err != nil {
re... | [
-0.6610653400421143,
-0.5831606984138489,
0.8520353436470032,
-0.1063610315322876,
-0.8956165909767151,
-0.012799287214875221,
0.9103918075561523,
0.604993999004364,
0.36150553822517395,
-0.26671335101127625,
-0.002257685177028179,
0.35625192523002625,
0.21189682185649872,
-0.1036294624209... |
func NewEnclosedEnvironment(outer *Environment) *Environment {
env := NewEnvironment()
env.outer = outer
return env
} | [
-1.141649842262268,
-0.6702495813369751,
0.37837326526641846,
-0.4778159260749817,
-0.6745442152023315,
0.5223296284675598,
0.43424519896507263,
0.0693938210606575,
0.029698332771658897,
-0.7056392431259155,
-0.14541208744049072,
0.6264985203742981,
-0.5637077689170837,
1.0246121883392334,... |
func NewEnvironment() *Environment {
s := make(map[string]Object)
return &Environment{store: s, outer: nil}
} | [
-0.44124120473861694,
-0.7533689141273499,
0.04681025445461273,
-0.28904902935028076,
-1.287171483039856,
0.07494639605283737,
0.5185526609420776,
0.0679996982216835,
0.1916598081588745,
-0.2713051438331604,
-0.5511290431022644,
0.3835006058216095,
-0.026252923533320427,
0.3218291401863098... |
func (e *Environment) Get(name string) (Object, bool) {
obj, ok := e.store[name]
if !ok && e.outer != nil {
obj, ok = e.outer.Get(name)
}
return obj, ok
} | [
-1.1942394971847534,
-0.41251757740974426,
0.7214059829711914,
-0.8845429420471191,
-0.6953927278518677,
0.3835214376449585,
-0.4308193325996399,
-0.279556542634964,
-0.34526222944259644,
0.9664480686187744,
-0.39796024560928345,
0.5692465305328369,
-0.6862817406654358,
-0.2110128104686737... |
func (e *Environment) Set(name string, val Object) Object {
e.store[name] = val
return val
} | [
-0.7779825329780579,
-0.5956428050994873,
0.2706640064716339,
-0.5042412281036377,
-0.9380180239677429,
1.0757434368133545,
-0.031823452562093735,
-0.6875149011611938,
-0.09863685071468353,
1.0759787559509277,
-0.8864189982414246,
0.31001272797584534,
-0.14717940986156464,
-0.1081379503011... |
func refreshToken(w http.ResponseWriter, r *http.Request) {
expireTime := viper.GetInt("expire")
refreshExpireTime := viper.GetInt("refreshexpire")
fmt.Println("Refresh token", expireTime, refreshExpireTime)
userid := GetUserID(r)
res := NewResponse(r, w)
token, err := utils.GetJWTToken(expireTime, userid)
if ... | [
-0.1441161036491394,
-0.5184435248374939,
0.7767546772956848,
0.5774929523468018,
0.021807096898555756,
-0.14426755905151367,
-0.37597477436065674,
-0.15382136404514313,
0.4351404905319214,
0.4697938859462738,
-0.5051282644271851,
1.1041816473007202,
0.5014005303382874,
0.8237088918685913,... |
func GetRuleProtocol(v string) (rules.Protocol, error) {
var protocol rules.Protocol
var err error
switch v {
case "any":
protocol = rules.ProtocolAny
case "icmp":
protocol = rules.ProtocolICMP
case "tcp":
protocol = rules.ProtocolTCP
case "udp":
protocol = rules.ProtocolUDP
default:
err = fmt.Errorf... | [
0.22973303496837616,
0.10628893226385117,
0.5485029816627502,
0.0022595315240323544,
0.4228404760360718,
0.681378185749054,
0.2445855587720871,
0.025256535038352013,
0.041598979383707047,
0.28023263812065125,
-0.05786420404911041,
0.35334619879722595,
-1.265438199043274,
-0.501906037330627... |
func (h HandlerPayloadUnmarshal) UnmarshalPayload(r io.Reader, v interface{}) error {
req := &request.Request{
HTTPRequest: &http.Request{},
HTTPResponse: &http.Response{
StatusCode: 200,
Header: http.Header{},
Body: ioutil.NopCloser(r),
},
Data: v,
}
h.Unmarshalers.Run(req)
return req.... | [
-0.23808646202087402,
0.22709591686725616,
0.8853738307952881,
-1.6997780799865723,
-1.2944196462631226,
0.2847328782081604,
-0.003022444900125265,
-0.15794974565505981,
-0.36201220750808716,
-0.5316029787063599,
0.07405276596546173,
-0.9432955384254456,
-0.16178295016288757,
0.06844554841... |
func (h HandlerPayloadMarshal) MarshalPayload(w io.Writer, v interface{}) error {
req := request.New(
aws.Config{},
metadata.ClientInfo{},
request.Handlers{},
nil,
&request.Operation{HTTPMethod: "PUT"},
v,
nil,
)
h.Marshalers.Run(req)
if req.Error != nil {
return req.Error
}
io.Copy(w, req.GetB... | [
0.8059312105178833,
0.2578798532485962,
0.5648645162582397,
-0.7551945447921753,
-0.630458414554596,
1.019242525100708,
-0.2071828991174698,
-0.25912371277809143,
0.05944603309035301,
-0.10016068816184998,
-0.2297723889350891,
0.6989153027534485,
-0.05596141889691353,
-0.27935099601745605,... |
func (w *Wallpaper) Download(dir string) error {
resp, err := getAuthedResponse(w.Path)
if err != nil {
return err
}
path := filepath.Join(dir, path.Base(w.Path))
return download(path, resp)
} | [
0.14537280797958374,
0.14136703312397003,
0.5440701246261597,
-0.042284950613975525,
0.06115231290459633,
0.008387572132050991,
0.8380873203277588,
-1.0088632106781006,
1.0315775871276855,
-0.27029338479042053,
-0.38710319995880127,
0.09122887253761292,
-0.5561425089836121,
0.2226338237524... |
func GenInitialNumberOfBonds(r *rand.Rand) (initialBonds uint64) {
return uint64(r.Int63n(MaxNumberOfInitialBonds) + 1)
} | [
-0.3854334354400635,
0.0008443424594588578,
0.4411516785621643,
0.6695505380630493,
-0.14237958192825317,
0.9243399500846863,
0.899349570274353,
0.13433368504047394,
0.855728805065155,
-1.2820998430252075,
-0.948675274848938,
0.08851958811283112,
-0.7328892350196838,
0.19004952907562256,
... |
func GenMaxNumberOfBonds(r *rand.Rand) (maxBonds uint64) {
return uint64(r.Int63n(MaxNumberOfBonds-MaxNumberOfInitialBonds) + MaxNumberOfInitialBonds + 1)
} | [
-0.2858741581439972,
0.061202384531497955,
0.5659862160682678,
1.0263041257858276,
-0.4599427282810211,
0.8052130341529846,
0.717328667640686,
-0.14486657083034515,
1.0674479007720947,
-0.8280080556869507,
-0.8602041602134705,
-0.27620935440063477,
-0.6989780068397522,
0.20748528838157654,... |
func RandomizedGenState(simState *module.SimulationState) {
r := simState.Rand
// Generate a random number of initial bonds and maximum bonds
var initialBonds, maxBonds uint64
simState.AppParams.GetOrGenerate(
simState.Cdc, InitialBonds, &initialBonds, simState.Rand,
func(r *rand.Rand) { initialBonds = GenInit... | [
0.26058506965637207,
0.875552237033844,
0.8505906462669373,
-0.06653586030006409,
-0.26803672313690186,
-0.3648689091205597,
0.08219953626394272,
-0.03296405076980591,
0.48716074228286743,
-0.06627822667360306,
0.043738674372434616,
-0.1956167370080948,
-0.07161332666873932,
0.172820925712... |
func (a Auth) registerHandler(w http.ResponseWriter, r *http.Request) {
vars := r.URL.Query()
if len(vars["username"]) != 1 || len(vars["password"]) != 1 || len(vars["email"]) != 1 {
log.Printf("Bad registration!\n")
responseError(w)
return
}
username := vars["username"][0]
password := vars["password"][0]
e... | [
-1.0026206970214844,
0.28247785568237305,
0.6948040127754211,
0.7640379667282104,
0.6995435953140259,
0.4043188989162445,
0.3978806436061859,
0.5809387564659119,
-0.48065945506095886,
-0.15494900941848755,
0.26095515489578247,
0.08748912066221237,
-0.9309574365615845,
0.4696427881717682,
... |
func ReleaseJSONURL() string {
return strings.Join([]string{versions.URLBase, versions.Branch, "/current/version_info.json"}, "")
} | [
-0.7971266508102417,
-1.0389585494995117,
0.55069500207901,
-0.6586980819702148,
-0.5633742213249207,
0.5903019905090332,
-0.7438454031944275,
0.14786891639232635,
-0.9178339242935181,
1.2623988389968872,
-0.6495493650436401,
0.2567045986652374,
0.12310606986284256,
-0.3148139417171478,
... |
func (c *ScriptRole) Run() error {
dest := fmt.Sprintf("/tmp/%s", utils.GetRandomSalt())
err := utils.New(c.host, c.remote_user, c.remote_pwd, c.remote_port).SftpUploadToRemote(c.script, dest)
if err != nil {
log.WithFields(log.Fields{
"src": c.script,
"耗时": time.Now().Sub(c.starttime),
}).Errorln(err.Err... | [
-0.3056548237800598,
-0.48330870270729065,
1.267661690711975,
-0.22491291165351868,
0.08404401689767838,
0.2846464514732361,
0.7177441120147705,
0.23673048615455627,
-0.6986885070800781,
0.6346810460090637,
-0.568800151348114,
0.4386250078678131,
-0.19724681973457336,
0.5350515842437744,
... |
func (mnfst *ImageManifest) Layers() []Digest {
var out []Digest
if mnfst.V1 != nil {
out = make([]Digest, len(mnfst.V1.FSLayers))
for i, dg := range mnfst.V1.FSLayers {
// v1 fsLayers are listed base-last
out[len(out)-(i+1)] = dg.BlobSum
}
}
if mnfst.V2 != nil {
for _, dg := range mnfst.V2.Layers {... | [
-0.7774894833564758,
-0.7879540324211121,
0.5865331292152405,
-0.2741124927997589,
-0.22319947183132172,
-0.4924536645412445,
-0.7508448958396912,
0.008002839051187038,
0.769411027431488,
-0.1570119708776474,
0.09282888472080231,
0.17718373239040375,
0.11054902523756027,
0.9891665577888489... |
func apiSettingsHandler(w http.ResponseWriter, r *http.Request) {
incMetric(metricAPISettingsReq)
utils.DebugHTTPDump(r, settingsmgr.DebugHTTP(settings.ServiceAPI, settings.NoEnvironment), false)
// Get context data and check access
ctx := r.Context().Value(contextKey(contextAPI)).(contextValue)
if !apiUsers.Check... | [
-0.7851677536964417,
0.4117046296596527,
0.6763574481010437,
-0.20626899600028992,
-0.42856109142303467,
0.22682757675647736,
0.5760029554367065,
-1.0786980390548706,
-0.7206853032112122,
0.689699649810791,
0.609197199344635,
0.16500966250896454,
-0.9023087620735168,
0.4508861303329468,
... |
func apiSettingsServiceHandler(w http.ResponseWriter, r *http.Request) {
incMetric(metricAPISettingsReq)
utils.DebugHTTPDump(r, settingsmgr.DebugHTTP(settings.ServiceAPI, settings.NoEnvironment), false)
vars := mux.Vars(r)
// Extract environment
service, ok := vars["service"]
if !ok {
apiErrorResponse(w, "error... | [
-0.9671526551246643,
0.23976445198059082,
0.7545313239097595,
-0.3513951301574707,
-0.3775661587715149,
0.15490815043449402,
0.4712889790534973,
-1.2789041996002197,
-0.6773712038993835,
0.848061203956604,
0.547081470489502,
0.40266162157058716,
-0.8388227820396423,
0.661586344242096,
0.... |
func apiSettingsServiceJSONHandler(w http.ResponseWriter, r *http.Request) {
incMetric(metricAPISettingsReq)
utils.DebugHTTPDump(r, settingsmgr.DebugHTTP(settings.ServiceAPI, settings.NoEnvironment), false)
vars := mux.Vars(r)
// Extract environment
service, ok := vars["service"]
if !ok {
apiErrorResponse(w, "e... | [
-0.9758355617523193,
-0.07691937685012817,
0.8986592292785645,
-0.3283512592315674,
-0.6228512525558472,
0.30503660440444946,
0.654061496257782,
-1.1732017993927002,
-0.5447916984558105,
0.7273263931274414,
0.4361402094364166,
0.4473258852958679,
-0.9137624502182007,
0.6932163834571838,
... |
func (s *Scanner) read() byte {
if s.bRead == s.bLen {
return eof
}
b := s.buf[s.bRead]
s.bRead++
s.ch = b
if b == '\n' {
s.line++
s.prevLineOffset = s.lineOffset
s.lineOffset = 0
} else {
s.prevLineOffset = s.lineOffset
s.lineOffset++
}
return b
} | [
0.4175247550010681,
-0.6013138294219971,
0.9218266010284424,
-0.08091659843921661,
-1.02452552318573,
-0.19548740983009338,
0.3601089119911194,
0.1717175841331482,
0.054786913096904755,
-1.1911470890045166,
0.08724816143512726,
0.6768351793289185,
-0.35237452387809753,
0.38584956526756287,... |
func (s *Scanner) scanString() Token {
line, offset := s.line, s.lineOffset
var buf bytes.Buffer
buf.WriteByte(s.read())
for {
if ch := s.read(); ch == eof {
break
// TODO: string across line is not supported ...
} else if isLetter(ch) {
buf.WriteByte(ch)
} else {
s.unread()
break
}
}
retur... | [
-0.17242884635925293,
-1.2787691354751587,
0.5303026437759399,
-0.490499883890152,
-1.048941969871521,
-0.31208088994026184,
-0.589691698551178,
0.5021398067474365,
-0.24044103920459747,
-0.8365890979766846,
0.659450113773346,
0.06481549888849258,
0.5651386380195618,
-0.6753374934196472,
... |
func (s *Scanner) scanNumber() Token {
line, offset := s.line, s.lineOffset
var buf bytes.Buffer
buf.WriteByte(s.read())
for {
if ch := s.read(); ch == eof {
break
} else if isNumber(ch) {
buf.WriteByte(ch)
} else {
s.unread()
break
}
}
return Token{tpe: NUMBER, val: buf.String(), line: line, ... | [
-0.39618515968322754,
-0.5805781483650208,
0.5375732183456421,
0.1264478862285614,
-1.4344611167907715,
-0.5505201816558838,
-0.4183882176876068,
0.7552576661109924,
0.3598051965236664,
-1.1993857622146606,
0.18467245995998383,
0.33067062497138977,
0.40163952112197876,
0.000504601513966918... |
func printResponseBody(res *http.Response) {
defer res.Body.Close()
responseBodyBytes, err := ioutil.ReadAll(res.Body)
if err != nil {
log.Fatal(err)
}
responseBody := string(responseBodyBytes)
fmt.Println(responseBody)
} | [
0.8618049025535583,
-1.2339458465576172,
0.6459903717041016,
-0.03525085374712944,
0.17169512808322906,
0.21556708216667175,
-0.268333375453949,
-1.0409362316131592,
1.3745163679122925,
-0.047002945095300674,
-0.2800699770450592,
-0.1155068427324295,
-0.5235186219215393,
0.3702799081802368... |
func SparseCollectionToInterface(elms []interface{}, indexes []int, size int) (interface{}, error) {
if len(elms) == 0 {
return nil, nil
}
first := elms[0]
var ok bool
switch v := first.(type) {
case bool:
arr := make([]bool, size)
for i, idx := range indexes {
e := elms[i]
if e == nil {
continu... | [
0.054226089268922806,
-0.41300252079963684,
0.9839439988136292,
-0.0663871169090271,
0.5404653549194336,
0.22644878923892975,
0.4514484703540802,
-0.20080384612083435,
0.463706374168396,
0.5683676600456238,
-0.11967310309410095,
0.5333267450332642,
-0.6781774759292603,
0.14036504924297333,... |
func (c *client) GetTKGDirectory() (string, error) {
if c.configDir == "" {
return "", errors.New("tkg config directory is empty")
}
return c.configDir, nil
} | [
-0.7442840933799744,
0.7277571558952332,
0.36673715710639954,
-0.17444151639938354,
0.14329645037651062,
-0.7653611898422241,
0.43648552894592285,
0.16099120676517487,
-0.5905499458312988,
0.20818409323692322,
-0.06320127099752426,
-0.23410260677337646,
-0.2704393267631531,
1.2675632238388... |
func (c *client) GetTKGProvidersDirectory() (string, error) {
tkgDir, err := c.GetTKGDirectory()
if err != nil {
return "", err
}
return filepath.Join(tkgDir, constants.LocalProvidersFolderName), nil
} | [
-0.3196529150009155,
-0.33331093192100525,
0.5181434154510498,
-0.7081841230392456,
0.31245851516723633,
-0.5414025783538818,
-0.09605028480291367,
0.4629416763782501,
-0.1366007775068283,
0.9884571433067322,
0.4346456825733185,
0.1851591020822525,
-0.645564079284668,
0.5403355956077576,
... |
func (c *client) GetTKGBoMDirectory() (string, error) {
tkgDir, err := c.GetTKGDirectory()
if err != nil {
return "", err
}
return filepath.Join(tkgDir, constants.LocalBOMsFolderName), nil
} | [
0.4047035574913025,
0.06728382408618927,
0.724649965763092,
0.02881552092730999,
0.8560596108436584,
-0.28401684761047363,
0.6915309429168701,
0.1213478073477745,
-0.5596286058425903,
0.14273136854171753,
-0.3252667188644409,
0.29141926765441895,
-0.42588165402412415,
0.7297478914260864,
... |
func (c *client) GetTKGCompatibilityDirectory() (string, error) {
tkgDir, err := c.GetTKGDirectory()
if err != nil {
return "", err
}
return filepath.Join(tkgDir, constants.LocalCompatibilityFolderName), nil
} | [
0.2595598101615906,
-0.21851304173469543,
0.5538344979286194,
-0.418788880109787,
-0.18457794189453125,
-0.23690389096736908,
0.547932505607605,
0.8438276648521423,
-0.6552280783653259,
0.3399713337421417,
0.3114517331123352,
-0.7236985564231873,
-0.22049105167388916,
1.027292013168335,
... |
func (c *client) GetTKGConfigDirectories() (string, string, string, error) {
tkgDir, err := c.GetTKGDirectory()
if err != nil {
return "", "", "", err
}
bomDir := filepath.Join(tkgDir, constants.LocalBOMsFolderName)
providerDir := filepath.Join(tkgDir, constants.LocalProvidersFolderName)
return tkgDir, bomDir, ... | [
-0.9802349209785461,
0.3290165960788727,
0.42510905861854553,
-0.42142951488494873,
0.20402076840400696,
-0.38140788674354553,
0.8468532562255859,
0.35991981625556946,
-1.1404306888580322,
0.8878353834152222,
-1.0070717334747314,
-0.6242231726646423,
-0.32154861092567444,
0.484534949064254... |
func (c *client) GetProvidersConfigFilePath() (string, error) {
providersDir, err := c.GetTKGProvidersDirectory()
if err != nil {
return "", err
}
return filepath.Join(providersDir, constants.LocalProvidersConfigFileName), nil
} | [
-0.09644047915935516,
-0.1530829668045044,
0.19377700984477997,
-0.553332507610321,
0.16940508782863617,
0.1473257690668106,
0.28999215364456177,
0.4249822497367859,
-1.1161555051803589,
1.4841159582138062,
-0.06350361555814743,
-0.2086227685213089,
-0.7250991463661194,
0.5531837344169617,... |
func (c *client) GetTKGCompatibilityConfigPath() (string, error) {
compatibilityDir, err := c.GetTKGCompatibilityDirectory()
if err != nil {
return "", err
}
return filepath.Join(compatibilityDir, constants.TKGCompatibilityFileName), nil
} | [
0.13355989754199982,
0.03428696095943451,
0.19082877039909363,
-0.25938183069229126,
-0.7398805022239685,
0.8679664134979248,
0.5465989112854004,
0.7118655443191528,
-1.38456130027771,
1.221068024635315,
0.0326397679746151,
-1.3450475931167603,
-0.6796041131019592,
0.6633772253990173,
0.... |
func (c *client) GetTKGConfigPath() (string, error) {
tkgDir, err := c.GetTKGDirectory()
if err != nil {
return "", err
}
return filepath.Join(tkgDir, constants.TKGConfigFileName), nil
} | [
-0.41691160202026367,
0.7109578251838684,
0.1924605667591095,
-0.36834535002708435,
-0.38472384214401245,
0.3988834023475647,
0.5235604047775269,
0.13650652766227722,
-1.5108379125595093,
1.511036992073059,
-0.41639840602874756,
-0.7499594688415527,
-0.634984016418457,
0.6789001226425171,
... |
func (c *client) GetDefaultClusterConfigPath() (string, error) {
tkgDir, err := c.GetTKGDirectory()
if err != nil {
return "", err
}
return filepath.Join(tkgDir, constants.TKGDefaultClusterConfigFileName), nil
} | [
-0.2543087899684906,
0.6563277840614319,
0.3076992630958557,
0.3745746314525604,
0.656253457069397,
0.7226097583770752,
0.9309327006340027,
0.14251524209976196,
-0.8051972985267639,
0.8321349024772644,
-0.16996753215789795,
-0.20418080687522888,
-1.0064691305160522,
0.5644155740737915,
0... |
func GetOverridesDirectory() string {
homeDir, err := os.UserHomeDir()
if err != nil {
return constants.OverrideFolder
}
return filepath.Join(homeDir, constants.OverrideFolder)
} | [
0.5605417490005493,
0.07319200783967972,
0.6401346325874329,
-0.20753933489322662,
0.5140595436096191,
-0.32549434900283813,
0.7552867531776428,
-0.6458364725112915,
0.02401605248451233,
-1.3084255456924438,
0.19242073595523834,
1.0001462697982788,
-0.5450212359428406,
0.3960426449775696,
... |
func GetRegistryCertFile() (string, error) {
home, err := os.UserHomeDir()
if err != nil {
return "", errors.Wrap(err, "could not locate user home dir")
}
return path.Join(home, constants.TKGRegistryCertFile), nil
} | [
0.9533788561820984,
0.4679560661315918,
0.361648827791214,
0.11905825883150101,
0.027448050677776337,
0.41216322779655457,
1.8149031400680542,
0.4803093373775482,
-1.0148566961288452,
0.2744801640510559,
-0.21233181655406952,
0.11226073652505875,
-0.3255368769168854,
0.3551815450191498,
... |
func GetRegistryTrustedCACertFileForWindows() (string, error) {
home, err := os.UserHomeDir()
if err != nil {
return "", errors.Wrap(err, "could not locate user home dir")
}
return path.Join(home, constants.TKGRegistryTrustedRootCAFileForWindows), nil
} | [
1.1594007015228271,
0.24631641805171967,
0.20967230200767517,
0.31161677837371826,
-0.4294084310531616,
0.24087831377983093,
1.8146651983261108,
0.05481953173875809,
-0.4139835238456726,
0.01706787943840027,
-0.35845959186553955,
0.6658965349197388,
-0.2877102792263031,
0.1173664778470993,... |
func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
if !handler.authorizeEndpointManagement {
return &httperror.HandlerError{http.StatusServiceUnavailable, "Endpoint management is disabled", ErrEndpointManagementDisabled}
}
endpointID, err := request.RetrieveNu... | [
-1.1201587915420532,
-0.6637114882469177,
0.7186105251312256,
0.10335684567689896,
-0.12189054489135742,
0.38862547278404236,
-0.5549907088279724,
0.5356330871582031,
0.04862847551703453,
1.0255820751190186,
0.2931228578090668,
-0.3698138892650604,
-0.6037669777870178,
-0.19406218826770782... |
func (d *Datagram) Version() int {
return int(d.Data[0] >> 4)
} | [
-0.6567828059196472,
0.5090451240539551,
0.31996405124664307,
-0.5175055861473083,
-0.09465079009532928,
-0.22910256683826447,
0.6881343722343445,
-0.08735018968582153,
0.3104703724384308,
-0.21673175692558289,
-1.4877129793167114,
0.04879238083958626,
-0.21868552267551422,
0.0709213614463... |
func (d *Datagram) HeaderLength() int {
// Multiplied by 4 because field unit is words
return int(d.Data[0]&0x0f) * 4
} | [
0.11523320525884628,
0.5726262927055359,
0.26474371552467346,
-0.6942181587219238,
-0.1771499067544937,
0.5524219274520874,
-0.1271076500415802,
0.10812900960445404,
0.9367237091064453,
-0.15605668723583221,
-0.4497031569480896,
-0.027734871953725815,
-1.2493711709976196,
0.032702013850212... |
func (d *Datagram) TotalLength() int {
return BytesToIntForEndianness16(d.Data[2:4], binary.BigEndian)
} | [
0.9386613368988037,
0.7347562909126282,
0.4498131275177002,
-0.8216472864151001,
0.8814955353736877,
0.030008286237716675,
0.7020881772041321,
0.3118361234664917,
1.117710828781128,
0.10202890634536743,
-0.9568399786949158,
-0.14497873187065125,
-0.6814042925834656,
-0.7095577120780945,
... |
func (d *Datagram) PayloadLength() int {
return d.TotalLength() - d.HeaderLength()
} | [
0.6528055667877197,
0.8691924810409546,
0.6586039066314697,
-1.3164538145065308,
-0.6962926387786865,
0.7023416757583618,
0.1512918621301651,
-0.7269231081008911,
0.6924194097518921,
0.10682410001754761,
-0.36881202459335327,
0.16999921202659607,
-0.3277672231197357,
0.1615716516971588,
... |
func (d *Datagram) Protocol() string {
protocolHeaderNumber := BytesToIntForEndianness(d.Data[9:10], binary.BigEndian)
return ProtocolMap[protocolHeaderNumber]
} | [
-0.3084513545036316,
0.6379308104515076,
0.2782794237136841,
-0.9280997514724731,
-0.3378135561943054,
0.03522694110870361,
-0.09904734045267105,
-0.5298478007316589,
0.9353917241096497,
0.3405047059059143,
0.23883572220802307,
-0.3191366493701935,
-0.577907919883728,
-1.0727711915969849,
... |
func (d *Datagram) SourceIP() string {
return BytesToIPAddress(d.Data[12:16])
} | [
0.1277034431695938,
0.444088339805603,
0.406156986951828,
-0.6183757781982422,
-0.6216752529144287,
-0.03377881646156311,
-0.00010237842798233032,
-0.12140613794326782,
1.80109441280365,
0.4155820310115814,
-0.23057183623313904,
-0.5338925123214722,
-0.07607631385326385,
-1.577957868576049... |
func (d *Datagram) DestinationIP() string {
return BytesToIPAddress(d.Data[16:20])
} | [
0.11083623766899109,
0.27861350774765015,
0.42785975337028503,
-0.3225312829017639,
-0.4803597033023834,
0.02262776717543602,
-0.2704242169857025,
0.06866195797920227,
0.9942892789840698,
0.7895365357398987,
0.02826499007642269,
-0.7487634420394897,
0.308587908744812,
-1.734946608543396,
... |
func (d *Datagram) Payload() TCPSegment {
data := d.Data[d.HeaderLength():d.TotalLength()]
// TODO: use Protocol() to return different structs based on Protocol
// this will require us to modify the return type as well
return TCPSegment{Data: data, ContainingDatagram: d}
} | [
-0.13222405314445496,
0.16154810786247253,
0.342241108417511,
-1.3297358751296997,
-0.7898586988449097,
-0.12360993027687073,
-0.16883036494255066,
-0.5143053531646729,
1.2000527381896973,
-0.33177652955055237,
-0.06911426037549973,
-0.5748222470283508,
-0.46571576595306396,
-0.19338706135... |
func BytesToIPAddress(bytes []byte) string {
address := ""
for _, b := range bytes {
if len(address) > 0 {
address += ":"
}
address += strconv.Itoa(int(b))
}
return address
} | [
-0.9106623530387878,
-1.4810805320739746,
0.6225447654724121,
-1.6262928247451782,
0.41245323419570923,
0.14318214356899261,
-0.5009885430335999,
0.789839506149292,
0.7365728616714478,
1.4552098512649536,
-0.8589702844619751,
0.5725724697113037,
-0.3234390318393707,
-0.8056766390800476,
... |
func (col ItemCollection) Match(text string) *Item {
var foundItem *Item
var foundStrength = 0
for _, itm := range col {
if str := itm.Match(text); str > foundStrength {
foundItem = itm
}
}
return foundItem
} | [
0.04647887870669365,
-0.01756555587053299,
0.3963192403316498,
0.5133933424949646,
-0.4089365005493164,
0.398632675409317,
-0.07175080478191376,
-0.20624272525310516,
-1.1039270162582397,
-0.0636398047208786,
-0.5971667766571045,
-0.6069017052650452,
-0.9686532020568848,
-0.373244583606719... |
func New(memoryLayout *device.MemoryLayout, dependent *Builder) *Builder {
ptrAlignment := uint64(memoryLayout.GetPointer().GetAlignment())
var dependentMemory uint64
mappedMemory := MappedMemoryRangeList{}
remappings := make(map[interface{}]value.Pointer)
volatileSpace := uint64(0)
if dependent != nil {
depend... | [
0.954755425453186,
-0.36040544509887695,
0.3934146463871002,
-0.3635961711406708,
-1.2424511909484863,
0.018483707681298256,
0.5035272836685181,
-0.44274890422821045,
0.3451106548309326,
-0.416434109210968,
0.26143771409988403,
-0.04768091067671776,
0.029295967891812325,
0.5089221596717834... |
func (b *Builder) MemoryLayout() *device.MemoryLayout {
return b.memoryLayout
} | [
1.8860139846801758,
0.7878241539001465,
0.028021974489092827,
0.42655065655708313,
-0.7526174783706665,
0.32670238614082336,
0.5190640687942505,
0.11822846531867981,
1.1326563358306885,
-0.7609966397285461,
0.1861502230167389,
0.6232046484947205,
-1.1812342405319214,
0.294723242521286,
-... |
func (b *Builder) AllocateMemory(size uint64) value.Pointer {
return value.VolatilePointer(b.heap.alloc(size))
} | [
0.6465468406677246,
0.21798598766326904,
0.4292638897895813,
0.6337284445762634,
0.14507155120372772,
-0.36756542325019836,
-0.31043025851249695,
-1.0631102323532104,
1.1584064960479736,
-0.46638432145118713,
0.6940317749977112,
-0.25464650988578796,
-0.12970122694969177,
0.156691566109657... |
func (b *Builder) AllocateTemporaryMemory(size uint64) value.Pointer {
return value.TemporaryPointer(b.temp.alloc(size))
} | [
-0.11320121586322784,
-0.29149627685546875,
0.4241790771484375,
0.18391618132591248,
0.28279343247413635,
0.18809600174427032,
0.04425249621272087,
-0.9050659537315369,
1.0185819864273071,
-0.032993923872709274,
0.3426666259765625,
-0.18911811709403992,
-0.33717426657676697,
-0.07226807624... |
func (b *Builder) BeginCommand(cmdID, threadID uint64) {
if b.inCmd {
panic("BeginCommand called while already building a command")
}
b.inCmd = true
b.cmdStart = len(b.instructions)
cmdID &= 0x3ffffff // Labels have 26 bit values.
if b.lastLabel != cmdID {
b.instructions = append(b.instructions, asm.Label{Va... | [
-0.1799054741859436,
-0.4328184127807617,
0.37667641043663025,
-0.3320430517196655,
0.4550560414791107,
0.1740473061800003,
0.46355706453323364,
-0.17897239327430725,
1.153600811958313,
-0.7151423096656799,
0.5389854907989502,
0.9712495803833008,
-0.6601162552833557,
1.0089324712753296,
... |
func (b *Builder) CommitCommand(ctx context.Context, optimise bool) {
if !b.inCmd {
panic("CommitCommand called without a call to BeginCommand")
}
newInstructions := make([]asm.Instruction, 0)
b.lastLabel, b.pendingLabel = b.pendingLabel, 0
b.currentThreadID = b.pendingThreadID
b.inCmd = false
b.temp.reset(... | [
-0.518918514251709,
0.48078128695487976,
0.7926651835441589,
-0.051773231476545334,
0.27863630652427673,
-0.28427597880363464,
0.9066515564918518,
0.00865880586206913,
-0.06982479989528656,
0.3846231698989868,
0.06974370777606964,
-0.2980274558067322,
-1.0264852046966553,
0.350297540426254... |
func (b *Builder) RevertCommand(err error) {
if !b.inCmd {
panic("RevertCommand called without a call to BeginCommand")
}
b.pendingLabel = 0
b.pendingThreadID = b.currentThreadID
b.inCmd = false
// TODO: Revert calls to: AllocateMemory, Buffer, String, ReserveMemory, MapMemory, UnmapMemory, Write.
b.temp.reset... | [
0.35839590430259705,
0.03656379133462906,
0.6350898742675781,
-0.1433209329843521,
0.48541519045829773,
-0.27010273933410645,
0.8151071667671204,
0.4430684447288513,
0.38304585218429565,
-0.8987012505531311,
0.3444651663303375,
0.7333711981773376,
-0.9557675123214722,
0.5707100629806519,
... |
func (b *Builder) Buffer(count int) value.Pointer {
pointerSize := b.memoryLayout.GetPointer().GetSize()
dynamic := false
size := 0
// Examine the stack to see where these values came from
for i := 0; i < count; i++ {
e := b.stack[len(b.stack)-i-1]
op := b.instructions[e.idx]
ty := e.ty
if _, isPush := op... | [
0.038804296404123306,
0.4220463037490845,
0.6023461818695068,
0.03491177037358284,
-0.17537041008472443,
-0.28327399492263794,
0.9659299254417419,
0.06789949536323547,
0.22444966435432434,
-0.1034805029630661,
0.3835996687412262,
0.47429347038269043,
-0.6178046464920044,
-0.038725402206182... |
func (b *Builder) String(s string) value.Pointer {
return b.constantMemory.writeString(s)
} | [
0.8308234214782715,
-0.34199196100234985,
-0.012087968178093433,
-0.6615487337112427,
-0.33228448033332825,
0.3108924627304077,
1.5378875732421875,
-0.17852112650871277,
0.3506590723991394,
-0.6050423979759216,
-0.07878664880990982,
0.9251822829246521,
-0.6701309084892273,
-0.6475392580032... |
func (b *Builder) Call(f FunctionInfo) {
b.popStackMulti(f.Parameters)
push := f.ReturnType != protocol.Type_Void
if push {
b.pushStack(f.ReturnType)
}
b.instructions = append(b.instructions, asm.Call{
PushReturn: push,
ApiIndex: f.ApiIndex,
FunctionID: f.ID,
})
} | [
-0.617897093296051,
1.1265547275543213,
0.42433539032936096,
0.5602144002914429,
-0.29444533586502075,
0.5743154287338257,
-0.5954410433769226,
-0.034422583878040314,
-0.29805582761764526,
-0.004606496077030897,
0.24190010130405426,
-0.005316009279340506,
-0.8899899125099182,
0.78160822391... |
func (b *Builder) Copy(size uint64) {
b.popStackMulti(2)
b.instructions = append(b.instructions, asm.Copy{
Count: size,
})
} | [
-0.5994814038276672,
0.5830352902412415,
0.33258071541786194,
1.2495836019515991,
-0.8566253781318665,
0.45305997133255005,
0.9937781095504761,
-0.00598879624158144,
0.5874784588813782,
0.12220444530248642,
-0.8930165767669678,
-0.13293907046318054,
-0.7794595956802368,
0.6577608585357666,... |
func (b *Builder) Clone(index int) {
sidx := len(b.stack) - 1 - index
// Change ownership of the top stack value to the clone instruction.
b.stack[sidx].idx = len(b.instructions)
b.pushStack(b.stack[sidx].ty)
b.instructions = append(b.instructions, asm.Clone{
Index: index,
})
} | [
-0.5177283883094788,
0.8034986853599548,
0.5335460901260376,
0.8871399164199829,
-0.29889175295829773,
0.03407684713602066,
0.43567144870758057,
-0.6236888766288757,
0.5237041711807251,
0.1023113802075386,
-0.41565608978271484,
0.5922045111656189,
-0.45177894830703735,
-0.671142578125,
1... |
func (b *Builder) Load(ty protocol.Type, addr value.Pointer) {
if !addr.IsValid() {
panic(fmt.Errorf("Pointer address %v is not valid", addr))
}
b.pushStack(ty)
b.instructions = append(b.instructions, asm.Load{
DataType: ty,
Source: b.remap(addr),
})
} | [
-0.10600436478853226,
0.5754122734069824,
0.23200197517871857,
-0.5782409310340881,
-0.5932028889656067,
0.3107699453830719,
-0.07401531934738159,
0.28893882036209106,
0.3688638210296631,
0.1790873408317566,
-0.17909669876098633,
0.5284021496772766,
-0.7619674205780029,
0.21473684906959534... |
func (b *Builder) Store(addr value.Pointer) {
if !addr.IsValid() {
panic(fmt.Errorf("Pointer address %v is not valid", addr))
}
b.popStack()
b.instructions = append(b.instructions, asm.Store{
Destination: b.remap(addr),
})
} | [
-0.013563044369220734,
0.840572714805603,
0.2087385356426239,
0.21926143765449524,
-0.4364163875579834,
0.39840856194496155,
0.8149389028549194,
0.5643488764762878,
0.9772469997406006,
-0.32671451568603516,
-0.38404974341392517,
0.36554980278015137,
-0.6899319887161255,
0.8198768496513367,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.