Skip to content

Instantly share code, notes, and snippets.

View RodolfoFerro's full-sized avatar
🐍
I speak Python.

Rodolfo Ferro RodolfoFerro

🐍
I speak Python.
View GitHub Profile
@RodolfoFerro
RodolfoFerro / install.sh
Created September 27, 2016 08:59
PyGame for Python 3 Mac
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
alias brew=/usr/local/bin/brew
brew install python3
alias python=python3
brew install mercurial
brew install git
brew install sdl sdl_image sdl_mixer sdl_ttf
brew tap homebrew/headonly
brew install --HEAD smpeg
brew install portmidi
@RodolfoFerro
RodolfoFerro / force_on_wire.py
Created May 10, 2017 16:48
Graphical analysis for a particle's attraction to a wire. (Based on Kellogg's: Foundation Of Potential Theory, Ch.1-S.4)
import numpy as np
import matplotlib.pyplot as plt
# Set wire, plot lenght and p position:
p = 6 # P position, along x axis
l = 5 # Wire's length
wire = np.linspace(0, l, 2) # Wire's discretization
lmbd = 1 # Lamnbda value
# Plotting domain:
@RodolfoFerro
RodolfoFerro / DFT_2D.py
Created May 31, 2017 06:26
2D - DFT: 2D - Discrete Fourier Transform
# 2 Dimension Fourier Transform:
def FT_2D(X):
m, n = X.shape
return np.array([ [ sum([ sum([ X[i,j]*np.exp(-1j*2*np.pi*(k_m*i/m + k_n*j/n)) for i in range(m) ]) for j in range(n) ]) for k_n in range(n) ] for k_m in range(m) ])
@RodolfoFerro
RodolfoFerro / simul.R
Created June 2, 2017 18:46
Simulación de datos para posterior modelado con Beta Generalizada de Tipo II.
# Rodolfo Ferro Pérez
# ferro@cimat.mx
# Simulación de datos Beta Generalizada de Tipo II, LogNormal y mezcla de LogNormales.
# Liberar memoria:
rm(list=ls())
# Set path:
setwd("/Users/RodolfoFerro/Desktop/simulación")
breaks = 70
@RodolfoFerro
RodolfoFerro / map.geojson
Last active September 27, 2017 22:55
Visualización de zonas de derrumbe #Verificado19s, acorde a la página oficial de https://datos.gob.mx/ (al 23 de septiembre de 2017).
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@RodolfoFerro
RodolfoFerro / insert_name.py
Created November 9, 2017 19:47
Gist to illustrate the insertion of first element on nested list.
# Import copy lib
import copy
# Create lists:
names = ["Mary", "David", "George"]
numbers = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6]]
# Create a deep copy to avoid using same memory direction:
new_list = copy.deepcopy(numbers)
@RodolfoFerro
RodolfoFerro / OpticalFlowExample.py
Created December 4, 2017 00:31
Optical Flow Example
# Python 2/3 compatibility
from __future__ import print_function
import numpy as np
import imutils
import cv2
import sys
# Global vars:
@RodolfoFerro
RodolfoFerro / PerceptronFLISoL18.py
Last active April 25, 2018 19:40
Intro a ANNs c/Keras (mini demos)
import numpy as np
class PerceptronFLISoL():
def __init__(self, entradas, pesos):
"""Constructor de la clase."""
self.n = len(entradas)
self.entradas = np.array(entradas)
self.pesos = np.array(pesos)
#Program to drive Sonic Pi 3 visualiser written in "processing"
#by Robin Newman, September 2017
#see article at https://rbnrpi.wordpress.com
#set up OSC address of processing sketch
use_osc '127.0.0.1',5000
#select shapes to show
osc "/viz/shapes","e" #"s" "e" "r" Star,Ellipse, Rectangle or combination
sleep 0.1
live_loop :c do
@RodolfoFerro
RodolfoFerro / INSTALL.md
Last active June 29, 2022 11:13
Anaconda environment for my workshop "Machine Learning as a Service" in PythonDay México 2018.

Installation

The latest version of Anaconda with Python >= 3.6 will be needed. We will be working with an Anaconda environment for this workshop.

To create the conda env and install the requirements just run:

conda env create -f environment.yml

To activate/deactivate the environment: