This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from random import randint | |
num_items = 1000000 | |
num_iters = 1000 | |
randoms_list = [randint(0, 1000000) for i in range(num_items)] | |
randoms_dict = {num: True for num in randoms_list} | |
randoms_set = {num for num in randoms_list} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"runtime" | |
"strconv" | |
"strings" | |
"sync" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"runtime" | |
"strconv" | |
"strings" | |
"sync" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func worker(line string) []string { | |
// do your phone# parsing | |
return []string{} | |
} | |
func main() { | |
fn := os.Args[1] | |
numWorkers := 10 | |
srcChans := make([]chan interface{}, numWorkers) | |
outChan := make(chan []string, 1024) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/cnnrznn/gomr" | |
"os" | |
"runtime" | |
"strings" | |
"sync" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Doesn't work */ | |
class Transport extends EventEmitter.EventEmitter { | |
constructor() { | |
super(); | |
this.connected = false; | |
this.ws = new WebSocket("ws://localhost:8081"); | |
this.ws.onmessage = fromServer; | |
this.ws.onopen = function(event) { | |
this.connected = true; | |
} |