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 make(func, **kwargs): | |
def f(arg): | |
return func(arg,**kwargs) | |
return f |
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
# We want to be able to manipulate the output of GDB with a python function. | |
####################################################################### | |
# Example 1: Defining the hook as a python function that would gdb.execute the same command | |
# Problem: The command is executed twice and we can't access args in the hook. | |
####################################################################### | |
python |
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 sys | |
from multiprocessing import Pool | |
# Compute the histogram of a csv file with a python parallel program | |
# Input file format: | |
# name,count\n | |
# Output the frequency of "count". | |
# Stolen from http://mikecvet.wordpress.com/2010/07/02/parallel-mapreduce-in-python/ | |
# Adapted to histogram computation instead of word count |