This file contains 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
module A = struct | |
let map f l = List.rev (List.rev_map f l) | |
let enclose x = "(" ^ x ^ ")" | |
let cross lhs rhs = | |
let rec cross_aux accu = function | |
| [] -> accu | |
| x::xs -> cross_aux (List.fold_left (fun a y -> (x^y)::a) accu rhs) xs | |
in | |
cross_aux [] lhs |
This file contains 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
type 'a tree = Lf | Bt of 'a * 'a tree * 'a tree | |
let rec size = function | |
| Lf -> 0 | |
| Bt (_, l, r) -> 1 + (size l) + (size r) | |
let rec depth = function | |
| Lf -> 0 | |
| Bt (_, l, r) -> 1 + max (depth l) (depth r) |
This file contains 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
#!/bin/bash | |
download_dir=./download | |
cd $download_dir | |
for file in `find . -name "*.zip"`; do | |
unzip $file | |
rm $file | |
touch $file | |
done |
This file contains 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
# -*- coding: utf-8 -*- | |
import re | |
import urllib | |
from urlparse import urlunparse, urlparse | |
import gzip | |
import eventlet | |
from eventlet.green import urllib2 | |
import cookielib | |
from pyquery import PyQuery as pq |
This file contains 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
# -*- coding: utf-8 -*- | |
# expressing my strong respect for mopemope | |
import re | |
import urllib | |
from urlparse import urlunparse, urlparse | |
import gzip | |
import eventlet | |
from eventlet.green import urllib2 | |
import cookielib |
This file contains 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
# -*- coding: utf-8 -*- | |
try: | |
from setuptools.setuptools import setup, Extension | |
except: | |
from distutils.core import setup, Extension | |
import sys | |
import os | |
from subprocess import Popen, PIPE |
This file contains 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
GNU GENERAL PUBLIC LICENSE | |
Version 2, June 1991 | |
Copyright (C) 1989, 1991 Free Software Foundation, Inc. | |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
Everyone is permitted to copy and distribute verbatim copies | |
of this license document, but changing it is not allowed. | |
Preamble |
This file contains 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
# -*- coding: utf-8 -*- | |
from lxml import etree | |
from StringIO import StringIO | |
from multiprocessing import Pool | |
import urllib2 | |
base_url = r"http://pypi.python.org" | |
xhtml_ns = r'http://www.w3.org/1999/xhtml' | |
pypi_list = r"http://pypi.python.org/pypi?%3Aaction=index" |
This file contains 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
# -*- coding: utf-8 -*- | |
from pyPdf import PdfFileWriter, PdfFileReader | |
def main(output_file, input_files): | |
print "concat all files:" | |
output = PdfFileWriter() | |
total_pages = 0 |
This file contains 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 -*- | |
import urllib2 | |
from datetime import datetime, timedelta | |
# create Basic Authorized opener | |
username = "nishio" | |
password = "nishio" | |
realm = "secret bucho contents" |
OlderNewer