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
#!/usr/bin/env python | |
""" | |
A pure python ping implementation using raw socket. | |
Note that ICMP messages can only be sent from processes running as root. | |
Derived from ping.c distributed in Linux's netkit. That code is |
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
// See http://stackoverflow.com/questions/2482933/write-number-n-in-base-m/2483546#2483546 | |
#include <cassert> | |
#include <cstdlib> // exit | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <boost/lambda/lambda.hpp> // _1 | |
#include <boost/function.hpp> // function<> | |
#include <boost/lexical_cast.hpp> // lexical_cast<> |
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
*.py[co] | |
/cachegrind.out.profilestats | |
/profilestats.prof |
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 <assert.h> | |
#include <stdio.h> | |
enum { N = 10 }; | |
static void inc(int* static_out, int* out){ | |
static int static_var = 0; | |
int var = 0; | |
++static_var; | |
++var; |
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
/** see http://stackoverflow.com/questions/2242553/copy-a-linked-list/2242645#2242645 */ | |
#include <assert.h> | |
#include <stdio.h> | |
#include <stdlib.h> // malloc | |
typedef struct Node* pNode; | |
typedef void (*node_visitor_t)(pNode); | |
struct Node { | |
int data; |
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 <iterator> | |
#include <algorithm> | |
#include <boost/range.hpp> | |
#include <boost/lambda/lambda.hpp> | |
#include <boost/lambda/bind.hpp> | |
namespace llist { | |
typedef long int ssize_t; |
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
boost-python/bin/ | |
*.py[co] | |
*.so | |
*.o | |
/xorcy.c |
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
// http://stackoverflow.com/questions/2638781/c-conjunction-of-binds | |
// $ g++ -Wall -pedantic conjunctions_of_bind.cc -o conjunctions_of_bind | |
// $ ./conjunctions_of_bind | |
#include <cstdlib> // atoi | |
#include <cstring> // strcmp | |
#include <boost/bind.hpp> | |
#include <boost/function.hpp> | |
#include <boost/test/minimal.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
// compare relative performance of tolower_ctype, tolower_openbsd, tolower_oraz functions | |
// result: 30.80, 30.51, 38.09 | |
// $ gcc -std=c99 -O3 -g -Wall -pedantic test_tolower.c -o test_tolower; | |
// $ valgrind --tool=callgrind ./test_tolower 1000000 | |
#include <assert.h> | |
#include <ctype.h> | |
#include <inttypes.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |
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
Index: gmpy_mpz.c | |
=================================================================== | |
--- gmpy_mpz.c (revision 311) | |
+++ gmpy_mpz.c (working copy) | |
@@ -400,72 +400,99 @@ | |
return result; | |
} | |
+static int gmpy_mpz_bit_set_iterable(PyObject *self, PyObject *other) { | |
+ long bit_index; |