text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (u User) Verify(r *http.Request, db *sql.DB) bool {
var DBUser User
err := DBUser.Get(r, db, fmt.Sprint(u.Credentials.Value))
if err != nil {
return false
}
isValidKey := crypt.VerifyPassHash(DBUser.Credentials.Key, u.Credentials.Key)
isValidUUID := DBUser.UUID == crypt.Hash(u.UUID)
if isValidKey && isVa... | [
-0.48489439487457275,
0.7742899060249329,
0.4545062482357025,
1.4230891466140747,
-0.21813394129276276,
0.5719767808914185,
-0.4601130485534668,
0.06521736830472946,
-0.3240736722946167,
-0.15234936773777008,
-1.1366119384765625,
-0.03570714220404625,
-0.4133290648460388,
0.273122727870941... |
func (u User) StoreLogin(r *http.Request, db *sql.DB) error {
// language=PostgreSQL
return UpdateErr(tdb.Exec(r, db, `UPDATE users
SET last_login = NOW(), app_version = $1, is_connected = true, firebase_token = $2
WHERE credentials = $3 AND UUID = $4`, u.AppVersion, u.FirebaseToken, crypt.Hash(u.Credentials.Value)... | [
-0.9737025499343872,
-0.34895336627960205,
0.35150346159935,
0.14472219347953796,
-0.49828261137008667,
0.6982001662254333,
-0.4562191665172577,
0.05133577063679695,
0.4225975275039673,
-0.08036637306213379,
-0.5772075653076172,
-0.28775733709335327,
-0.08465015888214111,
-0.10862442106008... |
func (u User) CloseLogin(r *http.Request, db *sql.DB) error {
// language=PostgreSQL
return UpdateErr(tdb.Exec(r, db, `UPDATE users
SET is_connected = false
WHERE credentials = $1 AND UUID = $2`, crypt.Hash(u.Credentials.Value), crypt.Hash(u.UUID)))
} | [
-1.4221184253692627,
-0.5567126274108887,
0.4562907814979553,
0.16160985827445984,
-0.8185418844223022,
1.4513801336288452,
-0.569651186466217,
0.2234724760055542,
-0.8797566294670105,
0.31867867708206177,
0.37746018171310425,
-0.20069503784179688,
-1.0098642110824585,
-0.38152095675468445... |
func (u User) SendStoredNotifications(r *http.Request, db *sql.DB, ws *websocket.Conn) error {
// send all stored notifications from db
notifications, err := u.FetchNotifications(db)
if err != nil {
return err
}
if len(notifications) > 0 {
bytes, err := json.Marshal(notifications)
if err == nil {
if err ... | [
-0.2879623472690582,
0.5087270140647888,
0.5425305366516113,
0.8237918019294739,
-0.06270802021026611,
0.37735438346862793,
0.7364783883094788,
-1.11622154712677,
0.3760620355606079,
0.25170862674713135,
-0.7746588587760925,
0.7083808183670044,
0.05852122604846954,
1.0603162050247192,
-0... |
func (b *Booking) Marshal() []byte {
bnLen, _ := hex.DecodeString(fmt.Sprintf("%02x", len(b.BookerName)))
facLen, _ := hex.DecodeString(fmt.Sprintf("%02x", len(b.Fac)))
payload := bnLen
payload = append(payload, []byte(b.BookerName)...)
payload = append(payload, []byte(b.Start.ToBytes())...) // 7 bytes
pa... | [
-0.31816044449806213,
0.41416028141975403,
0.9471643567085266,
0.1507902443408966,
-0.5493108630180359,
0.7309966087341309,
-0.5957112312316895,
0.3978632688522339,
-1.05469810962677,
-0.44012439250946045,
-0.16720886528491974,
0.9974838495254517,
-0.6777433156967163,
0.7474658489227295,
... |
func Unmarshal(data []byte) (*Booking,error) {
index := 0
// Booker Name
bnLen := int(data[index])
bn := string(data[index+1:index+1+bnLen])
index += 1+bnLen // Get next byte
// Start Date
sd := data[index:index+3]
index += 3 // Get next byte
// End Date
ed := data[index:index+3]
index += 3 // G... | [
-0.7108089923858643,
0.11558263003826141,
0.7687146663665771,
0.10540106892585754,
-1.1120985746383667,
0.18138085305690765,
0.8305349946022034,
0.9519336819648743,
-0.18207566440105438,
-0.12037450820207596,
0.22425171732902527,
0.10532432794570923,
-0.43893617391586304,
-0.35341054201126... |
func NewBooking(name string, start Date, end Date, f facility.Facility) Booking{
// Confirmation ID is a SHA1 hash in the form of BookerName@Current Time
h := sha1.New()
h.Write([]byte(name+"@"+time.Now().String()))
bs := h.Sum(nil)
cid := fmt.Sprintf("%x",bs)
return Booking{
BookerName: name,
Con... | [
-0.48393702507019043,
-0.5555647611618042,
0.38437187671661377,
1.4425694942474365,
-0.9326962232589722,
0.3220669627189636,
-0.10296511650085449,
0.5697023868560791,
-0.8678152561187744,
0.2014545500278473,
-0.17189832031726837,
-0.640467643737793,
0.06691165268421173,
0.38847416639328003... |
func (a TwitterApi) VerifyCredentials() (ok bool, err error) {
v := cleanValues(nil)
v.Set("include_entities", "false")
v.Set("skip_status", "true")
_, err = a.GetSelf(v)
return err == nil, err
} | [
-0.57656329870224,
0.13718797266483307,
0.5387147665023804,
0.05769362673163414,
0.4965539872646332,
0.680708646774292,
0.4829600155353546,
0.16226601600646973,
-0.022788522765040398,
0.41894233226776123,
-0.7258942127227783,
-0.018872102722525597,
-0.857451319694519,
1.2657334804534912,
... |
func (a TwitterApi) GetSelf(v url.Values) (u User, err error) {
v = cleanValues(v)
response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/account/verify_credentials.json", v, &u, _GET, response_ch}
return u, (<-response_ch).err
} | [
-0.14447951316833496,
0.3364998996257782,
0.26401448249816895,
0.6521364450454712,
-0.01915658824145794,
-0.7695307731628418,
0.6788172721862793,
-0.5484360456466675,
0.37699103355407715,
-0.7154202461242676,
-0.6565514206886292,
1.2309589385986328,
-0.162428081035614,
0.3085407316684723,
... |
func (m *PluginMetaData) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAPIVersion(formats); err != nil {
res = append(res, err)
}
if err := m.validateDataVersion(formats); err != nil {
res = append(res, err)
}
if err := m.validateLastUsedOfKind(formats); err != nil {
res =... | [
0.07306205481290817,
-0.7369594573974609,
0.275372713804245,
-0.021835261955857277,
0.5767386555671692,
-0.02810305543243885,
0.31077706813812256,
-0.904699981212616,
-0.4887917637825012,
0.3115463852882385,
-0.4263162910938263,
0.48632994294166565,
-1.0659055709838867,
0.3194992244243622,... |
func (c Client) Create(input *CreateEnvironmentInput) (*CreateEnvironmentResponse, error) {
return c.CreateWithContext(context.Background(), input)
} | [
-0.6537110209465027,
0.30541616678237915,
0.16280494630336761,
0.9550009369850159,
0.0031284410506486893,
0.8613719940185547,
0.9931097030639648,
-1.2894140481948853,
-0.10749651491641998,
-0.032270144671201706,
0.03652212396264076,
-0.1701360046863556,
-1.3279320001602173,
1.1212333440780... |
func (c Client) CreateWithContext(context context.Context, input *CreateEnvironmentInput) (*CreateEnvironmentResponse, error) {
op := client.Operation{
Method: http.MethodPost,
URI: "/Services/{serviceSid}/Environments",
ContentType: client.URLEncoded,
PathParams: map[string]string{
"serviceSid... | [
-1.2138488292694092,
0.15737557411193848,
0.5886545181274414,
-0.08469176292419434,
-0.4968736171722412,
0.270336776971817,
-0.09225722402334213,
-1.8024698495864868,
0.426545113325119,
0.4945327639579773,
-0.5086793899536133,
0.15761326253414154,
-0.9473841786384583,
0.6919471621513367,
... |
func Xor() gate.Chip {
and1 := gate.And()
and2 := gate.And()
not := gate.Not()
or := gate.Or()
and1.Out(not.In1)
not.Out(and2.In1)
or.Out(and2.In2)
return gate.NewChip(xorMap, 2, 1, and2, and1, not, or)
} | [
-0.44416558742523193,
-0.7151153683662415,
0.45633092522621155,
0.32212692499160767,
-1.8107426166534424,
-0.04925774410367012,
-0.43174439668655396,
0.6970654129981995,
-0.01770523563027382,
-0.01735571026802063,
0.08347997069358826,
0.2301473617553711,
-0.2314959168434143,
-0.28421831130... |
func Mux() gate.Chip {
and1 := gate.And()
and2 := gate.And()
or := gate.Or()
not := gate.Not()
not.Out(and1.In2)
and1.Out(or.In1)
and2.Out(or.In2)
return gate.NewChip(muxMap, 3, 1, or, and1, and2, not)
} | [
-0.6844004988670349,
-0.2487032264471054,
0.7340347766876221,
0.5768890380859375,
-1.6821911334991455,
0.37963035702705383,
-1.049074411392212,
0.6729263067245483,
0.8108171224594116,
0.04430348798632622,
0.04792868718504906,
0.6541465520858765,
0.038725320249795914,
-0.6352251768112183,
... |
func Dmux() gate.Chip {
and1 := gate.And()
and2 := gate.And()
not := gate.Not()
not.Out(and1.In2)
return gate.NewChip(demuxMap, 2, 2, and1, and2, not)
} | [
-1.3557875156402588,
0.48379331827163696,
0.7860949635505676,
0.24923402070999146,
-1.5170851945877075,
0.21876756846904755,
-1.0744720697402954,
0.8381519913673401,
0.2868558168411255,
-0.748219907283783,
-0.4699452817440033,
0.9756982922554016,
-0.04473254829645157,
-0.3193452060222626,
... |
func And16() gate.Chip {
gates := make([]*gate.Gate, 16)
for i := range gates {
gates[i] = gate.And()
}
return gate.NewChip(arrayMap, 32, 16, gates...)
} | [
1.298054814338684,
0.6370995044708252,
0.46053528785705566,
-0.0871422067284584,
-0.6292268633842468,
-0.34425029158592224,
-0.39792704582214355,
0.4295859634876251,
0.12679821252822876,
0.024161210283637047,
-0.04574080929160118,
0.6539931893348694,
-0.008638900704681873,
0.23081514239311... |
func Or16() gate.Chip {
gates := make([]*gate.Gate, 16)
for i := range gates {
gates[i] = gate.Or()
}
return gate.NewChip(arrayMap, 32, 16, gates...)
} | [
0.651341438293457,
0.6739399433135986,
0.34226325154304504,
-0.7301914691925049,
-0.3641875386238098,
-0.3209022879600525,
-0.37927064299583435,
0.0036436568479985,
0.11314810812473297,
0.0625268965959549,
0.11475425958633423,
0.524594783782959,
-0.17858807742595673,
-0.2981693148612976,
... |
func Not16() gate.Chip {
gates := make([]*gate.Gate, 16)
for i := range gates {
gates[i] = gate.Not()
}
return gate.NewChip(arrayNotMap, 16, 16, gates...)
} | [
0.6931041479110718,
0.38795408606529236,
0.3595959544181824,
0.3595835268497467,
-0.5394996404647827,
0.3543526232242584,
-0.1635383665561676,
0.12673363089561462,
-0.10337170958518982,
0.24882429838180542,
-0.32876837253570557,
0.7093729376792908,
-0.8653108477592468,
-0.07857665419578552... |
func Mux16() gate.Chip {
return nil
} | [
0.8705000877380371,
0.5145598649978638,
0.5831167101860046,
0.07757996767759323,
-0.7232936024665833,
-0.4069671630859375,
-0.6255599856376648,
-0.3625907897949219,
0.6740795969963074,
-0.7582462430000305,
0.06216241791844368,
0.605495274066925,
-0.20550471544265747,
0.2422754466533661,
... |
func (sm SystemMetricsInfo) Export() model.SystemMetricsInfo {
return model.SystemMetricsInfo{
Project: sm.Project,
Version: sm.Version,
Variant: sm.Variant,
TaskName: sm.TaskName,
TaskID: sm.TaskId,
Execution: int(sm.Execution),
Mainline: sm.Mainline,
}
} | [
0.887484073638916,
-0.3138361871242523,
0.4896840751171112,
0.654547393321991,
-0.8756353855133057,
0.8570407032966614,
0.22782237827777863,
-0.5091254711151123,
-0.3676242530345917,
0.28674808144569397,
-0.7532090544700623,
0.4357775151729584,
-0.5256364345550537,
0.4661927819252014,
-0... |
func (sm SystemMetricsArtifactInfo) Export() model.SystemMetricsArtifactOptions {
return model.SystemMetricsArtifactOptions{
Compression: sm.Compression.Export(),
Schema: sm.Schema.Export(),
}
} | [
1.873970866203308,
-0.10743720084428787,
0.14355523884296417,
0.9257975220680237,
-0.23383012413978577,
0.4919540584087372,
0.6106617450714111,
-0.6467416882514954,
0.10185849666595459,
-0.21077048778533936,
-0.17995166778564453,
0.7009514570236206,
0.5697867274284363,
0.1385105401277542,
... |
func getLocation(w http.ResponseWriter, request *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(locations)
} | [
-1.1250425577163696,
-0.8883728384971619,
0.6942180395126343,
0.2542971968650818,
-0.13401231169700623,
-0.35538724064826965,
0.5366281270980835,
-0.12311513721942902,
-0.22295397520065308,
0.5767220258712769,
-0.13848114013671875,
0.13833996653556824,
0.3743395507335663,
0.167401432991027... |
func CreateServer(
ctx context.Context,
logger log.Logger,
config *config.Config,
DB db.DataServerProxy,
client contracts.ETHClient,
contract *contracts.ITellor,
account *rpc.Account,
) (*DataServer, error) {
run, err := tracker.NewRunner(logger, config, DB, client, contract, account)
if err != nil {
return ... | [
-0.2709224224090576,
-0.13556228578090668,
0.5979179739952087,
-0.8066068291664124,
0.5414506793022156,
0.3192813992500305,
-0.163116917014122,
0.2892804443836212,
0.4320995509624481,
-0.05978882312774658,
-0.4929521083831787,
0.08953540772199631,
-0.6296486854553223,
0.24647289514541626,
... |
func (ds *DataServer) Start(ctx context.Context, exitCh chan int) error {
ds.exitCh = exitCh
ds.runnerExitCh = make(chan int)
ds.Stopped = false
err := ds.runner.Start(ctx, ds.runnerExitCh)
if err != nil {
return errors.Wrap(err, "starting runner data server")
}
go func() {
<-ds.runner.Ready()
level.Info(... | [
-1.3269004821777344,
0.12554103136062622,
0.4541644752025604,
-0.9342385530471802,
0.07575654238462448,
0.3058722913265228,
0.001587725942954421,
1.0392817258834839,
-0.5967573523521423,
0.2993251383304596,
-1.3700848817825317,
1.4072656631469727,
0.6853225231170654,
0.4474664628505707,
... |
func (ds *DataServer) Ready() chan bool {
return ds.readyChannel
} | [
-0.855034589767456,
0.30061355233192444,
0.47803783416748047,
-1.534211277961731,
-0.3488442003726959,
0.14903946220874786,
-0.44443750381469727,
0.45288580656051636,
0.29313868284225464,
-0.467540979385376,
-0.7513492107391357,
1.9492021799087524,
0.1824534684419632,
0.5425987839698792,
... |
func (ts *TriggerStatus) GetCondition(t apis.ConditionType) *apis.Condition {
return triggerCondSet.Manage(ts).GetCondition(t)
} | [
0.41834935545921326,
-0.23635265231132507,
0.10535278171300888,
0.5844942331314087,
0.02862582728266716,
-0.775051474571228,
0.27339234948158264,
-0.4223480224609375,
0.17473594844341278,
-0.2781546711921692,
-0.39594408869743347,
0.37647560238838196,
0.38109102845191956,
0.410039663314819... |
func (ts *TriggerStatus) GetTopLevelCondition() *apis.Condition {
return triggerCondSet.Manage(ts).GetTopLevelCondition()
} | [
0.8502944111824036,
-0.7926435470581055,
0.40411677956581116,
-0.4228075444698334,
-0.7831987738609314,
-0.12765510380268097,
0.7301163673400879,
-0.07449425011873245,
0.04677487537264824,
-0.6392883658409119,
-0.3085300922393799,
0.893433153629303,
0.027613788843154907,
0.3295490145683288... |
func (ts *TriggerStatus) IsReady() bool {
return triggerCondSet.Manage(ts).IsHappy()
} | [
-0.6763923764228821,
0.8400885462760925,
0.29277336597442627,
0.46286991238594055,
-0.1885141283273697,
-0.7896381616592407,
-0.3505006432533264,
0.2517525851726532,
-0.26967084407806396,
-0.36569416522979736,
-1.1276899576187134,
0.42920181155204773,
0.874224066734314,
0.41119706630706787... |
func (ts *TriggerStatus) InitializeConditions() {
triggerCondSet.Manage(ts).InitializeConditions()
} | [
-0.07070065289735794,
0.2560809552669525,
0.26483678817749023,
0.32316502928733826,
0.2880907952785492,
-0.8820257782936096,
0.6431971192359924,
0.1795433759689331,
-0.5872383117675781,
-0.5728310346603394,
-0.6792739033699036,
-0.13998843729496002,
0.22273442149162292,
0.48450711369514465... |
func Daemon(name string, arg ...string) *D {
cmd := &D{
Path: name,
Args: append([]string{name}, arg...),
}
if filepath.Base(name) == name {
if lp, err := exec.LookPath(name); err != nil {
cmd.lookPathErr = err
} else {
cmd.Path = lp
}
}
return cmd
} | [
-0.2317855805158615,
-0.9100460410118103,
0.5536280870437622,
-0.26647573709487915,
-0.7314713001251221,
0.05864891782402992,
0.18583868443965912,
-0.27349942922592163,
0.16074150800704956,
-1.3751964569091797,
0.47327035665512085,
0.7185083627700806,
0.4145354628562927,
0.3038605749607086... |
func DaemonFrom(c *exec.Cmd) *D {
cmd := convertFromExec(c)
return cmd
} | [
-0.15588845312595367,
-0.5534049868583679,
0.35114145278930664,
-0.19427533447742462,
-0.6486862897872925,
0.17059582471847534,
0.21372844278812408,
-0.29991477727890015,
0.8726884722709656,
-1.8752466440200806,
0.41190096735954285,
0.42230477929115295,
0.9643080830574036,
-0.1577926725149... |
func (c *D) Command() *exec.Cmd {
return c.cmd
} | [
0.025178106501698494,
-0.17243608832359314,
0.3771685063838959,
0.7607817649841309,
0.4798281788825989,
1.3355400562286377,
0.3679395020008087,
-0.03502946346998215,
0.8120517134666443,
-1.9183692932128906,
1.1589184999465942,
1.0596356391906738,
0.5073257088661194,
0.28495556116104126,
... |
func (c *D) Pid() (int, error) {
if !c.IsRunning() {
return 0, ErrNotRunning
}
return c.cmd.Process.Pid, nil
} | [
0.22141379117965698,
-0.4047827422618866,
0.5234701037406921,
0.39392057061195374,
0.07139843702316284,
1.246785283088684,
0.9651670455932617,
0.08913019299507141,
0.12739890813827515,
-0.5458211898803711,
1.156087875366211,
0.46598029136657715,
-0.7631030678749084,
0.6409169435501099,
1... |
func (c *D) Signal(signal os.Signal) error {
if !c.IsRunning() {
return ErrNotRunning
}
return c.cmd.Process.Signal(signal)
} | [
-0.8537477850914001,
0.1457524448633194,
0.3231686055660248,
0.5501875877380371,
-0.3009217083454132,
0.3814446032047272,
0.3033411204814911,
-0.44616901874542236,
-0.07256076484918594,
-0.9068984985351562,
-0.6119570732116699,
0.758861243724823,
0.2612992525100708,
1.0764719247817993,
0... |
func (c *D) Name() string {
if len(c.Args) > 0 {
return c.Args[0]
}
return c.Path
} | [
-0.6310803294181824,
0.0243216622620821,
0.6945022344589233,
0.22500281035900116,
-0.07984989881515503,
-0.1620221585035324,
0.999752402305603,
-0.02384086884558201,
-0.6319212913513184,
0.4631786048412323,
0.730109691619873,
-0.7094501852989197,
0.17673206329345703,
0.686760663986206,
-... |
func (c *D) SetGracePeriod(d time.Duration) {
c.gracePeriod = d
} | [
-0.008441518060863018,
0.6059911251068115,
0.5713576078414917,
-0.6189973950386047,
0.21277152001857758,
1.6217752695083618,
0.5721276998519897,
-0.7576552033424377,
0.10971486568450928,
0.2827783226966858,
-0.42948925495147705,
0.3708522319793701,
-0.24904251098632812,
1.0329488515853882,... |
func (c *D) SetGracefulShutDown(f func(*exec.Cmd) error) {
c.gracefulShutDown = f
} | [
0.04448206350207329,
0.3990896940231323,
0.6649373769760132,
-0.016541605815291405,
0.06074412912130356,
0.44586414098739624,
1.0012869834899902,
-0.1882646381855011,
-0.9004799723625183,
-0.44625619053840637,
0.028676198795437813,
-0.6528280973434448,
0.6155499815940857,
0.381065845489501... |
func (c *D) RunForever() error {
if c.lookPathErr != nil {
return c.lookPathErr
}
if c.cmd == nil {
c.cmd = c.delegate()
}
if c.stopCh == nil {
c.stopCh = make(chan struct{})
}
if c.errCh == nil {
c.errCh = make(chan error)
}
err := c.run()
if err != nil {
close(c.stopCh)
close(c.errCh)
return ... | [
0.22637280821800232,
-0.2057328224182129,
1.0168513059616089,
0.19662119448184967,
0.388810396194458,
0.12710262835025787,
0.024473626166582108,
-0.19609785079956055,
-0.38110795617103577,
-1.4459726810455322,
0.36870402097702026,
-0.3667638599872589,
-0.31096065044403076,
0.59744697809219... |
func (c *D) IsRunning() bool {
if c.cmd == nil {
return false
}
if c.cmd.Process == nil {
return false
}
process, err := ps.FindProcess(c.cmd.Process.Pid)
if err != nil {
panic(err)
}
if process == nil && err == nil {
// not found
return false
}
return true
} | [
-0.35170528292655945,
-0.7410606741905212,
0.5479161143302917,
0.2767811417579651,
0.312090665102005,
0.08012130856513977,
-0.28148627281188965,
0.4783681333065033,
0.06004447117447853,
-0.41634657979011536,
0.004012496210634708,
0.8483710289001465,
0.1294725388288498,
0.24644219875335693,... |
func (c *D) Stop() error {
if c.stopCh == nil {
return errors.New("execd: stop must be called after run")
}
close(c.stopCh)
if c.gracefulShutDown != nil && c.IsRunning() {
return c.gracefulShutDown(c.cmd)
}
return c.shutdown()
} | [
-0.5754360556602478,
0.15142831206321716,
0.5461156964302063,
0.5569964647293091,
-0.14377903938293457,
0.3587779104709625,
0.9146713614463806,
0.1747247278690338,
-0.5361219048500061,
-0.5806837677955627,
0.3457576632499695,
-0.1484571248292923,
0.1480429768562317,
0.4602152407169342,
1... |
func ParseConfig(configPath string) (*Config, error) {
var (
err error
file *os.File
)
file, err = os.Open(configPath)
if err != nil {
return nil, err
}
defer file.Close()
jsonDec := json.NewDecoder(file)
var config Config
err = jsonDec.Decode(&config)
if err != nil {
return nil, err
}
return &co... | [
0.4350152909755707,
-0.659474790096283,
0.5435389876365662,
-0.5140237808227539,
-0.3943653106689453,
0.3266199231147766,
0.1402064710855484,
0.7088128924369812,
-0.7755517363548279,
0.4660983085632324,
-0.6977307200431824,
-0.15781736373901367,
0.14803571999073029,
0.36497706174850464,
... |
func Print(p utils.Printer, version string) {
versionMessage := fmt.Sprintf(versionMessageTemplate, version)
p.Print(versionMessage)
} | [
0.39153188467025757,
-0.8875607848167419,
0.29355889558792114,
-0.166560098528862,
0.06408398598432541,
0.7375261187553406,
-0.9557891488075256,
0.4436936378479004,
-0.6698483228683472,
0.2627425491809845,
-0.8475623726844788,
0.7096680998802185,
-0.7944049835205078,
0.26550614833831787,
... |
func RunCommand(name string, args ...string) (stdout string, stderr string, exitCode int) {
var outbuf, errbuf bytes.Buffer
cmd := exec.Command(name, args...)
cmd.Stdout = &outbuf
cmd.Stderr = &errbuf
err := cmd.Run()
stdout = outbuf.String()
stderr = errbuf.String()
if err != nil {
// try to get the exit c... | [
-0.48462092876434326,
-0.7392888069152832,
0.8098250031471252,
-0.05529186129570007,
-0.19010205566883087,
-0.06851563602685928,
-0.7299754023551941,
0.5494356155395508,
-0.41144660115242004,
0.41361334919929504,
0.11460345983505249,
0.5277974009513855,
-0.06359773874282837,
0.701212406158... |
func Chomp(s string) string {
for {
if byte('\n') == s[len(s)-1] {
s = string(s[:len(s)-1])
} else {
break
}
}
return s
} | [
1.4123467206954956,
-0.2863446772098541,
0.559220552444458,
-0.5345726013183594,
0.09143395721912384,
-0.421843558549881,
-0.8594315648078918,
-0.7726108431816101,
0.4262138605117798,
0.23422831296920776,
0.6582047939300537,
0.22487866878509521,
-0.7444968819618225,
-1.1844685077667236,
... |
func ColumnsString() string { return strings.Join(EnabledColumns(), ",") } | [
0.6822683811187744,
-0.15839780867099762,
0.21636445820331573,
-0.5676516890525818,
-0.04225380718708038,
0.8192700743675232,
-0.6594240069389343,
-0.11796992272138596,
-0.1521616280078888,
0.270894855260849,
0.06077450141310692,
-0.5167081952095032,
-0.46461716294288635,
-0.55062574148178... |
func EnabledColumns() (a []string) {
lock.RLock()
defer lock.RUnlock()
for _, col := range GlobalColumns {
if col.Enabled {
a = append(a, col.Name)
}
}
return a
} | [
0.06315336376428604,
-0.3992967903614044,
0.38454756140708923,
0.8144952058792114,
-0.038807496428489685,
1.0080419778823853,
0.07113960385322571,
0.017682485282421112,
0.0978524461388588,
0.6225938200950623,
-1.285402536392212,
0.960593044757843,
-1.2226191759109497,
0.009432966820895672,... |
func ColumnToggle(name string) {
col := GlobalColumns[colIndex(name)]
col.Enabled = !col.Enabled
log.Noticef("config change [column-%s]: %t -> %t", col.Name, !col.Enabled, col.Enabled)
} | [
-0.43973150849342346,
0.23306719958782196,
0.661550760269165,
-0.037098098546266556,
-0.05176221579313278,
0.15518923103809357,
0.3592120110988617,
0.9323745369911194,
-0.4054861068725586,
1.5238723754882812,
-1.091126799583435,
0.27277928590774536,
-0.45583322644233704,
-0.321686685085296... |
func ColumnLeft(name string) {
idx := colIndex(name)
if idx > 0 {
swapCols(idx, idx-1)
}
} | [
0.3058949112892151,
-0.5686073303222656,
0.37642350792884827,
-0.4723833501338959,
0.45280152559280396,
-0.2614850103855133,
0.16461284458637238,
-0.6202686429023743,
0.04469721019268036,
0.711577296257019,
-1.265152931213379,
-0.3906760513782501,
0.2087114304304123,
-0.6530292630195618,
... |
func ColumnRight(name string) {
idx := colIndex(name)
if idx < len(GlobalColumns)-1 {
swapCols(idx, idx+1)
}
} | [
-0.1428362876176834,
0.4123184382915497,
0.7357066869735718,
0.04951958730816841,
-0.3970275819301605,
0.03577136993408203,
0.2053416222333908,
-0.3449513614177704,
-0.8381720781326294,
0.5101191401481628,
-0.783239483833313,
0.0773019790649414,
-0.14214257895946503,
-0.40438905358314514,
... |
func SetColumns(names []string) {
var (
n int
curColStr = ColumnsString()
newColumns = make([]*Column, len(GlobalColumns))
)
lock.Lock()
// add enabled columns by name
for _, name := range names {
newColumns[n] = popColumn(name)
newColumns[n].Enabled = true
n++
}
// extend with omitted c... | [
-0.1789863109588623,
0.5116687417030334,
0.5302793383598328,
-0.30111685395240784,
-0.28255218267440796,
0.4911896884441376,
-0.1028285026550293,
0.4997265338897705,
-0.6121242046356201,
0.8871904015541077,
-1.3235979080200195,
0.8342533707618713,
-0.8129657506942749,
0.33541128039360046,
... |
func colIndex(name string) int {
for n, c := range GlobalColumns {
if c.Name == name {
return n
}
}
return -1
} | [
-0.4171319603919983,
-0.4571865200996399,
0.6533496379852295,
-0.0014897004002705216,
-0.3755679726600647,
0.34013593196868896,
0.8616275191307068,
-0.10297004878520966,
-0.7920225262641907,
0.25242024660110474,
-0.959883987903595,
0.7653267979621887,
-0.2988728880882263,
-0.27976194024086... |
func genRsaKey(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error) {
private, err := rsa.GenerateKey(rand.Reader, bits)
if err != nil {
return nil, nil, err
}
return private, &private.PublicKey, nil
} | [
-1.0129363536834717,
0.2029229998588562,
0.21021810173988342,
-0.09955669194459915,
0.30899783968925476,
0.6036596894264221,
0.14636653661727905,
-0.21015402674674988,
-0.34428590536117554,
0.4977838695049286,
-0.37266677618026733,
0.858344554901123,
-0.47823548316955566,
1.046935200691223... |
func encodePrivateKey(private *rsa.PrivateKey) []byte {
return pem.EncodeToMemory(&pem.Block{
Bytes: x509.MarshalPKCS1PrivateKey(private),
Headers: nil,
Type: "RSA PRIVATE KEY",
})
} | [
-0.3981477916240692,
0.4354671537876129,
0.34503793716430664,
0.35230812430381775,
-0.09572378545999527,
0.23912903666496277,
-0.5086780786514282,
-1.2627428770065308,
1.3607940673828125,
1.030231237411499,
-0.14879852533340454,
0.3755294978618622,
-1.1834831237792969,
1.2516602277755737,
... |
func encodePublicKey(public *rsa.PublicKey) ([]byte, error) {
publicBytes, err := x509.MarshalPKIXPublicKey(public)
if err != nil {
return nil, err
}
return pem.EncodeToMemory(&pem.Block{
Bytes: publicBytes,
Type: "PUBLIC KEY",
Headers: nil,
}), nil
} | [
0.40029942989349365,
0.6904929280281067,
0.28231295943260193,
0.26025092601776123,
-0.26932796835899353,
0.2281593233346939,
-0.6094763875007629,
-0.5120853185653687,
0.2972237467765808,
1.2070897817611694,
-0.49553996324539185,
0.10160679370164871,
-0.778138279914856,
1.274429202079773,
... |
func encodeSSHKey(public *rsa.PublicKey) ([]byte, error) {
publicKey, err := ssh.NewPublicKey(public)
if err != nil {
return nil, err
}
return ssh.MarshalAuthorizedKey(publicKey), nil
} | [
0.1710740327835083,
0.8136808276176453,
0.39508500695228577,
0.6565227508544922,
0.1229046881198883,
0.5973654985427856,
-1.4322401285171509,
0.21412983536720276,
0.6758251190185547,
0.5532247424125671,
-0.4105898141860962,
1.1827689409255981,
-0.3618924617767334,
1.3269741535186768,
0.3... |
func GenRsaKey(bits int) (private, public []byte, err error) {
privKey, pubKey, err := genRsaKey(bits)
if err != nil {
return
}
priv := encodePrivateKey(privKey)
pub, err := encodePublicKey(pubKey)
if err != nil {
return
}
private = make([]byte, len(priv))
public = make([]byte, len(pub))
copy(public, ... | [
-1.006486177444458,
0.5642507076263428,
0.4663475453853607,
0.360005646944046,
-0.12130577862262726,
0.28677237033843994,
-0.03825236111879349,
-0.09000541269779205,
-0.6665483117103577,
1.0676454305648804,
-1.186418056488037,
1.327514886856079,
-0.40317806601524353,
0.982765257358551,
0... |
func SSHToPEM(skey []byte) (pemKey []byte, err error) {
pub, _, _, _, err := ssh.ParseAuthorizedKey(skey)
if err != nil {
return
}
// 根据ssh源码查到 ssh.PublicKey 被 ssh.rsaPublicKey 实现
// 且 ssh.rsaPublicKey 实现了 ssh.CryptoPublicKey
// 所以先转换成 ssh.CryptoPublicKey 调用 CryptoPublicKey 得到 crypto.PublicKey
// *rsa.Public... | [
-0.11969486624002457,
0.3465659022331238,
0.8019896745681763,
0.04339207336306572,
-0.46217378973960876,
0.3937529921531677,
-0.5126795172691345,
0.22819671034812927,
0.4607296884059906,
0.6462199687957764,
-0.7112001776695251,
0.2859305441379547,
-0.49222105741500854,
0.08195996284484863,... |
func PEMToSSH(pemKey []byte) (skey []byte, err error) {
//解密pem格式的公钥
block, _ := pem.Decode(pemKey)
if block == nil {
return nil, errors.New("public key error")
}
// 解析公钥
pubInterface, err := x509.ParsePKIXPublicKey(block.Bytes)
if err != nil {
return nil, err
}
// 类型断言
pub := pubInterface.(*rsa.PublicKey... | [
0.8760338425636292,
0.6385077238082886,
0.743632972240448,
0.7695992588996887,
-0.3371369540691376,
0.24023285508155823,
-0.5368080139160156,
-0.47986075282096863,
0.14410525560379028,
1.0795645713806152,
-0.7103267312049866,
0.37460532784461975,
-0.35058319568634033,
0.5514354109764099,
... |
func New() backend.Backend {
return &remotestate.Backend{
ConfigureFunc: configure,
// Set the schema
Backend: &schema.Backend{
Schema: map[string]*schema.Schema{
"lock_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Description: "initializes the state in a locked c... | [
0.8762019276618958,
-0.7529632449150085,
0.3016711175441742,
-0.5914577841758728,
-0.09608718752861023,
-0.24901269376277924,
-0.6293516755104065,
0.42539921402931213,
-0.3966292440891266,
0.356738805770874,
-0.7041968703269958,
0.728922963142395,
-0.3791274130344391,
-0.6767343878746033,
... |
func (r *gatewayFour) Run() {
r.state = RstateRunning
outstanding := 0
rxcallback := func(ev EventInterface) int {
tioevent := ev.(*TimedAnyEvent)
tio := tioevent.GetTio().(*Tio)
tio.doStage(r)
if tio.Done() {
atomic.AddInt64(&r.tiostats, 1)
outstanding--
}
return 0
}
go func() {
for r.stat... | [
-0.702362060546875,
0.1312425136566162,
0.7802507877349854,
-0.8467816710472107,
0.15190686285495758,
-0.3708260655403137,
0.7555696368217468,
-0.14910106360912323,
-0.28081169724464417,
0.5209840536117554,
-0.25905361771583557,
-0.34402772784233093,
-0.6219995021820068,
0.5633388757705688... |
func (r *serverFour) Run() {
r.state = RstateRunning
rxcallback := func(ev EventInterface) int {
tioevent := ev.(*TimedAnyEvent)
tio := tioevent.GetTio()
tio.doStage(r)
return 0
}
go func() {
for r.state == RstateRunning {
// recv
r.receiveEnqueue()
time.Sleep(time.Microsecond)
r.processPen... | [
-0.722881555557251,
-0.5220902562141418,
0.9251123070716858,
-0.5088779926300049,
0.3021623194217682,
-0.2779020369052887,
0.16151857376098633,
-0.13586416840553284,
-0.355075478553772,
-0.144561767578125,
-0.6129158735275269,
-0.17069561779499054,
-0.9320698976516724,
0.4943639934062958,
... |
func (m *modelFour) NewGateway(i int) NodeRunnerInterface {
gwy := &gatewayFour{NodeRunnerBase{RunnerBase: RunnerBase{id: i}, strtype: GWY}, 0}
gwy.init(config.numServers)
gwy.initios()
return gwy
} | [
-0.29193997383117676,
0.4985707998275757,
0.3314239978790283,
0.08545030653476715,
-0.0540534071624279,
0.07797776162624359,
0.6459460854530334,
-0.4506908357143402,
-0.3018577992916107,
-0.08771725744009018,
-0.6954212188720703,
0.34145408868789673,
-0.9907179474830627,
1.203350305557251,... |
func ExpressionVal(expr hcl.Expression) cty.Value {
return cty.CapsuleVal(ExpressionType, &expr)
} | [
0.27145591378211975,
-0.1316429227590561,
0.32090476155281067,
0.6841796040534973,
-0.8169169425964355,
-0.16948401927947998,
0.10793735086917877,
0.11527063697576523,
0.7481759786605835,
-0.13183605670928955,
0.7129873037338257,
0.7712032794952393,
0.6983965635299683,
0.475871741771698,
... |
func ExpressionFromVal(v cty.Value) hcl.Expression {
if !v.Type().Equals(ExpressionType) {
panic("value is not of ExpressionType")
}
ptr := v.EncapsulatedValue().(*hcl.Expression)
return *ptr
} | [
0.1425408124923706,
-0.11294601112604141,
0.02389935776591301,
0.8926100134849548,
-0.7734217047691345,
0.28938573598861694,
0.6248610615730286,
-0.6925625205039978,
1.5158787965774536,
0.3792857527732849,
0.184469535946846,
0.29664599895477295,
-0.247599259018898,
0.17439520359039307,
0... |
func ExpressionClosureVal(closure *ExpressionClosure) cty.Value {
return cty.CapsuleVal(ExpressionClosureType, closure)
} | [
0.10631372034549713,
-0.5275035500526428,
0.3247837722301483,
0.6439812183380127,
-1.4796825647354126,
-0.29552513360977173,
0.024486469104886055,
-0.2250402271747589,
0.2684417963027954,
-0.01562730222940445,
1.1202961206436157,
0.3475133180618286,
0.6805440783500671,
0.1569577306509018,
... |
func (c *ExpressionClosure) Value() (cty.Value, hcl.Diagnostics) {
return c.Expression.Value(c.EvalContext)
} | [
0.2628151774406433,
-0.7525403499603271,
0.19751599431037903,
0.15195295214653015,
0.05346410721540451,
0.3354111611843109,
0.7722130417823792,
-0.18069595098495483,
0.8405422568321228,
-0.2606925070285797,
0.996460497379303,
0.5153255462646484,
-0.010556208901107311,
0.4108130931854248,
... |
func ExpressionClosureFromVal(v cty.Value) *ExpressionClosure {
if !v.Type().Equals(ExpressionClosureType) {
panic("value is not of ExpressionClosureType")
}
return v.EncapsulatedValue().(*ExpressionClosure)
} | [
0.3966764211654663,
-0.4685543179512024,
0.24157395958900452,
0.9145893454551697,
-1.4584203958511353,
0.029507644474506378,
0.7082182168960571,
-0.8640726804733276,
1.5255852937698364,
0.24118846654891968,
1.126965880393982,
0.45159974694252014,
-0.18538057804107666,
0.10224681347608566,
... |
func (c *gcsCore) getOrAddContainerIndex(id string) (uint32, error) {
c.containerIndexMutex.Lock()
defer c.containerIndexMutex.Unlock()
// len() returns int32 so we cannot index a value greater than that size.
// And we know that given index range {0, MaxInt32 - 1} that if there are no
// slots and a maximum slic... | [
-0.5669722557067871,
0.33975496888160706,
0.9142998456954956,
-1.0370168685913086,
-0.2329699844121933,
-0.34817200899124146,
0.2487080991268158,
-0.7226534485816956,
0.7225819826126099,
-0.3010513186454773,
0.2668914198875427,
-0.037324439734220505,
-0.4244471788406372,
0.3537794947624206... |
func (c *gcsCore) getContainerIDFromIndex(index uint32) string {
c.containerIndexMutex.Lock()
defer c.containerIndexMutex.Unlock()
if int(index) < len(c.containerIndex) {
return c.containerIndex[index]
}
return ""
} | [
0.3253730535507202,
-0.2668627202510834,
0.6179797053337097,
-0.40811750292778015,
0.0157631766051054,
0.16297978162765503,
0.08771282434463501,
-1.6622780561447144,
0.8172318935394287,
0.35643988847732544,
0.27022460103034973,
-0.3501018285751343,
-0.6504912972450256,
0.25408729910850525,... |
func (c *gcsCore) removeContainerIndex(id string) {
c.containerIndexMutex.Lock()
defer c.containerIndexMutex.Unlock()
for i := 0; i < len(c.containerIndex); i++ {
if c.containerIndex[i] == id {
c.containerIndex[i] = ""
return
}
}
} | [
-0.6166664958000183,
-0.9231628775596619,
0.6309158205986023,
-0.6404696106910706,
-0.21893665194511414,
-0.4035910367965698,
0.3200456202030182,
-0.2436886876821518,
0.4013092815876007,
0.5391550064086914,
-0.5143750905990601,
-0.3869664669036865,
-1.1220383644104004,
-0.06644746661186218... |
func NewGCSCore(baseLogPath, baseStoragePath string, rtime runtime.Runtime, vsock transport.Transport) core.Core {
return &gcsCore{
baseLogPath: baseLogPath,
baseStoragePath: baseStoragePath,
Rtime: rtime,
vsock: vsock,
containerCache: make(map[string]*containerCacheEntry),
process... | [
-0.08142751455307007,
-0.6894738674163818,
0.4187958836555481,
-0.2206973284482956,
-0.012442029081285,
-0.2831992208957672,
-1.1980470418930054,
-1.2884478569030762,
-0.5989735722541809,
0.6207378506660461,
-0.12942007184028625,
0.2893701195716858,
-0.9685956835746765,
0.14811104536056519... |
func (c *gcsCore) CreateContainer(id string, settings prot.VMHostedContainerSettings) error {
c.containerCacheMutex.Lock()
defer c.containerCacheMutex.Unlock()
if c.getContainer(id) != nil {
return gcserr.NewHresultError(gcserr.HrVmcomputeSystemAlreadyExists)
}
containerEntry := newContainerCacheEntry(id)
// ... | [
0.023639248684048653,
0.104002945125103,
0.6357734799385071,
0.27367860078811646,
0.9671237468719482,
-0.20967406034469604,
0.7991383671760559,
-1.0997530221939087,
0.41500020027160645,
0.3372226655483246,
0.054531265050172806,
-0.30087006092071533,
0.6902724504470825,
0.7746457457542419,
... |
func (c *gcsCore) ExecProcess(id string, params prot.ProcessParameters, connection stdio.ConnectionSettings) (_ int, _ chan<- struct{}, err error) {
var stdioSet *stdio.ConnectionSet
stdioSet, err = stdio.Connect(c.vsock, connection)
if err != nil {
return -1, nil, err
}
defer func() {
if err != nil {
stdio... | [
0.6358004212379456,
-0.27619242668151855,
0.8239120841026306,
-0.23925960063934326,
0.6808426976203918,
-0.44977423548698425,
0.3917033076286316,
-0.6152845621109009,
-0.18728488683700562,
0.5696126222610474,
-0.09515272080898285,
0.2687129080295563,
-0.3836536705493927,
0.6426905393600464... |
func (c *gcsCore) SignalContainer(id string, signal syscall.Signal) error {
c.containerCacheMutex.Lock()
defer c.containerCacheMutex.Unlock()
containerEntry := c.getContainer(id)
if containerEntry == nil {
return gcserr.NewHresultError(gcserr.HrVmcomputeSystemNotFound)
}
if containerEntry.container != nil {
... | [
0.3250577747821808,
-0.6892380118370056,
0.5132572650909424,
0.6428290605545044,
0.6468842625617981,
-0.4853612780570984,
0.510983943939209,
-0.6450960040092468,
0.28005608916282654,
0.6593077778816223,
-0.37108364701271057,
0.18981660902500153,
0.123127281665802,
1.4212623834609985,
-0.... |
func (c *gcsCore) SignalProcess(pid int, options prot.SignalProcessOptions) error {
c.processCacheMutex.Lock()
if _, ok := c.processCache[pid]; !ok {
c.processCacheMutex.Unlock()
return gcserr.NewHresultError(gcserr.HrErrNotFound)
}
c.processCacheMutex.Unlock()
// Interpret signal value 0 as SIGKILL.
// TODO... | [
0.6734727621078491,
-0.5889696478843689,
0.5071054100990295,
0.3271499276161194,
0.4780513644218445,
-0.02356414683163166,
-0.6392176747322083,
-0.9293757081031799,
0.7517710328102112,
0.4739932715892792,
0.023130392655730247,
-0.2995148003101349,
-0.06727313995361328,
0.5424800515174866,
... |
func (c *gcsCore) GetProperties(id string, query string) (*prot.Properties, error) {
c.containerCacheMutex.Lock()
defer c.containerCacheMutex.Unlock()
containerEntry := c.getContainer(id)
if containerEntry == nil {
return nil, gcserr.NewHresultError(gcserr.HrVmcomputeSystemNotFound)
}
if containerEntry.contain... | [
0.17961432039737701,
-0.491599440574646,
0.4099862575531006,
-0.3429916501045227,
0.9228352904319763,
-0.38234150409698486,
-0.4624578058719635,
-0.813122570514679,
0.5383156538009644,
0.0019799116998910904,
0.7920202612876892,
0.6040672659873962,
-0.7131558656692505,
0.0701327919960022,
... |
func (c *gcsCore) RunExternalProcess(params prot.ProcessParameters, conSettings stdio.ConnectionSettings) (_ int, err error) {
var stdioSet *stdio.ConnectionSet
stdioSet, err = stdio.Connect(c.vsock, conSettings)
if err != nil {
return -1, err
}
defer func() {
if err != nil {
stdioSet.Close()
}
}()
var... | [
0.2386937290430069,
-0.08945126086473465,
1.1763073205947876,
-0.6011006236076355,
-0.016566691920161247,
0.25406861305236816,
0.5092809796333313,
-0.7622901201248169,
-0.14820623397827148,
0.5824341773986816,
-0.04410441964864731,
0.5933833122253418,
-0.3987716734409332,
0.094876706600189... |
func (c *gcsCore) ModifySettings(id string, request *prot.ResourceModificationRequestResponse) error {
c.containerCacheMutex.Lock()
defer c.containerCacheMutex.Unlock()
containerEntry := c.getContainer(id)
if containerEntry == nil {
return gcserr.NewHresultError(gcserr.HrVmcomputeSystemNotFound)
}
switch requ... | [
-1.136736273765564,
-0.11986847966909409,
0.5254499912261963,
0.6463314890861511,
0.49256065487861633,
-0.2809002697467804,
0.18262240290641785,
-1.1029531955718994,
0.870801568031311,
0.2656150460243225,
1.197831392288208,
-0.16468775272369385,
-0.11534418165683746,
0.8899056911468506,
... |
func (c *gcsCore) WaitContainer(id string) (func() prot.NotificationType, error) {
c.containerCacheMutex.Lock()
entry := c.getContainer(id)
if entry == nil {
c.containerCacheMutex.Unlock()
return nil, gcserr.NewHresultError(gcserr.HrVmcomputeSystemNotFound)
}
c.containerCacheMutex.Unlock()
f := func() prot.N... | [
0.23475663363933563,
-0.4010506272315979,
0.594048261642456,
-0.3374041020870209,
0.49817076325416565,
-0.0038054066244512796,
1.123016357421875,
-0.4502161145210266,
-0.40566474199295044,
-0.10759437829256058,
0.009340822696685791,
-0.11226388812065125,
0.28111985325813293,
0.656382739543... |
func (c *gcsCore) WaitProcess(pid int) (<-chan int, chan<- bool, error) {
c.processCacheMutex.Lock()
entry, ok := c.processCache[pid]
if !ok {
c.processCacheMutex.Unlock()
return nil, nil, gcserr.NewHresultError(gcserr.HrErrNotFound)
}
c.processCacheMutex.Unlock()
// If we are an init process waiter incremen... | [
0.22184261679649353,
-0.06651758402585983,
0.800617516040802,
-0.5004081726074219,
0.8420213460922241,
-0.6123324036598206,
0.2731165289878845,
-0.5384339690208435,
-0.34052911400794983,
0.2124052345752716,
-0.1396317481994629,
0.17718149721622467,
-0.370217889547348,
0.39994335174560547,
... |
func (c *gcsCore) setupMappedVirtualDisks(id string, disks []prot.MappedVirtualDisk) error {
mounts, err := c.getMappedVirtualDiskMounts(disks)
if err != nil {
return errors.Wrapf(err, "failed to get mapped virtual disk devices for container %s", id)
}
if err := c.mountMappedVirtualDisks(disks, mounts); err != ni... | [
-0.32761019468307495,
-0.25900325179100037,
0.8333447575569153,
0.38568419218063354,
0.3977048099040985,
0.20404277741909027,
-0.1894175261259079,
-0.31163766980171204,
0.9264395833015442,
0.04266095906496048,
-0.11955226212739944,
-0.1595468372106552,
0.36070916056632996,
0.34300559759140... |
func (c *gcsCore) setupMappedDirectories(id string, dirs []prot.MappedDirectory) error {
for _, dir := range dirs {
if !dir.CreateInUtilityVM {
return errors.New("we do not currently support mapping directories inside the container namespace")
}
if err := plan9.Mount(context.Background(), c.vsock, dir.Contain... | [
-0.25301867723464966,
0.3234199583530426,
0.7145929336547852,
-0.01450975239276886,
0.342418372631073,
0.19826941192150116,
0.36716747283935547,
-0.36979448795318604,
1.4286187887191772,
-0.4517475366592407,
0.34659913182258606,
-0.16676802933216095,
-0.35119232535362244,
0.456593155860900... |
func processParametersToOCI(params prot.ProcessParameters) (*oci.Process, error) {
if params.OCIProcess != nil {
return params.OCIProcess, nil
}
var args []string
if len(params.CommandArgs) == 0 {
var err error
args, err = processParamCommandLineToOCIArgs(params.CommandLine)
if err != nil {
return new(o... | [
0.4349464476108551,
-0.746720552444458,
0.5823767781257629,
-0.11111193895339966,
0.335690438747406,
-0.35366180539131165,
0.11518899351358414,
-1.0484883785247803,
0.061683449894189835,
0.5729400515556335,
0.6168321967124939,
0.45036035776138306,
0.25848624110221863,
0.07157699018716812,
... |
func processParamCommandLineToOCIArgs(commandLine string) ([]string, error) {
args, err := shellwords.Parse(commandLine)
if err != nil {
return nil, errors.Wrapf(err, "failed to parse command line string \"%s\"", commandLine)
}
return args, nil
} | [
0.041296955198049545,
-0.21725019812583923,
0.4057934284210205,
-0.06156889721751213,
0.855278730392456,
-0.08435019850730896,
0.06806742399930954,
-0.2853321433067322,
-0.7199679017066956,
1.7740055322647095,
0.5867559313774109,
-0.4502020478248596,
-0.6788893938064575,
0.3998608887195587... |
func processParamEnvToOCIEnv(environment map[string]string) []string {
environmentList := make([]string, 0, len(environment))
for k, v := range environment {
// TODO: Do we need to escape things like quotation marks in
// environment variable values?
environmentList = append(environmentList, fmt.Sprintf("%s=%s"... | [
-1.3347148895263672,
-0.9178832769393921,
0.501924991607666,
-0.01892537996172905,
0.6429216861724854,
0.15715527534484863,
-0.33819299936294556,
-0.12603799998760223,
-0.46451109647750854,
1.9076834917068481,
0.4329305589199066,
0.31768473982810974,
-0.289785772562027,
0.7001086473464966,... |
func (m *WikiV2) UnmarshalJSON(raw []byte) error {
// AO0
var aO0 WikiCreateBaseParameters
if err := swag.ReadJSON(raw, &aO0); err != nil {
return err
}
m.WikiCreateBaseParameters = aO0
// now for regular properties
var propsWikiV2 struct {
ID strfmt.UUID `json:"id,omitempty"`
Properties map[string]strin... | [
-0.8276365399360657,
-0.8291903138160706,
0.549923300743103,
-1.3763834238052368,
-0.9251748323440552,
-0.34517619013786316,
-0.41221725940704346,
0.6222510933876038,
-0.7920569181442261,
0.7643070816993713,
-0.6055145859718323,
0.5022892355918884,
0.10684337466955185,
0.4455408751964569,
... |
func (m WikiV2) MarshalJSON() ([]byte, error) {
_parts := make([][]byte, 0, 1)
aO0, err := swag.WriteJSON(m.WikiCreateBaseParameters)
if err != nil {
return nil, err
}
_parts = append(_parts, aO0)
// now for regular properties
var propsWikiV2 struct {
ID strfmt.UUID `json:"id,omitempty"`
Properties map[... | [
-0.6249156594276428,
-1.0969390869140625,
0.6112844944000244,
-0.6212466359138489,
-0.49439120292663574,
-0.07930202037096024,
-0.7814062833786011,
0.5026903748512268,
-0.7387046813964844,
0.8492957353591919,
-0.6195942163467407,
0.777009904384613,
-0.08807242661714554,
0.5666967630386353,... |
func (m *WikiV2) Validate(formats strfmt.Registry) error {
var res []error
// validation for a type composition with WikiCreateBaseParameters
if err := m.WikiCreateBaseParameters.Validate(formats); err != nil {
res = append(res, err)
}
if err := m.validateID(formats); err != nil {
res = append(res, err)
}
... | [
-1.025299072265625,
-0.8280104398727417,
0.23258621990680695,
-0.0729479268193245,
0.12759041786193848,
-0.3278515934944153,
0.025310499593615532,
0.02819817140698433,
-1.1653763055801392,
0.6729626059532166,
0.11411671340465546,
0.36225295066833496,
-0.9305844306945801,
1.2335200309753418... |
func (ts *tSafe) removeRecord(partitionID UniqueID) {
ts.tSafeMu.Lock()
defer ts.tSafeMu.Unlock()
log.Debug("remove tSafeRecord",
zap.Any("partitionID", partitionID),
)
delete(ts.tSafeRecord, partitionID)
} | [
0.6556026339530945,
0.2666766345500946,
0.28934118151664734,
-0.4603880047798157,
-0.5944502949714661,
-0.3481767475605011,
-0.23267215490341187,
1.413308024406433,
-0.5025432705879211,
0.43473246693611145,
-0.08488195389509201,
-0.32682669162750244,
-0.6133769750595093,
0.1769532412290573... |
func parallelize(functions ...func()) {
//New WaitGroup for handle goRoutines
var waitGroup sync.WaitGroup
//Add length of goRoutines to run
waitGroup.Add(len(functions))
//End of Functions wait for goRoutines to finish=(functionsGoRoutines.length==0)
defer waitGroup.Wait()
//Foreach of functions to execute ... | [
0.1784888058900833,
1.2855274677276611,
0.738036572933197,
0.1955542117357254,
0.5531467795372009,
0.5364885330200195,
-0.23990420997142792,
0.49414965510368347,
-0.7217899560928345,
0.023277129977941513,
0.031353164464235306,
-0.054201867431402206,
-0.7570590972900391,
-0.0681802853941917... |
func copy(w io.WriteCloser, r io.Reader) {
defer w.Close()
io.Copy(w, r)
} | [
-0.11428933590650558,
-1.395143747329712,
0.47913169860839844,
-0.006944403983652592,
-1.4526187181472778,
1.3459428548812866,
0.13103650510311127,
-0.5607771873474121,
-0.4131014347076416,
0.7163228392601013,
0.9616006016731262,
0.28790283203125,
-0.20470571517944336,
0.1366320252418518,
... |
func handleConnection(us *net.Conn, servers *[]string) {
for i := 0; i < activeServers-1; i++ {
if latencyServer[i+1] < latencyServer[i] {
balanceCondition = i + 1
} else {
balanceCondition = i
}
}
//Get path of the next server to send the data
ds, err := net.Dial("tcp", (*servers)[balanceCondition])
... | [
-0.010792253538966179,
0.35749250650405884,
0.6237438917160034,
-0.15975455939769745,
0.22693310678005219,
0.3743375837802887,
1.025922179222107,
-0.3261479437351227,
0.34402909874916077,
0.4573940634727478,
0.16925352811813354,
-0.6496590971946716,
-0.13930845260620117,
-0.230568408966064... |
func turnThirdServer() {
//run sh command, that run bin file of Server3 compiled
cmdStr := "./../../APIRest3/util/RunAPIRest.sh"
cmd := exec.Command("C:/Program Files/Git/bin/bash.exe", "-e", cmdStr)
_, err := cmd.Output()
if err != nil {
println(err.Error())
return
}
log.Println("Third Server Up!!!")
} | [
-0.7259407043457031,
-1.2487932443618774,
0.7557180523872375,
-0.7155991196632385,
0.5466347336769104,
1.255028247833252,
0.023806756362318993,
0.46743378043174744,
-0.10213512182235718,
0.1646561175584793,
-0.5627188682556152,
1.5236579179763794,
-0.8761866688728333,
-0.7271059155464172,
... |
func (s *SeqFuncChecker) FullCheck(t *testing.T) {
t.Run("Standard", func(t *testing.T) {
Check(t, s)
})
allVars := s.Vars
for i := range allVars {
t.Run(fmt.Sprintf("Vars[%d]", i), func(t *testing.T) {
newS := *s
newS.Vars = allVars[i : i+1]
Check(t, &newS)
})
}
t.Run("Accumulation", func(t *testi... | [
0.24381129443645477,
-0.09578181058168411,
0.5686225295066833,
0.35627853870391846,
0.17663317918777466,
-0.27207615971565247,
1.2576982975006104,
0.49917176365852356,
-0.1500113159418106,
-0.3713119626045227,
-0.2776614725589752,
0.306562215089798,
1.057879090309143,
1.0579736232757568,
... |
func (s *SeqFuncChecker) TestPrec() float64 {
if s.Prec == 0 {
return DefaultPrec
}
return s.Prec
} | [
1.2348436117172241,
0.36488595604896545,
0.31280478835105896,
0.6555594801902771,
0.4955737292766571,
-0.5299342274665833,
1.0713081359863281,
0.15601542592048645,
0.17774330079555511,
-0.8416363000869751,
0.8155998587608337,
-0.36287447810173035,
-0.7035536766052246,
0.31485864520072937,
... |
func (s *SeqFuncChecker) ApproxPartials(v *autofunc.Variable, idx int) linalg.Vector {
param := &v.Vector[idx]
old := *param
*param = old + s.delta()
val1 := copyFlatOut(s.F.ApplySeqs(s.input()).OutputSeqs())
*param = old - s.delta()
val2 := copyFlatOut(s.F.ApplySeqs(s.input()).OutputSeqs())
*param = old
return... | [
-0.0893658995628357,
-0.76197749376297,
0.44126221537590027,
-0.7666532397270203,
-0.9909297227859497,
0.05911867320537567,
0.6460942625999451,
-0.5628452897071838,
0.05507912114262581,
0.3026122450828552,
0.260221928358078,
0.4378145933151245,
-0.5067404508590698,
0.39003390073776245,
0... |
func (s *SeqFuncChecker) Jacobian() []autofunc.Gradient {
var jacobian []autofunc.Gradient
output := s.F.ApplySeqs(s.input())
upstream := make([][]linalg.Vector, len(output.OutputSeqs()))
for i, outSeq := range output.OutputSeqs() {
upstream[i] = make([]linalg.Vector, len(outSeq))
for j, outVec := range outSeq... | [
-1.1553457975387573,
-0.9686812162399292,
0.6346019506454468,
-0.2593616545200348,
-0.8943025469779968,
-0.007479850668460131,
0.9835264086723328,
0.501490592956543,
-0.2921423017978668,
0.036150313913822174,
-0.42681023478507996,
0.886227011680603,
0.003564888844266534,
0.72458815574646,
... |
func (x Time) IsZero() bool {
return time.Time(x).IsZero()
} | [
-0.5035200119018555,
0.22375623881816864,
0.36193639039993286,
1.4748541116714478,
-0.12614981830120087,
-0.05998185649514198,
-0.8624768257141113,
-0.25080975890159607,
0.4853720963001251,
0.5328457951545715,
-0.9079034924507141,
0.3746209442615509,
-0.45888856053352356,
0.741927742958068... |
func NewTime(t time.Time) Time {
return Time{
Time: t,
}
} | [
0.3179386258125305,
0.15446197986602783,
0.07903079688549042,
0.22055140137672424,
-0.5024827718734741,
0.3537125289440155,
-1.644310712814331,
-1.0689055919647217,
0.42054927349090576,
1.0608166456222534,
-0.5809470415115356,
-0.3262174725532532,
0.2492467314004898,
0.08742547780275345,
... |
func (nt Time) Valid() bool {
return !nt.IsZero()
} | [
-0.4176950454711914,
-0.038553472608327866,
0.4626222252845764,
0.09013316035270691,
-0.24005365371704102,
1.1196972131729126,
-1.0183391571044922,
-0.11276509612798691,
-0.7453351616859436,
0.1454269140958786,
0.17293255031108856,
-0.5786458849906921,
-0.6474257707595825,
1.10235822200775... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.