Skip to content
Snippets Groups Projects
Commit 1f727d4a authored by rohieb's avatar rohieb
Browse files

Merge remote-tracking branch 'comawill/master'

parents 7f53a793 066f04cf
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 5x7 font from http://www.hwsw.no/snippets/5x7_LCD_font.php
# every byte contains pixel data for one column, LSB is on top, MSB is ignored.
FONT = {
" ": [0x00,0x00,0x00,0x00,0x00],
"!": [0x00,0x00,0x4F,0x00,0x00],
"\"": [0x00,0x07,0x00,0x07,0x00],
"\"": [0x00,0x03,0x00,0x03,0x00],
"#": [0x14,0x7F,0x14,0x7F,0x14],
"$": [0x24,0x2A,0x7F,0x2A,0x12],
"%": [0x23,0x13,0x08,0x64,0x62],
"&": [0x36,0x49,0x55,0x22,0x50],
"'": [0x00,0x05,0x03,0x00,0x00],
"'": [0x00,0x00,0x03,0x00,0x00],
"(": [0x00,0x1C,0x22,0x41,0x00],
")": [0x00,0x41,0x22,0x1C,0x00],
"*": [0x14,0x08,0x3E,0x08,0x14],
"+": [0x08,0x08,0x3E,0x08,0x08],
",": [0x00,0x50,0x30,0x00,0x00],
"-": [0x08,0x08,0x08,0x08,0x08],
".": [0x00,0x60,0x60,0x00,0x00],
",": [0x00,0x00,0x60,0x00,0x00],
"-": [0x00,0x08,0x08,0x08,0x00],
".": [0x00,0x00,0x40,0x00,0x00],
"/": [0x20,0x10,0x08,0x04,0x02],
"0": [0x3E,0x51,0x49,0x45,0x3E],
......@@ -30,8 +31,8 @@ FONT = {
"7": [0x01,0x71,0x09,0x05,0x03],
"8": [0x36,0x49,0x49,0x49,0x36],
"9": [0x06,0x49,0x49,0x29,0x1E],
":": [0x36,0x36,0x00,0x00,0x00],
";": [0x56,0x36,0x00,0x00,0x00],
":": [0x00,0x00,0x24,0x00,0x00],
";": [0x00,0x00,0x64,0x00,0x00],
"<": [0x08,0x14,0x22,0x41,0x00],
"=": [0x14,0x14,0x14,0x14,0x14],
">": [0x00,0x41,0x22,0x14,0x08],
......@@ -69,7 +70,7 @@ FONT = {
"\\": [0x02,0x04,0x08,0x10,0x20],
"]": [0x00,0x41,0x41,0x7F,0x00],
"^": [0x04,0x02,0x01,0x02,0x04],
"_": [0x40,0x40,0x40,0x40,0x40],
"_": [0x00,0x40,0x40,0x40,0x40],
"`": [0x00,0x01,0x02,0x04,0x00],
"a": [0x20,0x54,0x54,0x54,0x78],
......@@ -84,7 +85,7 @@ FONT = {
"j": [0x20,0x40,0x44,0x3D,0x00],
"k": [0x7F,0x10,0x28,0x44,0x00],
"l": [0x00,0x41,0x7F,0x40,0x00],
"m": [0x78,0x04,0x58,0x44,0x78],
"m": [0x78,0x04,0x18,0x04,0x78],
"n": [0x7C,0x08,0x04,0x04,0x78],
"o": [0x38,0x44,0x44,0x44,0x38],
......@@ -104,6 +105,15 @@ FONT = {
"}": [0x00,0x41,0x36,0x08,0x00],
"~": [0x0C,0x02,0x0C,0x10,0x0C],
"\x7f": [0x55,0xAA,0x55,0xAA,0x55],
u"ä" : [0x20,0x55,0x54,0x55,0x78],
u"ü": [0x3C,0x41,0x40,0x21,0x7C],
u"ö": [0x38,0x45,0x44,0x45,0x38],
u"Ä": [0x7C,0x13,0x12,0x13,0x7C],
u"Ü": [0x3E,0x41,0x40,0x41,0x3E],
u"Ö": [0x3C,0x43,0x42,0x43,0x3C],
u"ß": [0x7F,0x01,0x49,0x4e,0x30],
u"": [0x00,0x00,0x03,0x00,0x00],
}
import client
......
#!/usr/bin/python
#!/usr/bin/env python2
import client
import random
......
#!/usr/bin/python
#!/usr/bin/env python2
import os
import bitmapfont
......@@ -23,7 +23,7 @@ HEIGHT = PHEIGHT*NUM_SEG_Y
import sys
SERVER = "tcp://localhost:5570"
SERVER = "tcp://mensadisplay:5556"
if len(sys.argv) >= 2:
SERVER = sys.argv[1]
......
#!/usr/bin/python
#!/usr/bin/env python2
import font_client
......@@ -8,5 +8,5 @@ import dateutil.tz
while True:
#font_client.draw(datetime.now().isoformat(), points=30)
font_client.draw(datetime.now(dateutil.tz.tzlocal()).isoformat(), points=25)
font_client.draw(datetime.now(dateutil.tz.tzlocal()).isoformat(), points=10)
#!/usr/bin/python
#!/usr/bin/env python2
import sys, client
......
#!/usr/bin/python
#!/usr/bin/env python2
import client
......
#!/usr/bin/env python2
import sys
import socket
import string
import client
def printline(nick, msg, me=False):
l = len(nick) + 3
if me:
l = len(nick) + 1
nick += " "
else:
nick = "<%s> " % nick
while msg:
client.writeline("%s%s" % (nick, msg[:96-len(nick)]))
nick = " " * len(nick)
msg = msg[96-len(nick):]
HOST="irc.freenode.net"
PORT=6667
NICK="mensadisplay"
IDENT="mensadisplay"
REALNAME="MensaDisplay"
readbuffer=""
s=socket.socket( )
s.connect((HOST, PORT))
s.send("NICK %s\r\n" % NICK)
s.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))
s.send("JOIN #stratum0\r\n")
while 1:
readbuffer=readbuffer+s.recv(1024)
temp=string.split(readbuffer, "\n")
readbuffer=temp.pop( )
for line in temp:
line = string.rstrip(line)
line = string.split(line)
print line
if line[1] == "PRIVMSG":
nick = line[0].split("!")[0][1:]
msg = " ".join(line[3:])[1:]
try:
if msg.startswith("\x01ACTION"):
#me
printline(nick, msg[8:-1].decode("utf8"), True)
else:
printline(nick, msg.decode("utf8"))
except UnicodeEncodeError:
pass
if(line[0]=="PING"):
s.send("PONG %s\r\n" % line[1])
\ No newline at end of file
#!/usr/bin/python
#!/usr/bin/env python2
import client
import random
......
#!/usr/bin/env python2
# 10x48x5x7 Pixel
import client, praw
from time import sleep
SERVER = "tcp://localhost:5570"
XOFF = 0
YOFF = 0
TEXT = ""
r = praw.Reddit(user_agent='Stratum0 Braunschweig Mensadisplay Parser')
reddit = ["opensource"
,"linux"
,"netsec"
,"sysadmin"
,"worldnews"
,"shittyaskscience"
,"showerthoughts"
,"explainlikeimcalvin"
,"pettyrevenge"
,"all"]
while True:
for i in reddit:
client.writeline("reddit.com/r/" + i)
submissions = r.get_subreddit(i).get_hot(limit=9)
subs = [unicode(x) for x in submissions]
for i in range(0,9):
votes,title = subs[i].split(' :: ',1)
TEXT = '%s :: %s' % (votes.rjust(5),title)
print(repr(TEXT))
client.writeline(TEXT)
sleep(10)
#!/usr/bin/python
#!/usr/bin/env python2
import client
import random
......
#!/usr/bin/python
#!/usr/bin/env python2
import sys, client
......
#!/usr/bin/python
#!/usr/bin/env python2
import zmq, sys
......
#!/usr/bin/python
#!/usr/bin/env python2
PWIDTH = 5
WIDTH = PWIDTH*96
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment