text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (h Handler) GetAllComments(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
comments, err := h.Service.GetAllComments()
if err != nil {
sendErrorResponse(w, "Unable to find all comments", err)
}
if err := json.NewEnc... | [
-0.2928965985774994,
-0.9682948589324951,
0.9217193722724915,
0.511362612247467,
0.04359967261552811,
-0.4033333659172058,
-0.51238614320755,
-0.6503427624702454,
-0.034757938235998154,
0.06057741865515709,
-0.3691571354866028,
0.6875049471855164,
-0.42437979578971863,
1.0586096048355103,
... |
func (h Handler) DeleteComment(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
vars := mux.Vars(r)
id := vars["id"]
commentID, err := strconv.ParseInt(id, 10, 64)
if err != nil {
sendErrorResponse(w, "Failed to parse uint... | [
-0.3606930375099182,
-0.8820650577545166,
0.6653429865837097,
-0.02941916137933731,
0.7467899322509766,
-0.5689829587936401,
0.6601144075393677,
-0.3579713702201843,
0.3976733088493347,
0.3872186839580536,
-0.3536585867404938,
0.13281802833080292,
-0.017871791496872902,
0.9560529589653015,... |
func Service(obj *interface{}, vt *interface{}, interfaceID *GUID) (*ServerObject, error) {
rv := reflect.ValueOf(obj).Elem()
if rv.Type().Kind() == reflect.Struct {
service := &ServerObject{}
service.VirtualTable = vt
service.Interface = obj
service.InterfaceID = interfaceID
return service, nil
}
return... | [
-0.4620349109172821,
-0.4643242061138153,
0.3217967748641968,
0.32538166642189026,
-0.46013373136520386,
0.6875008940696716,
0.6922187209129333,
-0.9659919738769531,
0.27602827548980713,
0.41374674439430237,
-0.8122648596763611,
1.1315585374832153,
-0.9233424663543701,
0.49218422174453735,... |
func checkMagConnection() bool {
setSetting(0x25, 0x0C|0x80)
setSetting(0x26, 0x00)
setSetting(0x27, 0x81) // Read one byte.
time.Sleep(100 * time.Microsecond)
r, err := i2cbus.ReadByteFromReg(0x68, 0x49)
chkErr(err)
ret := r == 0x48
// Read calibration data.
setSetting(0x25, 0x0C|0x80)
setSetting(0x26, 0... | [
-0.5975340008735657,
-0.20970548689365387,
0.7772111296653748,
-0.18978314101696014,
-0.5882192254066467,
-0.0021641207858920097,
-0.26245179772377014,
-0.49479055404663086,
0.23321276903152466,
0.3091590702533722,
0.06220163777470589,
-0.09411665797233582,
-1.1851661205291748,
0.074046954... |
func (ob *AESCipher) ValidateKey(key []byte) error {
if len(key) != 32 {
return logError(0xE42FDB,
"AES-256 key must be 32, but it is", len(key), "bytes long")
}
return nil
} | [
-0.48031172156333923,
0.8155544996261597,
0.581258237361908,
0.23731380701065063,
0.03308327496051788,
0.43828466534614563,
-0.2544151544570923,
-0.7500073313713074,
1.1272203922271729,
0.7471296787261963,
-0.5501164197921753,
-0.44683191180229187,
0.08128135651350021,
0.9559203386306763,
... |
func (ob *AESCipher) InitCipher(key []byte) error {
if len(key) != 32 {
return logError(0xE32BD3, errKeySize)
}
cphr, err := aes.NewCipher(key)
if err != nil {
return err
}
ob.gcm, err = cipher.NewGCM(cphr)
if err != nil {
return err
}
ob.cryptoKey = key
return nil
} | [
-0.11868181079626083,
0.8200011849403381,
0.6077451109886169,
-0.108230821788311,
0.2549537718296051,
0.21555934846401215,
-0.26223909854888916,
-0.3421785533428192,
0.41293400526046753,
0.8388251662254333,
-1.0381052494049072,
0.3021150827407837,
-0.4135177731513977,
1.808599829673767,
... |
func (ob *AESCipher) Encrypt(plaintext []byte) (ciphertext []byte, err error) {
if len(ob.cryptoKey) != 32 {
return nil, logError(0xE64A2E, errKeySize)
}
// nonce is a byte array filled with cryptographically secure random bytes
n := ob.gcm.NonceSize()
nonce := make([]byte, n)
_, err = io.ReadFull(rand.Reader, ... | [
-0.09984137862920761,
1.3874905109405518,
0.6949395537376404,
-0.5763466954231262,
-0.5222423672676086,
0.7050852179527283,
0.37291350960731506,
-1.4012669324874878,
0.7781632542610168,
0.48690563440322876,
-0.09973273426294327,
0.22897304594516754,
-1.126510500907898,
0.40015357732772827,... |
func (ob *AESCipher) Decrypt(ciphertext []byte) (plaintext []byte, err error) {
if len(ob.cryptoKey) != 32 {
return nil, logError(0xE35A87, errKeySize)
}
n := ob.gcm.NonceSize()
if len(ciphertext) < n {
return nil, err
}
nonce := ciphertext[:n]
ciphertext = ciphertext[n:]
plaintext, err = ob.gcm.Open(
nil... | [
0.050428103655576706,
1.6465944051742554,
0.6117948293685913,
-0.4120520055294037,
-0.8967235088348389,
0.6015427112579346,
1.1707379817962646,
-0.8709597587585449,
0.8762103915214539,
0.4143741726875305,
-0.15033367276191711,
-0.20541536808013916,
-1.0208823680877686,
0.3271810710430145,
... |
func WebStartUp() {
http.HandleFunc("/", servePage)
http.ListenAndServe(":8080", nil)
} | [
-0.3983849287033081,
-0.6700758934020996,
0.49556633830070496,
0.5094503164291382,
0.8851577639579773,
0.24728770554065704,
0.8146081566810608,
0.7040164470672607,
-0.3112637400627136,
-0.11985688656568527,
0.006775252521038055,
0.44544151425361633,
0.31758907437324524,
-0.2557333111763000... |
func (o *ApplyUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewApplyUpdateOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 4... | [
0.037798356264829636,
-1.3673243522644043,
0.8907884359359741,
0.4838847517967224,
-0.4762340188026428,
-1.027155876159668,
-0.22983688116073608,
0.2365264743566513,
0.8045752048492432,
0.31230592727661133,
0.6473537087440491,
-0.36903417110443115,
-1.054723858833313,
0.2602810263633728,
... |
func NewApplyUpdateOK() *ApplyUpdateOK {
return &ApplyUpdateOK{}
} | [
-0.26424792408943176,
-0.9872991442680359,
0.5266720652580261,
1.0935046672821045,
-1.4046285152435303,
0.12822318077087402,
-0.16170631349086761,
1.4264211654663086,
0.4245602786540985,
0.4852336049079895,
0.2134554088115692,
-1.1667762994766235,
0.4930124282836914,
1.488079309463501,
-... |
func NewApplyUpdateUnauthorized() *ApplyUpdateUnauthorized {
return &ApplyUpdateUnauthorized{}
} | [
-0.8465768694877625,
-0.6172579526901245,
0.5970481634140015,
0.7885150909423828,
-1.15803062915802,
-0.4861181080341339,
-0.9052596688270569,
1.6874223947525024,
0.7656244039535522,
-0.7188865542411804,
0.05900121480226517,
0.8246665596961975,
-0.14156153798103333,
0.40998902916908264,
... |
func NewApplyUpdateForbidden() *ApplyUpdateForbidden {
return &ApplyUpdateForbidden{}
} | [
0.536328136920929,
-0.30577942728996277,
0.43826717138290405,
1.2823857069015503,
-1.413418173789978,
0.3569575846195221,
-0.5328141450881958,
0.2784079611301422,
0.5275682210922241,
-0.18015067279338837,
0.053292594850063324,
0.3979492783546448,
-0.48940157890319824,
0.16172625124454498,
... |
func NewApplyUpdateNotFound() *ApplyUpdateNotFound {
return &ApplyUpdateNotFound{}
} | [
0.21428243815898895,
-1.679869532585144,
0.1922241598367691,
0.44021347165107727,
-0.669718861579895,
0.5824095010757446,
-0.3264031708240509,
0.9986557960510254,
1.0713728666305542,
-0.30920520424842834,
0.15525273978710175,
-0.004528345540165901,
-0.25908854603767395,
0.9875720739364624,... |
func Load() *Config {
if savedConfig != nil {
return savedConfig
}
if os.Getenv(envUseEnvConfig) == "true" {
log.Println("Info: [config] Load from env")
savedConfig = loadFromEnv()
} else {
path := os.Getenv(envConfigPath)
if len(path) == 0 {
path = defaultConfigPath
}
log.Println("Info: [config] ... | [
-0.35807499289512634,
-0.1022309884428978,
0.6806041598320007,
0.03331382945179939,
-0.2339823991060257,
0.3632109761238098,
-0.28618165850639343,
0.519097089767456,
-0.9154976606369019,
1.0663396120071411,
-0.4511539936065674,
-0.014039093628525734,
-0.8537645936012268,
0.1460358053445816... |
func (mp *MerkleProof) ToBytes() ([]byte, error) {
index := bt.VarInt(mp.Index)
txOrID, err := hex.DecodeString(mp.TxOrID)
if err != nil {
return nil, err
}
txOrID = bt.ReverseBytes(txOrID)
target, err := hex.DecodeString(mp.Target)
if err != nil {
return nil, err
}
target = bt.ReverseBytes(... | [
-0.6581929326057434,
0.26213687658309937,
0.9339462518692017,
-0.6158146858215332,
0.062450625002384186,
-0.41351446509361267,
-0.2756985127925873,
-0.3116178512573242,
0.09098351001739502,
1.2334574460983276,
-0.5698776841163635,
0.8349170088768005,
-0.669818639755249,
0.16595810651779175... |
func NewQueue() *QueueSlice {
return &QueueSlice{}
} | [
-0.4311133325099945,
-0.948438823223114,
0.1851961761713028,
1.206821322441101,
-0.43121224641799927,
-0.6738855242729187,
-0.5425447225570679,
-0.8205022811889648,
-0.2643536329269409,
-0.4364422857761383,
0.30972394347190857,
1.0299323797225952,
-0.13641254603862762,
0.43215450644493103,... |
func (queueslice *QueueSlice) Enqueue(item int) {
queueslice.Q = append(queueslice.Q, item)
} | [
-0.38918372988700867,
-0.1843368113040924,
0.36014747619628906,
0.0683416947722435,
0.52138751745224,
0.40773388743400574,
-0.8198289275169373,
-0.4732121229171753,
0.409500390291214,
0.26432859897613525,
-0.5909425020217896,
1.043684720993042,
-0.058125775307416916,
0.5962058305740356,
... |
func (queueslice *QueueSlice) Dequeue() int {
length := len(queueslice.Q)
if length == 0 {
fmt.Println("Q is empty, Can't dequeue.")
return -1
}
var firstItem int
firstItem, queueslice.Q = queueslice.Q[0], queueslice.Q[1:]
return firstItem
} | [
-0.6722525358200073,
-0.412541925907135,
0.7601190805435181,
-0.41467592120170593,
0.21251733601093292,
-0.7648663520812988,
-0.19838182628154755,
0.5720687508583069,
-0.47009992599487305,
-0.2039341777563095,
-0.2863389849662781,
0.5545554161071777,
-0.8054065108299255,
1.1954184770584106... |
func (queueslice *QueueSlice) QueueFront() int {
length := len(queueslice.Q)
if length == 0 {
fmt.Println("Q is empty")
return -1
}
return queueslice.Q[0]
} | [
-0.5430073142051697,
-0.5303139686584473,
0.4168221652507782,
-0.7909620404243469,
-0.10142745077610016,
-0.015315062366425991,
-0.43502581119537354,
-0.16214635968208313,
0.3323788642883301,
-0.46153607964515686,
0.020572567358613014,
1.4550120830535889,
-0.30250734090805054,
1.1705248355... |
func (queueslice *QueueSlice) QueueRear() int {
length := len(queueslice.Q)
if length == 0 {
fmt.Println("Q is empty")
return -1
}
return queueslice.Q[length-1]
} | [
-0.9543679356575012,
-0.6986708045005798,
0.8108041286468506,
-0.28997036814689636,
-0.4214145839214325,
-0.22569265961647034,
-0.47255828976631165,
-0.09221407771110535,
0.3827422559261322,
-0.42550721764564514,
0.7496632933616638,
0.9191835522651672,
-0.929219126701355,
0.607030093669891... |
func ErrNoRole() errors.TMError {
return errors.WithCode(errNoRole, unauthorized)
} | [
-0.730932891368866,
0.2552051246166229,
0.10430553555488586,
0.1454862654209137,
-0.2680756747722626,
-0.49421408772468567,
-0.4913492798805237,
-0.4996386766433716,
0.16704395413398743,
0.4983304738998413,
-0.3503560423851013,
0.45185187458992004,
-0.07870183140039444,
0.9788572788238525,... |
func (k Keeper) AllocateTokens(ctx sdk.Context, percentVotes sdk.Dec, proposer sdk.ConsAddress) {
logger := ctx.Logger()
// get the proposer of this block
proposerValidator := k.stakeKeeper.ValidatorByConsAddr(ctx, proposer)
if proposerValidator == nil {
panic(fmt.Sprintf("Can't find proposer %s in validator set... | [
0.5494821667671204,
-0.02455761469900608,
0.7657740712165833,
-0.22977867722511292,
0.4791533946990967,
-0.44003501534461975,
0.23334674537181854,
0.16518379747867584,
0.5587639808654785,
0.13278822600841522,
0.8565766215324402,
-0.19263988733291626,
-0.02801618166267872,
1.074873208999633... |
func (k Keeper) AllocateFeeTax(ctx sdk.Context, destAddr sdk.AccAddress, percent sdk.Dec, burn bool) {
logger := ctx.Logger()
//feePool := k.GetFeePool(ctx)
//communityPool := feePool.CommunityPool
//allocateCoins, _ := communityPool.MulDec(percent).TruncateDecimal()
//feePool.CommunityPool = communityPool.Sub(ty... | [
0.9878403544425964,
-0.2398824840784073,
0.8040796518325806,
-0.2113856077194214,
0.1444842517375946,
-0.25212129950523376,
0.8748995065689087,
-0.7839576005935669,
-0.15914541482925415,
-0.05926373973488808,
0.030774645507335663,
0.3399471342563629,
0.3947887122631073,
0.26905015110969543... |
func (pub PublicKey) Equal(x crypto.PublicKey) bool {
xx, ok := x.(PublicKey)
if !ok {
return false
}
return bytes.Equal(pub, xx)
} | [
0.1714031845331192,
0.8467721939086914,
-0.09284334629774094,
0.08729996532201767,
0.2449299693107605,
0.8870334625244141,
-0.7372739315032959,
-0.591282844543457,
-0.4591178894042969,
1.2139945030212402,
-1.557257056236267,
0.641864001750946,
-0.9728068709373474,
0.45379239320755005,
-0... |
func (v *ClassValue) Print(results *Results) string {
parts := make([]string, 0, len(v.Fields))
for n, f := range v.Fields {
value := strings.Replace(f.Print(results), "\n", "\n ", -1)
parts = append(parts, fmt.Sprintf(" %v: %v", n, value))
}
sort.Strings(parts)
return fmt.Sprintf("%v{\n%v\n}", v.Class.Name(... | [
-0.20618471503257751,
-0.45444026589393616,
0.6528968811035156,
-0.8359020352363586,
-0.49754536151885986,
0.3167397081851959,
-0.37106186151504517,
-1.1296436786651611,
-0.8079251050949097,
-0.25377142429351807,
0.454880952835083,
0.04453808069229126,
0.1554349809885025,
0.340051651000976... |
func (v *ClassValue) Type() semantic.Type {
return v.Class
} | [
-0.9033941030502319,
-0.3391820788383484,
0.037207815796136856,
0.5994886159896851,
0.6466624736785889,
0.40134525299072266,
1.013706088066101,
-0.7880743145942688,
1.0966362953186035,
-0.24044786393642426,
0.6075150966644287,
0.8492780327796936,
0.39376914501190186,
0.9036127924919128,
... |
func (v *ClassValue) Equivalent(o Value) bool {
if v == o {
return true
}
a, b := v, o.(*ClassValue)
for n, f := range a.Fields {
if !f.Equivalent(b.Fields[n]) {
return false
}
}
return true
} | [
-1.2499630451202393,
0.23009511828422546,
0.6173117756843567,
0.3974256217479706,
-0.0654350146651268,
0.059990156441926956,
0.7278032898902893,
0.017532100901007652,
-0.2207343727350235,
1.4252222776412964,
-1.5167527198791504,
-0.09694404900074005,
0.7231732606887817,
0.4246547520160675,... |
func (v *ClassValue) Equals(o Value) Possibility {
if v == o && v.Valid() {
return True
}
a, b := v, o.(*ClassValue)
result := True
for n, f := range a.Fields {
switch f.Equals(b.Fields[n]) {
case False:
return False
case Maybe:
result = Maybe
}
}
return result
} | [
-1.3498167991638184,
-0.5400000214576721,
0.45635393261909485,
0.5052165389060974,
0.21665866672992706,
-0.5469955205917358,
-0.1814386397600174,
-0.2902992069721222,
0.5146833062171936,
-0.3729839622974396,
-0.782684862613678,
-0.09465613961219788,
0.41679123044013977,
0.4192332625389099,... |
func (v *ClassValue) Valid() bool {
for _, f := range v.Fields {
if !f.Valid() {
return false
}
}
return true
} | [
-1.0271292924880981,
-0.3562338650226593,
0.5847837924957275,
0.45897597074508667,
-0.2256685197353363,
0.881287693977356,
0.2537441849708557,
0.44629546999931335,
-1.1434199810028076,
-0.4506688714027405,
-0.3085886240005493,
-0.8465871810913086,
-0.06039409711956978,
0.2602616548538208,
... |
func (v *ClassValue) Difference(o Value) Value {
a, b := v, o.(*ClassValue)
out := &ClassValue{Class: v.Class, Fields: make(map[string]Value, len(v.Fields))}
for n, f := range a.Fields {
out.Fields[n] = f.Difference(b.Fields[n])
}
return out
} | [
-1.129269003868103,
0.045943763107061386,
0.5314879417419434,
0.663618266582489,
-0.1816210001707077,
0.5542562007904053,
0.5484533905982971,
-0.25996968150138855,
0.41343194246292114,
-0.4476792812347412,
-0.8526136875152588,
0.04566824063658714,
1.2530549764633179,
0.20083725452423096,
... |
func (v *ClassValue) Clone() Value {
out := &ClassValue{Class: v.Class, Fields: make(map[string]Value, len(v.Fields))}
for n, f := range v.Fields {
out.Fields[n] = f
}
return out
} | [
-0.46490535140037537,
-0.31136354804039,
0.4570903480052948,
0.16332270205020905,
-1.0707621574401855,
0.3565080165863037,
-0.5131858587265015,
-0.39290571212768555,
-0.27545812726020813,
-0.018170591443777084,
-0.5788305401802063,
0.3778265714645386,
0.602777898311615,
-0.6314116716384888... |
func (v *ClassValue) field(s *scope, name string) Value {
field, ok := v.Fields[name]
if !ok {
panic(fmt.Errorf("ClassValue %v did not contain field %v", v.Type().Name(), name))
}
return field
} | [
-0.16994425654411316,
-0.2843901216983795,
0.1836937814950943,
-0.4103560149669647,
-0.32040080428123474,
0.3589082658290863,
-0.39936545491218567,
-0.9852868318557739,
0.6699930429458618,
0.3785136640071869,
0.3219023048877716,
0.7222834825515747,
0.40010011196136475,
0.09212995320558548,... |
func (v *ClassValue) setField(s *scope, name string, val Value) Value {
out := v.Clone().(*ClassValue)
out.Fields[name] = val
return out
} | [
-1.0416275262832642,
0.2665284276008606,
0.2278813272714615,
-0.2760747969150543,
-0.7239336371421814,
0.752770721912384,
-0.2490622103214264,
-0.7063812017440796,
0.6086716055870056,
0.22180064022541046,
-0.526089608669281,
0.8328847885131836,
0.7576975226402283,
-0.18372686207294464,
0... |
func (fn GetEditQuestionsFromTagHandlerFunc) Handle(params GetEditQuestionsFromTagParams, principal *models.User) middleware.Responder {
return fn(params, principal)
} | [
0.28743889927864075,
-0.6345369815826416,
0.41305240988731384,
0.4115521013736725,
-0.29862862825393677,
0.8196030259132385,
0.7064105868339539,
-0.7631315588951111,
-0.2309107482433319,
-0.6834379434585571,
0.45454010367393494,
-0.3175613284111023,
-0.3399949371814728,
-0.1630339026451110... |
func NewGetEditQuestionsFromTag(ctx *middleware.Context, handler GetEditQuestionsFromTagHandler) *GetEditQuestionsFromTag {
return &GetEditQuestionsFromTag{Context: ctx, Handler: handler}
} | [
0.47834041714668274,
-1.3179175853729248,
0.22341792285442352,
0.15251769125461578,
-0.2741573750972748,
0.6208866834640503,
0.35711804032325745,
-0.8515814542770386,
-0.004998515825718641,
-0.10228150337934494,
-0.13550765812397003,
-0.09917491674423218,
-0.04928238317370415,
0.7041518688... |
func (*CampaignCriterionOperation) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*CampaignCriterionOperation_Create)(nil),
(*CampaignCriterionOperation_Update)(nil),
(*CampaignCriterionOperation_Remove)(nil),
}
} | [
-0.6034823060035706,
0.1550426483154297,
0.5777112245559692,
0.5006729364395142,
0.14667929708957672,
-0.39159077405929565,
0.5700835585594177,
0.04200597479939461,
0.6464037299156189,
0.3505355417728424,
0.4254128634929657,
0.1246068924665451,
0.04921431466937065,
0.23524236679077148,
0... |
func (*User) Descriptor() ([]byte, []int) {
return file_proto_service_proto_rawDescGZIP(), []int{0}
} | [
-0.9896248579025269,
0.2379538118839264,
0.49766963720321655,
0.4971045255661011,
-0.6946604251861572,
0.00934925302863121,
0.7499802708625793,
0.07894618064165115,
-0.3486638069152832,
-1.0098551511764526,
-0.934335470199585,
0.26215657591819763,
0.16965916752815247,
1.0642526149749756,
... |
func (*Message) Descriptor() ([]byte, []int) {
return file_proto_service_proto_rawDescGZIP(), []int{1}
} | [
-0.9884734749794006,
1.1697496175765991,
0.5503793954849243,
0.2302570343017578,
-0.29795071482658386,
-0.12362140417098999,
0.030665138736367226,
0.17776881158351898,
-0.6602923274040222,
-0.8924380540847778,
0.19564072787761688,
0.23668339848518372,
-0.2596342861652374,
1.310425281524658... |
func (*Response) Descriptor() ([]byte, []int) {
return file_proto_service_proto_rawDescGZIP(), []int{2}
} | [
-0.5041229724884033,
0.4312629699707031,
0.329857736825943,
0.3813075125217438,
-0.188888818025589,
-0.15216851234436035,
0.8846540451049805,
0.05453560873866081,
0.29516589641571045,
-1.0913434028625488,
-1.0222954750061035,
-0.28856247663497925,
0.04997146874666214,
0.30119532346725464,
... |
func GetPerfValues(ctx context.Context, tconn *chrome.TestConn, a *arc.ARC) (map[string]time.Duration, error) {
const (
logcatTimeout = 30 * time.Second
// logcatLastEventTag is the last event tag to be processed.
// The test should read logcat until this tag appears.
logcatLastEventTag = "boot_progress_enabl... | [
0.39971527457237244,
0.5800477862358093,
0.6536962389945984,
0.5057990550994873,
0.3899354934692383,
-0.8508568406105042,
0.6928276419639587,
-0.19006267189979553,
-0.133170023560524,
0.2858586013317108,
0.16219118237495422,
0.3339240550994873,
-0.11878865212202072,
0.9451871514320374,
0... |
func clockDelta(ctx context.Context) (time.Duration, error) {
// /proc/timer_list contains a line which says "now at %Ld nsecs".
// This clock value comes from CLOCK_MONOTONIC (see the kernel's kernel/time/timer_list.c).
parse := func(output string) (int64, error) {
for _, line := range strings.Split(output, "\n")... | [
0.29173406958580017,
0.3624833822250366,
0.7404826283454895,
0.23746399581432343,
0.4780968427658081,
-0.28707462549209595,
0.6875864267349243,
-0.3600721061229706,
-0.577484667301178,
0.4674258530139923,
-0.23399125039577484,
1.1691739559173584,
0.44698354601860046,
0.6291269659996033,
... |
func OpenFile(path string, pkgName string) (*jen.File, error) {
path = Path(path)
f, ok := fileMap[path]
if ok {
return f, nil
}
if len(pkgName) == 0 {
log.Fatal("pkgName cannot be empty")
}
jenFile := jen.NewFile(pkgName)
fileMap[path] = jenFile
return jenFile, nil
} | [
-0.25103601813316345,
0.33933207392692566,
0.40737083554267883,
-0.12925411760807037,
-0.45659109950065613,
0.3122786283493042,
0.7273019552230835,
0.3304632604122162,
0.013781006447970867,
-0.8425752520561218,
0.8314759731292725,
-0.34868332743644714,
-0.13416871428489685,
-0.290039002895... |
func Path(path string) string {
path = filepath.Dir(path)
return path + "/zz_generated.thaterror.go"
} | [
0.24169856309890747,
-0.43855056166648865,
0.18789875507354736,
-0.18537412583827972,
-0.07789488881826401,
0.9957060813903809,
1.1427830457687378,
-0.4671429395675659,
0.12053070217370987,
0.003005225444212556,
0.36836162209510803,
0.377155065536499,
-0.049841150641441345,
-0.134405404329... |
func newUpdateParam4Update(req *http.Request) (*UpdateParam, error) {
param := &UpdateParam{}
err := xreq.BindURI(req, param)
return param, err
} | [
-1.560747742652893,
-1.0224604606628418,
0.5229182839393616,
0.6631888151168823,
-1.0662873983383179,
0.3632323741912842,
-0.5807439684867859,
-0.38219788670539856,
-0.8104815483093262,
0.3244733214378357,
-0.027304181829094887,
0.1565493792295456,
-0.8632198572158813,
0.49950510263442993,... |
func UpdateAction(req *http.Request) (interface{}, error) {
param, err := newUpdateParam4Update(req)
if err != nil {
return nil, err
}
return updateActionProcess(req, param)
} | [
-1.0894432067871094,
-1.7604111433029175,
0.5419661998748779,
0.5835617184638977,
-0.2278348058462143,
0.4401957392692566,
0.9406840801239014,
-0.13488805294036865,
0.7565903663635254,
1.1002681255340576,
-0.19013217091560364,
0.6919113993644714,
-0.38244619965553284,
0.7237145304679871,
... |
func (e Employee) displaySalary(){
fmt.Printf("Salary of %s is %s%d", e.name, e.currency, e.salary)
} | [
0.7619670629501343,
-0.523563802242279,
0.7135078310966492,
-0.007322897668927908,
-0.871044933795929,
0.5575286746025085,
-0.2103700190782547,
0.24398699402809143,
0.007476209197193384,
0.6503364443778992,
0.03320135548710823,
0.7725962400436401,
0.050737764686346054,
0.47381502389907837,... |
func (e Employee) changeName(newName string) {
e.name = newName
} | [
-0.589607834815979,
-0.6651366353034973,
0.27501505613327026,
-0.36720627546310425,
-0.18025201559066772,
0.49362891912460327,
-0.3112713694572449,
1.249476671218872,
-0.18389886617660522,
1.5747321844100952,
-0.8689479827880859,
0.5399117469787598,
-0.15768206119537354,
0.8183755278587341... |
func (e *Employee) changeAge(newAge int) {
e.salary = newAge
} | [
-0.8274669647216797,
-0.05976051837205887,
0.7078637480735779,
-0.3108121454715729,
-0.6549898982048035,
0.9825488328933716,
-0.47347182035446167,
0.8679307103157043,
-0.32889968156814575,
1.2088186740875244,
-0.33922088146209717,
0.7881410717964172,
0.01702585071325302,
1.5844645500183105... |
func NewP2P() *P2P {
// Setup a background context
ctx := context.Background()
// Setup a P2P Host Node
nodehost, kaddht := setupHost(ctx)
// Debug log
logrus.Debugln("Created the P2P Host and the Kademlia DHT.")
// Bootstrap the Kad DHT
bootstrapDHT(ctx, nodehost, kaddht)
// Debug log
logrus.Debugln("Boots... | [
0.2184717059135437,
-0.7693367600440979,
0.5445939898490906,
-0.0006318069063127041,
-1.026247501373291,
0.40460464358329773,
-0.6092692017555237,
-0.5017682313919067,
0.02452392689883709,
-0.2066582292318344,
0.49110129475593567,
-0.38811418414115906,
-0.38519078493118286,
0.6181532144546... |
func (p2p *P2P) Advertise(service string) {
// Advertise the availabilty of the service on this node
ttl, err := p2p.Discovery.Advertise(p2p.Ctx, service)
if err != nil {
logrus.WithFields(logrus.Fields{
"error": err.Error(),
}).Fatalln("Failed to Announce Service CID!")
}
// Debug log
logrus.Debugln("Adve... | [
-0.1487353891134262,
0.11305482685565948,
0.6350547075271606,
-0.2957949936389923,
0.2592442035675049,
0.1124684289097786,
-0.7588094472885132,
-0.07475754618644714,
-0.3177073299884796,
0.1340259164571762,
0.7872290015220642,
1.7182679176330566,
-0.8609980940818787,
0.9183249473571777,
... |
func setupHost(ctx context.Context) (host.Host, *dht.IpfsDHT) {
// Set up the host identity options
prvkey, _, err := crypto.GenerateKeyPairWithReader(crypto.RSA, 2048, rand.Reader)
identity := libp2p.Identity(prvkey)
// Handle any potential error
if err != nil {
logrus.WithFields(logrus.Fields{
"error": err.... | [
0.10349247604608536,
-0.49321773648262024,
0.7981869578361511,
-0.4949330985546112,
0.568768322467804,
0.2473042607307434,
-0.10881929099559784,
-0.06089369207620621,
-0.36843234300613403,
-0.46366921067237854,
0.1047363132238388,
-0.6649852991104126,
0.29491332173347473,
-0.31506928801536... |
func setupKadDHT(ctx context.Context, nodehost host.Host) *dht.IpfsDHT {
// Create DHT server mode option
dhtmode := dht.Mode(dht.ModeServer)
// Rertieve the list of boostrap peer addresses
bootstrappeers := dht.GetDefaultBootstrapPeerAddrInfos()
// Create the DHT bootstrap peers option
dhtpeers := dht.BootstrapP... | [
0.30822688341140747,
-0.17406165599822998,
0.5482385158538818,
-0.3589441478252411,
-0.3090114891529083,
0.4555273950099945,
-0.4868497848510742,
-0.2537404000759125,
-0.6457804441452026,
0.931459367275238,
0.3075864017009735,
0.22784379124641418,
-0.6141813397407532,
0.9825438261032104,
... |
func setupPubSub(ctx context.Context, nodehost host.Host, routingdiscovery *discovery.RoutingDiscovery) *pubsub.PubSub {
// Create a new PubSub service which uses a GossipSub router
pubsubhandler, err := pubsub.NewGossipSub(ctx, nodehost, pubsub.WithDiscovery(routingdiscovery))
// Handle any potential error
if err ... | [
0.7568366527557373,
0.27009251713752747,
0.6997230648994446,
-0.08334729820489883,
0.1816040426492691,
0.31614598631858826,
-0.10846392065286636,
0.2183302491903305,
0.16302186250686646,
-0.8408599495887756,
0.3774756193161011,
0.16055989265441895,
-0.6396175026893616,
0.28202810883522034,... |
func bootstrapDHT(ctx context.Context, nodehost host.Host, kaddht *dht.IpfsDHT) {
// Bootstrap the DHT to satisfy the IPFS Router interface
if err := kaddht.Bootstrap(ctx); err != nil {
logrus.WithFields(logrus.Fields{
"error": err.Error(),
}).Fatalln("Failed to Bootstrap the Kademlia!")
}
// Trace log
log... | [
-0.6503797173500061,
0.06976410746574402,
0.7720418572425842,
-0.5157327651977539,
0.36346516013145447,
-0.07199056446552277,
-0.16584548354148865,
0.1520715355873108,
-1.2473599910736084,
0.6388158202171326,
0.3285561800003052,
0.12985515594482422,
-0.11056200414896011,
0.555546760559082,... |
func outputPeerDiscovery(nodehost host.Host, peerchan <-chan peer.AddrInfo) int {
// Iterate over the peer channel
total := 0
for peer := range peerchan {
// Ignore if the discovered peer is the host itself
if peer.ID == nodehost.ID() {
continue
}
// Connect to the peer
//nodehost.Connect(context.Backg... | [
-0.8150076866149902,
-0.4560777246952057,
0.6069502830505371,
-1.238804817199707,
0.3161819577217102,
-0.8757832050323486,
-0.008376208133995533,
-0.28862032294273376,
-0.4365132451057434,
0.5601719617843628,
-0.5914242267608643,
0.5240544676780701,
-0.6405130624771118,
1.0779057741165161,... |
func generateCID(namestring string) cid.Cid {
// Hash the service content ID with SHA256
hash := sha256.Sum256([]byte(namestring))
// Append the hash with the hashing codec ID for SHA2-256 (0x12),
// the digest size (0x20) and the hash of the service content ID
finalhash := append([]byte{0x12, 0x20}, hash[:]...)
... | [
1.1083087921142578,
-1.1515291929244995,
0.644463837146759,
-0.3614087402820587,
-0.6882542371749878,
0.2700115740299225,
-0.3931584060192108,
0.4415161907672882,
0.5935900211334229,
-0.11502575874328613,
-0.49377623200416565,
-0.018914392217993736,
-1.009437918663025,
0.20633025467395782,... |
func GetENGChart() (req *http.Request, res *http.Response, v ENGChart, err error) {
var b ([]byte)
req, res, err = getRemoteFile(ENGChartURL)
if err != nil {
return
}
b, err = ioutil.ReadAll(res.Body)
if err != nil {
return
}
err = json.Unmarshal(b, &v)
return
} | [
-0.5542035102844238,
-0.05676678940653801,
0.7741038799285889,
-0.9842301607131958,
-0.35456639528274536,
0.35731858015060425,
-0.6623263955116272,
-0.6903883218765259,
-0.5082595944404602,
0.5623406171798706,
-0.3262875974178314,
0.6014158725738525,
-0.21507743000984192,
-0.44197356700897... |
func ReadENGChart(dir string, filename string) (v ENGChart, err error) {
err = readJSONFile(dir, filename, &v)
return v, err
} | [
-0.9423388838768005,
-0.1360933780670166,
0.45816487073898315,
-0.9751235842704773,
-0.9369551539421082,
0.3466946482658386,
-0.2609366178512573,
-0.6045066714286804,
-0.5218480825424194,
0.6540324687957764,
0.7890071868896484,
0.40582746267318726,
0.26460155844688416,
-0.6341790556907654,... |
func WriteENGChart(dir string, filename string, v *ENGChart) (fullpath string, err error) {
fullpath, err = writeJSONFile(dir, filename, v)
return
} | [
-1.2636536359786987,
-0.673227071762085,
0.46702200174331665,
-0.83916175365448,
0.24646976590156555,
0.5869287848472595,
0.6350952982902527,
-0.026787150651216507,
-0.18531090021133423,
0.33474022150039673,
-0.11637426167726517,
0.03223208338022232,
0.4099256992340088,
-0.0904797390103340... |
func EncryptJson(key []byte, data interface{}) ([]byte, error) {
plaintext, err := json.Marshal(data)
if err != nil {
return nil, err
}
return EncryptMessage(key, plaintext)
} | [
-0.690856397151947,
0.8860853314399719,
0.4902717173099518,
-0.24520288407802582,
-0.22616606950759888,
-0.43976643681526184,
-0.46851152181625366,
-0.9213581681251526,
0.32387351989746094,
1.3300899267196655,
-0.9474214911460876,
1.0981577634811401,
-1.0013277530670166,
0.8368926048278809... |
func DecryptJson(key []byte, ciphertext []byte, v interface{}) error {
plaintext, err := DecryptMessage(key, ciphertext)
if err != nil {
return err
}
return json.Unmarshal(plaintext, &v)
} | [
-0.7740448117256165,
0.30646681785583496,
0.5007640719413757,
-0.667702853679657,
-1.0027791261672974,
-0.6752033233642578,
0.11342421174049377,
-0.038732290267944336,
0.40075406432151794,
1.373167634010315,
-0.4095466136932373,
0.913213849067688,
-0.9947235584259033,
0.18244333565235138,
... |
func EncryptMessage(key []byte, plaintext []byte) ([]byte, error) {
block, err := aes.NewCipher(key[:])
if err != nil {
return nil, err
}
aead, err := cipher.NewGCM(block)
if err != nil {
return nil, err
}
nonce := make([]byte, aead.NonceSize())
_, err = io.ReadFull(ran... | [
-0.3825165629386902,
0.9625687003135681,
0.8115547895431519,
-0.5452122092247009,
0.5979689359664917,
0.46462514996528625,
-0.5175347328186035,
-0.8471400737762451,
0.7001286149024963,
1.2131574153900146,
0.2193078100681305,
-0.05829615890979767,
-1.7054948806762695,
0.890887975692749,
-... |
func DecryptMessage(key []byte, message []byte) ([]byte, error) {
// Key should be 32byte (256bit)
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
aead, err := cipher.NewGCM(block)
if err != nil {
return nil, err
}
nonceSize := aead.NonceSize()
if... | [
0.15296374261379242,
1.2794301509857178,
0.6910749077796936,
-0.2781599164009094,
-0.16699014604091644,
-0.14458362758159637,
0.33367517590522766,
-0.41947290301322937,
0.2805168926715851,
0.5082266330718994,
0.6437411308288574,
0.12593653798103333,
-1.5946416854858398,
0.4803539514541626,... |
func EncryptCatalog(catalog message.Catalog) ([]byte, []byte, error) {
var err error
catalogKey := make([]byte, 32)
_, err = rand.Read(catalogKey)
if err != nil {
return nil, nil, err
}
ciphertext, err := EncryptJson(catalogKey, catalog)
if err != nil {
return nil, nil, err... | [
-0.43365171551704407,
0.5215287804603577,
0.5113938450813293,
-0.606168270111084,
-0.8383908867835999,
0.269930899143219,
-0.5221091508865356,
-0.22786714136600494,
-0.5493605136871338,
1.1155407428741455,
-1.2969024181365967,
0.6082209348678589,
0.46564623713493347,
0.04693804308772087,
... |
func (d Disassembly) Equals(other Disassembly) bool {
return d.AddressU64 == other.AddressU64 &&
d.Address == other.Address &&
d.Opcode == other.Opcode &&
d.Mnemonic == other.Mnemonic &&
d.Operands == other.Operands
} | [
-0.8086194396018982,
-0.3156082034111023,
0.7287120223045349,
-0.47373828291893005,
-0.3290084898471832,
-0.33182546496391296,
-0.1331198513507843,
-0.27480199933052063,
0.9166212677955627,
-0.8227232098579407,
-0.9866501092910767,
0.5757386684417725,
0.3404791057109833,
0.0805728584527969... |
func NewDebugger(a Architecture, c DebuggerConfig) (*Debugger, error) {
var d Debugger
if err := d.init(a, c, false); err != nil {
return nil, err
}
return &d, nil
} | [
-0.23169323801994324,
0.347211092710495,
0.16811397671699524,
-0.011609704233705997,
-0.6977605223655701,
-0.2157515585422516,
0.06635329127311707,
0.2039862871170044,
0.41423937678337097,
-0.1640307903289795,
-0.8436124920845032,
-0.25697001814842224,
0.009335252456367016,
1.2403682470321... |
func (d *Debugger) Reset(keepMappings bool) error {
var err, firstError error
d.mu.Close()
// Reset to original configuration, but keep memory mappings
// This is intended to allow us to map regions as we discover they're
// necessary, and not have to re-do that with each reset.
newConfig := d.cfg
if keepMappin... | [
-0.6995725035667419,
0.9676836133003235,
0.8226708173751831,
0.10837818682193756,
-0.40930572152137756,
-0.2967217266559601,
1.078264594078064,
-0.48465031385421753,
-0.39461010694503784,
-0.023806756362318993,
-0.04153547063469887,
0.07628155499696732,
-0.46970731019973755,
0.319413095712... |
func (d *Debugger) Close() error {
var ret error = nil
mapped := d.mapped.Entries()
for _, region := range mapped {
if err := d.Unmap(region.name); ret == nil && err != nil {
ret = err
}
}
return d.closeAll(ret)
} | [
-0.3920574188232422,
0.38470980525016785,
0.7168619632720947,
-0.5258424282073975,
-0.5473830103874207,
0.15526729822158813,
0.4747926592826843,
-0.6449159383773804,
-0.43361949920654297,
-0.8811513185501099,
0.7012794613838196,
-0.5183906555175781,
-0.6479513645172119,
1.2754721641540527,... |
func (d *Debugger) code() MemRegion {
if codeMem, err := d.mapped.Get("code"); err != nil {
panic(err)
} else {
return codeMem
}
} | [
0.20797772705554962,
0.7829787135124207,
0.5058278441429138,
0.44344398379325867,
0.1944597214460373,
0.0230384673923254,
0.4928886294364929,
-0.5200040936470032,
0.5461432337760925,
-0.6844754219055176,
1.4079806804656982,
0.6654676795005798,
-0.2673180401325226,
0.5575183033943176,
0.3... |
func (d *Debugger) Map(toMap MemRegion) error {
var prot int
if toMap.size == 0 {
return errors.New("Zero-length mappings are not permitted.")
}
if d.mapped.Contains(toMap.name) {
return fmt.Errorf("A mapping named \"%s\" already exists.", toMap.name)
}
prot = 0
if toMap.perms.Read {
prot |= uc.PROT_REA... | [
-1.1740756034851074,
0.37805265188217163,
0.7612760663032532,
0.0712013840675354,
-0.4954611659049988,
0.6702125072479248,
0.5817670226097107,
-0.44860416650772095,
1.1327075958251953,
-0.10677526891231537,
0.3450988233089447,
0.16985414922237396,
-0.05093538016080856,
-0.11305025964975357... |
func (d *Debugger) IsMapped(name string) bool {
return d.mapped.Contains(name)
} | [
-0.4870428442955017,
0.2627180218696594,
0.6683558821678162,
0.3282994329929352,
-0.47303342819213867,
0.2858031690120697,
0.08113844692707062,
-0.41487449407577515,
1.3272751569747925,
-0.1254992038011551,
-1.0464489459991455,
0.26727429032325745,
0.25969117879867554,
0.7408602237701416,
... |
func (d *Debugger) Mapped() []MemRegion {
return d.mapped.Entries()
} | [
0.04571205750107765,
-0.20682279765605927,
0.427852064371109,
0.043017856776714325,
0.053583305329084396,
0.5222609639167786,
0.3850661516189575,
-0.5602439045906067,
0.9991925358772278,
-0.916358470916748,
-0.4651619493961334,
1.1021993160247803,
0.8914722204208374,
0.5167668461799622,
... |
func (d *Debugger) Unmap(name string) error {
var m MemRegion
var err error
var ret error = nil
if m, err = d.mapped.Get(name); err != nil {
return err
}
// An output file name indicates we want to save the contents of this region
if m.outputFile != "" {
data, err := d.mu.MemRead(m.base, m.size)
if err =... | [
-0.12966737151145935,
0.008739287964999676,
0.9829530715942383,
-0.9577240943908691,
-1.1374714374542236,
-0.5582450032234192,
0.788394570350647,
-0.05838954821228981,
0.1771974414587021,
-0.291279137134552,
0.1886949986219406,
-0.6193066239356995,
-0.4804735481739044,
0.2017495036125183,
... |
func (d *Debugger) Endianness() (Endianness, error) {
regs, err := d.ReadRegAll()
if err != nil {
return LittleEndian, err
}
return d.arch.endianness(regs), nil
} | [
-0.7889662981033325,
0.19877706468105316,
0.5500786900520325,
-0.39736971259117126,
0.4826541841030121,
0.2213844209909439,
0.5915326476097107,
0.5025774836540222,
0.40090253949165344,
-0.23941513895988464,
-0.4465518295764923,
0.5499780178070068,
-1.1560215950012207,
0.5845752954483032,
... |
func (d *Debugger) pc() (uint64, error) {
regs, err := d.ReadRegAll()
if err != nil {
return 0xdeadbeefdeadbeef, err
}
for _, reg := range regs {
if reg.attr.pc {
pc := d.arch.currentPC(reg.Value, regs)
return pc, nil
}
}
panic("Failed to locate program counter")
} | [
0.1670120805501938,
0.148845836520195,
0.8000863790512085,
0.29428136348724365,
-0.4300307631492615,
0.6365714073181152,
0.9557191729545593,
-0.5233243107795715,
0.4024043679237366,
0.521675169467926,
1.2643426656723022,
-0.19464083015918732,
-0.9102584719657898,
0.08299292623996735,
0.9... |
func (d *Debugger) ReadRegAll() ([]Register, error) {
var err error
regDefs := d.arch.registers()
regVals := make([]Register, len(regDefs), len(regDefs))
for i, reg := range regDefs {
regVals[i], err = d.readReg(reg)
if err != nil {
return []Register{}, err
}
}
return regVals, nil
} | [
-0.6510143876075745,
0.6107409000396729,
0.510723888874054,
0.4151900112628937,
0.49685177206993103,
-0.339112251996994,
0.0934368148446083,
0.19756922125816345,
-0.020741095766425133,
-0.12763123214244843,
0.11357375234365463,
1.572090983390808,
-0.36106574535369873,
1.6072930097579956,
... |
func (d *Debugger) readReg(attr *registerAttr) (Register, error) {
var reg Register
val, err := d.mu.RegRead(attr.uc)
reg.attr = attr
reg.Value = val
return reg, err
} | [
-0.9372549653053284,
0.6615304946899414,
0.4716877043247223,
-0.43240663409233093,
-0.8119363784790039,
-0.29068711400032043,
0.8280009627342224,
0.15738381445407867,
-0.621279776096344,
-0.6581184267997742,
0.7189607620239258,
1.2327057123184204,
0.1311694085597992,
0.2525184750556946,
... |
func (d *Debugger) ReadReg(reg *Register) error {
newReg, err := d.readReg(reg.attr)
reg.Value = newReg.Value
return err
} | [
-0.9371042847633362,
0.7008099555969238,
0.39963629841804504,
-0.11142405867576599,
-0.23549027740955353,
-0.006296321749687195,
0.9149239659309387,
-0.1841777116060257,
-0.843675971031189,
-0.10800257325172424,
0.3109922409057617,
1.1611078977584839,
0.3656131625175476,
0.8790457844734192... |
func (d *Debugger) ReadRegByName(name string) (Register, error) {
var reg Register
if attr, err := d.arch.register(name); err == nil {
return d.readReg(attr)
} else {
return reg, err
}
} | [
-0.8894376158714294,
0.7001716494560242,
0.6255765557289124,
0.29607588052749634,
-0.5520309805870056,
-0.7104650139808655,
0.28429660201072693,
-0.968472957611084,
-0.26502370834350586,
0.45001015067100525,
-0.7405610084533691,
0.28477048873901367,
-1.0160390138626099,
0.3814816176891327,... |
func (d *Debugger) WriteReg(reg Register) error {
if reg.attr.pc {
// Retrieve current system state and adjust PC value if needed
if regs, err := d.ReadRegAll(); err != nil {
return err
} else {
reg.Value = d.arch.currentPC(reg.Value, regs)
}
}
return d.mu.RegWrite(reg.attr.uc, reg.Value)
} | [
-1.117088794708252,
0.45165684819221497,
0.6567538976669312,
-0.45639780163764954,
0.3715882897377014,
0.08638563752174377,
1.8168225288391113,
-0.30712103843688965,
-0.1157565787434578,
-0.4235149323940277,
0.39700189232826233,
0.4383276402950287,
-0.5734599828720093,
0.467258095741272,
... |
func (d *Debugger) WriteRegs(regs []Register) error {
for _, reg := range regs {
if err := d.WriteReg(reg); err != nil {
return err
}
}
return nil
} | [
-1.4921824932098389,
0.9250366687774658,
0.34224066138267517,
0.4659513831138611,
1.7318390607833862,
-0.14012807607650757,
0.6584531664848328,
-0.5458508729934692,
-0.09673433750867844,
0.0852266177535057,
0.06343445181846619,
0.26713302731513977,
-0.9655174612998962,
1.5309648513793945,
... |
func (d *Debugger) WriteRegByName(name string, value uint64) error {
var reg Register
if attr, err := d.arch.register(name); err == nil {
reg.attr = attr
reg.Value = value
return d.WriteReg(reg)
} else {
return err
}
} | [
-0.890183687210083,
0.8443023562431335,
0.6369840502738953,
0.04597314074635506,
0.17139305174350739,
-0.9402504563331604,
0.9394887089729309,
-0.6448881030082703,
-0.32245251536369324,
0.5770001411437988,
-1.1205471754074097,
-0.041023336350917816,
-0.25761908292770386,
0.6269199252128601... |
func (d *Debugger) ReadMem(addr, size uint64) ([]byte, error) {
return d.mu.MemRead(addr, size)
} | [
-0.3571203052997589,
0.6101183891296387,
0.4164851903915405,
0.6298542618751526,
-0.7066031098365784,
-0.35070186853408813,
-0.1735677272081375,
-0.5435395240783691,
0.5804075002670288,
-0.009832843206822872,
0.9894112944602966,
1.0122421979904175,
-0.31893566250801086,
-0.3350339829921722... |
func (d *Debugger) ReadMemRegion(name string) (uint64, []byte, error) {
region, err := d.mapped.Get(name)
if err != nil {
return 0, []byte{}, err
}
data, err := d.mu.MemRead(region.base, region.size)
return region.base, data, err
} | [
-0.8501582145690918,
-0.35090869665145874,
0.6528362035751343,
-0.876652717590332,
-1.1865179538726807,
-0.31327080726623535,
-0.04801076278090477,
-0.5461134910583496,
0.1238877922296524,
0.08129199594259262,
-0.007299530319869518,
0.8975971937179565,
-0.5556790828704834,
0.51073235273361... |
func (d *Debugger) WriteMem(addr uint64, data []byte) error {
return d.mu.MemWrite(addr, data)
} | [
-0.7600546479225159,
0.3307178020477295,
0.3153592050075531,
0.6097027659416199,
0.17545577883720398,
-0.15935276448726654,
0.6462249755859375,
0.1998114436864853,
0.8189629316329956,
-0.2162991464138031,
0.44078871607780457,
0.7056337594985962,
-0.24871708452701569,
0.6225374341011047,
... |
func (d *Debugger) DumpMem(filename string, addr, size uint64) error {
data, err := d.ReadMem(addr, size)
if err != nil {
return err
}
return ioutil.WriteFile(filename, data, 0660)
} | [
0.07328983396291733,
0.3661205470561981,
0.5378668904304504,
0.0684528648853302,
-0.2297516167163849,
-0.005571551620960236,
0.7621977925300598,
0.15462236106395721,
0.1474907100200653,
-0.08762193471193314,
0.1318368762731552,
0.06547979265451431,
-0.4085581600666046,
0.1097932904958725,
... |
func (d *Debugger) DumpMemRegion(filename, regionName string) error {
region, err := d.mapped.Get(regionName)
if err != nil {
return err
}
return d.DumpMem(filename, region.base, region.size)
} | [
-0.30755794048309326,
-0.05756024271249771,
0.34807226061820984,
-0.6904282569885254,
-0.6799565553665161,
-0.13035443425178528,
0.6461728811264038,
-0.44230061769485474,
0.04049261286854744,
-0.2538086473941803,
-0.029744653031229973,
0.6127157807350159,
-0.854514479637146,
1.193337321281... |
func (d *Debugger) Step(count int64) (Exception, error) {
if count <= 0 {
return Exception{}, errors.New("Debugger.Step() requires that count >= 1.")
}
return d.run(count)
} | [
-0.8288284540176392,
1.7598862648010254,
0.5023704171180725,
0.7147242426872253,
-0.21771472692489624,
-0.18963460624217987,
1.1443638801574707,
-0.32698488235473633,
-0.733891487121582,
-1.016506552696228,
-0.926851212978363,
-0.37147384881973267,
-0.6244733333587646,
1.4714406728744507,
... |
func (d *Debugger) Continue() (Exception, error) {
return d.run(-1)
} | [
-0.09537217766046524,
0.3796963095664978,
0.4973093569278717,
0.3012706935405731,
-0.7388733625411987,
0.34923285245895386,
0.026956142857670784,
-1.1545811891555786,
-0.08643761277198792,
-0.3046586513519287,
0.19213862717151642,
0.9277865290641785,
-0.5546427965164185,
-0.047259319573640... |
func (d *Debugger) Disassemble(count uint64) ([]Disassembly, error) {
if rv, err := d.ReadRegByName("pc"); err != nil {
return []Disassembly{}, err
} else {
return d.DisassembleAt(rv.Value, count)
}
} | [
-1.04512357711792,
-0.09372283518314362,
0.5867600440979004,
0.45289158821105957,
0.3212141990661621,
-0.9492032527923584,
-0.1963699907064438,
-0.8378571271896362,
-0.5816496014595032,
0.30961254239082336,
-0.41704410314559937,
-0.7507294416427612,
-0.9628232717514038,
0.6386806964874268,... |
func (d *Debugger) DisassembleAt(addr uint64, count uint64) ([]Disassembly, error) {
var code []byte
var ret []Disassembly
var err error
var disasm *cs.Engine // Capstone disassembly engine (via capstr)
var regs []Register
// If we run outside the bounds of mapped region, keep reducing the
// data length until ... | [
-0.9269694089889526,
-0.5933696031570435,
0.7455816864967346,
-0.7064131498336792,
-0.43982091546058655,
-0.4406026601791382,
0.16712383925914764,
-0.29207468032836914,
0.2822922170162201,
-0.20200477540493011,
-0.02755601704120636,
-0.06793147325515747,
0.4163637161254883,
0.4312576353549... |
func (d *Debugger) SetBreakpoint(addr uint64) Breakpoint {
return d.bps.add(addr)
} | [
0.4634726941585541,
0.6623722910881042,
0.3932945728302002,
0.15365438163280487,
0.22687901556491852,
0.54433274269104,
0.4319930672645569,
-0.1907716691493988,
0.9740651249885559,
-0.5771229267120361,
-0.46839943528175354,
0.8264250755310059,
-1.2970584630966187,
0.9901183843612671,
0.0... |
func (d *Debugger) DeleteAllBreakpoints() {
d.bps.removeAll()
} | [
1.182711124420166,
-0.33310580253601074,
0.5448262691497803,
1.3070036172866821,
0.11320137232542038,
0.421568900346756,
0.27731963992118835,
0.008331387303769588,
0.5632289052009583,
-0.4866478443145752,
-0.9123840928077698,
-0.010003315284848213,
-1.0349878072738647,
1.9283150434494019,
... |
func (d *Debugger) DeleteBreakpointsAt(addr uint64) {
d.bps.removeAllAt(addr)
} | [
0.0375242680311203,
-0.46508774161338806,
0.442755788564682,
-0.45428961515426636,
-0.10984168201684952,
0.1980859488248825,
0.36584195494651794,
-0.6869280934333801,
0.74293053150177,
0.04636811465024948,
-0.8642290234565735,
0.3095073699951172,
-0.43998274207115173,
1.0729496479034424,
... |
func (d *Debugger) DeleteBreakpoint(id int) {
d.bps.remove(id)
} | [
0.6726729273796082,
0.014767632819712162,
0.35755082964897156,
0.4984634816646576,
0.5656439661979675,
0.42797771096229553,
0.40757066011428833,
-0.3474684953689575,
0.602207362651825,
-0.5991676449775696,
-1.2886786460876465,
0.0868130475282669,
-1.3830689191818237,
1.3795779943466187,
... |
func (d *Debugger) GetBreakpoints() BreakpointList {
return d.bps.get()
} | [
0.1708633005619049,
0.39125725626945496,
0.3458355665206909,
0.6573166251182556,
0.7072212100028992,
-0.07390832155942917,
-0.24302442371845245,
-0.605660080909729,
0.5317156314849854,
-0.5796453356742859,
-1.024661898612976,
0.7840167880058289,
-1.5334819555282593,
0.8982282280921936,
-... |
func (d *Debugger) GetBreakpointsAt(addr uint64) BreakpointList {
return d.bps.getAllAt(addr)
} | [
-0.4405202865600586,
-0.010539429262280464,
0.4308382272720337,
-0.3449081480503082,
0.013577417470514774,
-0.37061360478401184,
-0.7172924876213074,
-0.9484384655952454,
0.5620026588439941,
0.20959533751010895,
-0.9997639060020447,
0.738429069519043,
-0.41438111662864685,
0.71620196104049... |
func ensureProxyPathTrailingSlash(originalPath, proxyPath string) string {
if len(proxyPath) > 1 {
if originalPath[len(originalPath)-1] == '/' && proxyPath[len(proxyPath)-1] != '/' {
return proxyPath + "/"
}
}
return proxyPath
} | [
0.7781921625137329,
0.2537078261375427,
0.5639913082122803,
0.3551008105278015,
0.21687263250350952,
0.32146552205085754,
-0.0019724599551409483,
0.40205785632133484,
0.09820514172315598,
-0.2650590240955353,
0.4517388641834259,
0.41517165303230286,
-0.359017938375473,
-0.4558994770050049,... |
func isFieldStringable(tpe ast.Expr) bool {
if ident, ok := tpe.(*ast.Ident); ok {
switch ident.Name {
case "int", "int8", "int16", "int32", "int64",
"uint", "uint8", "uint16", "uint32", "uint64",
"float64", "string", "bool":
return true
}
} else if starExpr, ok := tpe.(*ast.StarExpr); ok {
return is... | [
-1.2426384687423706,
0.08875386416912079,
0.5277116298675537,
-0.26994451880455017,
-0.6509966850280762,
0.1414693146944046,
-0.27672305703163147,
0.02381477691233158,
-0.7496155500411987,
0.9584378004074097,
-0.7908138632774353,
-0.6778537034988403,
-0.6240038871765137,
0.3503109812736511... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.