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
Due to limitations of SQLite, we need to make a temp table for this: | |
CREATE TEMP TABLE duped_urls AS | |
SELECT url, SUM(visits) AS total, MAX(modified) AS latest, MAX(_id) AS winner | |
FROM history | |
GROUP BY url | |
HAVING count(url) > 1; | |
UPDATE history | |
SET visits = (SELECT total FROM duped_urls WHERE duped_urls.url=history.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
#! /usr/bin/env python | |
import csv | |
import urllib2 | |
import sgmllib | |
class LinkParser(sgmllib.SGMLParser): | |
def parse(self, s): | |
self.feed(s) | |
self.close() |
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
function getDominantColor(aImg) { | |
let canvas = document.createElement("canvas"); | |
canvas.height = aImg.height; | |
canvas.width = aImg.width; | |
let context = canvas.getContext("2d"); | |
context.drawImage(aImg, 0, 0); | |
// keep track of how many times a color appears in the image | |
let colorCount = {}; |
NewerOlder