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
# @file: pyh.py | |
# @purpose: a HTML tag generator | |
# @author: Emmanuel Turlay <turlay@cern.ch> | |
__doc__ = """The pyh.py module is the core of the PyH package. PyH lets you | |
generate HTML tags from within your python code. | |
See http://code.google.com/p/pyh/ for documentation. | |
""" | |
__author__ = "Emmanuel Turlay <turlay@cern.ch>" | |
__version__ = '$Revision$' |
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
$ cat h.js | |
n = 100000000; | |
s = {}; | |
key = "abc"; | |
s[key] = 0; | |
for (i = 0; i < n; i++) { | |
s[key] += 1; | |
} | |
console.log(s[key]); | |
$ time node h.js |
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
$ cat h.py | |
n = 100000; | |
d = {}; | |
for _ in xrange(1000): | |
for k in xrange(n): | |
if k not in d: | |
d[k] = k * 2 | |
else: | |
d[k] += 1 | |
print d[n - 1] |
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
The character used to test UCS-2 error: 𝌆 |
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
<?php | |
$g_default_lang = "en"; | |
$g_messages = array(); | |
function get_target_language() { | |
global $g_default_lang; | |
if (isset($_GET['lang'])) { | |
return $_GET['lang']; | |
} |
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
/* | |
usage: nodejs test_memory_by_reading_file.js LARGE_FILE | |
It looks no memory limit for the process with node.js v0.10.38, | |
but single project cannot use more than ~2G. | |
*/ | |
var sleep = require('sleep'); | |
var fs = require('fs'); | |
var bs = []; | |
for (var i = 0; i < 10; i++) { |
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
qsort :: Ord a => [a] -> [a] | |
qsort [] = [] | |
qsort (x:xs) = qsort small ++ [x] ++ qsort big | |
where small = [x'| x' <- xs, x' < x] | |
big = [x'| x' <- xs, x' >= x] |
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
* Levels of tests | |
o unit test | |
o integration test | |
o system test | |
o acceptance test | |
* Why test? (acceptance test / system test) | |
o verify correctness: bugs always exist (but we can keep them small and easier to solve) | |
o save manually verification time | |
* Why unit test? | |
o help find root of bugs (save debugging time) |
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 Test.QuickCheck | |
import Data.List | |
-- | |
-- aux functions for verifications | |
-- | |
isOrdered :: Ord a => [a] -> Bool | |
isOrdered [] = True | |
isOrdered [x] = True | |
isOrdered (x:x2:xs) = x <= x2 && isOrdered (x2:xs) |
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
-- | |
-- wc.hs: word count | |
-- | |
-- Given a file name in the first command line argument, | |
-- print WORD: COUNT for each WORD per line. | |
-- The output is ordred by COUNT. | |
-- | |
import System | |
import Data.List |
OlderNewer