text
stringlengths
11
6.3k
embedding
listlengths
768
768
func Timeout(d time.Duration) func(*Attacker) { return func(a *Attacker) { a.client.Timeout = d } }
[ 0.12305185943841934, 0.489067941904068, 0.379792183637619, -0.1688019335269928, -0.2607845664024353, 0.3557201027870178, 0.4890439212322235, 0.39496901631355286, 0.5800414085388184, 0.4240547716617584, 0.4195895791053772, 0.7543657422065735, 1.2330905199050903, -0.8885218501091003, 0.249...
func LocalAddr(addr net.IPAddr) func(*Attacker) { return func(a *Attacker) { tr := a.client.Transport.(*http.Transport) a.dialer.LocalAddr = &net.TCPAddr{IP: addr.IP, Zone: addr.Zone} tr.Dial = a.dialer.Dial } }
[ 0.4603949785232544, -0.9028531312942505, 0.5132535696029663, -0.5250879526138306, -1.0496200323104858, -0.2622085511684418, -0.09522755444049835, 0.419201523065567, 1.060925841331482, 0.16934065520763397, 0.567138135433197, 0.14609858393669128, 0.8144989609718323, -0.561058759689331, 0.2...
func KeepAlive(keepalive bool) func(*Attacker) { return func(a *Attacker) { tr := a.client.Transport.(*http.Transport) tr.DisableKeepAlives = !keepalive if !keepalive { a.dialer.KeepAlive = 0 tr.Dial = a.dialer.Dial } } }
[ -0.2146909236907959, -0.7295502424240112, 0.8306052684783936, -0.03420935571193695, -0.12361185997724533, 0.8198498487472534, -0.43984222412109375, -0.15752354264259338, -0.28367283940315247, 0.5193769335746765, -0.2248963713645935, -1.147314190864563, -0.3167702257633209, -1.4081228971481...
func TLSConfig(c *tls.Config) func(*Attacker) { return func(a *Attacker) { tr := a.client.Transport.(*http.Transport) tr.TLSClientConfig = c } }
[ 1.3075557947158813, 0.12962600588798523, 0.49460160732269287, -1.6889183521270752, -0.7373338341712952, -0.32413217425346375, -0.15450255572795868, 0.7968152761459351, 0.10155928134918213, 0.4571439027786255, -1.5030266046524048, -0.1333453208208084, 1.1601556539535522, -0.1720278561115265...
func HTTP2(enabled bool) func(*Attacker) { return func(a *Attacker) { if tr := a.client.Transport.(*http.Transport); enabled { http2.ConfigureTransport(tr) } else { tr.TLSNextProto = map[string]func(string, *tls.Conn) http.RoundTripper{} } } }
[ 0.13978733122348785, -0.8208913207054138, 0.5105616450309753, 0.8566616773605347, -1.3300437927246094, 0.30252039432525635, -0.5518962740898132, 0.2960476875305176, -0.6231264472007751, 0.37797755002975464, -0.4002450108528137, 0.41042253375053406, 0.034413233399391174, -0.1339027583599090...
func H2C(enabled bool) func(*Attacker) { return func(a *Attacker) { if tr := a.client.Transport.(*http.Transport); enabled { a.client.Transport = &http2.Transport{ AllowHTTP: true, DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) { return tr.Dial(network, addr) }, } } ...
[ 0.7702273726463318, -1.272260308265686, 0.8422037959098816, 0.47051337361335754, -0.8884412050247192, 0.19297780096530914, 0.017908034846186638, 0.389884352684021, -0.7698317766189575, 0.021220888942480087, 0.16332803666591644, 0.059170693159103394, 0.7542269825935364, -1.0614455938339233,...
func MaxBody(n int64) func(*Attacker) { return func(a *Attacker) { a.maxBody = n } }
[ -0.20364175736904144, 0.4779964089393616, 0.5533537268638611, 0.6619415283203125, -0.2549702227115631, -0.08296602219343185, -0.13891102373600006, -0.6331206560134888, 1.6045715808868408, -0.5738764405250549, -1.0124250650405884, -0.8009628057479858, 0.4129146933555603, 0.27449607849121094...
func UnixSocket(socket string) func(*Attacker) { return func(a *Attacker) { if tr, ok := a.client.Transport.(*http.Transport); socket != "" && ok { tr.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) { return net.Dial("unix", socket) } } } }
[ 0.371328204870224, 0.3341321051120758, 0.7501223683357239, -0.35266441106796265, -0.07945593446493149, -0.1823381632566452, -0.731665849685669, 0.08235347270965576, 0.42243343591690063, -0.6897716522216797, -0.2712318003177643, 0.6374221444129944, 0.4077874422073364, -1.1586837768554688, ...
func Client(c *http.Client) func(*Attacker) { return func(a *Attacker) { a.client = *c } }
[ 0.4041842818260193, -0.31635311245918274, 0.24304743111133575, -0.4735572040081024, -0.446328729391098, 0.19015446305274963, 0.6373463273048401, -0.0371168814599514, 0.20420502126216888, -0.7653369903564453, -0.89982670545578, 0.6424695253372192, 0.9957616329193115, -1.1191515922546387, ...
func ProxyHeader(h http.Header) func(*Attacker) { return func(a *Attacker) { if tr, ok := a.client.Transport.(*http.Transport); ok { tr.ProxyConnectHeader = h } } }
[ 0.09267020225524902, -0.46118637919425964, 0.6078022122383118, -0.21329666674137115, 0.023101070895791054, 0.0759953036904335, 0.36115220189094543, 0.3001580536365509, -0.38292747735977173, 0.5459122657775879, -0.27796241641044617, -0.3181000351905823, 0.005465889349579811, -0.730423688888...
func (a *Attacker) Attack(tr Targeter, p Pacer, du time.Duration, name string) <-chan *Result { var wg sync.WaitGroup workers := a.workers if workers > a.maxWorkers { workers = a.maxWorkers } results := make(chan *Result) ticks := make(chan struct{}) for i := uint64(0); i < workers; i++ { wg.Add(1) go a....
[ -0.9514849781990051, 0.4211445450782776, 0.7782116532325745, 0.08354940265417099, -0.08816207200288773, -0.47495338320732117, 0.8265806436538696, -0.8034512996673584, -0.3387312889099121, 0.4202105402946472, 0.44786956906318665, 0.20170237123966217, -0.3602731227874756, -0.3062503337860107...
func (a *Attacker) Stop() { select { case <-a.stopch: return default: close(a.stopch) } }
[ -0.24350322782993317, -0.46447500586509705, 0.24250349402427673, 0.4785434305667877, 0.623038113117218, 0.3362638056278229, 0.4043845236301422, -0.5341970324516296, -0.7330532670021057, -0.5606975555419922, -0.10937090963125229, -0.08562274277210236, -0.19851216673851013, -1.12032318115234...
func WithWriteConfig(c Config) Option { return func(ro *repoOptions) { ro.writeConfigs = append(ro.writeConfigs, c) } }
[ -0.27447184920310974, -0.45799171924591064, 0.36742350459098816, -0.5197311639785767, 0.6550096869468689, -0.18435513973236084, 0.5783650875091553, 0.4702926576137543, 0.4631099998950958, 0.9614609479904175, -0.6252729892730713, -0.4314836859703064, 0.9592946171760559, 0.3691117465496063, ...
func WithReadConfig(c Config) Option { return func(ro *repoOptions) { ro.readConfigs = append(ro.readConfigs, c) } }
[ 0.5624632239341736, -0.05936112627387047, 0.7070061564445496, -0.5129662752151489, -0.4959786832332611, 0.598110556602478, 0.20686356723308563, 0.20375560224056244, 0.758222222328186, 0.1855025589466095, -0.3952202796936035, -0.6488808393478394, 0.961733341217041, 0.059732697904109955, -...
func NewRepo(options ...Option) (*Repo, error) { ro := &repoOptions{} for _, opt := range options { opt(ro) } var dbc repository.DbConfig for _, wc := range ro.writeConfigs { var c repository.Config c.User = wc.User c.Password = wc.Password c.Host = wc.Host c.Port = wc.Port c.Db = wc.Db dbc.WriteCo...
[ 0.20575839281082153, 0.297437459230423, 0.6536728143692017, 0.4997972846031189, -0.09066958725452423, -0.4176001250743866, 0.6000957489013672, -0.04372674226760864, 0.03028726391494274, -0.3995898962020874, 0.21050412952899933, -0.6115478873252869, -0.1441372185945511, -0.651461660861969, ...
func (r *Repo) GetAtlasSources(dst uint32, stale time.Duration) ([]uint32, error) { rows, err := r.Repo.GetReader().Query(getSources, dst, int64(stale.Minutes())) var srcs []uint32 if err != nil { log.Error(err) return nil, err } defer logError(rows.Close) for rows.Next() { var curr uint32 err := rows.Sca...
[ -0.7297816276550293, 0.5685962438583374, 0.770194947719574, -0.7285755276679993, -0.3393392562866211, -0.577538013458252, -0.8026689291000366, -0.6964434385299683, -0.02003137208521366, 0.1296442151069641, -0.2254096120595932, -0.18800583481788635, 0.2872403562068939, 0.698983907699585, ...
func (r *Repo) CheckIntersectingPath(tracerouteID int64, hopIntersection uint32) (*pb.Path, error) { // First check if the hop intersection is in the traceroute // If it is, it was an exact match if we do not need to look further // Else it was a guessed RR match so we need to look in the RR table var err error a...
[ -0.20596033334732056, 0.36302870512008667, 0.7702162265777588, 0.43041297793388367, -0.13054852187633514, 0.5004721879959106, 0.743654191493988, 0.24011386930942535, -0.6451142430305481, 0.7434608936309814, 0.6543112993240356, -1.5066313743591309, -0.8031323552131653, 0.6660683155059814, ...
func (r *Repo) FindIntersectingTraceroute(iq types.IntersectionQuery) (types.IntersectionResponse, error) { log.Debug("Finding intersecting traceroute ", iq) // var err error foundIntersectingRR := false if iq.UseAtlasRR { // Allow to use the RR pings from the traceroute atlas. var rowsRR *sql.Rows if iq.Ign...
[ 0.05020138993859291, -0.22427643835544586, 0.8758375644683838, -0.7702379822731018, 0.3186905086040497, -0.23346379399299622, 0.06185866892337799, -0.27295982837677, -0.16199280321598053, 0.32855892181396484, 0.9226164817810059, -0.8583856821060181, -0.6270320415496826, 0.8116320967674255,...
func (r *Repo) StoreAtlasTraceroute(trace *datamodel.Traceroute) (int64, error) { conn := r.Repo.GetWriter() tx, err := conn.Begin() if err != nil { return 0, err } res, err := tx.Exec(insertAtlasTrace, trace.Dst, trace.Src, trace.SourceAsn, trace.Platform) if err != nil { logError(tx.Rollback) return 0, er...
[ -0.4639875590801239, 0.44356781244277954, 0.9261165857315063, -0.6013408899307251, 0.06111367419362068, -0.45450323820114136, 0.5710436105728149, -0.2803198993206024, -0.1199691966176033, 0.5079224705696106, -0.28481927514076233, -0.8468797206878662, -0.4415792226791382, 0.5208486914634705...
func (r *Repo) StoreAtlasTracerouteBulk(trs []*datamodel.Traceroute) ([] int64, error) { conn := r.Repo.GetWriter() tx, err := conn.Begin() if err != nil { return []int64{}, err } ids, err := storeAtlasTracerouteBulk(tx, trs) if err != nil { tx.Rollback() log.Error(err) return []int64{}, err } err = ...
[ -0.8542702794075012, 0.6333991289138794, 0.8160121440887451, -0.48847293853759766, 1.0439783334732056, -0.40827295184135437, 0.3051765561103821, -0.20434099435806274, -0.0016675605438649654, 0.5598770976066589, -1.2417627573013306, -0.07724075764417648, 0.24988560378551483, 0.1669082343578...
func (r *Repo) GetIPAliases(ips []uint32) (map[uint32]int64, map[int64][]uint32, error) { conn := r.Repo.GetReader() query := getAliasSets query += "(" for i, ip := range(ips) { if i > 0 { query += "," } query += fmt.Sprintf("%d", ip) } query += "))" // fmt.Println(query) rows, err:= conn.Query(query...
[ -0.8582388162612915, -0.2429066300392151, 0.5978830456733704, -0.6293376088142395, -0.5825032591819763, -0.3407650589942932, 0.15508046746253967, 0.202184796333313, -0.2348255217075348, 0.6667540073394775, 0.20645511150360107, -1.0113195180892944, 0.35197484493255615, 0.08641039580106735, ...
func (r *Repo) StoreTrRRHop(trIDRRHopAliass []types.TrIDRRHop) error { conn := r.Repo.GetWriter() tx, err := conn.Begin() if err != nil { log.Error(err) return err } query := bytes.Buffer{} query.WriteString(insertTrRRHopAliasBulk) for _, in := range trIDRRHopAliass { // if i == 2 { // break // } ...
[ -1.1969716548919678, -0.29932865500450134, 0.6948362588882446, -0.2956595718860626, 0.1026870384812355, 0.7131789326667786, 0.2719753384590149, 0.13168080151081085, -0.041871070861816406, 0.7826988697052002, -0.20138028264045715, -0.5349045395851135, -0.7040484547615051, 0.292184978723526,...
func numIslands(grid [][]byte) int { var count int for i := 0; i < len(grid); i++ { for j := 0; j < len(grid[i]); j++ { if grid[i][j] == '1' { dfsIslands(grid, i, j) count++ } } } return count }
[ 0.6317502856254578, 1.1915206909179688, 0.6851491332054138, 0.5157185196876526, 0.007485209032893181, -0.23057016730308533, 0.6993902325630188, -0.021114498376846313, 0.699641227722168, 0.26485899090766907, -0.16538332402706146, -0.41725674271583557, -0.6961987018585205, 1.279694676399231,...
func Duration(filepath string) (int, error) { file, _ := os.Open(filepath) defer file.Close() moovAtomPosition, _, err := findAtom(0, "moov", file) if err != nil { return 0, err } // start searching for the mvhd atom inside the moov atom. // The first child atom of the moov atom starts 8 bytes after the star...
[ 0.6414701342582703, -0.25353193283081055, 0.6333904266357422, -0.23728343844413757, -0.20284250378608704, 0.38626423478126526, 0.7790457010269165, 0.940167248249054, -0.415286660194397, 1.1458786725997925, -0.04555816203355789, 0.055909063667058945, -0.40616074204444885, 0.6429877877235413...
func findAtom(startPos int64, atomName string, file *os.File) (int64, int64, error) { buffer := make([]byte, 8) for true { _, err := file.ReadAt(buffer, startPos) if err != nil { return 0, 0, err } // The structure of an mp4 atom is: // 4 bytes - length of atom // 4 bytes - name of atom in ascii encod...
[ 0.24107295274734497, -1.186036467552185, 0.5698940753936768, -0.2596680223941803, -0.12915518879890442, -0.5797246098518372, 0.420000821352005, -0.11563113331794739, -0.7748356461524963, 0.3998021185398102, -0.5568907260894775, 0.5099653601646423, -0.7287197113037109, 0.038777511566877365,...
func durationFromMvhdAtom(mvhdStart int64, mvhdLength int64, file *os.File) (int, error) { buffer := make([]byte, 8) _, err := file.ReadAt(buffer, mvhdStart+20) // The timescale field starts at the 21st byte of the mvhd atom if err != nil { return 0, err } // The timescale is bytes 21-24. // The duration is by...
[ 1.1243925094604492, -0.529670238494873, 0.6267191171646118, -0.594369113445282, -0.9762544631958008, 0.36788201332092285, -0.3707980215549469, 0.6360157132148743, -0.8500903248786926, 1.323906421661377, -0.23760364949703217, 0.17013008892536163, -0.41278210282325745, 0.44347241520881653, ...
func extractAppDefinition(jsonContent []byte) (*v2.ApplicationDefinition, error) { application := &v2.ApplicationDefinition{} err := json.Unmarshal(jsonContent, &application) if err != nil { return nil, err } return application, nil }
[ 0.416835218667984, -1.1203726530075073, 0.18930065631866455, -0.24485357105731964, -1.0772558450698853, -0.16588719189167023, -0.7128798365592957, -0.20419850945472717, 0.6761243343353271, 1.4314159154891968, -0.9982708692550659, 0.22821666300296783, -0.2429063767194748, 0.4714676141738891...
func GetApplicationDefinition(filePath string) (*v2.ApplicationDefinition, []byte, error) { info, err := os.Stat(filePath) if err != nil { return nil, nil, err } var buffer []byte if info.IsDir() { _, content, err := resolveYamlOrJSON(path.Join(filePath, filepath.Base(filePath))) if err != nil { return n...
[ 0.2660898268222809, -0.7759552597999573, 0.6986163258552551, 0.3327312767505646, -0.11555321514606476, -0.40660107135772705, 0.25974422693252563, 0.336529016494751, 0.3788484036922455, 0.5559720396995544, -0.6784248948097229, 0.2675126791000366, 0.22818665206432343, 1.4452165365219116, 0...
func PrintStatus() { hrepo := sqlite.NewHeadsRepo() trepo := sqlite.NewTaskRepo() var pr *domain.Project var t *domain.Task var err error if t, pr, err = hrepo.GetCurrentTask(); err != nil { fmt.Printf("Error :%v\n", err) return } taskName := "No definida" tid := 0 if t != nil { taskName = t.Name ...
[ 0.5016312599182129, -0.2544019818305969, 0.7964681386947632, -0.3550468981266022, 0.5341436266899109, 0.3238580822944641, 0.45124098658561707, 0.5521854758262634, -1.1263008117675781, -0.23446516692638397, 0.23157086968421936, 0.5267332196235657, 0.13045327365398407, 0.6596161723136902, ...
func NewApiService( nowPaymentsService now_payments.Service, ordersService orders.Service, ) ApiServicer { return &ApiService { nowPaymentsService: nowPaymentsService, ordersService: ordersService, } }
[ -0.30843108892440796, -0.4317053258419037, 0.06999010592699051, -0.43542060256004333, -0.7179471850395203, -0.7015252113342285, -1.5085608959197998, -0.8313942551612854, 0.5984761118888855, 0.6874372959136963, -0.0029956025537103415, 0.15176501870155334, -0.5481160283088684, 1.090143442153...
func (s *ApiService) GetStatus(ctx context.Context) (ordf.ImplResponse, error) { status := ordf.Status{ Status: "UP", } // check NowPayments API nowPaymentsStatus, err := s.nowPaymentsService.Status(ctx) if err != nil { status.Status = fmt.Sprintf("Failed to check NowPayments status: %+v", err) } else if now...
[ -0.42754220962524414, -0.6906852722167969, 0.5202391743659973, -0.7949436902999878, 0.2025574892759323, -0.5364894270896912, -0.1606787145137787, 0.16546037793159485, 1.2288141250610352, 0.7303818464279175, 0.511463463306427, 0.2968670427799225, -0.5286387205123901, 0.047752745449543, -0...
func (s *ApiService) GetOrders(ctx context.Context, orderId string) (ordf.ImplResponse, error) { // TODO: implement long polling on separate polling API // will need to update SDK to pass in last known state and check for change order, err := s.ordersService.GetOrder(ctx, orderId) if err != nil { return ordf.Resp...
[ -1.2062723636627197, 0.20107944309711456, 0.3728918731212616, -0.2919294238090515, 0.8737777471542358, -1.1200532913208008, -0.6630150675773621, -0.9896402359008789, 1.2599066495895386, 0.5605770349502563, 0.3649942874908447, 0.5804809927940369, -0.426763653755188, 0.736395537853241, 0.0...
func (s *ApiService) PostOrders(ctx context.Context, order ordf.Order) (ordf.ImplResponse, error) { orderID, err := s.ordersService.CreateOrder(ctx, order) if err != nil { return ordf.Response(500, nil), err } return ordf.Response(200, ordf.OrderCreated{ OrderId: orderID, }), nil }
[ -0.9576117992401123, 0.1956968605518341, 0.19228380918502808, -0.8033192753791809, 0.1808331310749054, -0.6683204174041748, -0.32568103075027466, -0.23989559710025787, 0.5840977430343628, -0.16336104273796082, -0.646443784236908, -0.268217533826828, -1.331999659538269, 0.41365453600883484,...
func (s *ApiService) IPNWebhook(w http.ResponseWriter, r *http.Request) { // return 200 on success, otherwise nothing (NowPayments will retry) /* ctx := context.Background() // cryptographically validate webhook payload payment, err := s.nowPaymentsService.IPNWebhookValidate(r) if err != nil { fmt.Printf("Fai...
[ -0.6102476119995117, -0.354138046503067, 0.7022815346717834, 0.03955911844968796, -0.14187577366828918, 0.10460608452558517, 0.1770990639925003, 0.20081356167793274, -0.04692642390727997, 0.972758948802948, 0.12176627665758133, -0.5906118750572205, -0.2744590640068054, -0.49795645475387573...
func wndProc(hwnd syscall.Handle, msg uint32, wparam, lparam uintptr) (rc uintptr) { return uit.M.DefWindowProc(hwnd, msg, wparam, lparam) }
[ 1.2029768228530884, -0.0706779807806015, 0.6203852295875549, -0.7531525492668152, -0.44660067558288574, -0.14011378586292267, 0.954694926738739, -1.3364447355270386, -0.32903143763542175, 0.2520638108253479, 0.8412678241729736, 0.7803361415863037, -0.8638375401496887, 0.3602575659751892, ...
func main() { objects.SeedRng() game := InitGame(10, 6) game.Play() }
[ 0.3755791187286377, 0.2603679299354553, 0.638443648815155, 0.8413211107254028, 0.7157190442085266, 0.41085925698280334, 0.3689008355140686, -0.21378442645072937, -0.14786699414253235, 0.398029088973999, -0.2769078314304352, -0.08522007614374161, -0.32343730330467224, -0.0020038208458572626...
func InitGame(gridSize, numBombs int) *Game { return &Game{ grid: InitGrid(gridSize, numBombs), status: InProgress, } }
[ 0.30390626192092896, -0.023480983451008797, 0.5276302695274353, 0.4841533601284027, -0.1911994367837906, -0.002763560274615884, -0.6394120454788208, -0.25761878490448, 0.10819996148347855, -0.06246725469827652, 0.13923339545726776, -0.6719053983688354, -1.5987217426300049, 0.36416360735893...
func (game Game) Play() { for game.status == InProgress { game.display() action := promptAction() coords := game.getCoordsInput() game.applyAction(action, coords) game.status = game.getStatus() } game.display() game.printEndStatus() }
[ -0.8347194790840149, -0.8849889039993286, 0.6336621046066284, 0.4865226745605469, 0.36852383613586426, 0.6880984306335449, 0.15568359196186066, -0.3664252460002899, -0.23128442466259003, -0.0907478779554367, 0.5072659254074097, -0.39625442028045654, 0.033768314868211746, 0.0612301453948020...
func (game Game) getCoordsInput() objects.GridCoords { coords := promptCoords() for !game.grid.validCoords(coords) || game.grid[coords.Row][coords.Col]&Explored != 0 { fmt.Println("Invalid row/col, try again.") coords = promptCoords() } return coords }
[ -0.25296562910079956, 0.42543330788612366, 0.5399891138076782, 0.05745108425617218, 0.06836726516485214, 0.5481570363044739, 0.7145969271659851, -1.033531665802002, 0.23428833484649658, -0.7206401824951172, 0.7447155714035034, -0.2474900186061859, -0.5090401768684387, -0.6846216917037964, ...
func (game Game) applyAction(action GameAction, coords objects.GridCoords) { switch action { case Explore: game.grid[coords.Row][coords.Col] |= Explored if game.grid[coords.Row][coords.Col]&Bomb == 0 && game.grid.countNeighbourBombs(coords) == 0 { game.exploreNeighbours(coords) } case Flag: if game.gr...
[ -0.06335372477769852, -0.10840664803981781, 0.899971604347229, -0.17862772941589355, 0.23616717755794525, 0.8974465131759644, -0.17843899130821228, 0.07733417302370071, 0.5740774869918823, 0.26226744055747986, 0.3712378740310669, -0.07980892062187195, -0.14614903926849365, 0.43796089291572...
func (game Game) exploreNeighbours(coords objects.GridCoords) { for i := range objects.GridDirections { newCoords := coords.MoveDirection(objects.GridDirections[i]) if game.grid.validCoords(newCoords) && game.grid[newCoords.Row][newCoords.Col]&Explored == 0 { game.applyAction(Explore, newCoords) } } }
[ -0.4086930453777313, 0.5713978409767151, 0.6942715644836426, 0.13303251564502716, -0.36752185225486755, -0.29549044370651245, 0.13245585560798645, -0.8890888690948486, 0.16080600023269653, 0.37635537981987, -0.046984750777482986, -0.24733193218708038, -0.1447800248861313, 0.700005292892456...
func (game Game) printEndStatus() { switch game.status { case GameWon: fmt.Println("You win - congrats!") case GameLost: fmt.Println("BOOM: you lose.") default: panic("Unexpected game status") } }
[ -0.1765509396791458, -0.5202944278717041, 0.4985383152961731, -0.21486292779445648, 0.3851371109485626, 1.1253843307495117, -1.4441630840301514, 0.014380177482962608, -0.5160887241363525, 0.858665943145752, -0.3596620559692383, 1.3790615797042847, 0.13845117390155792, 0.4595085382461548, ...
func (game Game) getStatus() GameStatus { numUnexplored := 0 for row := range game.grid { for col := range game.grid { cell := game.grid[row][col] if cell&Explored != 0 && cell&Bomb != 0 { return GameLost } if cell&(Explored|Flagged) == 0 { numUnexplored++ } } } if numUnexplored > 0 {...
[ -0.23561716079711914, 0.02794659323990345, 0.6863213777542114, 0.4693686366081238, 0.25990521907806396, -0.1079525426030159, -0.2929604947566986, 0.24985508620738983, 0.2078186720609665, 0.005741290748119354, 0.043780457228422165, 0.05078301206231117, -0.5394819378852844, 0.623691737651825...
func InitGrid(size, numBombs int) Grid { grid := make(Grid, size) for i := range grid { grid[i] = make([]Cell, size) } bombsPlaced := 0 for bombsPlaced != numBombs { row := rand.Intn(size) col := rand.Intn(size) if grid[row][col]&Bomb == 0 { grid[row][col] |= Bomb bombsPlaced++ } } return grid ...
[ 0.04343840479850769, 0.09298601001501083, 0.7518218755722046, 0.1345798820257187, 0.3627164363861084, 0.05150508135557175, 0.19265341758728027, -0.20346741378307343, -0.042170751839876175, 0.03746895492076874, -0.5797446966171265, 0.017325233668088913, -1.2643110752105713, 0.64770036935806...
func (grid Grid) validCoords(coords objects.GridCoords) bool { if coords.Row < 0 || coords.Row >= len(grid) { return false } if coords.Col < 0 || coords.Col >= len(grid[0]) { return false } return true }
[ -0.733669102191925, 0.1423899382352829, 0.539219081401825, 0.05328486114740372, -0.4597030580043793, 0.48625442385673523, -0.34053242206573486, -0.4933672845363617, -0.024390581995248795, -0.605174720287323, 0.3901699483394623, -0.4384290874004364, -0.873252809047699, 0.06413103640079498, ...
func (grid Grid) CellChar(coords objects.GridCoords) rune { cell := grid[coords.Row][coords.Col] if cell&Explored != 0 { if cell&Bomb != 0 { return 'X' } else { neighbourBombs := grid.countNeighbourBombs(coords) if neighbourBombs == 0 { return ' ' } else { return []rune(strconv.Itoa(neighbourB...
[ -0.2190062552690506, -0.7009513974189758, 0.7625771760940552, 0.9586890339851379, 0.05807514861226082, 0.16813285648822784, 0.420318603515625, -0.4663671851158142, -0.3039787709712982, 0.11636760830879211, 0.6841429471969604, 0.06534958630800247, 0.13162977993488312, 0.22931231558322906, ...
func (grid Grid) countNeighbourBombs(coords objects.GridCoords) int { bombCount := 0 for i := range objects.GridDirections { newCoords := coords.MoveDirection(objects.GridDirections[i]) if grid.validCoords(newCoords) && grid[newCoords.Row][newCoords.Col]&Bomb != 0 { bombCount++ } } return bombCount }
[ -0.03564854711294174, -0.3542640507221222, 0.6937128901481628, 0.12051503360271454, -0.6858272552490234, 0.7511971592903137, 0.6208691000938416, 0.022880731150507927, -0.7079917192459106, 0.08456134051084518, -1.4835225343704224, -0.32516857981681824, -0.8416509628295898, 0.478192210197448...
func toAction(actionInput string) (GameAction, error) { normalised := strings.ToUpper(strings.TrimSuffix(actionInput, "\n")) if len(normalised) < 1 { return -1, errors.New("No action specified") } switch normalised[0] { case 'E': return Explore, nil case 'F': return Flag, nil default: return -1, error...
[ -0.7592763900756836, -0.43907198309898376, 0.7124301791191101, 0.2818153202533722, 0.4211187958717346, -0.06023719161748886, 0.9345395565032959, -0.05354498699307442, 0.34667232632637024, 1.0688000917434692, -0.3225901424884796, 0.24057532846927643, -0.21727214753627777, -0.310578852891922...
func promptAction() GameAction { reader := bufio.NewReader(os.Stdin) fmt.Print("Select an action ((E)xplore or (F)lag)\n> ") actionInput, err := reader.ReadString('\n') if err != nil { panic(err) } action, actionErr := toAction(actionInput) for actionErr != nil { fmt.Print( "Invalid action, please try a...
[ -0.08840809017419815, -1.1480892896652222, 0.4215810000896454, -0.013912973925471306, 0.11470706760883331, 0.21522647142410278, 0.21050827205181122, -0.9151440262794495, 0.41924360394477844, 0.30609437823295593, 0.6959188580513, 0.8816910982131958, -0.09486617892980576, -0.6429403424263, ...
func promptCoords() objects.GridCoords { fmt.Println("Enter row and column:") row := getIntInput("row:\n> ") col := getIntInput("col:\n> ") return objects.GridCoords{Row: row, Col: col} }
[ -0.19417844712734222, -0.12013441324234009, 0.6170080900192261, -0.16547518968582153, -0.4217624366283417, 0.48496872186660767, 0.6036397814750671, -1.3567181825637817, -0.24164287745952606, -0.2519243061542511, 0.14860163629055023, -0.05791766941547394, -0.6863746047019958, -0.74040186405...
func getIntInput(prompt string) int { fmt.Print(prompt) reader := bufio.NewReader(os.Stdin) rawInput, err := reader.ReadString('\n') if err != nil { panic(err) } intInput, convertErr := strconv.Atoi(strings.TrimSuffix(rawInput, "\n")) for convertErr != nil { fmt.Println("Invalid integer, please try again.")...
[ 0.020496809855103493, -0.630469799041748, 0.9804197549819946, -0.3112953305244446, -0.932043731212616, 0.5551219582557678, 0.3178865909576416, -0.3899506628513336, -0.22658388316631317, -0.5888000726699829, 0.013604545965790749, 0.8945153951644897, -0.6843521595001221, -0.4418448209762573,...
func (c *InitCommand) Help() string { helpText := ` Usage: replicator init Creates an example scaling document that can be used as a starting point to customize further. The example is designed to work with the 'nomad init' job example. ` return strings.TrimSpace(helpText) }
[ 0.8964656591415405, -0.4252152740955353, 0.5435196161270142, -0.5008183121681213, -0.3448406457901001, 0.6114766597747803, 0.5082600116729736, 0.3901834785938263, -0.43572306632995605, 0.6243247389793396, -0.8424843549728394, 0.9558985233306885, -0.5758455991744995, -0.15099959075450897, ...
func (c *InitCommand) Synopsis() string { return "Create an example Replicator job scaling document" }
[ 0.4047114849090576, 0.11556978523731232, 0.2869786024093628, 0.43326088786125183, -0.24853573739528656, -0.3441151976585388, -0.16936765611171722, 1.1679093837738037, -0.6269059777259827, 0.6201408505439758, -0.35730576515197754, 0.5114172697067261, -0.07604528218507767, -0.447903752326965...
func (c *InitCommand) Run(args []string) int { // The command should be used with 0 extra flags. if len(args) != 0 { c.UI.Error(c.Help()) return 1 } // Check if the file already exists. _, err := os.Stat(DefaultInitName) if err != nil && !os.IsNotExist(err) { c.UI.Error(fmt.Sprintf("Failed to stat '%s': %...
[ -0.5036749839782715, 0.10628975182771683, 0.8480614423751831, -0.274179071187973, 0.4732218384742737, 0.20040163397789001, 1.4374364614486694, 0.5789610147476196, -1.0294499397277832, 0.8909024596214294, -0.868556797504425, 0.2281043380498886, -0.853188693523407, 0.533530056476593, 0.106...
func Provider() *schema.Provider { // TODO: log.Printf("[INFO] Creating Provider") return &schema.Provider{ Schema: map[string]*schema.Schema{ "username": { Type: schema.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("TRUEMARK_CONFLUENTCLOUD_USERNAME", ""), }, "passwor...
[ -0.5407934188842773, 0.1407073438167572, 0.31287530064582825, 0.020831173285841942, 0.03081582300364971, 0.17945513129234314, 0.6488013863563538, 0.5441197156906128, 0.515525758266449, 0.04224957153201103, 0.015780076384544373, -0.41946566104888916, 0.09092720597982407, 0.14201228320598602...
func resourceServiceAccount() *schema.Resource { return &schema.Resource{ CreateContext: ServiceAccountCreate, ReadContext: ServiceAccountRead, // UpdateContext: ServiceAccountUpdate, DeleteContext: ServiceAccountDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughCont...
[ 0.2379128783941269, -0.4980924725532532, 0.4267018437385559, -0.14231064915657043, -0.789788007736206, 0.048026300966739655, 1.2059626579284668, -0.588836669921875, 0.6868788599967957, 0.07856954634189606, 0.26700443029403687, 0.664520800113678, 0.24114327132701874, 0.03470025211572647, ...
func restoreSpec(config *core.Configuration) []string { errors := make([]string, 0, len(config.Spec)) for dst, src := range config.Spec { err := file.CopySpec(src, dst, config.Restore.Overwrite) if err != nil { errors = append(errors, err.Error()) core.WriteTaskFailure(src, dst) continue } core.Writ...
[ 0.08512714505195618, -0.3269794285297394, 0.5286241769790649, 0.0849834457039833, 0.7667089104652405, -0.1887514442205429, 0.5754350423812866, 0.6726769208908081, -0.45252734422683716, 1.171911358833313, -0.2329419106245041, -0.09526679664850235, 0.25073036551475525, 0.3281114399433136, ...
func restoreGlob(config *core.Configuration) []string { errors := make([]string, 0, len(config.Spec)) for dst, src := range config.Glob { err := file.RestoreGlob(src, dst, config.Backup.Overwrite) if err != nil { errors = append(errors, err.Error()) core.WriteTaskFailure(src.Dst, dst) continue } cor...
[ -0.24407672882080078, 0.2350701242685318, 0.6051538586616516, 0.3455158770084381, 1.188140869140625, 0.035374272614717484, 1.1469100713729858, 0.541189968585968, -0.24893780052661896, 0.9103001356124878, -0.4314168393611908, -0.33560869097709656, -0.48520052433013916, 0.4785414934158325, ...
func Restore(config *core.Configuration) { core.WriteTaskHeader("restore") specErrors := restoreSpec(config) globErrors := restoreGlob(config) errors := append(specErrors, globErrors...) core.WriteTaskFooter("restore", len(errors) == 0) core.WriteTaskErrors(errors) }
[ 0.07453624904155731, 0.251726359128952, 0.4325367212295532, 0.2977742552757263, 0.4717632532119751, -0.024574607610702515, 1.2773618698120117, 0.5996634364128113, -0.18815535306930542, 0.24770136177539825, -0.31314536929130554, 0.40135109424591064, -0.714024543762207, 0.37918561697006226, ...
func NewUserRepository(db UserRepositoryInterface) *UserRepository { return &UserRepository{ User: db, } }
[ -0.2661443054676056, -0.007036201655864716, -0.039873261004686356, 0.04977671429514885, -1.5739309787750244, -0.5187343955039978, -0.1616717427968979, 0.02625456266105175, 0.6117807030677795, -0.4731282889842987, -0.616661548614502, -0.3868311047554016, 0.28917157649993896, 0.5698862671852...
func (l *Lexer) emit(t TokenType) { l.tokens <- Token{t, l.cache()} l.start = l.pos }
[ -1.0357054471969604, 0.21663948893547058, 0.05826380103826523, -1.0888035297393799, 0.19062985479831696, 0.2580541670322418, -0.9505382180213928, 0.1446382701396942, -0.6029789447784424, 0.48065075278282166, -1.3984590768814087, 0.41341981291770935, -0.29790565371513367, 0.5302581787109375...
func (l *Lexer) ignore() { l.start = l.pos }
[ -0.23265008628368378, -1.0474066734313965, 0.2933233082294464, -0.635613203048706, 0.2802802324295044, 0.5310941338539124, -0.20793722569942474, 0.5553550124168396, -0.5592588186264038, -0.22354580461978912, -0.8997787237167358, -0.22738628089427948, -0.6409200429916382, 0.0661452934145927...
func (l *Lexer) next() rune { r, width := utf8.DecodeRuneInString(l.input[l.pos:]) l.pos += width // log.Printf("[next] %s", l.debugString()) return r }
[ -0.5338917970657349, -0.29862919449806213, 0.4234067499637604, -0.37720799446105957, -1.0264616012573242, -0.06376676261425018, -0.9556064009666443, 0.3618895411491394, 0.25505417585372925, -0.74949711561203, 0.46024686098098755, 0.3311045169830322, -0.8574925661087036, -0.0832127407193183...
func (l *Lexer) backup() { l.pos = l.start // log.Printf("[back] %s", l.debugString()) }
[ 0.2116970270872116, -1.0344828367233276, 0.47230592370033264, -0.647791862487793, -0.25656187534332275, 0.2181277573108673, 0.2991972863674164, 0.601333737373352, -0.32945093512535095, 0.1424642652273178, -0.019576553255319595, 0.4088301658630371, -0.8499746322631836, -0.21960003674030304,...
func (l *Lexer) peek() rune { r, _ := utf8.DecodeRuneInString(l.input[l.pos:]) // log.Printf("[peek] %q", r) return r }
[ -0.033499203622341156, -0.22891469299793243, 0.45919516682624817, -1.0331172943115234, -0.8826866149902344, -0.569909930229187, -0.8941358327865601, -0.6933881044387817, -0.7296220064163208, -0.3188866972923279, 0.15675285458564758, 0.7827572226524353, -0.026294155046343803, -0.63322728872...
func (l *Lexer) accept(valid string) bool { if strings.IndexRune(valid, l.peek()) >= 0 { return true } return false }
[ -0.521780788898468, -0.02300521731376648, 0.7782158255577087, -0.11631837487220764, -1.6657887697219849, 0.6171215176582336, -0.2195436805486679, 0.4405938982963562, -0.5638126730918884, 0.01692822389304638, 0.29240378737449646, -0.2529393434524536, -0.8928966522216797, 0.6076793670654297,...
func (l *Lexer) errorf(format string, args interface{}) { prefixed := fmt.Sprintf("ERROR: %s: %s", l.name, format) l.tokens <- Token{Error, fmt.Sprintf(prefixed, args)} }
[ -0.038931045681238174, -0.6050808429718018, 0.3533852696418762, -0.9401738047599792, 0.820169985294342, -0.05367622897028923, -0.8743454217910767, 0.8301482796669006, -0.7323139309883118, -0.22649531066417694, -0.08680782467126846, 0.6234159469604492, 0.7991352081298828, 0.888566255569458,...
func NewInt64Set(values ...int64) Int64Set { set := make(Int64Set) for _, i := range values { set[i] = struct{}{} } return set }
[ -0.8855780959129333, 0.3550526201725006, 0.32972580194473267, 0.246834397315979, -0.7883716821670532, -0.22364424169063568, -0.014521278440952301, -0.592552125453949, -0.3834756016731262, -0.6311812996864319, -0.20471203327178955, -0.10270753502845764, -0.9670675992965698, -0.0398563891649...
func ConvertInt64Set(values ...interface{}) (Int64Set, bool) { set := make(Int64Set) for _, i := range values { switch i.(type) { case int: set[int64(i.(int))] = struct{}{} case int8: set[int64(i.(int8))] = struct{}{} case int16: set[int64(i.(int16))] = struct{}{} case int32: set[int64(i.(int32...
[ -1.3330750465393066, 0.430585116147995, 0.9143474102020264, -0.6374427080154419, -0.5352792739868164, 0.000049486956413602456, -0.06578680872917175, -1.0684359073638916, 0.2393968254327774, -0.03904343396425247, -0.7695210576057434, -0.47990408539772034, -0.9714425802230835, 0.395813524723...
func BuildInt64SetFromChan(source <-chan int64) Int64Set { set := make(Int64Set) for v := range source { set[v] = struct{}{} } return set }
[ -0.9062149524688721, -0.5210411548614502, 0.1734902709722519, -0.6108869910240173, -0.9190665483474731, -0.3248734474182129, -0.32237669825553894, -0.6382644176483154, 0.32862818241119385, -0.19032248854637146, -0.40012454986572266, 0.3363111615180969, -1.1062766313552856, 0.32170394062995...
func (set Int64Set) ToSlice() []int64 { var s []int64 for v := range set { s = append(s, v) } return s }
[ -1.0810052156448364, 0.29836317896842957, 0.44191452860832214, 0.6281028389930725, -0.02029016613960266, -0.6277180910110474, -0.3875858187675476, -1.0066120624542236, 0.3260003924369812, 1.3961151838302612, 0.5853707194328308, 0.8470420241355896, -0.39218416810035706, -0.1559525579214096,...
func (set Int64Set) ToInterfaceSlice() []interface{} { var s []interface{} for v, _ := range set { s = append(s, v) } return s }
[ -1.0426745414733887, 0.5095094442367554, 0.33147361874580383, -0.3079088628292084, 0.3602715730667114, -0.030655717477202415, 0.34212443232536316, -0.8971555233001709, 0.40575650334358215, 1.278619647026062, 0.46091797947883606, 0.9387943148612976, -0.3697104752063751, 0.17480167746543884,...
func (set Int64Set) Clone() Int64Set { clonedSet := NewInt64Set() for v := range set { clonedSet.doAdd(v) } return clonedSet }
[ -0.5731160044670105, -0.1822526454925537, 0.574995219707489, 0.5573697686195374, -1.2975116968154907, 0.19768811762332916, -0.5144811272621155, -1.3530120849609375, 0.7041560411453247, 0.32116445899009705, 0.7162694334983826, 0.2609478533267975, -0.7629156112670898, -0.5424891710281372, ...
func (set Int64Set) IsEmpty() bool { return set.Size() == 0 }
[ -1.2325505018234253, 0.2764270305633545, 0.3115478754043579, 0.032132282853126526, 0.2390584647655487, -0.14114844799041748, -0.4673551321029663, -0.6851101517677307, -0.009762788191437721, 0.24471786618232727, 0.13669435679912567, 0.64895099401474, -0.5411220192909241, -0.0699564442038536...
func (set Int64Set) NonEmpty() bool { return set.Size() > 0 }
[ -0.9958961009979248, 0.4881073236465454, 0.34482699632644653, -0.18763019144535065, -0.16713222861289978, -0.5140448212623596, -0.6985281705856323, -1.0869431495666504, -0.8266874551773071, 0.8013412356376648, -0.4798485040664673, -0.2841362953186035, -0.5332980751991272, -0.04667319729924...
func (set Int64Set) IsSequence() bool { return false }
[ -1.8796299695968628, -0.09488914906978607, 0.37886369228363037, 1.0460304021835327, -0.03745032101869583, -0.8407454490661621, 0.04730380326509476, -0.009450584650039673, 1.0350849628448486, 0.30215054750442505, 0.2113245725631714, -0.25159502029418945, -1.072338581085205, 0.41011744737625...
func (set Int64Set) IsSet() bool { return true }
[ -1.0624749660491943, -0.20772750675678253, 0.236436128616333, 0.34828439354896545, -0.1982121467590332, -0.02413330413401127, 0.012485725805163383, -0.16425307095050812, 0.3183661699295044, -0.12690570950508118, 0.09408668428659439, 0.25935879349708557, -0.7489925026893616, 0.2025331109762...
func (set Int64Set) Size() int { return len(set) }
[ -0.7362497448921204, 0.8215521574020386, -0.01123702060431242, -0.8837215304374695, -0.9522663950920105, 0.018779447302222252, 0.3296595513820648, -0.413225382566452, 0.1886236071586609, -0.10915067046880722, 0.1501924842596054, 0.19765864312648773, -0.4228971004486084, 0.12281370162963867...
func (set Int64Set) Cardinality() int { return set.Size() }
[ -0.5380823016166687, 0.2637622654438019, 0.24328504502773285, 0.283612996339798, -0.11922822892665863, -0.3613367974758148, 0.23967590928077698, 0.47685182094573975, 0.5241005420684814, -0.2074100822210312, -0.08571969717741013, 0.021539097651839256, -0.12234072387218475, 0.321543753147125...
func (set Int64Set) Add(i ...int64) Int64Set { for _, v := range i { set.doAdd(v) } return set }
[ -1.3709919452667236, 0.35407090187072754, 0.44202542304992676, 0.4786747097969055, 0.0673937052488327, 0.554843544960022, -0.1035078838467598, -0.8058065176010132, 0.12703396379947662, -0.031065011397004128, 0.5532346963882446, -0.12626510858535767, -0.5398648977279663, 0.41938555240631104...
func (set Int64Set) Contains(i int64) bool { _, found := set[i] return found }
[ -1.246415376663208, 0.07309665530920029, 0.02977072075009346, -0.417869508266449, -0.960681676864624, -0.09782499074935913, 0.09598105400800705, -1.2893120050430298, -0.20653434097766876, -0.2882077991962433, -0.22069385647773743, -0.1722273975610733, -0.22722169756889343, -0.0963227301836...
func (set Int64Set) ContainsAll(i ...int64) bool { for _, v := range i { if !set.Contains(v) { return false } } return true }
[ -0.4652244746685028, 0.38315561413764954, 0.3734373152256012, 1.0369905233383179, -0.605901300907135, 0.6837469339370728, -0.677777111530304, -0.4320758283138275, -0.4800078570842743, -0.5917310118675232, 0.024545913562178612, -0.6044278144836426, -0.5195571184158325, 0.49385249614715576, ...
func (set Int64Set) IsSubset(other Int64Set) bool { for v := range set { if !other.Contains(v) { return false } } return true }
[ -0.9671505093574524, 0.06333089619874954, 0.32156601548194885, 0.36961421370506287, -1.2003023624420166, 0.028673000633716583, -0.6629913449287415, -0.6746198534965515, 0.4906143248081207, 0.011592160910367966, -0.04155775159597397, 0.29487335681915283, -0.6845488548278809, -0.020311679691...
func (set Int64Set) IsSuperset(other Int64Set) bool { return other.IsSubset(set) }
[ -1.0818428993225098, 0.23792746663093567, 0.3220604360103607, 0.8690690994262695, -1.329694151878357, -0.5221223831176758, -0.6808592677116394, -0.4319547116756439, 0.9019700288772583, -0.2872115969657898, -0.5501551628112793, 0.5722163915634155, -0.2158077508211136, -0.14559634029865265, ...
func (set Int64Set) Append(more ...int64) Int64Set { unionedSet := set.Clone() for _, v := range more { unionedSet.doAdd(v) } return unionedSet }
[ -1.0405588150024414, 0.7645589113235474, 0.4670494496822357, 0.4397198259830475, -0.7159537076950073, 0.43724754452705383, -0.7189735770225525, -0.7759109139442444, 0.4954816699028015, -0.6321499943733215, 0.3534630537033081, -0.03738662227988243, -0.4292685091495514, 0.5555320978164673, ...
func (set Int64Set) Union(other Int64Set) Int64Set { unionedSet := set.Clone() for v := range other { unionedSet.doAdd(v) } return unionedSet }
[ -1.0427864789962769, 0.25325360894203186, 0.3872748017311096, 0.38366928696632385, -0.8026930093765259, 0.14798259735107422, -0.6276068091392517, -0.8547577857971191, 1.435924768447876, -0.3507136106491089, 0.30593156814575195, 0.7324456572532654, -0.17376726865768433, -0.4783858060836792,...
func (set Int64Set) Intersect(other Int64Set) Int64Set { intersection := NewInt64Set() // loop over smaller set if set.Size() < other.Size() { for v := range set { if other.Contains(v) { intersection.doAdd(v) } } } else { for v := range other { if set.Contains(v) { intersection.doAdd(v) } ...
[ -0.023616448044776917, 0.14230328798294067, 0.7665018439292908, 0.39784762263298035, -1.455320954322815, -0.29402244091033936, -0.4884825646877289, -1.0644277334213257, 0.2088085412979126, 0.5119496583938599, 1.0421825647354126, -0.2915676236152649, -0.9587032794952393, 0.5281581878662109,...
func (set Int64Set) Difference(other Int64Set) Int64Set { differencedSet := NewInt64Set() for v := range set { if !other.Contains(v) { differencedSet.doAdd(v) } } return differencedSet }
[ -1.136445164680481, -0.007664188742637634, 0.6297125816345215, 0.6579474210739136, -0.9952774047851562, 0.30209869146347046, -0.2737860679626465, -0.8359649181365967, 1.1099541187286377, -0.38736864924430847, 0.33249369263648987, 0.12552770972251892, -0.1802576333284378, 0.4046908617019653...
func (set Int64Set) SymmetricDifference(other Int64Set) Int64Set { aDiff := set.Difference(other) bDiff := other.Difference(set) return aDiff.Union(bDiff) }
[ -0.7144041657447815, 0.34979334473609924, 0.39961427450180054, 0.3234049379825592, -0.766326367855072, -0.3430001735687256, 0.6120366454124451, -1.0633426904678345, 0.6645987629890442, -0.037881143391132355, -0.09359731525182724, 0.28052207827568054, 0.04153304919600487, 0.0677998885512352...
func (set *Int64Set) Clear() { *set = NewInt64Set() }
[ -0.8634259104728699, 0.3941041827201843, 0.20707139372825623, -0.15588916838169098, -1.263675332069397, 0.35817718505859375, -0.12630696594715118, -0.93730628490448, -0.07401565462350845, -0.0023292771074920893, 0.9383058547973633, 1.1226226091384888, -0.04865575581789017, 0.27989071607589...
func (set Int64Set) Remove(i int64) { delete(set, i) }
[ -0.9528679251670837, 0.3549327850341797, -0.04571224004030228, -0.12762773036956787, -1.4345370531082153, -0.7004581093788147, 0.1478140503168106, 0.03453622758388519, 0.29004791378974915, 0.43658024072647095, -0.11168214678764343, -0.448273628950119, -0.8230863213539124, -0.13598066568374...
func (set Int64Set) Send() <-chan int64 { ch := make(chan int64) go func() { for v := range set { ch <- v } close(ch) }() return ch }
[ -1.040787935256958, -0.023169342428445816, 0.5365123152732849, -0.10445085912942886, -0.6099005341529846, -0.11927174031734467, -0.44749879837036133, -1.7860287427902222, -0.6090742349624634, 0.22896327078342438, 0.5218888521194458, 0.4272732734680176, -0.771700382232666, 0.374053239822387...
func (set Int64Set) Forall(fn func(int64) bool) bool { for v := range set { if !fn(v) { return false } } return true }
[ -0.1921970248222351, 0.46735888719558716, 0.444898784160614, 0.28867530822753906, -0.6054494380950928, 0.0844912901520729, -0.42127835750579834, -0.12707020342350006, -0.8274056911468506, -0.66205894947052, 0.288693368434906, -0.25358638167381287, 0.3393830955028534, 0.36781659722328186, ...
func (set Int64Set) Exists(fn func(int64) bool) bool { for v := range set { if fn(v) { return true } } return false }
[ -1.179971694946289, 0.27328941226005554, 0.3815830647945404, -0.0034095393493771553, -0.14434297382831573, -0.4451541602611542, -0.7465164661407471, -0.3514041304588318, -0.5664129257202148, -0.4675693213939667, 0.156366229057312, -0.1839047223329544, 0.3735727071762085, 0.0811407342553138...
func (set Int64Set) Foreach(fn func(int64)) { for v := range set { fn(v) } }
[ -0.17509247362613678, 0.5920584797859192, 0.1736675202846527, 0.49975183606147766, -0.49654078483581543, -0.4597773551940918, 0.4523492455482483, -0.8738139867782593, -0.6234484314918518, 0.10451003909111023, 0.34495243430137634, 0.2419232577085495, 0.9927119612693787, 0.324541836977005, ...
func (set Int64Set) Filter(fn func(int64) bool) Int64Set { result := NewInt64Set() for v := range set { if fn(v) { result[v] = struct{}{} } } return result }
[ -0.8838731646537781, 0.5978993773460388, 0.35665735602378845, 0.2145596295595169, -1.6025954484939575, -0.5291463732719421, -0.09352914243936539, -0.544808030128479, -0.24220705032348633, -0.09138274937868118, -0.07518284022808075, 0.5822237133979797, -0.24543501436710358, -0.4780972599983...
func (set Int64Set) Partition(p func(int64) bool) (Int64Set, Int64Set) { matching := NewInt64Set() others := NewInt64Set() for v := range set { if p(v) { matching[v] = struct{}{} } else { others[v] = struct{}{} } } return matching, others }
[ -1.202539086341858, 0.3244994878768921, 0.24579265713691711, -0.13024649024009705, -1.560985803604126, -0.7606441378593445, -0.39041420817375183, -0.09115102887153625, 0.5586123466491699, 0.03845308721065521, 0.2134827971458435, -0.12390094995498657, -0.8936230540275574, -0.058453232049942...
func (set Int64Set) Map(fn func(int64) int64) Int64Set { result := NewInt64Set() for v := range set { result[fn(v)] = struct{}{} } return result }
[ -1.3914333581924438, 0.4175882935523987, 0.3006330728530884, 0.4700411558151245, -1.072688341140747, -0.1715908646583557, -0.06089576706290245, -0.3501531779766083, 0.4890458583831787, -0.10656712204217911, 0.04189198836684227, 0.14430297911167145, 0.48978784680366516, -0.7647864818572998,...
func (set Int64Set) FlatMap(fn func(int64) []int64) Int64Set { result := NewInt64Set() for v, _ := range set { for _, x := range fn(v) { result[x] = struct{}{} } } return result }
[ -1.1321297883987427, 0.5146559476852417, 0.40550997853279114, 0.404436320066452, -0.5453971028327942, -0.13051852583885193, 0.2997922897338867, -0.12014324963092804, 1.0700007677078247, -0.7607065439224243, 0.30780932307243347, 0.3177412152290344, -0.4409977197647095, -0.6446551084518433, ...
func (set Int64Set) CountBy(predicate func(int64) bool) (result int) { for v := range set { if predicate(v) { result++ } } return }
[ -0.6020480394363403, 0.7318062782287598, 0.540511429309845, 0.17996428906917572, -1.328458547592163, -0.3270100951194763, 0.5134802460670471, 0.32289624214172363, -0.683456301689148, 0.4896264672279358, -0.1714538186788559, -0.30434849858283997, 0.08348344266414642, 0.07709093391895294, ...