Skip to content

Instantly share code, notes, and snippets.

View agmarrugo's full-sized avatar

Andres Marrugo agmarrugo

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@agmarrugo
agmarrugo / jekyllpre.rb
Created October 14, 2015 05:35 — forked from ttscoff/jekyllpre.rb
Marked Custom Processor for Jekyll/Octopress previews with img/gist Liquid tags
#!/usr/bin/ruby
# encoding: utf-8
# Version 1
#
# Example custom processor for use with Marked <http://markedapp.com> and Jekyll _posts
# It's geared toward my personal set of plugins and tags, but you'll get the idea.
# It turns
# {% img alignright /images/heythere.jpg 100 100 "Hey there" "hi" %}
# into
# <img src="../images/heythere.jpg" alt="Hey there" class="alignright" title="hi" />
@agmarrugo
agmarrugo / gist:73d244c1f04b4f85f443
Last active August 29, 2015 14:25 — forked from vladimirtsyupko/gist:10964772
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master

Python version of the MATLAB code in this Stack Overflow post: http://stackoverflow.com/a/18648210/97160

The example shows how to determine the best-fit plane/surface (1st or higher order polynomial) over a set of three-dimensional points.

Implemented in Python + NumPy + SciPy + matplotlib.

quadratic_surface

"""
This code takes two screenshots from the camera roll combines them into one image and saves the new image to the camera roll.
This is adapted from Federico Viticci's blog post at:
http://www.macstories.net/stories/automating-ios-how-pythonista-changed-my-workflow/
It removes the option to change which picture is where, automatically assigning the first one chosen as the leftmost image.
It also removes the necessity to copy the images to the clipboard outside of Pythonista using the new photos library in version 1.3. Finally, it removes the clipboard output.
"""
import photos
#!/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