Skip to content

Instantly share code, notes, and snippets.

View rocarvaj's full-sized avatar
🐀

Rodolfo Carvajal rocarvaj

🐀
View GitHub Profile
@rocarvaj
rocarvaj / algorithm.tex
Created February 18, 2014 21:12
Example of algorithm/algorithmic packages
\usepackage{algorithm}
\usepackage{algorithmic}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\begin{algorithm}[!ht]
\caption{Solving the Lagrangian dual for (CF)}
\label{alg:lower_bound}
\begin{algorithmic}[1]
\ENSURE Lower bound $\underbar z$ and upper bound $\bar z$.
@rocarvaj
rocarvaj / 2014-02-01_cplex-out-of-memory.md
Created September 4, 2014 14:04
CPLEX running out of memory #blog

"CPLEX Error 1001: Out of memory", a tip that might help you too

`CPLEX Error 1001: Out of memory`

Now that's something I hate to see. Especially if you are just trying to solve the "small" problems in you target instance set.

Of course there are many reasons for this to happen. You can try to get some help/inspiration from:

  • Asking or searching (for lost souls with similar problem) in the CPLEX forum.
  • Following the advice of this technote from the IBM Support site.
@rocarvaj
rocarvaj / 2013-11-30_crosh-as-window.md
Last active August 29, 2015 14:06
A patch for the "crosh as window" app in ChromeOS. Deprecated.

Open crosh as a window in ChromeOS

I've spent a lot of time using my Samsung Chromebook as my main machine and I'm pretty much conviced that it is all I need. I usually use a browser and a terminal, that's it. The great thing is that ChromeOS can satisfy both needs, by using the great Secure Shell extension, that allows you to connect via SSH to remote machines.

But there are times (very few now, for me at least) when you want to have a fully operational Linux installation. That's when you can use Crouton (through the Chrome Shell, called crosh), which allows you to run a standard Linux distribution (Ubuntu, for example) as an additional process within ChromeOS.

The only problem: If you want to use shortcuts like Ctrl+w (in Vim, for example), Chrome will take the default action associated to that shortcut, which is not what we want. One solution is to open crosh as a wind

@rocarvaj
rocarvaj / 2013-08-20_latex-tables-gdrive.md
Last active August 29, 2015 14:06
LaTeX tables in Google Drive

LaTeX tables in Google Drive

Date: 2013-08-20

Here are two nice ways of generating LaTeX code for tables in Google Drive. I haven't tested them very much, but they seem to do a great job:

  1. Using http://www.tablesgenerator.com/. You just copy-and-paste your table from GDrive to the grid shown in the website, you can easily change the style of the table.

  2. Using the following GDrive script created by Dave Rim.

Text-to-columns in Google Drive

Date: 2013-07-30

This is something that should be a standard feature in Google Drive: When pasting data formatted as rows separated by a new line and columns separated by spaces (or commas), get the data in the expected format (rows as spreadsheet rows and columns as spreadsheet columns). Right now, Google Drive does not do this, it just preserves the rows.

So we need the text-to-columns feature available in LibreOffice or Office. The feature in GDrive can be used as a script:

  • Go to "Tools" > "Script Gallery".
  • Search for "Text to columns".
  • Install script (have to give persmission to the script here).

Why do we keep on having babies?

Date: 2013-05-26

This post is also at Medium.

Our baby boy was born a few days ago. We’re very happy. Friends came to the hospital, the computer was full of congratulations and then, the first night with our brand new baby came.

I stayed with my wife at the hospital and I had forgotten the first nights and what the lack of sleep does to your head, and especially to your wive’s head. Although, to be fair, my son is very regular and wakes up around two specific times during the night. And suddenly, the question popped up in my head:

Why do we do this? Why do we have babies?

#!/bin/sh
#
# Usage: sleeper.sh [time]]
# default for time is 60 seconds
# -- our name ---
#$ -N Sleeper1
#$ -S /bin/sh
# Make sure that the .e and .o file arrive in the
# working directory
@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 / pandas-tips.md
Last active October 3, 2015 20:48
Things that I've learned about Pandas but that weren't easy to find (for me at least)