Skip to content

Instantly share code, notes, and snippets.

View rocarvaj's full-sized avatar
🐀

Rodolfo Carvajal rocarvaj

🐀
View GitHub Profile
@rocarvaj
rocarvaj / homework_guidelines.md
Last active December 11, 2015 02:48
Homework guidelines

ISyE 6662 - Spring 2013: Homework guidelines

The solutions to the homework are required to be typesetted in LaTeX. Please find a LaTeX template and more information in the LaTeX folder in the Resources section of the course's T-square site.

Please follow the following guidelines regarding your homework solutions:

Homeworks are meant as individual assignments. Although you are encouraged to discuss them with your classmates, each student should complete and submit his/her own work, unless specifically instructed to work in groups. Cite all reference sources used in your assignments. Late homework submissions will not be accepted, except for serious unavoidable circumstances.

Write your name and class clearly at the top of at least the first page, along with the assignment number and the page number(s). If you are not stapling or paper-clipping the pages together, then put your name or initials on all the pages.

@rocarvaj
rocarvaj / matplotlib-tips.py
Last active April 5, 2016 13:47
Plotting in pandas
# Subplots
fig, axes = plt.subplots(nrows=1, ncols=3, figsize=(15,5))
average_change[['primal', 'primal_dsoff', 'dual', 'dual_dsoff']].plot(ax=axes[0])
axes[0].set_ylim(-0.0, 0.4)
axes[0].axhline(0.0, ls='dashed')
axes[0].xaxis.set_ticks(list(average_change.index))
axes[0].set_title("Improvement of bounds and gap of best clone")
axes[0].set_xlabel("Number of clones (k)")
axes[0].set_ylabel("Average improvement")
@rocarvaj
rocarvaj / cython.md
Last active July 28, 2016 21:15
How to use Cython
  1. Create script my-script.pyx
  2. Create setup.py with
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

ext_modules = [Extension("hello", ["hello.pyx"])]
@rocarvaj
rocarvaj / useful_pandas_snippets.py
Last active August 3, 2016 20:07 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# Merging a pandas groupby result back into DataFrame
# Ref: http://stackoverflow.com/a/29642002/162264
df['maxval'] = df.groupby(by=['idn']).transform('max')
#Print full dataframe
def print_full(x):
pd.set_option('display.max_rows', len(x))
print(x)
pd.reset_option('display.max_rows')
@rocarvaj
rocarvaj / bash-tips.md
Last active December 5, 2016 19:12
Bash/cli tips!

Print from line n on

tail -n +2 file.csv

From the man page:

-n, --lines=N
     output the last N lines, instead of the last 10
...
@rocarvaj
rocarvaj / pip-force.md
Last active November 22, 2017 13:56
Force pip to install (duplicate) package locally

Citing Marcus Smith (maintainer of pip):

If you think the global site is out of date, and want the latest in the user site, then use:

pip install --upgrade --user SomePackage

If the global site is up to date, and you really just want the same thing duplicated in --user, then use:

pip install --ignore-installed --user SomePackage

@rocarvaj
rocarvaj / git-branching.md
Last active December 9, 2017 18:53
Git branching
@rocarvaj
rocarvaj / links-fgo.md
Last active May 14, 2018 15:31
Algunos links interesantes (o que por lo menos yo considero interesantes)
@rocarvaj
rocarvaj / CMDMaker.sh
Created September 23, 2012 12:03
Submit multiple jobs to Condor
#!/bin/bash
########################################################
# This script generates multiples .cmd (Condor) files,
# one for each instance in the input file instances.txt.
# You can easily change this to have different arguments
# in the input file.
#
# After you have generated the file, use the multiSubmit.sh
# script to submit all your jobs at once.
@rocarvaj
rocarvaj / best-of-read-write-as.md
Last active January 31, 2019 14:39
Best of read.write.as