Skip to content

Instantly share code, notes, and snippets.

View map0logo's full-sized avatar

Francisco Palm map0logo

View GitHub Profile
@map0logo
map0logo / pi_montecarlo.py
Last active December 14, 2015 23:29
Estimating Pi using Monte Carlo method
# -*- coding: utf-8 -*-
from random import random
from math import sqrt
from turtle import *
speed(0) # Máxima velocidad
n = 100 # Número de intentos
scale = 200 # Proporción del dibujo, por defecto es 200
pos = [(-1.5,.5),(0,.5),(-1.5,-1),(0,-1)] # Posición de los gráficos
font = ('Arial', scale/20, 'bold')
@map0logo
map0logo / chuleta_venv.rst
Last active August 29, 2015 14:04
Cheat Sheets

Instalar archivos básicos de Python

Instalar paquetes básicos de compilación

$ sudo apt-get install build-essential

Instalar cabeceras de compilación de Python

#!/usr/local/bin/python3.3
"""
This script creates and installs a Mezzanine CMS database and application.
"""
import sys
import xmlrpclib
cmsName = "my_cms"
databaseName = "cms_db"
databaseType = "postgresql"
//
// Bubbles emerging over horizon and spaceships arriving to base
// Use two planes, one upper left for arcs over bands,
// and a lower right plane with points, triangles, rectangles and quads.
// I want to use open access nice color palettes.
//
// For lines use Sunny Duck Palette http://www.colourlovers.com/palette/167272/Sunny_Duck
// For arcs use Thought Provoking Palette http://www.colourlovers.com/palette/694737/Thought_Provoking
// For points use cheer up emo kid Palette http://www.colourlovers.com/palette/1930/cheer_up_emo_kid
// For triangules use Three Colors Palette http://www.colourlovers.com/palette/3473665/Three_Colors
@map0logo
map0logo / libro_mppp.py
Created February 21, 2015 02:34
Para descargar las imágenes del libro "Venezuela en cifras" http://www.mppp.gob.ve/libro/
import urllib
url = "http://www.mppp.gob.ve/libro/images/VzlaEnCifras-{}.jpg"
data = "VzlaEnCifras-{}.jpg"
for i in xrange(1, 151):
image = urllib.URLopener()
image.retrieve(url.format(i), data.format(i))
@map0logo
map0logo / libro_pdf.py
Last active August 29, 2015 14:15
Para crear el PDF a partir de las imágenes descargadas con https://gist.github.com/map0logo/d97911f3d7dae2d30804
# instalar img2pdf usando
# $ pip install img2pdf
import img2pdf
import glob
page_list = glob.glob("*.jpg")
def page_num(s):
start = s.index("-") + 1
end = s.index(".", start + 1)
@map0logo
map0logo / Extract tabular data from Wikipedia.ipynb
Created September 24, 2015 22:14
Extract tabular data from Wikipedia
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@map0logo
map0logo / Ejercicios 1.ipynb
Created November 27, 2015 13:54
Ananda Rivas - Ejercicios 1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@map0logo
map0logo / comunidades_tecnologicas_ve_telegram.md
Created September 16, 2016 18:53
Comunidades Tecnológicas de Venezuela en Telegram