Skip to content

Instantly share code, notes, and snippets.

@six519
Last active December 13, 2015 19:49
Show Gist options
  • Save six519/4965681 to your computer and use it in GitHub Desktop.
Save six519/4965681 to your computer and use it in GitHub Desktop.
Quote of the day shit!
"""
.. module:: qotd_shit
.. moduleauthor:: Ferdinand (The **Brain Damage**) Silva <ferdinandsilva@ferdinandsilva.com>
Just got bored again and played around with some few lines of code in Python
================================
List of operational QOTD Servers
================================
#. alpha.mike-r.com
#. ota.iambic.com
`My GitHub <https://github.com/six519>`_
"""
import socket
QOTD_SERVER = "ota.iambic.com"
con = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
qotd = ""
try:
con.connect((QOTD_SERVER,17))
while True:
buff = con.recv(1024)
if len(buff) > 0:
qotd += buff
else:
break
con.close()
print qotd
except (socket.gaierror,socket.error) as e:
print e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment