Skip to content

Instantly share code, notes, and snippets.

View nojhan's full-sized avatar

nojhan nojhan

View GitHub Profile
@nojhan
nojhan / phisto.py
Last active December 15, 2015 00:29
Compute the histogram of a csv file with a python parallel program
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
@nojhan
nojhan / test.gdbinit
Created November 5, 2014 16:48
Manipulate the output of GDB with a python function
# 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
@nojhan
nojhan / func_composition.py
Created March 10, 2020 15:20
Wrapping call as the basis for function composition
def make(func, **kwargs):
def f(arg):
return func(arg,**kwargs)
return f