Skip to content

Instantly share code, notes, and snippets.

View douglasmiranda's full-sized avatar
👽

Douglas Miranda douglasmiranda

👽
  • Earth, Brazil
View GitHub Profile
@iamatypeofwalrus
iamatypeofwalrus / roll_ipython_in_aws.md
Last active February 21, 2025 18:39
Create an iPython HTML Notebook on Amazon's AWS Free Tier from scratch.

What

Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.

What are we using? What do you need?

  • An active AWS account. First time sign-ups are eligible for the free tier for a year
  • One Micro Tier EC2 Instance
  • With AWS we will use the stock Ubuntu Server AMI and customize it.
  • Anaconda for Python.
  • Coffee/Beer/Time
import sys
import collections
import gridfs
import io
import psycopg2
import pymongo
import random
import time
# For fairness use the same chunk size - 512k.
@rh0dium
rh0dium / base.py
Created February 10, 2013 23:19
Another..
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format': "[%(asctime)s] %(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s",
'datefmt': "%d/%b/%Y %H:%M:%S"
},
},
'handlers': {
class ColorizingStreamHandler(logging.StreamHandler):
"""
A stream handler which supports colorizing of console streams
under Windows, Linux and Mac OS X.
:param strm: The stream to colorize - typically ``sys.stdout``
or ``sys.stderr``.
"""
# color names to indices
@fabiocerqueira
fabiocerqueira / example_descriptors.py
Created October 11, 2012 02:17
Exemplo de uso de descriptors em Python
class Field(object):
def __init__(self, default=None):
self.val = default
def __get__(self, obj, objtype):
if obj is None:
return self.__class__
else:
return self.val
@marcelcaraciolo
marcelcaraciolo / friends_recommender.py
Created October 10, 2012 18:31
Twitter Friends Recommender
#-*-coding: utf-8 -*-
'''
This module represents the recommender system for recommending
new friends based on 'mutual friends'.
'''
__author__ = 'Marcel Caraciolo <[email protected]>'
from django.views.generic import ListView
from django.views.generic.edit import FormMixin
from django.db.models import Q
class SearchView(FormMixin, ListView):
template_name_suffix = '_search'
filter_operator = 'contains'
allow_or_operator = False
def get_filter_operator(self):
@fabiocerqueira
fabiocerqueira / mixins.py
Created September 24, 2012 15:09
Success Message Mixin
from django.core.exceptions import ImproperlyConfigured
from django.contrib import messages
class SuccessMessageMixin(object):
success_message = None
def get_success_message(self):
if self.success_message:
@Miserlou
Miserlou / middleware.py
Created September 6, 2012 01:47
Django Profiler
# Orignal version taken from http://www.djangosnippets.org/snippets/186/
# Original author: udfalkso
# Modified by: Shwagroo Team and Gun.io
import sys
import os
import re
import hotshot, hotshot.stats
import tempfile
import StringIO
@ihercowitz
ihercowitz / scrapper.py
Created August 24, 2012 14:38
Scrapping the Coloring book site
import requests
from lxml.html import fromstring
import os
def connect(url):
return requests.get(url)
def parser(page):