Skip to content

Instantly share code, notes, and snippets.

View mariomartinezsz's full-sized avatar

Mario Martínez Sánchez mariomartinezsz

View GitHub Profile
@mariomartinezsz
mariomartinezsz / recursive_factorial.py
Created June 1, 2017 12:00
Recursive Factorial in Python
def fact(n):
if n == 1:
return 1
else:
return n * fact(n - 1)
@mariomartinezsz
mariomartinezsz / fibonacci.ex
Created April 24, 2017 06:10
Fibonacci module for Elixir
defmodule Fibonacci do
@moduledoc """
A Fibonacci series generator.
"""
@doc """
get_series/1 function.
Returns a Fibonacci series in a list.
@mariomartinezsz
mariomartinezsz / setup-python3-django-virtualenv-macos.md
Last active March 15, 2017 21:34
Setup Python 3 + Django 1.10 + Virtual Environment on MacOS Sierra

How to Set Up Python 3 + Django 1.10 + a Virtual Environment on MacOS Sierra

You will need an open Terminal.

Note: If you don't have Homebrew go to https://brew.sh in order to install it. It's simple. Maybe something as:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

If you don't have Python 3

@mariomartinezsz
mariomartinezsz / saludame.rs
Last active November 7, 2016 17:30
Saludame: Ejercicio de programación con Rust. El programa pregunta al usuario su nombre y le presenta un saludo personalizado.
use std::io; // Es un módulo que permite que el programa realice ciertas operaciones de entrada y salida.
fn main() {
// Declaramos una variable para contener el nombre del usuario
let mut nombre_usuario = String::new();
// Preguntamos al usuario su nombre
println!("Escribe tu nombre:");
// Leemos el texto ingresado por el usuario y lo pasamos a la variable nombre_usuario
@mariomartinezsz
mariomartinezsz / social_bar_tumblr.html
Last active May 11, 2016 18:27
Social media buttons for sharing posts from Tumblr
<!-- Put this css code after <style type="text/css"> -->
.socialbar {text-align: center;}
.socialbar a{text-decoration: none; border: none;}
<!-- ... -->
<!-- Place the next code before the {/block:Posts} tag.
Replace icons source "src" with yours
-->
<div class="socialbar">
@mariomartinezsz
mariomartinezsz / langoliers.rb
Created May 7, 2016 16:00 — forked from robinsloan/langoliers.rb
Tweet delete script
#!/usr/bin/env ruby
require 'rubygems'
require 'twitter'
require 'json'
require 'faraday'
# things you must configure
PATH_TO_DROPBOX = "/Users/your_name/Dropbox/backup/tweets/" # you need to create this folder
TWITTER_USER = "your_twitter_username"
@mariomartinezsz
mariomartinezsz / setupvenv3.4.sh
Last active April 11, 2016 20:05
Python3.4 virtual environment on Ubuntu 14.04
#!/bin/sh
# Installing python3.4-venv (just needed one time at first.)
sudo apt-get install python3.4-venv
# Creating a new virtual environment, change virtualenv_name with a prefered name
python3 -m venv virtualenv_name
# Activating the new virtual environment
source virtualenv_name/bin/activate
@mariomartinezsz
mariomartinezsz / install_ruby_on_rails_on_ubuntu_1404.sh
Last active September 23, 2015 05:02
Installing Ruby On Rails on Ubuntu 14.04
#Sources:
# https://gorails.com/setup/ubuntu/14.04
# https://github.com/sstephenson/rbenv
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
@mariomartinezsz
mariomartinezsz / find_file_and_move.md
Last active July 28, 2018 05:28
Find files in current dir and move them to another
# for Linux:
find . -iname "*something*.ext" -exec mv {} another/dir/path \;
@mariomartinezsz
mariomartinezsz / install-couchdb-1.5.0.sh
Last active December 30, 2015 05:29
Install CouchDB 1.5.0 on Ubuntu Server (Tested with Ubuntu Server 12.04 LTS Precise Pangolin)
#!/bin/sh
# Based on http://jswiki.lab-01.com/wiki/doku.php?id=install-couch
echo "Downloading Linux build tools and Erlang"
sudo apt-get install build-essential libicu-dev libcurl4-gnutls-dev libtool erlang-dev erlang zip -y
# Work on tmp directory
cd /tmp
# Spidermonkey is required