Skip to content

Instantly share code, notes, and snippets.

View rocarvaj's full-sized avatar
🐀

Rodolfo Carvajal rocarvaj

🐀
View GitHub Profile
@rocarvaj
rocarvaj / mpiRingISendIRecv.c
Created April 27, 2012 17:22
MPI_Send/MPI_Recv versus MPI_ISend/MPI_IRecv, ring example
/*######################################################################
Example 6 : MPI_Isend MPI_Irecv
Description:
Examples 5 and 6 demonstrate the difference between blocking
and non-blocking point-to-point communication.
Example 5: MPI_Send/MPI_Recv (blocking)
Example 6: MPI_Isend/MPI_Irecv (non-blocking)
@rocarvaj
rocarvaj / bibtexStuff.bib
Created April 27, 2012 19:05
LaTeX tricks (or stuff I forget)
% A website
@misc{exoplanetwebsite,
Author = {Jean Schneider},
Title = {The Extrasolar Planets Encyclopaedia},
howpublished = {\url{http://exoplanet.eu/catalog.php}}
}
@rocarvaj
rocarvaj / mpiParallelSearch.c
Created April 27, 2012 21:26
MPI_ISend example, parallel search on arrays
/* array_search1.c - array searching example where each process is looking for a specific
number and notifies the other processes when it finds it. Uses a non-blocking receive.
*/
#include <mpi.h>
#include <stdio.h>
main(int argc, char* argv[]) {
int rank,size;
MPI_Status status;
MPI_Request request;
@rocarvaj
rocarvaj / .vimrc
Created April 27, 2012 21:28
Minimal .vimrc for C/C++ developers
" VIM Configuration File
" Description: Optimized for C/C++ development, but useful also for other things.
" Author: Gerhard Gappmeier
"
" set UTF-8 encoding
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
" disable vi compatibility (emulation of old bugs)
@rocarvaj
rocarvaj / classExample.py
Created May 3, 2012 18:35
Class in Python
class Arc(object):
""" An arc in the graph """
def __init__(self, origin=None, dest=None, varCost=None, fixCost=None, capac=None):
self.origin = origin
self.dest = dest
self.varCost = varCost
self.fixCost = fixCost
self.capac = capac
@rocarvaj
rocarvaj / template.py
Created May 22, 2012 00:50
Basic python script
#!/usr/bin/python
import sys
fileName = sys.argv[1]
print "Reading file:", fileName
inFile = open(fileName, 'r')
@rocarvaj
rocarvaj / .screenrc
Created July 2, 2012 20:49
Screen config file
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "
@rocarvaj
rocarvaj / chomp.cpp
Created July 25, 2012 19:57
C++ string chomp
string::size_type pos = str.find_last_not_of("\n \t");
if(pos != string::npos)
str = str.substr(0, pos+1);
@rocarvaj
rocarvaj / numbers.cpp
Created August 24, 2012 16:35
Printing tips C++
std::cout << std::setw(2) << setfill('0') << myNumber;
@rocarvaj
rocarvaj / plot.gnuplot
Created August 27, 2012 05:27
Plot from data file
plot "c37.lp_MIPStart.log" using 1:5 with lines, "c37.lp_MIPStart.log" using 1:6 with lines