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
/* | |
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 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
<?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 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
The character used to test UCS-2 error: 𝌆 |
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
$ 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 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
$ 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 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
# @file: pyh.py | |
# @purpose: a HTML tag generator | |
# @author: Emmanuel Turlay <[email protected]> | |
__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 <[email protected]>" | |
__version__ = '$Revision$' |
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 <iostream> | |
#include <set> | |
enum Type { | |
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z | |
}; | |
bool isOkayBySwitch(Type type) { | |
switch (type) { | |
case A: |
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
.file "switch_cases_check.cpp" | |
.text | |
.p2align 4,,15 | |
.globl _Z14isOkayBySwitch4Type | |
.type _Z14isOkayBySwitch4Type, @function | |
_Z14isOkayBySwitch4Type: | |
.LFB1206: | |
.cfi_startproc | |
cmpl $24, %edi | |
ja .L4 |
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 <iostream> | |
#include <set> | |
enum Type { | |
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z | |
}; | |
bool isOkayBySwitch(Type type) { | |
switch (type) { | |
case A: |
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
import gdb | |
# Ref. http://stackoverflow.com/a/14698568/278456 | |
v = gdb.selected_frame().read_var('LOCAL_VARIABLE_NAME') | |
for k in v.type.target(): | |
try: | |
print k, v[k] | |
except Exception, e: | |
pass |