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
#define PREFIX_FREE(p) \ | |
do { \ | |
free(p); \ | |
(p) = NULL; \ | |
} while(false) |
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
function round(num) | |
return math.floor(num+.5) | |
end |
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
def get_ext(ent): | |
root, ext = os.path.splitext(ent) | |
return ext |
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
#!/bin/sh | |
find . | egrep '#$' | xargs rm |
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
a = [ 1, 15, 2, 3, 3, 31, 34, 99 ]; | |
a.sort(); |
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
try { | |
x = y; | |
} catch (e) { | |
console.log(e.message); // y is not defined | |
} |
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
var memoizer = function (memo, fundamental) { | |
var shell = function (n) { | |
var result = memo[n]; | |
if (typeof result !== 'number') { | |
result = fundamental(shell, n); | |
memo[n] = result; | |
} | |
return result; | |
}; |
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
int count_str (char *buf, const char *s, int len) | |
{ | |
int c; | |
char *p; | |
c = 0; | |
p = buf; | |
while (p != NULL) { | |
p = strstr(p, s); | |
if (p != NULL) { | |
p += len; |
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
#include <string.h> | |
/** | |
* The algorithm implemented here is based Boyer-Moore algorithm | |
*/ | |
// following functions can process ascii character | |
void bm_create_table (char *pattern, int *skip) | |
{ |
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
def configure(conf, libs, headers, funcs): | |
if not conf.CheckCC(): | |
print "c compiler is not installed!" | |
return False | |
for lib in libs: | |
if not conf.CheckLib(lib): | |
print "library " + lib + " not installed!" | |
return False |
OlderNewer