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 urllib | |
def get_image(url, path): | |
urllib.urlretrieve(url, path) | |
url_base = "http://www.gojapan.jp/toku3/aaimage/sub/" | |
file_base = "title0" | |
for i in range(1, 50): | |
file = file_base + ("%02d" % i) | |
url = url_base + file |
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
from bs4 import BeautifulSoup as Magic | |
import urllib | |
# urllib.urlretrieve("http://www.gunnerkrigg.com//comics/00000001.jpg", | |
# "1.jpg") | |
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
from bs4 import BeautifulSoup as Magic | |
import urllib | |
# urllib.urlretrieve("http://www.gunnerkrigg.com//comics/00000001.jpg", | |
# "1.jpg") | |
base = "http://www.gojapan.jp/toku3/" |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="description" content="GREE"> | |
<meta name="keywords" content="GREE, openfeint, free games"> | |
<!-- iphone --> | |
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, | |
user-scalable=0"> |
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
(defun ya-elt (the-list index) | |
(if (> index 0) | |
(ya-elt (cdr the-list) (- index 1)) | |
(car the-list))) | |
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
class BasicParser: | |
def __init__(self, doc): | |
self.pos = 0 | |
self.doc = doc | |
def next (self): | |
self.pos += 1 | |
return self | |
def chr(self): |
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 convert2d (m): | |
l = len(m) | |
for y in range(0, l): | |
for x in range(0, l-y): | |
m[x][y], m[l-1-y][l-1-x] = m[l-1-y][l-1-x], m[x][y] | |
return m | |
def prettify (m): | |
for r in m: | |
print " " * 4 + str(r) |
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 getIP (record): | |
return record[:record.index(" ")] | |
def go (): | |
ips = dict() | |
for line in open("access.log", "r"): | |
ip = getIP(line) | |
ips[ip] = ips.get(ip, 0) + 1 | |
ips = sorted(ips.items(), key=lambda x: -x[1]) | |
prettify(ips) |
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
(*------------------------ WEEK 1 ------------------------------------*) | |
(* 1 *) | |
fun is_older (fst: int*int*int, snd: int*int*int) = | |
(#1 fst) * 10000 + (#2 fst) * 100 + #3 fst < | |
(#1 snd) * 10000 + (#2 snd) * 100 + #3 snd | |
(* 2 *) | |
fun number_in_month (dates: (int*int*int) list, month: int) = | |
if null dates then 0 |