Skip to content

Instantly share code, notes, and snippets.

View aduartem's full-sized avatar
🏠
Working from home

Andrés Duarte M. aduartem

🏠
Working from home
View GitHub Profile
@aduartem
aduartem / ejemplos.py
Created February 27, 2016 04:08
Python - Ejemplos
#!/usr/bin/python
# -*- coding: utf-8 -*-
# probado Python 2.7.6
x = 2.5
y = 7.5
total = x + y
print '%g + %g = %g ' % (x, y, total)
@aduartem
aduartem / parsing_json.py
Last active August 29, 2016 03:35
Python - Parsing JSON
#!/usr/bin/python
import json
json_string = '{"Language":[{"Name":"Python"},{"Name":"Ruby"},{"Name":"Java"},{"Name":"C"},{"Name":"PHP"}]}'
data = json.loads(json_string)
i=0
for lenguaje in data['Language']:
print '- ' + str(data['Language'][i]['Name'])
@aduartem
aduartem / socket_client.py
Last active August 29, 2016 03:35
Python - Socket Examples
#!/usr/bin/python
# Socket Client Example
import socket
HOST = 'localhost' # El host remoto
PORT = 9999 # El puerto del host remoto
s = socket.socket()
s.connect((HOST, PORT))
@aduartem
aduartem / vim.md
Last active September 1, 2016 00:15
Vim

Vim

Comandos de uso frecuente

Comando Descripción
ESC Volver al modo de comandos. También se usa para cancelar comandos.
Ctrl+F Avanzar una página hacia adelante
Ctrl+B Avanzar una página hacia atrás
Ctrl+L Refrescar pantalla
@aduartem
aduartem / instalar_ruby.md
Created March 1, 2016 19:28
Cómo Instalar Ruby, Ruby on Rails y Capistrano en Debian 7

Cómo Instalar Ruby, Ruby on Rails y Capistrano en Debian 7

Esta guía indica como instalar Ruby 2.3.0 usando chruby + ruby install y Ruby o Rails 4.2.5. Está guía aplica tanto para Debian 7.0 como para Ubuntu 14.04, pero probablemente sirve para otras distribuciones Linux, incluyendo versiones más recientes de Ubuntu y Debian.

Primero que todo actualizar el listado de paquetes disponibles:

sudo apt-get update
@aduartem
aduartem / guia_instalacion_rapida_django.md
Created March 1, 2016 19:30
Guía de instalación rápida de Django

Como instalar Django

Django requiere Python instalado. Funciona con Python 2.7, 3.2, 3.3, o 3.4. Estas versiones incluyen la base de datos SQLite.

Podemos verificar si python está instalado ingresando en la terminal el siguiente comando:

$ python
@aduartem
aduartem / laravel.md
Last active August 10, 2018 12:30
Laravel

Laravel

Instalar Laravel en Ubuntu

Requisitos previos:

Tener al menos instalado PHP y un motor de base de datos como por ejemplo MySQL. También se recomienda instalar un servidor web como por ejemplo Apache o Nginx.

Paso 1: Instalar CURL

@aduartem
aduartem / juego_recursividad.py
Last active August 29, 2016 03:35
Python - Recursividad
#!/usr/bin/python
# -*- coding: utf-8 -*-
def jugar(intento = 1):
print "\n¿Cuanto es 2 x 2?"
respuesta = int(raw_input("> "))
if respuesta != 4:
max = 3
if intento < max:
print "\nRespuesta incorrecta. Intentalo nuevamente, te quedan " + str(max - intento) + " intento(s)"
intento += 1
@aduartem
aduartem / django_tutorial01.md
Last active March 8, 2016 02:16
Django - Tutorial 01

Django - Tutorial 01

Basado en la documentación oficial.

Escribiendo tu primera Django app, parte 1

django-admin

Si en la terminal ingresas el comando django-admin se mostrará lo siguiente:

@aduartem
aduartem / python_listas_y_diccionarios.md
Last active May 21, 2022 19:09
Python - Listas y Diccionarios

Listas y Diccionarios

Listas

>>> series = ['Breaking Bad', 'Game of Thrones', 'Mad Men', 'The 100']
>>> print(series)
['Breaking Bad', 'Game of Thrones', 'Mad Men', 'The 100']