This file contains hidden or 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
| from itertools import combinations, product | |
| LOW = 1 | |
| HIGH = 40 | |
| REFERENCE_WEIGHT_COUNT = 4 | |
| def has_solution(object_weight, reference_weights): | |
| """returns True if there is a way to use the reference weights to correctly identify the object weight""" | |
| guess_range = [LOW, HIGH] # >= low, <= high | |
| # we take reference weight and a sign (+/-): + means on the right side of the scale, - means on the left |
This file contains hidden or 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 org.maltparser.core.config; | |
| import java.io.File; | |
| import java.net.MalformedURLException; | |
| import java.net.URL; | |
| import org.maltparser.core.exception.MaltChainedException; | |
| import org.maltparser.core.flow.FlowChartInstance; | |
| import org.maltparser.core.flow.item.ChartItem; | |
| import org.maltparser.core.flow.spec.ChartItemSpecification; |
This file contains hidden or 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
| /* | |
| * given a list of input leveldb's, merge them into a single output leveldb | |
| * | |
| */ | |
| #include <iostream> | |
| #include <algorithm> | |
| #include <boost/program_options.hpp> | |
| #include <boost/cstdint.hpp> |
This file contains hidden or 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
| #include <cstdlib> | |
| #include <cstring> | |
| #include <iostream> | |
| #include <boost/array.hpp> | |
| #include <boost/bind.hpp> | |
| #include <boost/asio.hpp> | |
| namespace posix = boost::asio::posix; | |
| class echo_client |
This file contains hidden or 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
| #include <cstdlib> | |
| #include <cstring> | |
| #include <iostream> | |
| #include <boost/array.hpp> | |
| #include <boost/bind.hpp> | |
| #include <boost/asio.hpp> | |
| namespace posix = boost::asio::posix; | |
| class posix_chat_client |
This file contains hidden or 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
| erik@roastbeef:~/proj$ time node child.js < bigfile > derp | |
| real 0m6.176s | |
| user 0m4.176s | |
| sys 0m1.916s | |
| erik@roastbeef:~/proj$ time cat bigfile | node child.js | cat > derp | |
| real 0m1.504s | |
| user 0m0.560s | |
| sys 0m0.892s |
This file contains hidden or 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
| erik@roastbeef:~/proj$ cat child2.js | |
| var readline = require('readline'), | |
| rl = readline.createInterface(process.stdin, process.stdout); | |
| rl.on('line', function(line) { | |
| console.log(line); | |
| }); | |
| erik@roastbeef:~/proj$ time node child2.js < bigfile > derp |
This file contains hidden or 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
| erik@roastbeef:~/proj$ cat child.py | |
| import sys | |
| line = sys.stdin.readline() | |
| while line: | |
| line = sys.stdin.readline() | |
| erik@roastbeef:~/proj$ time python child.py < bigfile > derp | |
| real 0m0.073s | |
| user 0m0.056s |
This file contains hidden or 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
| >>> not None | |
| True | |
| >>> True is not None | |
| True | |
| >>> not not None | |
| False | |
| >>> False is not not None | |
| File "<stdin>", line 1 | |
| False is not not None | |
| ^ |
This file contains hidden or 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
| >>> not None | |
| True | |
| >>> True is not None | |
| True | |
| >>> not not None | |
| False | |
| >>> False is not not None | |
| File "<stdin>", line 1 | |
| True is not not None | |
| ^ |