text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func TestExecute(t *testing.T) {
fmt.Println("TestExecute start")
var inputSource *bytes.Buffer
ipTest := []IPTest{
{"127.0.0.1", "9999", 1, 1},
{"8.8.8.8", "443", 1, 0},
{"::1", "9999", 1, 1},
{"127.0.0.1 ::1", "9999", 2, 2}}
for _, v := range ipTest {
inputSource = bytes.NewBuffer([]byte(fmt.Sprintf("se... | [
-0.5058165788650513,
0.6650007367134094,
0.7631310224533081,
0.12076342105865479,
0.7013524770736694,
-0.136026531457901,
0.2815929055213928,
-0.312094509601593,
-0.31349608302116394,
-0.6318336725234985,
-0.21592560410499573,
-0.6393300890922546,
-0.529025137424469,
-0.0000473791988042648... |
func (c *Client) CreateTilesetSource(ctx context.Context, tilesetID string, jsonReader io.Reader) (NewTilesetSourceResponse, error) {
return c.PutTilesetSource(ctx, tilesetID, jsonReader)
} | [
-1.198493480682373,
-0.21568183600902557,
-0.1815853714942932,
-1.1699299812316895,
-1.2961041927337646,
-0.9864488840103149,
-0.00036289350828155875,
-0.8694701194763184,
0.3012285530567169,
0.2072179615497589,
-0.442641943693161,
0.3714568614959717,
-0.5549176931381226,
0.365479171276092... |
func (c *Client) PutTilesetSource(ctx context.Context, tilesetID string, jsonReader io.Reader) (NewTilesetSourceResponse, error) {
url := baseURL +
"/tilesets/v1/sources/" + c.username + "/" + tilesetID +
"?access_token=" + c.accessToken
var jsonResp NewTilesetSourceResponse
resp, err := putMultipart(ctx, c.htt... | [
-1.7133673429489136,
-0.2837943434715271,
0.15252092480659485,
-1.1586732864379883,
-1.042524814605713,
-0.7391258478164673,
-0.011584421619772911,
-0.7758925557136536,
0.07350572198629379,
0.8218225240707397,
-0.6986833214759827,
0.48941248655319214,
-0.7049216628074646,
0.615498006343841... |
func ParseHclInterface(val interface{}, spec hcldec.Spec, vars map[string]cty.Value) (cty.Value, hcl.Diagnostics, []error) {
evalCtx := &hcl.EvalContext{
Variables: vars,
Functions: GetStdlibFuncs(),
}
// Encode to json
var buf bytes.Buffer
enc := codec.NewEncoder(&buf, structs.JsonHandle)
err := enc.Encode(... | [
-0.46210092306137085,
-0.6794288754463196,
0.6019390821456909,
-0.5282629728317261,
-0.5900086164474487,
0.03990403190255165,
-0.2357599288225174,
-0.26097217202186584,
0.042647428810596466,
0.6604333519935608,
-0.46058809757232666,
-0.130612313747406,
0.31473368406295776,
0.63039302825927... |
func GetStdlibFuncs() map[string]function.Function {
return map[string]function.Function{
"abs": stdlib.AbsoluteFunc,
"coalesce": stdlib.CoalesceFunc,
"concat": stdlib.ConcatFunc,
"hasindex": stdlib.HasIndexFunc,
"int": stdlib.IntFunc,
"jsondecode": stdlib.JSONDecodeFunc,
"jsonencod... | [
-0.11074233055114746,
-0.5832533836364746,
0.4248557388782501,
-0.443777471780777,
-0.6999108791351318,
-0.2972484827041626,
0.018828580155968666,
-0.6027824878692627,
-0.7283782362937927,
-0.30299219489097595,
-1.8318673372268677,
0.4915178418159485,
0.2667006254196167,
-0.107387527823448... |
func formattedDiagnosticErrors(diag hcl.Diagnostics) []error {
var errs []error
for _, d := range diag {
if d.Summary == "Extraneous JSON object property" {
d.Summary = "Invalid label"
}
err := fmt.Errorf("%s: %s", d.Summary, d.Detail)
errs = append(errs, err)
}
return errs
} | [
-0.8230414986610413,
-1.175593376159668,
0.40278360247612,
-0.2977807819843292,
0.3373360335826874,
0.32974526286125183,
-0.3173482120037079,
0.16512368619441986,
0.660002589225769,
0.5931850075721741,
0.7010696530342102,
0.11634615808725357,
1.3385257720947266,
0.5287851095199585,
0.406... |
func KindFromSides(a, b, c float64) Kind {
t := []float64{a, b, c}
sort.Float64s(t)
for _, value := range t {
if value <= 0 || math.IsNaN(value) || math.IsInf(value, 0) {
return NaT
}
}
if t[2] > t[1]+t[0] {
return NaT
}
if t[0] == t[1] && t[1] == t[2] {
return Equ
}
if t[0] == t[1] || t[1] == t[2... | [
1.1140612363815308,
-0.06670667231082916,
0.6293498277664185,
-0.6767135858535767,
-0.04994342848658562,
0.6719180941581726,
-0.3624047636985779,
-1.2736461162567139,
-0.8056821227073669,
-0.06040147319436073,
0.844031035900116,
0.3963199853897095,
0.542221188545227,
-0.25941231846809387,
... |
func NewSimpleController(cfg *Config, crd CRD, handler Handler) Controller {
if cfg == nil {
cfg = &Config{}
}
cfg.setDefaults()
// queue
queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter())
resourceEventHandlerFuncs := cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interfac... | [
0.10731016099452972,
-0.024922430515289307,
0.5582202672958374,
-0.24845774471759796,
-0.6992455124855042,
-0.2899847626686096,
0.10866469144821167,
-0.2820952534675598,
0.4464007019996643,
-0.6151585578918457,
-0.5484243631362915,
-0.4402047097682953,
-0.4951896071434021,
0.81390661001205... |
func (c *SimpleController) Run(stopper <-chan struct{}) error {
defer runtime.HandleCrash()
defer c.queue.ShutDown()
fmt.Println(c.cfg.Name, " Starts...")
go c.informer.Run(stopper)
if !cache.WaitForCacheSync(stopper, c.informer.HasSynced) {
runtime.HandleError(fmt.Errorf("Timed out waiting for caches to sync... | [
-0.650826096534729,
0.10575783997774124,
0.6040149331092834,
-0.19129067659378052,
0.3692910075187683,
0.3609789311885834,
0.7655792832374573,
0.30551791191101074,
-0.5920612812042236,
-0.5628155469894409,
-1.1415985822677612,
-0.7918949723243713,
-0.5046749711036682,
0.6974586248397827,
... |
func GetUserList(w http.ResponseWriter, r *http.Request) {
users, err := user.GetUserList(r)
if err != nil {
httpext.AbortAPI(w, err.Error(), http.StatusInternalServerError)
return
}
httpext.SuccessDataAPI(w, "Ok", users)
} | [
-1.1680684089660645,
-0.4287145435810089,
0.5061317682266235,
0.8608911633491516,
0.27420875430107117,
0.18593807518482208,
-0.1741577833890915,
-0.11252845078706741,
0.21258781850337982,
0.5526434779167175,
-0.5423069000244141,
0.6456091403961182,
0.14444804191589355,
0.27120402455329895,... |
func CreateUser(w http.ResponseWriter, r *http.Request) {
decoder := json.NewDecoder(r.Body)
var update models.User
err := decoder.Decode(&update)
u, err := user.CreateUser(update, r)
if err != nil {
httpext.AbortAPI(w, err.Error(), http.StatusInternalServerError)
return
}
httpext.SuccessDataAPI(w, "Ok", u... | [
-0.9254109263420105,
-0.6486332416534424,
0.8781073689460754,
0.3625182807445526,
0.0019603644032031298,
0.8728617429733276,
-0.3125589191913605,
-0.17707271873950958,
0.1204729750752449,
0.4868982434272766,
-0.3394359052181244,
-0.6124197244644165,
-0.7261615991592407,
-0.0513322353363037... |
func GetUser(w http.ResponseWriter, r *http.Request) {
httpext.SuccessAPI(w, "ok")
} | [
-0.33778730034828186,
-0.22354571521282196,
0.6369325518608093,
1.5229078531265259,
-0.39088577032089233,
0.8148237466812134,
0.2974640727043152,
-0.31016743183135986,
-0.15721836686134338,
-0.36266639828681946,
-0.4778369069099426,
0.5221289992332458,
-0.01902800239622593,
-0.299675911664... |
func UpdateUser(w http.ResponseWriter, r *http.Request) {
decoder := json.NewDecoder(r.Body)
var update models.User
err := decoder.Decode(&update)
u, err := user.UpdateUser(update, r)
if err != nil {
httpext.AbortAPI(w, err.Error(), http.StatusInternalServerError)
return
}
httpext.SuccessDataAPI(w, "Ok", u... | [
-1.6443886756896973,
-0.8561217188835144,
0.8004724383354187,
0.7472572326660156,
-0.7893962860107422,
0.4499695599079132,
-0.174005925655365,
-0.13516637682914734,
-0.13871616125106812,
0.10957778990268707,
-0.8426693677902222,
0.2706993520259857,
-0.5117517113685608,
-0.2678582966327667,... |
func DeleteUser(w http.ResponseWriter, r *http.Request) {
httpext.SuccessAPI(w, "ok")
} | [
-0.4022843539714813,
-0.4082500636577606,
0.5664807558059692,
1.3236520290374756,
-0.476667195558548,
0.8121426701545715,
0.6048685908317566,
0.32213476300239563,
0.13999029994010925,
-0.6347720623016357,
-0.4423680305480957,
0.4208473265171051,
-0.17263129353523254,
0.0713386982679367,
... |
func New(config Config) *KubernetesExecutor {
k := &KubernetesExecutor{
kl: config.Kubelet,
updateChan: config.Updates,
state: disconnectedState,
tasks: make(map[string]*kuberTask),
pods: make(map[string]*api.Pod),
sourcename: ... | [
-0.41261133551597595,
-0.6940341591835022,
0.5631089210510254,
-0.6256684064865112,
-0.37113094329833984,
-1.009352445602417,
-0.173930361866951,
-0.34176793694496155,
0.17542023956775665,
0.09866510331630707,
-0.6089802980422974,
0.160826176404953,
0.7076067924499512,
0.7044052481651306,
... |
func (k *KubernetesExecutor) Registered(driver bindings.ExecutorDriver,
executorInfo *mesos.ExecutorInfo, frameworkInfo *mesos.FrameworkInfo, slaveInfo *mesos.SlaveInfo) {
if k.isDone() {
return
}
log.Infof("Executor %v of framework %v registered with slave %v\n",
executorInfo, frameworkInfo, slaveInfo)
if !(&... | [
-0.33348071575164795,
-0.1467146873474121,
0.7428063750267029,
-0.2720803916454315,
1.2323089838027954,
-0.7531265020370483,
0.16691827774047852,
0.3082103133201599,
-0.504516065120697,
0.4455522298812866,
-1.0571210384368896,
0.6739325523376465,
0.44140806794166565,
1.2213717699050903,
... |
func (k *KubernetesExecutor) Reregistered(driver bindings.ExecutorDriver, slaveInfo *mesos.SlaveInfo) {
if k.isDone() {
return
}
log.Infof("Reregistered with slave %v\n", slaveInfo)
if !(&k.state).transition(disconnectedState, connectedState) {
log.Errorf("failed to reregister/transition to a connected state")
... | [
-0.03420484438538551,
-0.27691468596458435,
0.7701836228370667,
-0.2230229377746582,
0.6360583305358887,
-0.6878012418746948,
0.12215687334537506,
0.6806792616844177,
-0.19192853569984436,
0.6907289624214172,
-0.7741131782531738,
1.1636435985565186,
0.1700531244277954,
0.40931805968284607,... |
func (k *KubernetesExecutor) InitializeStaticPodsSource(sourceFactory func()) {
<-k.initialRegComplete
if k.staticPodsConfig == nil {
return
}
log.V(2).Infof("extracting static pods config to %s", k.staticPodsConfigPath)
err := archive.UnzipDir(k.staticPodsConfig, k.staticPodsConfigPath)
if err != nil {
log... | [
-0.720083475112915,
0.09948935359716415,
0.35375019907951355,
0.09147541224956512,
0.23805564641952515,
-0.9574044942855835,
0.3801613748073578,
0.46446526050567627,
-0.17619439959526062,
0.14673320949077606,
-0.7174882888793945,
-0.14230772852897644,
0.5816810131072998,
0.0255836918950080... |
func (k *KubernetesExecutor) Disconnected(driver bindings.ExecutorDriver) {
if k.isDone() {
return
}
log.Infof("Slave is disconnected\n")
if !(&k.state).transition(connectedState, disconnectedState) {
log.Errorf("failed to disconnect/transition to a disconnected state")
}
} | [
-0.054632384330034256,
-0.539066731929779,
0.6084235906600952,
0.0135933393612504,
0.0644509345293045,
0.20421282947063446,
-0.7454689145088196,
0.6077920794487,
1.2717630863189697,
0.4974980652332306,
-0.32084357738494873,
0.27101564407348633,
0.36115092039108276,
0.5533179640769958,
0.... |
func (k *KubernetesExecutor) LaunchTask(driver bindings.ExecutorDriver, taskInfo *mesos.TaskInfo) {
if k.isDone() {
return
}
log.Infof("Launch task %v\n", taskInfo)
if !k.isConnected() {
log.Errorf("Ignore launch task because the executor is disconnected\n")
k.sendStatus(driver, newStatus(taskInfo.GetTaskId(... | [
0.10576516389846802,
-0.629852831363678,
0.5714729428291321,
0.19490393996238708,
0.21229210495948792,
-0.7113317251205444,
-0.22505269944667816,
0.03051079995930195,
0.2814091742038727,
-0.02437489852309227,
-0.4398578405380249,
0.0975528284907341,
0.46291568875312805,
1.0004924535751343,... |
func (k *KubernetesExecutor) resetSuicideWatch(driver bindings.ExecutorDriver) <-chan struct{} {
ch := make(chan struct{})
go func() {
defer close(ch)
k.lock.Lock()
defer k.lock.Unlock()
if k.suicideTimeout < 1 {
return
}
if k.suicideWatch != nil {
if len(k.tasks) > 0 {
k.suicideWatch.Stop()
... | [
0.3614639937877655,
0.21136102080345154,
0.3116248846054077,
0.24833349883556366,
-0.04598494619131088,
-0.11619971692562103,
-0.04562902823090553,
-0.5093716382980347,
-0.28203558921813965,
0.09168586134910583,
0.18260854482650757,
1.159409523010254,
-0.7650351524353027,
0.247085139155387... |
func (k *KubernetesExecutor) launchTask(driver bindings.ExecutorDriver, taskId string, pod *api.Pod) {
deleteTask := func() {
k.lock.Lock()
defer k.lock.Unlock()
delete(k.tasks, taskId)
k.resetSuicideWatch(driver)
}
// TODO(k8s): use Pods interface for binding once clusters are upgraded
// return b.Pods(bi... | [
-0.8848761916160583,
-0.4882946014404297,
0.7147704362869263,
0.5172184109687805,
-0.6822699308395386,
0.0914313793182373,
-0.18606390058994293,
0.07953377813100815,
0.5147213339805603,
0.679529070854187,
-0.13397938013076782,
0.5526491403579712,
0.02628815360367298,
0.8647691011428833,
... |
func (k *KubernetesExecutor) checkForLostPodTask(driver bindings.ExecutorDriver, taskId string, isKnownPod func() bool) bool {
// TODO (jdefelice) don't send false alarms for deleted pods (KILLED tasks)
k.lock.Lock()
defer k.lock.Unlock()
// TODO(jdef) we should really consider k.pods here, along with what docker ... | [
-0.2955792546272278,
0.13789790868759155,
0.536033034324646,
-0.4720180034637451,
0.3523154854774475,
-0.26997777819633484,
-0.418468713760376,
-0.8885616660118103,
0.28645822405815125,
-0.02864808216691017,
-0.30051544308662415,
-0.0900760293006897,
0.6207945942878723,
1.0289407968521118,... |
func (k *KubernetesExecutor) KillTask(driver bindings.ExecutorDriver, taskId *mesos.TaskID) {
if k.isDone() {
return
}
log.Infof("Kill task %v\n", taskId)
if !k.isConnected() {
//TODO(jdefelice) sent TASK_LOST here?
log.Warningf("Ignore kill task because the executor is disconnected\n")
return
}
k.lock.... | [
-0.2901635766029358,
-0.27546828985214233,
0.44200071692466736,
0.21263884007930756,
0.7176669836044312,
-0.16224855184555054,
-0.6442779302597046,
-0.2665235102176666,
0.5429812073707581,
0.808576226234436,
0.039444856345653534,
-0.013091756030917168,
0.6805129647254944,
0.501521229743957... |
func (k *KubernetesExecutor) reportLostTask(driver bindings.ExecutorDriver, tid, reason string) {
k.removePodTask(driver, tid, reason, mesos.TaskState_TASK_LOST)
} | [
-0.15826308727264404,
-0.39600396156311035,
0.18391676247119904,
-1.2013864517211914,
0.4398435354232788,
-0.7281493544578552,
-0.6410509347915649,
-0.16189059615135193,
0.1264362931251526,
-0.1754821240901947,
-0.0945754423737526,
0.8617802262306213,
0.10948324203491211,
0.667323887348175... |
func (k *KubernetesExecutor) removePodTask(driver bindings.ExecutorDriver, tid, reason string, state mesos.TaskState) {
task, ok := k.tasks[tid]
if !ok {
log.V(1).Infof("Failed to remove task, unknown task %v\n", tid)
return
}
delete(k.tasks, tid)
k.resetSuicideWatch(driver)
pid := task.podName
pod, found :... | [
-0.19556167721748352,
-0.22431862354278564,
0.30375561118125916,
-0.12095849961042404,
-0.030025072395801544,
-0.5375334620475769,
-0.41851329803466797,
0.16665227711200714,
0.29941093921661377,
0.7435558438301086,
-0.4002477526664734,
-0.07603248953819275,
0.2329954355955124,
0.1123706251... |
func (k *KubernetesExecutor) FrameworkMessage(driver bindings.ExecutorDriver, message string) {
if k.isDone() {
return
}
if !k.isConnected() {
log.Warningf("Ignore framework message because the executor is disconnected\n")
return
}
log.Infof("Receives message from framework %v\n", message)
//TODO(jdef) mas... | [
-0.4652315676212311,
0.37175092101097107,
0.5331434607505798,
0.25206658244132996,
0.567040205001831,
-1.4397550821304321,
0.5939092636108398,
-0.26633763313293457,
0.14506922662258148,
0.14169169962406158,
0.05239539220929146,
-0.6549462676048279,
-0.5228643417358398,
1.553188681602478,
... |
func (k *KubernetesExecutor) Shutdown(driver bindings.ExecutorDriver) {
k.lock.Lock()
defer k.lock.Unlock()
k.doShutdown(driver)
} | [
-0.7428581118583679,
-0.22000983357429504,
0.4945683479309082,
0.35689008235931396,
0.3141824007034302,
-0.09983901679515839,
-0.6845313310623169,
0.5773599147796631,
1.3385467529296875,
0.5736511945724487,
0.48771271109580994,
-0.004670866299420595,
-0.32075801491737366,
0.710613131523132... |
func (k *KubernetesExecutor) doShutdown(driver bindings.ExecutorDriver) {
defer func() {
log.Errorf("exiting with unclean shutdown: %v", recover())
if k.exitFunc != nil {
k.exitFunc(1)
}
}()
(&k.state).transitionTo(terminalState)
// signal to all listeners that this KubeletExecutor is done!
close(k.done... | [
-0.40276435017585754,
-0.47854289412498474,
0.8459441065788269,
0.12640152871608734,
0.4046817123889923,
-0.14785458147525787,
-0.10064304620027542,
-0.25847291946411133,
-0.18544423580169678,
0.6461766958236694,
0.04931202530860901,
-0.01816088892519474,
0.15835395455360413,
0.66799104213... |
func (k *KubernetesExecutor) killKubeletContainers() {
if containers, err := dockertools.GetKubeletDockerContainers(k.dockerClient, true); err == nil {
opts := docker.RemoveContainerOptions{
RemoveVolumes: true,
Force: true,
}
for _, container := range containers {
opts.ID = container.ID
log.... | [
0.2649538516998291,
-0.8786378502845764,
0.486454039812088,
-0.01808704249560833,
0.675542414188385,
-1.1961647272109985,
-0.8784522414207458,
-1.086313009262085,
0.10363505780696869,
1.1285382509231567,
0.48093074560165405,
-0.1344621628522873,
-0.14536550641059875,
0.38236814737319946,
... |
func Start(logger *flogging.FabricLogger, cmd *exec.Cmd, exitFuncs ...ExitFunc) (*Session, error) {
logger = logger.With("command", filepath.Base(cmd.Path))
stderr, err := cmd.StderrPipe()
if err != nil {
return nil, err
}
err = cmd.Start()
if err != nil {
return nil, err
}
sess := &Session{
command: ... | [
-0.07942131161689758,
-0.5832591652870178,
0.39732375741004944,
-0.11722168326377869,
-0.40969038009643555,
-0.5584072470664978,
0.23004262149333954,
-0.23008011281490326,
0.13314542174339294,
0.06210551783442497,
-0.2336842566728592,
1.1379835605621338,
0.28972935676574707,
-0.19341373443... |
func (s *Session) Wait() error {
<-s.exited
return s.exitErr
} | [
-0.5515074729919434,
-0.4679374098777771,
0.24594709277153015,
-0.2835441529750824,
0.3975514769554138,
0.3817283511161804,
0.019439665600657463,
-0.34464865922927856,
0.29284384846687317,
-0.4533519446849823,
-0.8365795016288757,
0.14160040020942688,
0.4404720962047577,
-0.251584202051162... |
func (s *Session) Signal(sig os.Signal) {
s.command.Process.Signal(sig)
} | [
-0.6726915240287781,
-0.6054171919822693,
0.05067190155386925,
0.29247212409973145,
-0.19177745282649994,
0.44524088501930237,
0.30830705165863037,
-0.4011073410511017,
0.7169020771980286,
-0.7003663778305054,
-1.228845238685608,
0.7484883069992065,
0.442624032497406,
1.2066459655761719,
... |
func (sd *ServiceDiscovery) CanonicalName(service string) string {
if strings.HasSuffix(service, sd.Domain) {
return service
}
return strings.Join([]string{service, serviceSuffix, sd.Dc, sd.Domain}, ".")
} | [
0.6102938055992126,
0.08763077855110168,
0.4296073615550995,
0.13340570032596588,
-0.7392987012863159,
0.17090754210948944,
-0.3036268949508667,
-0.2271595299243927,
0.8347113728523254,
-0.0675281211733818,
0.7198160290718079,
0.8503594994544983,
0.8811488747596741,
0.2369261384010315,
0... |
func (sd *ServiceDiscovery) ResolveName(name string) (string, string) {
name = stripDomain(name)
if strings.HasSuffix(name, sd.Domain) {
name = name[0 : len(name)-len(sd.Domain)-1]
}
separator := fmt.Sprintf(".%s", serviceSuffix)
var service string
var dc string
if strings.Contains(name, separator) {
cols :=... | [
-0.6506288051605225,
0.07757288217544556,
0.6622354984283447,
-0.7030285000801086,
-0.3958004415035248,
-0.932892918586731,
-0.0006660694489255548,
0.16948340833187103,
0.08599347621202469,
-0.1657891869544983,
-0.5401394367218018,
0.213758647441864,
0.6261928677558899,
0.13089591264724731... |
func (sd *ServiceDiscovery) lookupInternal(name, consistency string) ([]*Endpoint, error) {
service, dc := sd.ResolveName(name)
opts := &QueryOptions{
dc,
consistency == weakConsistency,
consistency == strongConsistency,
0,
0,
"",
}
entries, _, err := sd.Client.Health().Service(service, "", true, opts)
... | [
-1.4114316701889038,
0.11036860942840576,
0.9459971189498901,
-0.4665803611278534,
-0.2559371292591095,
-0.3420475125312805,
-0.6368592977523804,
0.26105672121047974,
-0.08575436472892761,
0.5982825756072998,
0.06571901589632034,
0.0329744853079319,
-0.7018935680389404,
0.1489810198545456,... |
func (g *game) ClearPath(participant int) {
g.paths[participant] = *NewPathEmpty()
} | [
-0.4340030550956726,
-0.1986471265554428,
0.3291931450366974,
-0.10301953554153442,
-0.2394571453332901,
1.1092560291290283,
0.06142529100179672,
-0.2844490110874176,
0.11197605729103088,
1.091630220413208,
-0.1633087545633316,
-0.06821682304143906,
-0.8664005994796753,
-0.4803514480590820... |
func (g *game) ResetPath(participant int) {
// GeneratePath contains a path-finding algorithm. This function is used as a path finder.
GeneratePath := func(g *game, participant int) Path {
const icol int = 0 // level
irow := participant // participant
grid := g.ladder.grid
route := []pixel.Vec{}
pri... | [
-0.12163083255290985,
-0.23667624592781067,
0.8195611834526062,
-0.2146499752998352,
-0.36074018478393555,
-0.015319962054491043,
1.17507004737854,
0.14407625794410706,
-0.01790679804980755,
0.71112459897995,
0.06305011361837387,
-0.9040719866752625,
-0.935011088848114,
-0.0805420428514480... |
func (g *game) Shuffle(times, inMillisecond int) {
speed := g.galaxy.Speed()
g.galaxy.SetSpeed(speed * 10)
{
i := 0
for range time.Tick(
(time.Millisecond * time.Duration(inMillisecond)) / time.Duration(times),
) {
g.bg = gg.RandomNiceColor()
g.Reset()
i++
if i >= times {
break
... | [
-0.250991553068161,
1.2261555194854736,
0.6914318203926086,
-0.47359177470207214,
-0.13554003834724426,
0.20439864695072174,
0.05452777072787285,
-0.39512231945991516,
0.2325960099697113,
0.22111795842647552,
0.7267255783081055,
0.8550717830657959,
-0.38242632150650024,
1.0011508464813232,... |
func (g game) WindowDeep() (baseWindow *glfw.Window) {
return *(**glfw.Window)(unsafe.Pointer(reflect.Indirect(reflect.ValueOf(g.window)).FieldByName("window").UnsafeAddr()))
} | [
-0.14325456321239471,
-0.14255540072917938,
0.4263855814933777,
-0.10108288377523422,
-0.4085645377635956,
0.7703694105148315,
1.1619374752044678,
-1.3090416193008423,
0.18469476699829102,
-0.7340273261070251,
0.6718941330909729,
1.8588608503341675,
-0.18811115622520447,
-0.000693640206009... |
func (g game) BridgesCount() (sum int) {
for _, row := range g.ladder.bridges {
for _, col := range row {
if col {
sum++
}
}
}
return sum
} | [
0.594039797782898,
0.3481854498386383,
0.5720852017402649,
-0.16019435226917267,
0.010781063698232174,
0.9270780682563782,
1.0188320875167847,
-0.18936777114868164,
0.2298467606306076,
0.3821384012699127,
-0.6469081044197083,
-0.7224079966545105,
0.02865768037736416,
0.2473425269126892,
... |
func (g *game) Run() {
pixelgl.Run(func() {
g.RunLazyInit()
g.RunEventLoop()
})
} | [
-0.39609378576278687,
0.3128596842288971,
0.4173489809036255,
0.3161797523498535,
0.3292445242404938,
0.1505114734172821,
0.37194448709487915,
-0.9609032273292542,
-0.6094840168952942,
-0.3561535179615021,
-0.5668154358863831,
0.2233569324016571,
-0.19625002145767212,
1.078741192817688,
... |
func NewWin32LobAppRegistryDetection()(*Win32LobAppRegistryDetection) {
m := &Win32LobAppRegistryDetection{
Win32LobAppDetection: *NewWin32LobAppDetection(),
}
odataTypeValue := "#microsoft.graph.win32LobAppRegistryDetection"
m.SetOdataType(&odataTypeValue)
return m
} | [
0.5781229138374329,
-0.38150084018707275,
-0.07921025902032852,
0.0409630723297596,
-0.2200353592634201,
0.3261984586715698,
0.46735483407974243,
0.8103997111320496,
0.23677590489387512,
0.22800295054912567,
-0.7280703186988831,
0.04275590553879738,
-0.6182246804237366,
0.5985328555107117,... |
func CreateWin32LobAppRegistryDetectionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
return NewWin32LobAppRegistryDetection(), nil
} | [
1.007341980934143,
0.005163826979696751,
0.2670706808567047,
-0.27681902050971985,
-0.6043174862861633,
0.7328050136566162,
0.4465465545654297,
0.6357174515724182,
0.2900729179382324,
-0.19006222486495972,
-0.034625180065631866,
0.07479945570230484,
0.2992078959941864,
1.2039092779159546,
... |
func (m *Win32LobAppRegistryDetection) GetCheck32BitOn64System()(*bool) {
val, err := m.GetBackingStore().Get("check32BitOn64System")
if err != nil {
panic(err)
}
if val != nil {
return val.(*bool)
}
return nil
} | [
-0.5236926078796387,
0.7919002771377563,
0.20423224568367004,
1.1850144863128662,
0.39033105969429016,
1.0816453695297241,
0.2130269706249237,
-0.5234283804893494,
-0.212112694978714,
-0.13775533437728882,
-0.45969146490097046,
0.2424345165491104,
-0.6060683131217957,
0.7266365885734558,
... |
func (m *Win32LobAppRegistryDetection) GetDetectionType()(*Win32LobAppRegistryDetectionType) {
val, err := m.GetBackingStore().Get("detectionType")
if err != nil {
panic(err)
}
if val != nil {
return val.(*Win32LobAppRegistryDetectionType)
}
return nil
} | [
1.2516534328460693,
0.24300475418567657,
-0.1319761723279953,
1.026158332824707,
1.0640698671340942,
0.6601477861404419,
0.7575531005859375,
0.32704946398735046,
0.8923619389533997,
-0.47546812891960144,
0.06459486484527588,
-0.4285167455673218,
-0.2810380458831787,
1.0416486263275146,
1... |
func (m *Win32LobAppRegistryDetection) GetDetectionValue()(*string) {
val, err := m.GetBackingStore().Get("detectionValue")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
} | [
1.1371045112609863,
0.1012018695473671,
0.1342320740222931,
0.8901998996734619,
0.09187690913677216,
0.62589031457901,
0.31422731280326843,
0.3376169800758362,
0.11052501946687698,
-0.25008881092071533,
0.024741576984524727,
-0.04657040163874626,
0.35448920726776123,
0.5474669337272644,
... |
func (m *Win32LobAppRegistryDetection) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
res := m.Win32LobAppDetection.GetFieldDeserializers()
res["check32BitOn64System"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80b... | [
0.23649264872074127,
0.1063871681690216,
0.6418648958206177,
-0.7713714241981506,
0.2709706127643585,
-0.2926388084888458,
0.6108973026275635,
0.35560351610183716,
-0.6440851092338562,
-0.5003677606582642,
-0.7964820861816406,
0.30410388112068176,
-0.8741230964660645,
0.8599727153778076,
... |
func (m *Win32LobAppRegistryDetection) GetKeyPath()(*string) {
val, err := m.GetBackingStore().Get("keyPath")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
} | [
1.0871479511260986,
0.35245445370674133,
0.2374783158302307,
1.2232317924499512,
0.5541180372238159,
0.5792639851570129,
0.623978316783905,
-0.7640976905822754,
0.6264834403991699,
-0.10783743113279343,
-0.19983291625976562,
-0.21298272907733917,
-1.0218747854232788,
0.10318676382303238,
... |
func (m *Win32LobAppRegistryDetection) GetOperator()(*Win32LobAppDetectionOperator) {
val, err := m.GetBackingStore().Get("operator")
if err != nil {
panic(err)
}
if val != nil {
return val.(*Win32LobAppDetectionOperator)
}
return nil
} | [
0.6228958368301392,
0.22640344500541687,
0.17724092304706573,
0.646523654460907,
0.17381282150745392,
0.719788134098053,
0.6530367732048035,
0.22715125977993011,
1.1096619367599487,
-0.41448861360549927,
0.12816515564918518,
-0.421082466840744,
-0.48175865411758423,
0.27280935645103455,
... |
func (m *Win32LobAppRegistryDetection) GetValueName()(*string) {
val, err := m.GetBackingStore().Get("valueName")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
} | [
0.31717485189437866,
0.14949655532836914,
0.21933794021606445,
0.8765504956245422,
0.4760901927947998,
0.22553351521492004,
0.24198009073734283,
0.310098797082901,
0.4897853136062622,
0.31265148520469666,
0.09252037107944489,
-0.20754121243953705,
-0.3284744620323181,
0.30674174427986145,
... |
func (m *Win32LobAppRegistryDetection) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
err := m.Win32LobAppDetection.Serialize(writer)
if err != nil {
return err
}
{
err = writer.WriteBoolValue("check32BitOn64System", m.Get... | [
-0.0534798800945282,
0.10571595281362534,
0.5808019042015076,
0.24448394775390625,
0.2793184816837311,
-0.09719173610210419,
1.0383436679840088,
0.24457597732543945,
-0.28479358553886414,
0.3546871542930603,
-0.5143383145332336,
0.04016780108213425,
-0.5527830719947815,
1.2429777383804321,... |
func (m *Win32LobAppRegistryDetection) SetCheck32BitOn64System(value *bool)() {
err := m.GetBackingStore().Set("check32BitOn64System", value)
if err != nil {
panic(err)
}
} | [
-0.7372846603393555,
0.42827385663986206,
0.1248624324798584,
1.109972596168518,
0.022837642580270767,
1.2807393074035645,
0.3431793749332428,
-0.46220558881759644,
-0.6234723925590515,
0.04789554327726364,
-0.665450930595398,
-0.27008241415023804,
-0.11457331478595734,
1.0486465692520142,... |
func (m *Win32LobAppRegistryDetection) SetDetectionType(value *Win32LobAppRegistryDetectionType)() {
err := m.GetBackingStore().Set("detectionType", value)
if err != nil {
panic(err)
}
} | [
0.7279821038246155,
0.3297131061553955,
-0.18206138908863068,
1.023980975151062,
0.4831557273864746,
0.9073763489723206,
1.0314130783081055,
0.26833775639533997,
0.3795987069606781,
-0.05160392448306084,
-0.41192322969436646,
-1.4164505004882812,
0.1637556105852127,
1.3275877237319946,
0... |
func (m *Win32LobAppRegistryDetection) SetDetectionValue(value *string)() {
err := m.GetBackingStore().Set("detectionValue", value)
if err != nil {
panic(err)
}
} | [
0.6362966299057007,
0.0906527042388916,
0.03342345729470253,
0.8349530100822449,
-0.2074078619480133,
0.9182868003845215,
0.60511714220047,
0.6267696022987366,
0.016236431896686554,
0.018911151215434074,
-0.5698455572128296,
-0.6331422328948975,
0.47080832719802856,
0.9858566522598267,
0... |
func (m *Win32LobAppRegistryDetection) SetKeyPath(value *string)() {
err := m.GetBackingStore().Set("keyPath", value)
if err != nil {
panic(err)
}
} | [
0.676303505897522,
0.31646496057510376,
0.22635674476623535,
0.9668019413948059,
0.17115435004234314,
1.119160771369934,
0.752517819404602,
-0.5410667061805725,
0.12496578693389893,
0.21538886427879333,
-1.144583821296692,
-0.6900505423545837,
-0.6649900078773499,
0.47107261419296265,
0.... |
func (m *Win32LobAppRegistryDetection) SetOperator(value *Win32LobAppDetectionOperator)() {
err := m.GetBackingStore().Set("operator", value)
if err != nil {
panic(err)
}
} | [
0.19872580468654633,
0.6925414800643921,
0.10262677073478699,
0.4728507399559021,
-0.2877717614173889,
1.1840510368347168,
0.996932327747345,
0.5662517547607422,
0.5269890427589417,
-0.2053149938583374,
-0.2892119884490967,
-0.9391550421714783,
-0.03371125087141991,
0.9809436202049255,
0... |
func (m *Win32LobAppRegistryDetection) SetValueName(value *string)() {
err := m.GetBackingStore().Set("valueName", value)
if err != nil {
panic(err)
}
} | [
-0.3659213185310364,
0.29806241393089294,
0.16915665566921234,
0.8761901259422302,
0.28018471598625183,
0.5352116227149963,
0.48374634981155396,
0.636607825756073,
0.3267160654067993,
0.6335179805755615,
-0.9194030165672302,
-0.6049837470054626,
-0.26017847657203674,
0.6842102408409119,
... |
func SignRequest(params map[string]string) string {
keys := make([]string, len(params))
for key := range params {
keys = append(keys, key)
}
pairs := make([]string, len(keys))
sort.Strings(keys)
for idx, key := range keys {
pairs[idx] = key + params[key]
}
slug := []byte(SharedSecret + strings.Join(pairs... | [
-0.7638375163078308,
-0.5335069894790649,
0.7322136759757996,
-0.8152326941490173,
-0.06575130671262741,
0.07115112245082855,
-0.2641890048980713,
0.17060358822345734,
-0.6000208258628845,
0.6508861780166626,
0.48828765749931335,
-0.21368102729320526,
-0.24106985330581665,
0.31933143734931... |
func FormURL(baseURL string, method string, params map[string]string) *url.URL {
u, err := url.Parse(baseURL)
if err != nil {
log.Fatalf("Failed to set root URL: %s\n", err)
}
params["method"] = method
params["format"] = "json"
log.WithField("params", params).Debug("got arguments for request")
query := u.Qu... | [
-0.47065654397010803,
-0.2600431442260742,
0.6021966934204102,
-0.00013637095980811864,
0.04929168522357941,
-0.021559197455644608,
-0.6398469805717468,
0.3674257695674896,
-0.6677342057228088,
-0.18903639912605286,
0.10184288769960403,
0.007620394229888916,
0.12808489799499512,
1.03959381... |
func GetMethod(method string, args map[string]string, unmarshal func([]byte) error) error {
requestURL := FormURL(rootURL, method, args)
resp, err := myClient.Get(requestURL.String())
if err != nil {
return err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
... | [
-0.8176904916763306,
-0.3385962247848511,
1.0910232067108154,
-1.1682049036026,
0.08444256335496902,
-0.3054482936859131,
-0.14429980516433716,
-0.5090519785881042,
-0.6235510110855103,
-0.03783200681209564,
1.0741020441055298,
0.430282324552536,
-0.248119056224823,
-0.1274920105934143,
... |
func NewMadlibServer(addr string, madlibs []MadlibTemplate) *MadlibServer {
return &MadlibServer{
addr: addr,
madlibs: madlibs,
ongoing: make(map[string]*Madlib),
}
} | [
-0.3156515955924988,
-1.2484025955200195,
0.04401254653930664,
-0.8879552483558655,
-1.3015297651290894,
0.18958993256092072,
-1.0915768146514893,
0.8537670373916626,
0.16392198204994202,
-0.01187158189713955,
-0.382373571395874,
0.1882142722606659,
-0.6575427651405334,
0.32773301005363464... |
func minNumberOperationsOn(target []int) int {
sum := target[0]
for i:=1; i<len(target); i++ {
// it's easy to understand:
// every larger number than prev need to increase by its own
// every smaller number than prev can be covered by prev larger number
if target[i]>target[i-1] {
sum += target[i]-target[i... | [
-0.010137626901268959,
0.3408307135105133,
0.7745723724365234,
0.6156619787216187,
-1.030126690864563,
-0.4552452862262726,
1.1743359565734863,
0.010803653858602047,
0.9764633178710938,
0.04454897716641426,
-0.4614449143409729,
-0.021635012701153755,
-0.6292399168014526,
0.2934350669384002... |
func build(tree, data []int, ind, left, right int) {
if left == right {
tree[ind] = left
return
}
leftSub, rightSub, mid := ind*2+1, ind*2+2, left+(right-left)/2
build(tree, data, leftSub, left, mid)
build(tree, data, rightSub, mid+1, right)
// merge two sub trees
if data[tree[leftSub]] <= data[tree[ri... | [
-0.5457521677017212,
-0.35670846700668335,
0.7376716732978821,
-0.3767739534378052,
-0.5742897391319275,
0.6969585418701172,
-0.8432704210281372,
-0.4836786985397339,
-0.17544129490852356,
-0.030755704268813133,
-0.3729713559150696,
0.9841622710227966,
-0.20501971244812012,
-0.001176332356... |
func query(tree, data []int, ind, left, right, queryLeft, queryRight int) (minInd int) {
// query range is equal to tree range
if left==queryLeft && right==queryRight {
return tree[ind]
}
leftSub, rightSub, mid := ind*2+1, ind*2+2, left+(right-left)/2
if queryRight<=mid { // query range in left sub tree
... | [
0.03759833052754402,
-0.13352654874324799,
0.7652981281280518,
-0.42358821630477905,
-1.0323967933654785,
0.41731682419776917,
-0.8465744256973267,
-0.7699102759361267,
0.21599367260932922,
0.13190937042236328,
0.17678691446781158,
0.6819302439689636,
-0.806574285030365,
0.1103375256061554... |
func NewSTSManager(client STSClientDescriptor) *STSManager {
return &STSManager{
client: client,
}
} | [
0.26036974787712097,
-0.0765930563211441,
0.052381642162799835,
-0.9857509732246399,
-0.8940210342407227,
-0.1233741044998169,
-1.2648544311523438,
-0.40238797664642334,
-0.1969846934080124,
-0.641729474067688,
-0.3497823476791382,
0.7518157958984375,
0.14961037039756775,
1.271799802780151... |
func MiddleRow(rows [][]string, decimalPlaces int) []string {
middleRow := rows[1]
result := make([]string, len(middleRow))
for i, val := range middleRow {
if isNaN(val) {
result[i] = averageOf(
decimalPlaces,
valueAt(rows[0], i),
valueAt(rows[2], i),
valueLeftOf(middleRow, i),
valueRightOf... | [
-0.3113568127155304,
-0.004898010287433863,
0.49076804518699646,
-0.12626372277736664,
-0.9282213449478149,
-0.471627801656723,
-0.2997373044490814,
-0.301766037940979,
0.23337747156620026,
0.8857153654098511,
0.6874749064445496,
-0.07597683370113373,
-0.18783113360404968,
0.66034978628158... |
func isNaN(val string) bool {
if val == nan {
return true
}
_, err := strconv.ParseFloat(val, 64)
return err != nil
} | [
-0.5787243843078613,
0.16975146532058716,
0.4789380431175232,
0.5426811575889587,
-1.0620639324188232,
-0.08794983476400375,
-0.42595598101615906,
-0.08025144785642624,
-0.12857788801193237,
-0.590181291103363,
-0.4563218057155609,
0.37009739875793457,
0.3069427013397217,
0.288048446178436... |
func averageOf(decimalPlaces int, floats ...*float64) string {
var total, num float64
for _, f := range floats {
if f == nil {
continue
}
num++
total += *f
}
if num == 0 {
return nan
}
return strconv.FormatFloat(total/num, 'f', decimalPlaces, 64)
} | [
0.45130476355552673,
0.9076502919197083,
0.5822765231132507,
-0.2779506742954254,
-0.43917912244796753,
-0.5745204091072083,
0.6931641101837158,
-0.5498114228248596,
0.08280394226312637,
-0.015815209597349167,
1.0599440336227417,
-0.6681866645812988,
0.24246257543563843,
0.1115500107407569... |
func valueAt(row []string, position int) *float64 {
if row == nil {
return nil
}
return stringToFloat(row[position])
} | [
0.2952940762042999,
-0.5219160318374634,
0.36558017134666443,
-1.1084972620010376,
0.20544452965259552,
-1.3187060356140137,
-1.258954405784607,
-0.8549229502677917,
-0.0337817519903183,
0.8670194745063782,
0.782701849937439,
0.01652034930884838,
0.10413990169763565,
-0.29131457209587097,
... |
func stringToFloat(num string) *float64 {
if num == nan {
return nil
}
f, err := strconv.ParseFloat(num, 64)
if err != nil {
return nil
}
return &f
} | [
0.8092246055603027,
0.05647842586040497,
0.2576683461666107,
0.2640594244003296,
0.007230685092508793,
-0.9929015040397644,
-0.05126573517918587,
-0.3168744742870331,
0.21096836030483246,
-0.6923831701278687,
-0.40522462129592896,
0.24174539744853973,
-0.17460863292217255,
-0.6455611586570... |
func valueLeftOf(row []string, position int) *float64 {
if position <= 0 {
return nil
}
return stringToFloat(row[position-1])
} | [
1.1664628982543945,
-0.07925546914339066,
0.25153133273124695,
-0.33467820286750793,
0.026560699567198753,
-1.0686535835266113,
-1.5224711894989014,
-1.13788902759552,
0.4243353009223938,
0.9211015701293945,
0.76999831199646,
-0.2517390251159668,
0.39821958541870117,
0.2061503827571869,
... |
func valueRightOf(row []string, position int) *float64 {
if position >= len(row)-1 {
return nil
}
return stringToFloat(row[position+1])
} | [
0.7309761047363281,
0.30472633242607117,
0.4045787453651428,
-0.05340604484081268,
-0.3348367512226105,
-1.369860053062439,
-1.218353509902954,
-1.0775130987167358,
-0.07425913959741592,
0.6646185517311096,
1.0804303884506226,
0.11482181400060654,
-0.04117522016167641,
0.26890474557876587,... |
func (c *CSVInterpolator) NextRow() ([]string, error) {
c.row++
rowsToGet := c.numRows()
rows, err := c.rp.GetRows(c.rowToStartWith(), rowsToGet)
if err != nil {
return nil, err
}
if rowsToGet != rowsNeededToInterpolate {
rows = [][]string{nil, rows[0], rows[1]}
}
if rows[1] == nil {
return nil, io.EOF... | [
-0.1725948601961136,
0.3673239052295685,
0.6814426779747009,
0.5987482070922852,
-0.7465853691101074,
-0.5922924876213074,
-0.6018304228782654,
-0.2699308395385742,
0.6588973999023438,
-0.1453549563884735,
1.000336766242981,
-0.11047592014074326,
0.057464148849248886,
0.5982764959335327,
... |
func (c *CSVInterpolator) numRows() int64 {
if c.row == 1 {
return rowsNeededToInterpolate - 1
}
return rowsNeededToInterpolate
} | [
-0.5270370244979858,
0.7630872130393982,
0.34779539704322815,
0.14329774677753448,
-0.3958187699317932,
-0.4695265591144562,
0.4655292332172394,
0.2416059821844101,
0.7375872731208801,
-0.18520839512348175,
0.15253077447414398,
-0.5846124291419983,
-0.6410255432128906,
0.4498937129974365,
... |
func (c *CSVInterpolator) rowToStartWith() int64 {
if c.row == 1 {
return 1
}
return c.row - 1
} | [
-0.777353048324585,
0.14773638546466827,
0.38288626074790955,
0.4964642822742462,
0.20501552522182465,
-0.5817120671272278,
0.6262528300285339,
-0.208266943693161,
0.8933355808258057,
0.2899865210056305,
0.19970253109931946,
0.308437705039978,
0.22030937671661377,
0.34324517846107483,
-0... |
func (*CampaignExtensionSettingOperation) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*CampaignExtensionSettingOperation_Create)(nil),
(*CampaignExtensionSettingOperation_Update)(nil),
(*CampaignExtensionSettingOperation_Remove)(nil),
}
} | [
-1.4324541091918945,
0.4277150630950928,
0.40781140327453613,
0.23257160186767578,
-0.329784095287323,
-0.8574411273002625,
0.4161396026611328,
-0.40462395548820496,
1.1197726726531982,
1.045269250869751,
-0.25568753480911255,
-0.43674197793006897,
-0.48491406440734863,
-0.291886568069458,... |
func (c *Client) sendRequest(method, term string, body io.Reader) (*http.Response, error) {
// Compose URL
rel := &url.URL{}
targetURL := c.BaseURL.ResolveReference(rel)
// Write body
var buf io.ReadWriter
if body != nil {
buf = new(bytes.Buffer)
err := json.NewEncoder(buf).Encode(body)
if err != nil {
... | [
-1.352073311805725,
-0.4107818603515625,
0.9215158224105835,
-0.4519594609737396,
0.3975432515144348,
-0.6595327854156494,
-0.42007219791412354,
0.1644395887851715,
-0.2639065980911255,
0.5638964772224426,
0.7531206011772156,
0.59888756275177,
-0.02072056196630001,
-0.16357393562793732,
... |
func (c *Client) Search(term string) (*Response, error) {
httpResp, err := c.sendRequest("GET", term, nil)
if err != nil {
return nil, err
}
result := &Response{}
if httpResp.StatusCode == http.StatusOK {
defer httpResp.Body.Close()
body, err := ioutil.ReadAll(httpResp.Body)
if err != nil {
return nil,... | [
-0.8926740288734436,
-0.3886890113353729,
1.0661541223526,
-0.4280480742454529,
-0.3812479078769684,
-0.4491555988788605,
-0.5839250087738037,
-0.9043628573417664,
-0.03220977634191513,
0.35290220379829407,
-0.43571582436561584,
-0.049978047609329224,
-0.8940806984901428,
-0.33743515610694... |
func (c *Client) GetVendor(term string) string {
c.Output = "vendor"
result := ""
httpResp, err := c.sendRequest("GET", term, nil)
if err != nil {
return result
}
if httpResp.StatusCode == http.StatusOK {
defer httpResp.Body.Close()
body, err := ioutil.ReadAll(httpResp.Body)
if err != nil {
return resu... | [
-0.8244864344596863,
0.06501328945159912,
0.6601956486701965,
0.4500695765018463,
-1.005801796913147,
-0.30302998423576355,
-0.7072672247886658,
-0.39266178011894226,
-0.12175339460372925,
0.20318719744682312,
0.041110098361968994,
1.3027541637420654,
-0.6815813779830933,
0.353139132261276... |
func TransformAccount(ledgerChange ingestio.Change) (AccountOutput, error) {
ledgerEntry, outputDeleted, err := utils.ExtractEntryFromChange(ledgerChange)
if err != nil {
return AccountOutput{}, err
}
accountEntry, accountFound := ledgerEntry.Data.GetAccount()
if !accountFound {
return AccountOutput{}, fmt.Er... | [
0.31840285658836365,
-0.7527489066123962,
0.7053743600845337,
0.2765847146511078,
-0.13360299170017242,
-0.6956889033317566,
0.8451204299926758,
0.36120542883872986,
0.8016126751899719,
0.19636300206184387,
0.4868057072162628,
0.5664493441581726,
0.2602171301841736,
0.6015487909317017,
0... |
func equal(left, right []string) bool {
if len(left) != len(right) {
return false
}
for i, value := range left {
if value != right[i] {
return false
}
}
return true
} | [
-0.10481428354978561,
-0.1849176287651062,
0.766383171081543,
-0.5848468542098999,
0.4142909646034241,
0.7554560303688049,
-1.4890466928482056,
-0.5640817880630493,
-0.7907035946846008,
1.4276918172836304,
-1.0046499967575073,
0.7863074541091919,
-0.9021623730659485,
0.8236321210861206,
... |
func DefaultRegions() []string {
return []string{
"us-east-2",
"us-east-1",
"us-west-1",
"us-west-2",
"ap-south-1",
"ap-northeast-2",
"ap-southeast-1",
"ap-northeast-1",
"ca-central-1",
"eu-central-1",
"eu-west-1",
"eu-west-2",
"sa-east-1",
}
} | [
-0.39718517661094666,
0.3425763249397278,
0.6349330544471741,
-0.15765830874443054,
0.5436679124832153,
0.46494022011756897,
-0.34621208906173706,
-0.5348455905914307,
0.46083423495292664,
-0.45381492376327515,
-0.32308802008628845,
-0.27434074878692627,
-0.194473996758461,
0.0399029701948... |
func trackConfigFileChanges(ctx context.Context, configFilePath string) {
watcher, err := fsnotify.NewWatcher()
if err != nil {
logs.LogWithFields(ctx).Error(err.Error())
}
err = watcher.Add(configFilePath)
if err != nil {
logs.LogWithFields(ctx).Error(err.Error())
}
go func() {
for {
select {
case f... | [
0.5906440019607544,
-0.585793137550354,
0.7113352417945862,
0.19012103974819183,
0.06424278020858765,
0.2672288715839386,
0.9230470657348633,
0.23219521343708038,
-1.2310216426849365,
0.45997145771980286,
-0.5171351432800293,
-0.2787066102027893,
-0.04785238951444626,
0.7603025436401367,
... |
func createContext(transactionID, actionID, actionName, threadID, threadName, ProcessName string) context.Context {
ctx := context.Background()
ctx = context.WithValue(ctx, common.TransactionID, transactionID)
ctx = context.WithValue(ctx, common.ActionID, actionID)
ctx = context.WithValue(ctx, common.ActionName, ac... | [
1.106523036956787,
-0.7599940896034241,
0.7394660711288452,
-0.19149941205978394,
0.30729642510414124,
0.3334725499153137,
-0.7109988927841187,
-1.0187491178512573,
0.5467528104782104,
0.941778302192688,
0.8442358374595642,
-0.2926844358444214,
-0.9221178293228149,
0.06976703554391861,
-... |
func main() {
//predef of 4 languages
languages[0] = "english"
languages[1] = "日本語"
languages[2] = "deutsch"
languages[3] = "svenska"
//starting client
client()
} | [
0.2827923595905304,
0.0919659361243248,
0.4372389316558838,
-0.44371601939201355,
-0.19145475327968597,
0.5712339878082275,
0.25971466302871704,
0.46720653772354126,
-1.3005045652389526,
0.11799982190132141,
-1.0018444061279297,
0.22961096465587616,
-0.6936941742897034,
0.4318898618221283,... |
func check(err error) {
if (err != nil) {
fmt.Println(err)
os.Exit(1)
}
} | [
0.295061856508255,
0.010827180929481983,
0.3339569866657257,
1.4430086612701416,
-0.02003098838031292,
0.6741632223129272,
0.19578416645526886,
0.6151220202445984,
0.1142563670873642,
0.07001660764217377,
0.8845655918121338,
0.7465224266052246,
0.032148782163858414,
1.960795521736145,
0.... |
func validateLang() {
//print all lang options
fmt.Println(intro)
for _, lang := range languages {
fmt.Println(lang)
}
//local lines that will hold all lines in the choosen lang file
lines = make([]string,0)
//l will be our predefined languages
l := languages
//infinit loop for reading user input languag... | [
0.7252522110939026,
-0.6919232606887817,
0.774143397808075,
0.042193703353405,
-0.1938299834728241,
0.9527413249015808,
0.3718954920768738,
0.2217833399772644,
-1.0458793640136719,
-0.14066943526268005,
0.3267683684825897,
0.4391045570373535,
-0.2849544882774353,
1.2655458450317383,
0.67... |
func userInput() string {
msg, err := reader.ReadBytes('\n')
check(err)
if len(msg) == 0 {
msg = append(msg, 32)
}
return string(msg)
} | [
0.2949897050857544,
0.3142513334751129,
0.5799719095230103,
-0.19639773666858673,
-0.7660691142082214,
0.7442598938941956,
0.3810719847679138,
-1.1713813543319702,
0.46005502343177795,
-0.799153745174408,
0.22774828970432281,
0.3196515440940857,
-0.8670147657394409,
-0.28101658821105957,
... |
func fillup(array []byte, endIndex, startIndex int) []byte {
for tmp := startIndex; tmp < endIndex; tmp++ {
array[tmp] = byte(0)
}
return array
} | [
-0.4058413803577423,
-0.08946464955806732,
0.8879863023757935,
-0.32525870203971863,
0.8297329545021057,
0.49258625507354736,
0.28435948491096497,
-0.10346100479364395,
0.24249814450740814,
0.5277574062347412,
-0.2698684632778168,
0.7465659379959106,
-0.5857897400856018,
-0.709984898567199... |
func makeMsg(opt int, msg string) []byte {
msg = strings.TrimSpace(msg) //remove space from input
var res = make([]byte, 10) //return array variable for what to send back to srv
res[0] = byte(opt) //opt code will always be on index zero
switch opt {
case 2 : //Withdrawl
if len(msg) > 9 { //cant whithdrawl... | [
-0.6403093934059143,
0.9782702922821045,
1.308047890663147,
-0.4762228727340698,
-0.22149114310741425,
-0.41022735834121704,
0.05390177294611931,
-0.4337524175643921,
0.1484951227903366,
1.001010537147522,
-0.09757674485445023,
-0.0603233203291893,
-0.3854996860027313,
0.4602908492088318,
... |
func loginSetUp(connection net.Conn) {
fmt.Println(lines[0]) //first line in the given lang file
//infinit loop to read in correct cardnumber
for {
fmt.Print(lines[1])
card := strings.Replace(string(userInput()), " ", "", -1) //remooves space in cardnumber
connection.Write(makeMsg(100, card)) //send msg to ... | [
-0.670799732208252,
-0.56474769115448,
0.9556624293327332,
-0.09634049236774445,
-0.12678532302379608,
0.19763636589050293,
-0.09199589490890503,
-0.025345519185066223,
-0.350809246301651,
0.25316038727760315,
0.09903403371572495,
0.14987227320671082,
-0.1629447340965271,
-0.01196153182536... |
func decode(array []byte) string {
var tmp string
for _, elem := range array {
tmp += strconv.Itoa(int(elem))
}
return tmp
} | [
0.0006408739718608558,
-0.6218322515487671,
0.48512691259384155,
-0.22923174500465393,
0.09925362467765808,
0.11382215470075607,
-0.5530644655227661,
0.5728529691696167,
0.1824577897787094,
0.35024768114089966,
0.017929136753082275,
-0.7600762248039246,
-0.45972582697868347,
0.550677597522... |
func overrideFile(filename, newcontent string) {
file, fileErr := os.Create(filename) //open given file
if fileErr != nil {
fmt.Println(fileErr)
}
file.WriteString(newcontent) //write the new content to the file
file.Close()
return
} | [
0.45137491822242737,
-0.5775288939476013,
0.3603293001651764,
-0.3724859058856964,
0.7011827826499939,
0.24309474229812622,
0.15543480217456818,
0.9412574172019958,
-1.2736308574676514,
-0.3586053252220154,
0.1991475522518158,
0.10985762625932693,
-0.522198498249054,
-0.4074372351169586,
... |
func updateFile(connection net.Conn) {
fmt.Println("Updating file...")
lang := make([]byte, 10)
var content string //content for the new file
connection.Read(lang) //read what lang file to change
tmp := make([]byte, 255) //tmp for holdning the content from the srv
for {
read,_ := connection.Read(tmp) //r... | [
0.338387668132782,
-0.38731279969215393,
0.9621978998184204,
-0.26928701996803284,
-0.5165112614631653,
0.07599419355392456,
-0.11518590897321701,
0.6349219679832458,
-1.1841866970062256,
0.32879605889320374,
0.03694842755794525,
-0.0043734218925237656,
-0.9507779479026794,
0.6972147822380... |
func client(){
// Connect to the server through tcp/IP.
connection, err := net.Dial("tcp", ("127.0.0.1" + ":" + "9090"))
updateListener , listErr := net.Dial("tcp", ("127.0.0.1" + ":" + "9091"))
// If connection failed crash.
check(err)
check(listErr)
//Create separate thread for updating client.
go update(... | [
0.19015902280807495,
0.13835035264492035,
0.38004204630851746,
0.24984008073806763,
-0.19792790710926056,
0.43999913334846497,
0.19994443655014038,
-0.029203910380601883,
-0.37208402156829834,
-0.19246695935726166,
-0.19901598989963531,
-0.1439051479101181,
0.0006322322878986597,
-0.128527... |
func update(connection net.Conn) {
tmp := make([]byte, 1)
for {
connection.Read(tmp)
if tmp[0] == 255 {
updateFile(connection)
}
}
} | [
-0.1326226145029068,
-0.887701153755188,
0.5117548108100891,
0.0651194304227829,
-0.3127577602863312,
0.13104280829429626,
-0.2167796939611435,
-0.09471382945775986,
-0.9468351006507874,
0.6618428230285645,
0.33935296535491943,
-0.723392903804779,
-0.809572160243988,
0.7035612463951111,
... |
func NewArtifactListerOK() *ArtifactListerOK {
return &ArtifactListerOK{}
} | [
-0.14688844978809357,
-0.8703464865684509,
-0.009444231167435646,
-0.0488494411110878,
-0.7786256670951843,
-1.006980299949646,
0.6969040632247925,
0.8580248951911926,
0.4186192750930786,
0.15839934349060059,
-0.5873674750328064,
0.013007530942559242,
0.5293474197387695,
-0.653007626533508... |
func (o *ArtifactListerOK) WithNext(next string) *ArtifactListerOK {
o.Next = next
return o
} | [
-0.2386222630739212,
0.18333519995212555,
-0.00967793446034193,
0.2919284999370575,
-0.8341110348701477,
-0.534915566444397,
0.2173020988702774,
0.2810843586921692,
0.8688855171203613,
0.010718662291765213,
-0.5416574478149414,
-0.18424008786678314,
0.03378405049443245,
-0.4671928882598877... |
func (o *ArtifactListerOK) SetNext(next string) {
o.Next = next
} | [
-0.4885304570198059,
0.39661848545074463,
-0.17271658778190613,
0.7145471572875977,
-0.8360118865966797,
-0.16994795203208923,
0.28129059076309204,
0.3058106601238251,
0.4401783347129822,
0.2675984501838684,
-0.880673885345459,
0.21046671271324158,
-0.708393931388855,
0.05857173353433609,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.