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/env python | |
| # -*- coding: utf-8 -*- | |
| from BeautifulSoup import BeautifulSoup | |
| import re, Image | |
| for tr in BeautifulSoup(open('index.html', 'r')).findAll(lambda tag: (tag.name == 'tr' and tag.td and tag.td.attrs and len(tag.td.attrs) ==1) and tag.td.p): | |
| print "INSERT INTO colour (`palette_id`,`photo`,`name`) VALUES (11,'"+re.sub(r'\#+', '', tr.contents[5].span.string)+".jpg','"+re.sub(r' *\n *', ' ', tr.td.p.span.string.replace(' ',' '))+'-'+re.sub(r' *\n *', ' ', tr.contents[9].p.span.string.replace(' ',' '))+"'); " | |
| Image.new('RGB',(29,29), tr.contents[5].span.string.replace('##','#')).save(re.sub(r'\#+', '', tr.contents[5].span.string)+'.jpg', 'JPEG') |
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
| var cluster = require('cluster'), | |
| app = require('./express-app'); | |
| var workers = {}, | |
| count = require('os').cpus().length; | |
| function spawn(){ | |
| var worker = cluster.fork(); | |
| workers[worker.pid] = worker; | |
| return worker; |
NewerOlder