Skip to content

Instantly share code, notes, and snippets.

View agmarrugo's full-sized avatar

Andres Marrugo agmarrugo

View GitHub Profile
@agmarrugo
agmarrugo / duplicate_papers.py
Created October 18, 2014 02:46
A script for detecting unique and duplicate values from a csv file.
import csv
with open('papers.csv','r') as f:
sheet = csv.reader(f)
papers = []
for row in sheet:
# Every row is a list, thus I concatenate all to form a single list
papers = papers + row
# remove blank spaces
papers = filter(None,papers)
@agmarrugo
agmarrugo / accept_letter.py
Last active August 29, 2015 14:07
Generate acceptance letters for a list of papers downloaded from Easy Chair
# This Python file uses the following encoding: utf-8
import re, subprocess, os, shlex
from string import Template
class REMatcher(object):
def __init__(self, matchstring):
self.matchstring = matchstring
def match(self,regexp):
theta = 60
beta = 18.02
// Omega en radianes
w = 1500*2*%pi/60
// Analisis de velocidades
//
// V_A = V_B + V_A/B
@agmarrugo
agmarrugo / plano_oblicuo.matlab
Last active August 29, 2015 14:05
Script para analizar el cambio de los esfuerzos normal y cortante en un plano oblicuo bajo carga axial
%% Datos iniciales
%
% Script para analizar el cambio de los esfuerzos normal y cortante
% en un plano oblicuo bajo carga axial
A_0 = 1; % Area de la seccion transversal
P = 1; % Fuerza externa
% La variacion en theta desde un corte transversal (0º - 0 rad)
% a un corte longitudinal (90º - pi/2 rad)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright INRIA
# Contributors: Nicolas P. Rougier (Nicolas.Rougier@inria.fr)
#
# DANA is a computing framework for the simulation of distributed,
# asynchronous, numerical and adaptive models.
#
# This software is governed by the CeCILL license under French law and abiding
from numpy.fft import fft, ifft, fft2, ifft2, fftshift
import numpy as np
def fft_convolve2d(x,y):
""" 2D convolution, using FFT"""
fr = fft2(x)
fr2 = fft2(np.flipud(np.fliplr(y)))
m,n = fr.shape
cc = np.real(ifft2(fr*fr2))
cc = np.roll(cc, -m/2+1,axis=0)
#! /usr/bin/python
"""
brute force get title of web page
usage: getTitle.py url
Gordon Meyer January 1, 2013
www.gordonmeyer.com
"""
# modules used
import urllib2, urlparse, string, os
@agmarrugo
agmarrugo / inlinefootnotes.rb
Created October 1, 2012 20:21
A script for writing Day One footnotes inline.
#!/usr/bin/env ruby
def e_sh(str)
str.to_s.gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\')
end
input = STDIN.read
footnotes = input.scan(/\(\*(.*?)\*\)/m)
# existing = input.scan(/^\[\^fn(\d+)\]: /i)
@agmarrugo
agmarrugo / gist:3182270
Created July 26, 2012 14:11
Moving referenced images in a markdown file to another folder
for f in `grep -o '\..*png' myreport.txt`; do cp $f ../Public/myproject/ ; done