This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_info(**kwargs): | |
logging.info("=" * 80) | |
logging.info("Build configuration options:") | |
logging.info("=" * 80) | |
buildinfo=[ | |
('Games', kwargs['games']), | |
('Languages', kwargs['languages']), | |
('Partner', kwargs['partner']), | |
('InstallTag', kwargs['installtag']), | |
('Marketing', kwargs['marketingmode']), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import re | |
file = sys.argv[1] | |
with open(file, 'rU') as f: | |
text = f.read() | |
text = re.sub('[\s]{2,10}', ' ', text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
import xml.etree.ElementTree as ET | |
import os | |
port = '/dev/ttyUSB0' | |
baud = 57600 | |
ser = serial.Serial(port, baud) | |
data = ser.readline() | |
root = ET.fromstring(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# Reads data from a Current Cost device via serial port. | |
use strict; | |
use Device::SerialPort qw( :PARAM :STAT 0.07 ); | |
my $PORT = "/dev/ttyUSB0"; | |
my $ob = Device::SerialPort->new($PORT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import re | |
url = 'http://wiki.shoryuken.com/index.php?title=Super_Street_Fighter_IV_AE/Abel&action=edit' | |
def test(url): | |
data = read_url_data(url) | |
table = find_move_table(data) | |
print find_moves_data(table) | |
def read_url_data(url): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webapp2 | |
import re | |
class MainPage(webapp2.RequestHandler): | |
with open('login.html', 'rU') as f: | |
html = f.read() | |
data = {'username':'', | |
'password':'', | |
'verify':'', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webapp2 | |
import cgi | |
html=""" | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Unit 2 Rot 13</title> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def escape_html(s): | |
list = [('&', '&'), | |
('<', '<'), | |
('"', '"'), | |
('>', '>')] | |
for i in list: | |
if i[0] in s: | |
s = s.replace(i[0],i[1]) | |
return s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def escape_html(s): | |
for i, v in ('&', '&'), ('<', '<'), ('"', '"'), ('>', '>'): | |
if i in s: | |
s = s.replace(i,v) | |
return s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
import os | |
import re | |
port = '/dev/ttyUSB0' | |
baud = 57600 | |
ser = serial.Serial(port, baud) | |
rrdpath = '/etc/cron.cc/rrd/powertemp.rrd' | |
dataRE = re.compile(r'.+<tmpr>(.+?)<\/tmpr>.+<watts>(.+?)<\/watts>') | |
while True: |