Skip to content

Instantly share code, notes, and snippets.

View goanpeca's full-sized avatar
馃彔
Working from home

Gonzalo Pe帽a-Castellanos goanpeca

馃彔
Working from home
View GitHub Profile
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
C1 = np.array([-3.46, 14.991, 1.969])
C9 = np.array([-3.797, 13.86, 2.93])
C8 = np.array([-2.541, 13.306, 3.48])
@goanpeca
goanpeca / tweet_listener.py
Created December 21, 2018 21:29 — forked from hugobowne/tweet_listener.py
Here I define a Tweet listener that creates a file called 'tweets.txt', collects streaming tweets as .jsons and writes them to the file 'tweets.txt'; once 100 tweets have been streamed, the listener closes the file and stops listening.
class MyStreamListener(tweepy.StreamListener):
def __init__(self, api=None):
super(MyStreamListener, self).__init__()
self.num_tweets = 0
self.file = open("tweets.txt", "w")
def on_status(self, status):
tweet = status._json
self.file.write( json.dumps(tweet) + '\n' )
self.num_tweets += 1
@goanpeca
goanpeca / adn.py
Created August 8, 2018 19:57
Tarea de taller de introducci贸n a Python
# -*- coding: utf-8 -*-
"""
Esto es un Dosctring de m贸dulo, sirve para documentar infromaci贸n de los
m贸dulos de python.
Las triples comillas se usan para textos que ocupan m谩s de una l铆nea, como
este ejemplo.
Documentaci贸n de Python
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 23 18:37:06 2016
@author: goanpeca
"""
# Standard library imports
import os