text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (b *Blob) BreakLeaseWithBreakPeriod(breakPeriodInSeconds int, options *LeaseOptions) (breakTimeout int, err error) {
headers := b.Container.bsc.client.getStandardHeaders()
headers[leaseAction] = breakLease
headers[leaseBreakPeriod] = strconv.Itoa(breakPeriodInSeconds)
return b.breakLeaseCommon(headers, options... | [
0.33052700757980347,
-0.8867005705833435,
0.5020801424980164,
-0.12093650549650192,
-0.16494056582450867,
0.3892318904399872,
-0.5117143392562866,
-0.5150454044342041,
-0.04774453863501549,
-0.035751648247241974,
-0.37991976737976074,
-0.39042341709136963,
-1.0468101501464844,
-0.208338797... |
func (b *Blob) breakLeaseCommon(headers map[string]string, options *LeaseOptions) (breakTimeout int, err error) {
respHeaders, err := b.leaseCommonPut(headers, http.StatusAccepted, options)
if err != nil {
return 0, err
}
breakTimeoutStr := respHeaders.Get(http.CanonicalHeaderKey(leaseTime))
if breakTimeoutStr... | [
0.19750379025936127,
-0.4569380283355713,
0.8966894149780273,
-0.40104585886001587,
-0.19353726506233215,
0.13438844680786133,
-0.07435592263936996,
0.07138042151927948,
-0.7691464424133301,
0.734036386013031,
-0.4285132586956024,
-0.7875574231147766,
-1.6030921936035156,
0.300789117813110... |
func (b *Blob) ChangeLease(currentLeaseID string, proposedLeaseID string, options *LeaseOptions) (newLeaseID string, err error) {
headers := b.Container.bsc.client.getStandardHeaders()
headers[leaseAction] = changeLease
headers[headerLeaseID] = currentLeaseID
headers[leaseProposedID] = proposedLeaseID
respHeaders... | [
0.1936332881450653,
-1.0439553260803223,
0.7448204159736633,
-0.20339828729629517,
-0.26228997111320496,
-0.32256752252578735,
-0.7717621922492981,
0.1521700769662857,
0.027702724561095238,
0.6958106160163879,
0.49732786417007446,
0.5618475675582886,
-1.5885118246078491,
0.2773076295852661... |
func (b *Blob) ReleaseLease(currentLeaseID string, options *LeaseOptions) error {
headers := b.Container.bsc.client.getStandardHeaders()
headers[leaseAction] = releaseLease
headers[headerLeaseID] = currentLeaseID
_, err := b.leaseCommonPut(headers, http.StatusOK, options)
if err != nil {
return err
}
return ... | [
-0.030566049739718437,
-0.45199358463287354,
0.5323750972747803,
-0.5921927690505981,
0.0776616707444191,
-0.28929781913757324,
-0.05376838147640228,
-0.0510062538087368,
0.07760706543922424,
0.6738870143890381,
0.01832609996199608,
-0.06481850892305374,
-1.9442795515060425,
0.022614855319... |
func (b *Blob) RenewLease(currentLeaseID string, options *LeaseOptions) error {
headers := b.Container.bsc.client.getStandardHeaders()
headers[leaseAction] = renewLease
headers[headerLeaseID] = currentLeaseID
_, err := b.leaseCommonPut(headers, http.StatusOK, options)
if err != nil {
return err
}
return nil
... | [
0.5224332213401794,
-0.6211016178131104,
0.4506749212741852,
-0.21789467334747314,
0.07527406513690948,
-0.16928566992282867,
-0.4407559335231781,
0.0013082221848890185,
-0.19857080280780792,
0.2940063774585724,
-0.1977875977754593,
0.2996664345264435,
-1.4008797407150269,
0.21343289315700... |
func kern_procargs(pid int,
exe func(string),
argv func(string),
env func(string, string)) error {
mib := []C.int{C.CTL_KERN, C.KERN_PROCARGS2, C.int(pid)}
argmax := uintptr(C.ARG_MAX)
buf := make([]byte, argmax)
err := sysctl(mib, &buf[0], &argmax, nil, 0)
if err != nil {
return nil
}
bbuf := bytes.NewBu... | [
0.22571294009685516,
-0.5888348817825317,
1.1366840600967407,
0.152556374669075,
-0.36630988121032715,
-0.6526323556900024,
-0.36342623829841614,
0.11797121912240982,
-0.5914511680603027,
0.6982249021530151,
0.4704548716545105,
0.8756815195083618,
-0.03754545748233795,
0.5279752612113953,
... |
func sysctl(mib []C.int, old *byte, oldlen *uintptr,
new *byte, newlen uintptr) (err error) {
var p0 unsafe.Pointer
p0 = unsafe.Pointer(&mib[0])
_, _, e1 := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(p0),
uintptr(len(mib)),
uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)),
uintptr(unsafe.Poin... | [
1.4532654285430908,
-0.7009761929512024,
0.6120114922523499,
-0.2724515497684479,
-0.3758912682533264,
-0.5000492334365845,
0.06490384042263031,
-0.500435471534729,
0.36752814054489136,
1.3345340490341187,
-1.276328682899475,
0.36552828550338745,
-0.15830889344215393,
0.222686767578125,
... |
func sysctlbyname(name string, data interface{}) (err error) {
val, err := syscall.Sysctl(name)
if err != nil {
return err
}
buf := []byte(val)
switch v := data.(type) {
case *uint64:
*v = *(*uint64)(unsafe.Pointer(&buf[0]))
return
}
bbuf := bytes.NewBuffer([]byte(val))
return binary.Read(bbuf, binary... | [
0.6685597896575928,
-0.27583447098731995,
0.6168419718742371,
-0.35211867094039917,
-1.1848641633987427,
-0.8276214599609375,
-0.750176191329956,
-1.5030555725097656,
0.022469881922006607,
1.135585069656372,
-1.1818572282791138,
-0.012242431752383709,
-0.2599116563796997,
0.080175213515758... |
func getfsstat(buf []syscall.Statfs_t, flags int) (n int, err error) {
var ptr uintptr
var size uintptr
if len(buf) > 0 {
ptr = uintptr(unsafe.Pointer(&buf[0]))
size = unsafe.Sizeof(buf[0]) * uintptr(len(buf))
} else {
ptr = uintptr(0)
size = uintptr(0)
}
trap := uintptr(syscall.SYS_GETFSSTAT64)
ret, _... | [
0.025367768481373787,
0.8036119341850281,
0.7718481421470642,
0.17660950124263763,
-0.24207669496536255,
-1.2686991691589355,
0.7152779698371887,
-0.742365837097168,
0.1490323543548584,
-0.9514847993850708,
-0.1824331432580948,
0.021794933825731277,
-0.6955419182777405,
0.7224131226539612,... |
func GetTopStats(session *mgo.Session) (*TopStatus, error) {
results := &TopStatus{}
err := session.DB("admin").Run(bson.D{{Name: "top", Value: 1}}, &results)
return results, err
} | [
-1.008082389831543,
1.1052144765853882,
0.43268129229545593,
-0.47896337509155273,
-0.6334388852119446,
-0.31806981563568115,
-0.7017248868942261,
-0.867488443851471,
0.272232323884964,
-0.24680058658123016,
-0.37782689929008484,
0.4566032886505127,
-0.39498594403266907,
0.2335667163133621... |
func (status *TopStatus) Export(ch chan<- prometheus.Metric) {
status.TopStats.Export(ch)
} | [
0.08249447494745255,
-0.05788830667734146,
0.18754443526268005,
0.36834463477134705,
-0.8289530277252197,
0.7648792862892151,
-0.08252272754907608,
-0.9363619685173035,
0.7858827710151672,
-0.4428614377975464,
-0.5856624841690063,
1.0108283758163452,
0.08081251382827759,
1.2083356380462646... |
func GetTopStatus(session *mgo.Session) *TopStatus {
topStatus, err := GetTopStats(session)
if err != nil {
log.Debug("Failed to get top status.")
return nil
}
return topStatus
} | [
-0.7430142164230347,
-0.000006245844360819319,
0.3859895169734955,
-0.36851245164871216,
-0.707886278629303,
-0.4560471773147583,
-0.3391275703907013,
-0.6195909380912781,
0.8772946000099182,
-0.3731047511100769,
-0.6434184312820435,
0.3394540846347809,
0.31231823563575745,
-0.220916390419... |
func (m ComicsModel) Insert(comics *Comics) error {
query := `INSERT INTO comics (title, year, pages)
VALUES ($1, $2, $3)
RETURNING id, created_at, version`
args := []interface{}{comics.Title, comics.Year, comics.Pages}
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
... | [
-0.8980225920677185,
0.4831857681274414,
0.324798583984375,
-0.33868035674095154,
0.07993265241384506,
0.31093695759773254,
-0.5961995720863342,
-0.3848446011543274,
-0.6864398121833801,
-0.19750554859638214,
-0.8397876620292664,
-0.9758393168449402,
-0.9884488582611084,
-0.073862507939338... |
func (m ComicsModel) Get(id int64) (*Comics, error) {
if id < 1 {
return nil, ErrRecordNotFound
}
query := `SELECT id, created_at, title, year, pages, version
FROM comics
WHERE id = $1`
var comics Comics
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
err := m.DB... | [
-0.6658948659896851,
-0.17951816320419312,
0.45680174231529236,
-0.6060968637466431,
0.47513434290885925,
-0.40715256333351135,
-0.9929273724555969,
-0.5775089263916016,
-0.4051540493965149,
-0.48307955265045166,
-0.017385002225637436,
0.153733029961586,
-0.05751562491059303,
0.09321729838... |
func (m ComicsModel) Update(comics *Comics) error {
query := `UPDATE comics
SET title = $1, year = $2, pages = $3, version = version + 1
WHERE id = $4 AND version = $5
RETURNING version`
args := []interface{}{
comics.Title,
comics.Year,
comics.Pages,
comics.ID,
comics.Version,
}
ctx, cancel := c... | [
-0.9436519145965576,
-0.4583912789821625,
0.427140474319458,
-0.1377219706773758,
-0.2086799442768097,
0.09896998852491379,
-0.8331716060638428,
-0.8654259443283081,
-0.06818190962076187,
0.19466663897037506,
-0.20738670229911804,
-0.6575968265533447,
-0.8155108690261841,
0.158601626753807... |
func (m ComicsModel) Delete(id int64) error {
if id < 1 {
return ErrRecordNotFound
}
query := `DELETE FROM comics
WHERE id = $1`
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
result, err := m.DB.ExecContext(ctx, query, id)
if err != nil {
return err
}
rowsAffec... | [
0.13233192265033722,
0.25949564576148987,
0.5045211315155029,
-0.08149625360965729,
0.21831108629703522,
0.03591451048851013,
0.08767130225896835,
-0.40039342641830444,
-0.20990051329135895,
-0.08271782100200653,
0.26569265127182007,
-0.29171261191368103,
-0.8973374962806702,
0.00059029139... |
func NewDatabase(settings *settings.Settings) Database {
generalDatabase := &generalDatabase{
driver: dbTypeToDriverMap[settings.DbType],
settings: settings,
}
switch settings.DbType {
case "mysql":
return &mysql{generalDatabase}
default: // pg
return &postgresql{generalDatabase}
}
} | [
-1.0874332189559937,
0.3036959171295166,
0.40427112579345703,
0.8275992274284363,
0.544396162033081,
-0.035098880529403687,
-0.31903183460235596,
-0.6351562738418579,
0.6621078252792358,
0.499162495136261,
0.14601360261440277,
0.37625831365585327,
-1.0791698694229126,
0.8906813859939575,
... |
func (gdb *generalDatabase) Close() error {
return gdb.db.Close()
} | [
-0.41136088967323303,
0.41567760705947876,
0.36623629927635193,
0.4216708242893219,
-0.29035672545433044,
1.6371058225631714,
-0.15607598423957825,
-1.0465290546417236,
-0.8165239691734314,
-0.16041818261146545,
0.43190693855285645,
0.36134904623031616,
-1.7408545017242432,
1.3787877559661... |
func (gdb *generalDatabase) IsNullable(column Column) bool {
return column.IsNullable == "YES"
} | [
-0.264356404542923,
0.4873049855232239,
0.4767467975616455,
1.2881956100463867,
-0.5948144197463989,
0.7576497793197632,
-0.18798743188381195,
0.15806184709072113,
-0.6851356029510498,
1.0791505575180054,
-0.9931377172470093,
0.46053290367126465,
-0.4942139983177185,
0.6565744280815125,
... |
func (gdb *generalDatabase) IsStringInSlice(needle string, haystack []string) bool {
for _, s := range haystack {
if s == needle {
return true
}
}
return false
} | [
-0.37084659934043884,
-0.5190178751945496,
0.3159123659133911,
0.05234885588288307,
0.1609850525856018,
-0.8921583294868469,
-1.078277587890625,
0.008842856623232365,
-0.7528278231620789,
0.8635162115097046,
0.25425639748573303,
0.6875408291816711,
-0.5973387956619263,
-0.17299486696720123... |
func (provider *GoogleOAuthProvider) GetAuthorizationRedirect(redirect_uri string) (string, error) {
return ConstructSafeURL("https", "accounts.google.com", "o/oauth2/v2/auth",
map[string]string{
"client_id": config.GOOGLE_CLIENT_ID,
"scope": "profile email",
"response_type": "code",
"redirec... | [
-0.47785690426826477,
0.7146320343017578,
0.5216400027275085,
0.5635573267936707,
-0.3541453182697296,
0.3342505693435669,
1.0299839973449707,
-0.21572765707969666,
0.3134585916996002,
-0.2002222239971161,
0.022453026846051216,
1.4320080280303955,
-0.03226741403341293,
-0.5167790055274963,... |
func (provider *GoogleOAuthProvider) Authorize(code string, redirect_uri string) error {
request, err := grequests.Post("https://www.googleapis.com/oauth2/v4/token", &grequests.RequestOptions{
Params: map[string]string{
"client_id": config.GOOGLE_CLIENT_ID,
"client_secret": config.GOOGLE_CLIENT_SECRET,
... | [
-1.3738839626312256,
0.6791396141052246,
0.670211672782898,
-0.11692487448453903,
0.6774718761444092,
-0.41040146350860596,
-0.08663760125637054,
0.10877104103565216,
0.43788620829582214,
0.7708473801612854,
-0.4129234850406647,
1.3504372835159302,
-0.21487101912498474,
0.19977594912052155... |
func (provider *GoogleOAuthProvider) GetUserInfo() (*models.UserInfo, error) {
var user_info models.UserInfo
request, err := grequests.Get("https://www.googleapis.com/oauth2/v1/userinfo?alt=json", &grequests.RequestOptions{
Headers: map[string]string{
"Authorization": "Bearer " + provider.token,
},
})
if e... | [
-0.20096367597579956,
0.032971180975437164,
0.5018459558486938,
-0.009786470793187618,
0.42980727553367615,
0.2921092212200165,
-0.7393118143081665,
-0.9681437015533447,
-0.33484378457069397,
0.3221406042575836,
-1.4306941032409668,
1.092695951461792,
-0.29138556122779846,
-0.0638934597373... |
func (provider *GoogleOAuthProvider) IsVerifiedUser() bool {
return provider.isVerifiedUser
} | [
-0.3645689785480499,
0.6636772155761719,
-0.015167199075222015,
1.326387643814087,
0.036525145173072815,
0.08983791619539261,
-0.4109559953212738,
-0.13113729655742645,
1.2652318477630615,
0.3431131839752197,
-1.4687563180923462,
0.9607295393943787,
-0.7840991020202637,
0.6498044729232788,... |
func Completion(cmd *cobra.Command, args []string) {
err := cmd.Root().GenBashCompletionFile(completionTarget)
completion(err, args...)
} | [
0.6310614347457886,
-0.32204240560531616,
0.30439966917037964,
0.4577294886112213,
1.182340383529663,
0.16642676293849945,
0.6801462769508362,
1.2416452169418335,
-1.2637510299682617,
-0.14671076834201813,
-0.08100693672895432,
0.1881852000951767,
1.0041385889053345,
0.959662914276123,
0... |
func Choose(baseURL string, store ChooseDB, strategies strategy.Strategies, chooseTemplate, meTemplate tmpl) http.Handler {
return mux.Method{
"GET": chooseProvider(baseURL, store, strategies, chooseTemplate, meTemplate),
}
} | [
-0.6911346316337585,
-0.08961855620145798,
0.1654045432806015,
0.3457011580467224,
-0.3960987329483032,
-0.7132664918899536,
-0.06160411238670349,
-0.7092794179916382,
-0.012919594533741474,
0.5593906044960022,
0.33418524265289307,
-0.3711102604866028,
-0.12733818590641022,
-0.230521529912... |
func NewRequest(headersToSend []string) func(*gin.Context, []string) *proxy.Request {
if len(headersToSend) == 0 {
headersToSend = router.HeadersToSend
}
return func(c *gin.Context, queryString []string) *proxy.Request {
params := make(map[string]string, len(c.Params))
for _, param := range c.Params {
para... | [
-0.41885825991630554,
-0.1713612973690033,
0.86735999584198,
-0.17874307930469513,
-0.5886951684951782,
-0.7154484391212463,
-0.3584848642349243,
0.2076457142829895,
-0.4970623254776001,
0.6211566925048828,
1.2698436975479126,
0.035831086337566376,
0.2845248281955719,
0.4315798580646515,
... |
func saveToOutputFile(path string, licenses *Licenses, config *Config) error {
// Sort the licenses in alphabetical order for consistency.
sort.Slice(licenses.licenses, func(i, j int) bool { return licenses.licenses[i].Category < licenses.licenses[j].Category })
data := struct {
Used []*License
Unused []*Licen... | [
-0.22480559349060059,
0.1259998232126236,
0.6627258658409119,
-0.7338586449623108,
-0.5926429033279419,
-0.7957842946052551,
0.2265811413526535,
-0.027561305090785027,
-0.9721203446388245,
0.5451476573944092,
-0.2639278769493103,
-0.43673908710479736,
0.028697067871689796,
0.27836126089096... |
func compressGZ(d []byte) ([]byte, error) {
buf := bytes.Buffer{}
zw := gzip.NewWriter(&buf)
if _, err := zw.Write(d); err != nil {
return nil, err
}
if err := zw.Close(); err != nil {
return nil, err
}
return buf.Bytes(), nil
} | [
-0.18412519991397858,
0.07120516151189804,
0.3720492720603943,
0.4239960014820099,
-1.1096832752227783,
0.12125012278556824,
0.2630586326122284,
-0.36617693305015564,
0.7583415508270264,
-0.09023850411176682,
-0.7161672711372375,
-0.21450261771678925,
-1.2766127586364746,
1.207216024398803... |
func NotifyUser(user *models.User, name string, msg string, url string, email bool) {
if user.ID > 0 {
notification := models.NewNotification(name, msg, url)
notification.UserID = user.ID
models.ORM.Create(¬ification)
// TODO: Email notification
/* if email {
}*/
}
} | [
0.33014383912086487,
0.8943297266960144,
0.44335442781448364,
1.509513020515442,
0.20057179033756256,
0.26347753405570984,
1.0451186895370483,
0.9491390585899353,
-0.32747983932495117,
-0.2639961540699005,
-1.5424895286560059,
-0.5815621018409729,
0.6298328042030334,
0.8240724802017212,
... |
func ToggleReadNotification(identifier string, id uint) { //
models.ORM.Model(&models.Notification{}).Where("identifier = ? AND user_id = ?", identifier, id).Updates(models.Notification{Read: true})
} | [
-0.3350488841533661,
-0.867214024066925,
0.677505373954773,
0.2551335394382477,
-0.23931249976158142,
1.179471731185913,
0.2447139024734497,
0.7797783017158508,
0.38524144887924194,
0.8107035160064697,
-0.3195613622665405,
0.21251557767391205,
0.32454633712768555,
-0.5676581263542175,
-0... |
func DeleteAllNotifications(id uint) { //
models.ORM.Where("user_id = ?", id).Delete(&models.Notification{})
} | [
0.8005551695823669,
-0.1697026640176773,
0.7961129546165466,
1.752906322479248,
0.2073490470647812,
0.19732026755809784,
0.40709003806114197,
-0.1461832970380783,
0.4258359372615814,
-0.08567828685045242,
-1.296176791191101,
-0.2818371057510376,
0.27493321895599365,
1.4481143951416016,
-... |
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
} | [
0.25708064436912537,
-1.2911276817321777,
-0.15975941717624664,
-1.1987494230270386,
-0.7055332064628601,
0.14473751187324524,
0.16492673754692078,
-0.7642391324043274,
-0.964878261089325,
-0.4666050374507904,
-0.13648737967014313,
0.7510700225830078,
0.052431024610996246,
0.66191029548645... |
func (a *Client) AddGroupToCustomer(params *AddGroupToCustomerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddGroupToCustomerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewAddGroupToCustomerParams()
}
op := &runtime.ClientOperation{
ID: ... | [
-1.563934564590454,
0.5307184457778931,
0.5265143513679504,
-0.212382510304451,
-0.38610804080963135,
-0.06419980525970459,
0.7537053227424622,
-0.6336067914962769,
-0.7989619374275208,
0.2209538370370865,
-0.23777037858963013,
0.896074652671814,
-1.127677083015442,
0.44437792897224426,
... |
func (a *Client) CreateCustomer(params *CreateCustomerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateCustomerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateCustomerParams()
}
op := &runtime.ClientOperation{
ID: "CreateC... | [
-1.1728991270065308,
-0.26224711537361145,
0.7295346260070801,
0.4501762390136719,
-0.01630021631717682,
0.19854363799095154,
0.6438793540000916,
-0.25824347138404846,
-0.2928282916545868,
0.2020222246646881,
-0.5973952412605286,
0.6153079271316528,
-1.0966737270355225,
0.48156535625457764... |
func (a *Client) CreateCustomerCard(params *CreateCustomerCardParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateCustomerCardOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateCustomerCardParams()
}
op := &runtime.ClientOperation{
ID: ... | [
-1.0492383241653442,
-0.2957123816013336,
0.566876232624054,
-0.2815311551094055,
0.006927198730409145,
0.2481406331062317,
0.2519413232803345,
-0.3576783239841461,
-0.044024981558322906,
0.648217499256134,
-0.8877685070037842,
0.7094898819923401,
-0.874758243560791,
0.46367940306663513,
... |
func (a *Client) DeleteCustomer(params *DeleteCustomerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCustomerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteCustomerParams()
}
op := &runtime.ClientOperation{
ID: "DeleteC... | [
-1.001271367073059,
-0.18710164725780487,
0.7560878992080688,
0.6259023547172546,
-0.3395605981349945,
-0.351066529750824,
0.758769690990448,
0.030248837545514107,
0.050417132675647736,
-0.23992933332920074,
-0.3608236312866211,
1.0856387615203857,
-0.9732393622398376,
0.4073025584220886,
... |
func (a *Client) DeleteCustomerCard(params *DeleteCustomerCardParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteCustomerCardOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteCustomerCardParams()
}
op := &runtime.ClientOperation{
ID: ... | [
-1.0215775966644287,
-0.38138988614082336,
0.5969037413597107,
0.06087775155901909,
-0.41779160499572754,
-0.32356685400009155,
0.378523051738739,
0.033599235117435455,
0.3827565312385559,
0.10341746360063553,
-0.7571784257888794,
1.0021723508834839,
-0.8368573188781738,
0.5171815156936646... |
func (a *Client) ListCustomers(params *ListCustomersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCustomersOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListCustomersParams()
}
op := &runtime.ClientOperation{
ID: "ListCustome... | [
-1.260468602180481,
-0.4683886170387268,
0.6922811269760132,
0.06876823306083679,
0.0813709944486618,
-0.4837069809436798,
0.09945310652256012,
-0.2647809386253357,
0.29340237379074097,
0.5734891891479492,
-0.2033025473356247,
0.9221792221069336,
-1.043239951133728,
-0.031857654452323914,
... |
func (a *Client) RemoveGroupFromCustomer(params *RemoveGroupFromCustomerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RemoveGroupFromCustomerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewRemoveGroupFromCustomerParams()
}
op := &runtime.ClientOpera... | [
-1.1058406829833984,
0.19427697360515594,
0.3472767472267151,
0.08984653651714325,
-0.9135761260986328,
-0.2162575125694275,
0.6125443577766418,
-0.23755331337451935,
-0.5562207102775574,
-0.10961046069860458,
-0.12402611970901489,
0.6701902151107788,
-1.176239252090454,
0.4286051690578460... |
func (a *Client) RetrieveCustomer(params *RetrieveCustomerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RetrieveCustomerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewRetrieveCustomerParams()
}
op := &runtime.ClientOperation{
ID: ... | [
-0.4878196716308594,
-0.15325652062892914,
0.8176565766334534,
0.7486669421195984,
-0.0965178906917572,
-0.843366801738739,
0.7762430906295776,
-0.1602238118648529,
0.018253061920404434,
-0.6339219212532043,
-0.552382230758667,
0.6295478343963623,
-1.3614166975021362,
0.11384634673595428,
... |
func (a *Client) SearchCustomers(params *SearchCustomersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SearchCustomersOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewSearchCustomersParams()
}
op := &runtime.ClientOperation{
ID: "Sea... | [
-1.7017860412597656,
-0.1896427571773529,
0.5868659019470215,
0.27982935309410095,
-0.02302636206150055,
-0.4326849579811096,
0.12515421211719513,
-0.43439075350761414,
-0.23029154539108276,
0.5518141388893127,
-0.397042840719223,
0.7597430348396301,
-1.4928773641586304,
0.0537475310266017... |
func (a *Client) UpdateCustomer(params *UpdateCustomerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateCustomerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUpdateCustomerParams()
}
op := &runtime.ClientOperation{
ID: "UpdateC... | [
-1.536958932876587,
-0.5471360087394714,
0.845496416091919,
0.5417314171791077,
-0.773246169090271,
-0.13568350672721863,
0.7282167673110962,
0.009444761089980602,
-0.07673237472772598,
0.3672199547290802,
-0.6429907083511353,
1.033956527709961,
-1.1980211734771729,
-0.012003274634480476,
... |
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
} | [
0.43289124965667725,
-0.16396044194698334,
0.06502870470285416,
0.17467869818210602,
-0.022012455388903618,
0.3327627182006836,
1.1535402536392212,
-0.7375835180282593,
0.32833772897720337,
-1.0833802223205566,
-1.4707483053207397,
0.4919946491718292,
-0.44076064229011536,
0.62663459777832... |
func LogWithDefer(str string) (deferFunc func()) {
fmt.Printf("%s %s ", time.Now().Format(golibhelper.TimeFormatLogger), str)
return func() {
if r := recover(); r != nil {
fmt.Printf("\x1b[31;1mERROR: %v\x1b[0m\n", r)
panic(r)
}
fmt.Println("\x1b[32;1mSUCCESS\x1b[0m")
}
} | [
0.6635928153991699,
-0.8054060339927673,
1.1964871883392334,
-0.5068646669387817,
-0.46815261244773865,
0.36861830949783325,
-0.8259034752845764,
-0.3698152005672455,
0.19349712133407593,
-0.5083588361740112,
-0.033781591802835464,
0.1711445152759552,
0.5483981370925903,
0.58741694688797,
... |
func LogYellow(str string) {
fmt.Printf("\x1b[33;2m%s\x1b[0m\n", str)
} | [
0.9713165760040283,
-0.4756229817867279,
0.7530551552772522,
-0.8012369871139526,
-0.5631914138793945,
0.22248637676239014,
-0.8679503202438354,
-0.4487546384334564,
0.7668628692626953,
-0.9299903512001038,
-0.3979056477546692,
1.3190444707870483,
0.4654802978038788,
0.23008833825588226,
... |
func LogRed(str string) {
fmt.Printf("\x1b[31;2m%s\x1b[0m\n", str)
} | [
0.4670182168483734,
0.34664809703826904,
0.9051179885864258,
-0.11363714933395386,
-0.8224228024482727,
1.288598895072937,
-1.5902869701385498,
-0.03632860258221626,
0.4655055105686188,
-0.6445598602294922,
-0.28421545028686523,
1.6782361268997192,
-0.49361902475357056,
0.49208006262779236... |
func LogGreen(str string) {
fmt.Printf("\x1b[32;2m%s\x1b[0m\n", str)
} | [
0.4892429709434509,
0.09150811284780502,
0.8638280034065247,
0.21739158034324646,
-0.6423221826553345,
1.6622092723846436,
-1.6356570720672607,
0.161603644490242,
-0.6267202496528625,
-0.4229525923728943,
-0.5299415588378906,
1.2188308238983154,
-0.6295123100280762,
0.03972672298550606,
... |
func (whsvr *WebhookServer) serve(w http.ResponseWriter, r *http.Request) {
var body []byte
if r.Body != nil {
if data, err := ioutil.ReadAll(r.Body); err == nil {
body = data
}
}
if len(body) == 0 {
klog.Error("empty body")
http.Error(w, "empty body", http.StatusBadRequest)
return
}
// verify the c... | [
-0.8696033954620361,
-0.8491659164428711,
0.8104803562164307,
-0.43236303329467773,
-0.21834290027618408,
-0.14647820591926575,
0.26392436027526855,
0.19788415729999542,
-0.45521080493927,
0.9853343963623047,
0.07696488499641418,
1.0364166498184204,
-0.28220975399017334,
0.0342517048120498... |
func GetPersistentToken(hc *corev1alpha1.HumioCluster, url, password string, humioClient humio.Client) (string, error) {
jwtToken, err := getJWTForSingleUser(hc, url, password)
if err != nil {
return "", err
}
err = humioClient.Authenticate(&humioapi.Config{Token: jwtToken, Address: url})
if err != nil {
retur... | [
-0.09902656078338623,
0.24752821028232574,
0.5334345698356628,
0.6312467455863953,
-0.19778503477573395,
0.04448104649782181,
-0.0163112785667181,
1.5476261377334595,
0.09945906698703766,
0.018525542691349983,
-0.12120121717453003,
0.39254453778266907,
-0.7083473801612854,
-0.3877555429935... |
func getJWTForSingleUser(hc *corev1alpha1.HumioCluster, url, password string) (string, error) {
message := map[string]interface{}{
"login": "developer",
"password": password,
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
return "", err
}
// TODO: get baseurl from humio service name... | [
-0.22066594660282135,
0.34356141090393066,
0.6758816838264465,
0.6003753542900085,
-1.2273317575454712,
-0.2929917275905609,
0.34902405738830566,
0.09043919295072556,
-0.39934322237968445,
-0.5291208028793335,
-0.27058592438697815,
0.3443150818347931,
0.06564730405807495,
0.569034337997436... |
func New(repo model.TictacRespository, addsvc addservice.AddService, logger log.Logger) (s TictacService) {
var svc TictacService
{
svc = &stubTictacService{logger: logger, addsvc: addsvc, repo: repo}
svc = LoggingMiddleware(logger)(svc)
}
return svc
} | [
-0.1707712709903717,
-0.39768558740615845,
0.326140820980072,
-0.9694358110427856,
-0.16901563107967377,
-0.30328643321990967,
0.2556166648864746,
-1.049346923828125,
0.39653143286705017,
-0.44834938645362854,
0.29885292053222656,
0.915796160697937,
0.4588067829608917,
0.5629467368125916,
... |
func (ti *stubTictacService) Tic(ctx context.Context) (err error) {
dv, err := ti.repo.Tac(ctx)
if err != nil {
level.Error(ti.logger).Log("method", "ti.repo.Tac", "err", err)
return err
}
nv, err := ti.addsvc.Sum(ctx, dv, 1)
if err != nil {
level.Error(ti.logger).Log("method", "ti.addsvc.Sum", "err", err)
... | [
-0.009240795858204365,
0.1262727826833725,
0.9251444935798645,
-0.47273072600364685,
0.3464503884315491,
0.22717046737670898,
1.4418249130249023,
-0.8923209309577942,
0.3039996027946472,
0.1099012941122055,
0.3750452995300293,
0.6766827702522278,
0.6387027502059937,
0.07719694823026657,
... |
func (ti *stubTictacService) Tac(ctx context.Context) (res int64, err error) {
return ti.repo.Tac(ctx)
} | [
0.2264356017112732,
0.21136939525604248,
0.30834197998046875,
-0.6921931505203247,
0.4974844753742218,
-0.08283378183841705,
1.6339716911315918,
-0.5934317111968994,
0.12182707339525223,
-0.009242984466254711,
0.03642791137099266,
0.534385621547699,
0.7322707772254944,
-0.5494527220726013,... |
func Walk(v Visitor, node Node) {
if node == nil {
return
}
if v = v.Visit(node); v == nil {
return
}
switch n := node.(type) {
case *BinaryExpr:
Walk(v, n.LHS)
Walk(v, n.RHS)
case *NotExpr:
Walk(v, n.Expr)
case *Function:
for _, expr := range n.Args {
Walk(v, expr)
}
case *ParenExpr:
Walk(v... | [
-0.6352845430374146,
0.3590794801712036,
0.7945475578308105,
0.002870420226827264,
-0.03253396227955818,
0.5298462510108948,
0.8681782484054565,
0.14761404693126678,
-0.07053808122873306,
-0.46204838156700134,
-0.2196173518896103,
0.6207981705665588,
-0.027125176042318344,
0.60014289617538... |
func WalkFunc(node Node, fn func(Node)) {
Walk(walkFuncVisitor(fn), node)
} | [
0.19481690227985382,
0.5685637593269348,
0.23919366300106049,
-0.137793630361557,
-0.019239570945501328,
-0.22118529677391052,
1.067552089691162,
1.0419557094573975,
-0.42909228801727295,
-0.44029590487480164,
0.37384116649627686,
1.0483405590057373,
1.618615746498108,
-0.2765636146068573,... |
func Read(files []string) (documents []Document) {
for _, fp := range files {
f, err := ioutil.ReadFile(fp)
if err != nil {
fmt.Println("There was an error reading the file", err)
os.Exit(-1)
}
yamlDocumentsInFile := bytes.SplitN(f, []byte("---\n"), -1)
//fmt.Printf("%q\n", yamlDocumentsInFile)
i... | [
-0.6723082065582275,
-0.901222288608551,
0.854572057723999,
0.11914407461881638,
-0.28058910369873047,
-0.08726051449775696,
0.999128520488739,
0.44877153635025024,
-0.482340544462204,
0.3640843629837036,
0.44608280062675476,
-0.2976360321044922,
-0.6678290367126465,
1.4848202466964722,
... |
func New(db *sql.DB) *Postgres {
pg := &Postgres{
DB: db,
migrator: migrations.New(db),
}
base := BaseStore{
DB: db,
Txier: pg.Tx,
}
pg.download = &DownloadStore{base}
pg.user = &UserStore{base}
pg.file = &FileStore{base}
pg.chat = &ChatStore{base}
return pg
} | [
0.18324047327041626,
-0.12592828273773193,
0.11030151695013046,
-0.2661796510219574,
-0.795239269733429,
-0.072437584400177,
-0.9095862507820129,
-0.5583143830299377,
-0.49170446395874023,
-0.15285979211330414,
0.22053734958171844,
-0.4031919538974762,
-0.5420987010002136,
0.71350574493408... |
func (pg *Postgres) Tx(ctx context.Context, txFunc store.TxFunc) (err error) {
tx := shared.GetTx(ctx)
if tx != nil {
return txFunc(ctx)
}
tx, err = pg.BeginTx(ctx, nil)
if err != nil {
return errors.Wrap(err, "begin tx failed")
}
ctx = shared.WithTx(ctx, tx)
//nolint:gocritic
defer func() {
if r := ... | [
-0.020208723843097687,
0.5775447487831116,
1.0326693058013916,
0.09484401345252991,
-0.13347575068473816,
-0.20063935220241547,
0.13625527918338776,
0.30414098501205444,
0.42428916692733765,
0.5503497123718262,
0.17060734331607819,
0.4447798728942871,
0.33282679319381714,
-1.37377452850341... |
func Handshake(sock io.ReadWriter, ih *metainfo.Hash, peerID [20]byte, extensions PeerExtensionBits) (res HandshakeResult, ok bool, err error) {
// Bytes to be sent to the peer. Should never block the sender.
postCh := make(chan []byte, 4)
// A single error value sent when the writer completes.
writeDone := make(ch... | [
-0.23218385875225067,
0.4653574228286743,
0.8786662220954895,
0.2110079973936081,
0.35276150703430176,
-0.4306505024433136,
0.00869937613606453,
-0.5282760858535767,
-0.45448729395866394,
0.571070671081543,
0.002552448771893978,
-0.0784696713089943,
-1.131264328956604,
0.09513773769140244,... |
func grpcTransportFactory(
opts SendOptions,
rpcContext *rpc.Context,
replicas ReplicaSlice,
args roachpb.BatchRequest,
) (Transport, error) {
clients := make([]batchClient, 0, len(replicas))
for _, replica := range replicas {
conn, err := rpcContext.GRPCDial(replica.NodeDesc.Address.String())
if err != nil {... | [
0.14363007247447968,
-0.47747230529785156,
0.6985817551612854,
-0.4724203944206238,
0.24607045948505402,
0.22430264949798584,
0.23045997321605682,
-0.5914292931556702,
-0.33047616481781006,
0.15101873874664307,
-0.6697781682014465,
0.8378828763961792,
-0.37312665581703186,
-0.5601986050605... |
func (gt *grpcTransport) SendNext(done chan BatchCall) {
client := gt.orderedClients[0]
gt.orderedClients = gt.orderedClients[1:]
addr := client.remoteAddr
if log.V(2) {
log.Infof(gt.opts.Context, "sending request to %s: %+v", addr, client.args)
}
if localServer := gt.rpcContext.GetLocalInternalServerForAddr(... | [
-0.00006729909364366904,
0.3069637715816498,
0.8407971262931824,
0.32100701332092285,
0.13017790019512177,
0.19472551345825195,
-0.45721811056137085,
-0.9181539416313171,
0.012048391625285149,
0.08844834566116333,
-0.14657588303089142,
1.2140498161315918,
-0.6698548197746277,
0.44486093521... |
func splitHealthy(clients []batchClient) int {
var nHealthy int
sort.Stable(byHealth(clients))
for _, client := range clients {
if client.healthy {
nHealthy++
}
}
return nHealthy
} | [
-0.1372346132993698,
-0.6205052137374878,
0.7577983140945435,
0.3255716860294342,
0.0962047278881073,
-0.25931721925735474,
0.462897390127182,
-0.3436686098575592,
-0.5028602480888367,
-0.22370970249176025,
-0.2765042185783386,
0.7423536777496338,
-0.8192834258079529,
0.37178993225097656,
... |
func SenderTransportFactory(tracer opentracing.Tracer, sender client.Sender) TransportFactory {
return func(
_ SendOptions, _ *rpc.Context, _ ReplicaSlice, args roachpb.BatchRequest,
) (Transport, error) {
return &senderTransport{tracer, sender, args, false}, nil
}
} | [
0.24242056906223297,
-0.3637080788612366,
0.5685136318206787,
-0.13156858086585999,
-0.5713334083557129,
-0.5003551244735718,
0.3713417053222656,
-0.7168906331062317,
-0.04474474862217903,
-0.22467467188835144,
-0.8302471041679382,
-0.027028411626815796,
0.022545982152223587,
-0.5502077341... |
func (r RHELDriver) DockerComposeDir() string { return "/usr/bin" } | [
-0.8099101185798645,
-0.9482519030570984,
0.6375632286071777,
0.6413835883140564,
-0.07463321834802628,
0.8699005246162415,
1.9273358583450317,
0.3138680160045624,
0.0788702592253685,
-1.1053727865219116,
0.25651922821998596,
-0.30791932344436646,
-0.18248040974140167,
1.0485047101974487,
... |
func LoadRequestFromQuery(query string) Request {
parsedQuery, _ := url.ParseQuery(query)
request := Request{}
request.Token = parsedQuery.Get("token")
request.TeamID = parsedQuery.Get("team_id")
request.TeamDomain = parsedQuery.Get("team_domain")
request.ChannelID = parsedQuery.Get("channel_id")
request.Channel... | [
0.45309555530548096,
-0.670669436454773,
0.6355993747711182,
-1.0924707651138306,
-0.9368904829025269,
-0.18695828318595886,
-1.562973141670227,
-0.9654757380485535,
0.5550614595413208,
-0.6730495095252991,
0.40229296684265137,
0.8339653015136719,
-0.06236056983470917,
0.09329963475465775,... |
func (request *Request) Validate(config config.Config) bool {
return request.Token == config.Token
} | [
-0.647104024887085,
0.07475294172763824,
0.3821054995059967,
0.5999625325202942,
0.16177810728549957,
0.16094684600830078,
-0.7967332005500793,
-0.3725697100162506,
0.04927152022719383,
-0.26277250051498413,
0.07099733501672745,
-0.06768601387739182,
-0.0978495255112648,
0.2227705121040344... |
func (request *Request) UserInList(list []string) bool {
for _, name := range list {
if name == request.UserName || name == request.UserID {
return true
}
}
return false
} | [
-0.8507217764854431,
-1.0767567157745361,
0.4473925232887268,
0.8870354294776917,
-1.0121684074401855,
0.5777004361152649,
-0.7129870653152466,
0.3451137840747833,
0.3493577539920807,
0.24643708765506744,
-0.9263071417808533,
-0.3220360279083252,
-0.591349184513092,
1.2057461738586426,
-... |
func getZipfOffset(N int64, exp, ratio float64) float64 {
z := math.Pow(ratio, 1/exp)
return z * float64(N-1) / (1 - z)
} | [
0.09438630193471909,
0.24790900945663452,
0.28168004751205444,
0.2772435247898102,
-0.9089475870132446,
0.2350013554096222,
1.1828495264053345,
0.3639022707939148,
0.22962379455566406,
-0.05285634845495224,
0.2672208547592163,
-0.41161778569221497,
-0.4084034264087677,
-0.41408511996269226... |
func (b *Zipf) Init(hostSetup *HostSetup, agentNum int) error {
b.Name = "zipf"
b.Seed = b.Seed + int64(agentNum)
rnd := rand.New(rand.NewSource(b.Seed))
rowOffset := getZipfOffset(b.MaxRowID-b.MinRowID, b.RowExponent, b.RowRatio)
b.rowRng = rand.NewZipf(rnd, b.RowExponent, rowOffset, uint64(b.MaxRowID-b.MinRowID-... | [
-0.6240215301513672,
0.2661036252975464,
0.7672406435012817,
-0.6790576577186584,
-0.4205901026725769,
-0.5747493505477905,
1.367516279220581,
0.1788531094789505,
0.017534205690026283,
-0.10652473568916321,
-0.17446601390838623,
0.271307110786438,
-0.2586575448513031,
-0.04631904885172844,... |
func (b *Zipf) Run(ctx context.Context) *Result {
results := NewResult()
if b.client == nil {
results.err = fmt.Errorf("No client set for Zipf")
return results
}
operation := "SetBit"
if b.Operation == "clear" {
operation = "ClearBit"
}
for n := 0; n < b.Iterations; n++ {
// generate IDs from Zipf distr... | [
-1.2026021480560303,
0.8181273937225342,
0.6821041703224182,
-0.3959524929523468,
0.24238289892673492,
-0.4720657467842102,
1.2681931257247925,
-0.35086044669151306,
-0.44862100481987,
0.653203010559082,
-0.3465399146080017,
0.3631344735622406,
-1.2624927759170532,
0.5023568272590637,
-0... |
func main() {
// setup and start the webserver.
portString := fmt.Sprintf(":%d", config.Port)
initTemplates(config.TemplatesDir)
// custom handler with strict url pattern matching
vh := server.NewStrictHandler()
vh.NotFoundHandler = notFoundHandler
vh.HandlePatterns([]string{"/", "/index.html"}, indexHandler)
... | [
-0.19137243926525116,
-0.15842236578464508,
0.8896068930625916,
0.27761754393577576,
-0.04139392822980881,
0.2779034674167633,
0.5829610228538513,
0.5563070178031921,
-0.14462026953697205,
-0.22768299281597137,
-0.39308446645736694,
0.08445438742637634,
-0.12230569869279861,
0.704525470733... |
func indexHandler(res http.ResponseWriter, req *http.Request) {
defer server.LogRequest(req, http.StatusOK)
username, err := session.Username(req)
if err == nil {
data := struct{ Username string }{Username: username}
// a username was found, greet them.
renderBaseTemplate(res, "index.html", data)
} else {
... | [
-0.27533960342407227,
-0.09491951018571854,
0.4114539921283722,
0.5985382795333862,
-0.3960226774215698,
0.03225609287619591,
0.7189095616340637,
0.5452473163604736,
0.497598260641098,
-0.0549406036734581,
0.05250536650419235,
-0.334518164396286,
-0.4974863529205322,
-0.22816717624664307,
... |
func loginHandler(res http.ResponseWriter, req *http.Request) {
defer server.LogRequest(req, http.StatusFound)
counter.Increment("login")
// get the requested username
username := req.FormValue("name")
if len(username) < 1 {
renderBaseTemplate(res, "login_error.html", nil)
} else {
err := session.Create(res,... | [
-0.5871191620826721,
0.09746531397104263,
0.6940411925315857,
0.6087943315505981,
-0.2795204520225525,
0.59027498960495,
0.45292267203330994,
0.41048532724380493,
0.5954166054725647,
-0.5293762683868408,
-0.546065628528595,
-0.8856663703918457,
-0.75258469581604,
-0.1565614491701126,
0.8... |
func logoutHandler(res http.ResponseWriter, req *http.Request) {
defer server.LogRequest(req, http.StatusFound)
session.Destroy(req, res)
renderBaseTemplate(res, "logout.html", nil)
} | [
-0.4460044801235199,
-1.2927420139312744,
0.5293317437171936,
-0.47075459361076355,
-0.6973558664321899,
-0.16075745224952698,
0.2756243348121643,
0.997079610824585,
0.6277436017990112,
0.341011106967926,
0.5523033738136292,
-0.505488395690918,
0.41639986634254456,
0.3059699535369873,
0.... |
func timeHandler(res http.ResponseWriter, req *http.Request) {
defer server.LogRequest(req, http.StatusOK)
// replace empty string with the username text if logged in.
data := struct {
Time string
MilitaryTime string
Username string
}{
Time: time.Now().Local().Format(TIME_LAYOUT),
Mil... | [
-0.32781967520713806,
0.28993338346481323,
0.718315839767456,
0.6752291321754456,
-0.8582367300987244,
0.7284938097000122,
0.6214261651039124,
0.0631321370601654,
0.2904633581638336,
0.5686138272285461,
-0.010511426255106926,
-1.133366346359253,
-0.42133671045303345,
0.8746736645698547,
... |
func notFoundHandler(res http.ResponseWriter, req *http.Request) {
defer server.LogRequest(req, http.StatusNotFound)
res.WriteHeader(http.StatusNotFound)
renderBaseTemplate(res, "404.html", nil)
} | [
-0.45231786370277405,
-0.83501797914505,
0.20660409331321716,
0.44897690415382385,
-0.3707296550273895,
0.5847333073616028,
0.628171443939209,
0.6601740121841431,
0.03255254402756691,
-0.41901615262031555,
-0.021859727799892426,
-0.4761039614677429,
-0.13034716248512268,
0.4918033480644226... |
func BenchmarkLemireCreate(b *testing.B) {
for i := 0; i < b.N; i++ {
bitmap := New(0) // we force dynamic memory allocation
for v := uint(0); v <= 100000000; v += 100 {
bitmap.Set(v)
}
}
} | [
-0.04985324293375015,
0.9625330567359924,
0.4503185749053955,
-0.5195401906967163,
1.1649376153945923,
0.010932439006865025,
0.5835874676704407,
-0.471906840801239,
0.20149186253547668,
-0.18840143084526062,
0.029729772359132767,
-0.22234013676643372,
-0.2781226933002472,
1.420237779617309... |
func BenchmarkLemireCount(b *testing.B) {
bitmap := New(100000000) // we force dynamic memory allocation
for v := uint(0); v <= 100000000; v += 100 {
bitmap.Set(v)
}
sum := uint(0)
for i := 0; i < b.N; i++ {
sum += bitmap.Count()
}
if sum == 0 { // added just to fool ineffassign
return
}
} | [
0.6314103007316589,
0.48051032423973083,
0.5740493535995483,
-0.5429978966712952,
0.7507818937301636,
-0.22295109927654266,
0.902644693851471,
0.3108796775341034,
0.3113041818141937,
-0.05524297431111336,
-0.11510802805423737,
-0.31833013892173767,
-0.5249039530754089,
1.324876070022583,
... |
func BenchmarkLemireIterate(b *testing.B) {
bitmap := New(100000000) // we force dynamic memory allocation
for v := uint(0); v <= 100000000; v += 100 {
bitmap.Set(v)
}
sum := uint(0)
for i := 0; i < b.N; i++ {
for i, e := bitmap.NextSet(0); e; i, e = bitmap.NextSet(i + 1) {
sum++
}
}
if sum == 0 { // ad... | [
0.09708133339881897,
0.7112540602684021,
0.6920950412750244,
-0.28622886538505554,
0.3833973705768585,
-0.6455031633377075,
0.9614846110343933,
-0.2619718611240387,
0.3816152811050415,
0.15854856371879578,
0.26250919699668884,
-0.3068419396877289,
-0.7438567280769348,
1.0401161909103394,
... |
func (plgf PLGridFacade) SetId(smRecord *SMRecord, id string) {
smRecord.JobID = id
} | [
0.8529356718063354,
0.2593938708305359,
0.48757341504096985,
0.5138706564903259,
-0.2325325459241867,
0.2673272490501404,
0.45736178755760193,
0.3275549113750458,
-0.28454598784446716,
0.011540520004928112,
-0.48474276065826416,
1.1857103109359741,
-0.5617706179618835,
1.1252044439315796,
... |
func Initialisieren (keim int64) {
rand.Seed (keim)
} | [
0.2170010358095169,
-0.0881737768650055,
0.19438061118125916,
0.8122255206108093,
0.1910659670829773,
0.23503783345222473,
0.6292091608047485,
0.1404585838317871,
0.027898674830794334,
-0.4971196949481964,
-0.897087812423706,
0.012317033484578133,
-0.5028309226036072,
1.6416455507278442,
... |
func Randomisieren () {
rand.Seed(time.Now().UnixNano())
} | [
0.09919550269842148,
-0.11094070225954056,
0.3071762025356293,
0.2602255642414093,
0.25211992859840393,
0.3829805850982666,
-0.1618618667125702,
0.43917176127433777,
-0.1503637582063675,
-0.23370707035064697,
-0.9185660481452942,
0.2808826267719269,
-0.15571466088294983,
1.0679775476455688... |
func Zufallszahl (a,b int64) int64 {
return a + rand.Int63n(b-a+1)
} | [
0.1275886744260788,
0.1635725200176239,
0.21944710612297058,
0.6405293345451355,
-0.25120115280151367,
0.2388157993555069,
0.8733442425727844,
-0.41161513328552246,
1.2292884588241577,
-0.11038707941770554,
0.29124635457992554,
-0.3273313641548157,
0.04314219206571579,
0.34599438309669495,... |
func (*DataSource) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*DataSource_Filename)(nil),
(*DataSource_InlineBytes)(nil),
(*DataSource_InlineString)(nil),
}
} | [
-1.4217342138290405,
0.29764631390571594,
0.11201823502779007,
-0.9710648059844971,
0.4243241250514984,
-0.9243290424346924,
-0.17193388938903809,
0.40287667512893677,
1.1679996252059937,
-0.21840451657772064,
-1.2611846923828125,
0.1222744733095169,
0.33097824454307556,
0.4869544506072998... |
func (*AsyncDataSource) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*AsyncDataSource_Local)(nil),
(*AsyncDataSource_Remote)(nil),
}
} | [
-1.631833553314209,
0.44168612360954285,
0.07726877927780151,
-0.7755699753761292,
0.4800785779953003,
-0.547293484210968,
-0.3543420433998108,
0.25132015347480774,
0.9606451988220215,
0.06028987839818001,
-0.5081912875175476,
0.12349461764097214,
0.3716648519039154,
0.44174015522003174,
... |
func (*TransportSocket) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*TransportSocket_TypedConfig)(nil),
}
} | [
-1.6119645833969116,
0.8896868824958801,
0.49588915705680847,
-0.6280378103256226,
0.7017924785614014,
0.031772639602422714,
0.16701094806194305,
-0.6046667695045471,
1.0566201210021973,
0.29428017139434814,
-0.40853655338287354,
0.5471838712692261,
-0.47907695174217224,
0.4742463529109955... |
func (*SocketOption) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*SocketOption_IntValue)(nil),
(*SocketOption_BufValue)(nil),
}
} | [
-1.0972316265106201,
0.2338644564151764,
0.5087152719497681,
0.10825297981500626,
0.5024079084396362,
-0.2601984441280365,
0.3510158061981201,
-1.4277642965316772,
1.4390568733215332,
0.6497200727462769,
-0.8076527118682861,
0.4938249886035919,
-0.5543237924575806,
0.7716203927993774,
0.... |
func StartApplicatin() {
mapUrls()
router.Run(":8080")
} | [
-0.10049151629209518,
-1.1563140153884888,
0.4413781464099884,
0.3109903037548065,
-0.64909428358078,
0.7785525918006897,
0.33508649468421936,
0.8145865201950073,
-0.14725904166698456,
-0.34900256991386414,
0.35900557041168213,
1.1728966236114502,
0.5059973001480103,
0.5312232971191406,
... |
func (v LabelSet) String() string {
if v.LabelSet == nil {
return ""
}
records := make([]string, 0, len(v.LabelSet)>>1)
for k, v := range v.LabelSet {
records = append(records, string(k)+"="+string(v))
}
var buf bytes.Buffer
w := csv.NewWriter(&buf)
if err := w.Write(records); err != nil {
panic(err)
}
... | [
-0.08966485410928726,
-0.6824946403503418,
0.2054329663515091,
-1.452957034111023,
-0.4945043623447418,
0.06011657416820526,
-0.5480599403381348,
-1.3259209394454956,
-0.5869675278663635,
0.05019448697566986,
0.5972225069999695,
1.056835651397705,
0.22609777748584747,
-0.171353280544281,
... |
func (v *LabelSet) UnmarshalYAML(unmarshal func(interface{}) error) error {
lbSet := model.LabelSet{}
err := unmarshal(&lbSet)
if err != nil {
return err
}
v.LabelSet = lbSet
return nil
} | [
0.0024628012906759977,
0.29611024260520935,
0.4685346186161041,
-1.2960799932479858,
-0.8440819978713989,
-0.7576801180839539,
0.21787592768669128,
-0.15380334854125977,
-0.03290532901883125,
0.014099331572651863,
0.649543821811676,
0.9188726544380188,
0.5123845934867859,
-0.23308628797531... |
func checkScramble(s1 string, s2 string, m map[[2]string]bool) bool {
if s1==s2 {
m[[2]string{s1,s2}] = true
return true
}
//if len(s1)!=len(s2) || sortString(s1)!=sortString(s2) {
if !containSameChar(s1, s2) {
m[[2]string{s1,s2}] = false
return false
}
//var n ... | [
-0.3927890658378601,
-0.1519712209701538,
1.0440467596054077,
0.5221498012542725,
-0.9377121925354004,
-0.3734362721443176,
-0.1508352905511856,
-0.40423810482025146,
-0.40619730949401855,
0.6363767981529236,
-0.6665017008781433,
0.6302003264427185,
-0.9024699926376343,
-0.1484802663326263... |
func copyStates(m map[string]*ExchangeState) map[string]*ExchangeState {
c := make(map[string]*ExchangeState)
for k, v := range m {
c[k] = v
}
return c
} | [
-0.435928612947464,
-0.18123923242092133,
0.3621351718902588,
-1.1944396495819092,
-1.5016329288482666,
0.5680559277534485,
0.05105463042855263,
-0.1497286707162857,
0.9482717514038086,
0.6837584972381592,
0.5195248126983643,
-0.9985237717628479,
0.04030410572886467,
-0.4344242215156555,
... |
func (state ExchangeBotState) copy() *ExchangeBotState {
state.DcrBtc = copyStates(state.DcrBtc)
state.FiatIndices = copyStates(state.FiatIndices)
return &state
} | [
-0.6159647703170776,
-0.31191185116767883,
0.21631935238838196,
-0.37546831369400024,
-0.8293859362602234,
0.7350860834121704,
0.20984384417533875,
-0.7092721462249756,
0.7435266971588135,
-0.21253103017807007,
0.04333724081516266,
0.11958422511816025,
-0.39455223083496094,
-0.470141768455... |
func NewExchangeBot(config *ExchangeBotConfig) (*ExchangeBot, error) {
// Validate configuration
if config.DataExpiry == "" {
config.DataExpiry = DefaultDataExpiry
}
if config.RequestExpiry == "" {
config.RequestExpiry = DefaultRequestExpiry
}
dataExpiry, err := time.ParseDuration(config.DataExpiry)
if err !... | [
-0.14756931364536285,
-0.11000961065292358,
0.7988314032554626,
-0.3589193820953369,
-0.0881231501698494,
-0.007465093396604061,
-0.8824475407600403,
-0.2078903615474701,
-0.19096411764621735,
0.25609105825424194,
-0.36160168051719666,
0.20235863327980042,
-0.5345836281776428,
-0.167935565... |
func (bot *ExchangeBot) Start(ctx context.Context, wg *sync.WaitGroup) {
tick := time.NewTimer(time.Second)
// Start refresh on all exchanges, and then change the updateTimes to
// de-sync the updates.
timeBetween := bot.DataExpiry / time.Duration(len(bot.Exchanges))
idx := 0
for _, xc := range bot.Exchanges {
... | [
-0.3559933304786682,
0.1493401974439621,
0.4760655164718628,
-0.21627920866012573,
-0.4113362729549408,
-0.11735506355762482,
0.1561436802148819,
-0.2959875464439392,
-0.09871751815080643,
0.5632649064064026,
-0.11840556561946869,
0.7171118855476379,
-0.43042218685150146,
0.142502009868621... |
func (bot *ExchangeBot) UpdateChannels() *UpdateChannels {
update := make(chan *UpdateSignal, 16)
quit := make(chan struct{})
bot.Lock()
defer bot.Unlock()
bot.updateChans = append(bot.updateChans, update)
bot.quitChans = append(bot.quitChans, quit)
return &UpdateChannels{
Update: update,
Quit: quit,
}
} | [
-0.5771366357803345,
-0.7806476950645447,
0.5323350429534912,
-0.9815037250518799,
-0.5310473442077637,
-0.12792173027992249,
-1.19773530960083,
-1.1604958772659302,
0.003615599824115634,
0.19652880728244781,
0.00111121847294271,
-0.08647686243057251,
-0.971840500831604,
-0.392505586147308... |
func (bot *ExchangeBot) signalUpdate(token string) {
var signal *UpdateSignal
if bot.IsFailed() {
signal = &UpdateSignal{
Token: token,
State: nil,
Bytes: []byte{},
}
} else {
signal = &UpdateSignal{
Token: token,
State: bot.State(),
Bytes: bot.StateBytes(),
}
}
for _, ch := range bot.upd... | [
-0.6590946912765503,
-0.5367557406425476,
0.4782628118991852,
-0.2882407605648041,
-0.13969355821609497,
-0.25277429819107056,
-1.654819130897522,
-0.6132909059524536,
0.166382297873497,
0.40896075963974,
-1.2003843784332275,
-0.04717981815338135,
-0.6338685154914856,
-0.04976773262023926,... |
func (bot *ExchangeBot) IsUpdated() bool {
oldestValid := time.Now().Add(-bot.RequestExpiry)
for _, xc := range bot.Exchanges {
lastUpdate := xc.LastUpdate()
if lastUpdate.Before(oldestValid) {
return false
}
if xc.LastFail().After(lastUpdate) {
return false
}
}
return true
} | [
-0.6092234253883362,
-0.5753498673439026,
0.6650997996330261,
0.03628828749060631,
-0.11044607311487198,
0.5800238847732544,
-0.8164415955543518,
0.6370162963867188,
1.0700488090515137,
-0.16582496464252472,
0.08367835730314255,
0.08233389258384705,
-0.6111147999763489,
-0.0923418104648590... |
func (bot *ExchangeBot) State() *ExchangeBotState {
bot.RLock()
defer bot.RUnlock()
return bot.stateCopy
} | [
-0.6758719682693481,
-0.02983020804822445,
0.21296118199825287,
0.20840750634670258,
-0.639192521572113,
0.6339327692985535,
0.2592322528362274,
-0.27948489785194397,
0.48437491059303284,
-0.2506459355354309,
0.2816070020198822,
0.7965860366821289,
-0.9339492321014404,
0.10891912132501602,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.