Skip to content

Instantly share code, notes, and snippets.

View v2e4lisp's full-sized avatar

Yan Wenjun v2e4lisp

View GitHub Profile
@v2e4lisp
v2e4lisp / image.py
Created January 9, 2013 09:27
grab images
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
@v2e4lisp
v2e4lisp / meibutu.py
Created January 9, 2013 09:29
meibutu.name
from bs4 import BeautifulSoup as Magic
import urllib
# urllib.urlretrieve("http://www.gunnerkrigg.com//comics/00000001.jpg",
# "1.jpg")
@v2e4lisp
v2e4lisp / place.py
Created January 9, 2013 09:30
find place info
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/"
@v2e4lisp
v2e4lisp / index.html
Created January 9, 2013 09:32
index.html
<!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">
@v2e4lisp
v2e4lisp / tmp.el
Created January 13, 2013 15:44
ya-elt
(defun ya-elt (the-list index)
(if (> index 0)
(ya-elt (cdr the-list) (- index 1))
(car the-list)))
@v2e4lisp
v2e4lisp / basic.py
Created January 19, 2013 14:39
basic-parser-or-nothing
class BasicParser:
def __init__(self, doc):
self.pos = 0
self.doc = doc
def next (self):
self.pos += 1
return self
def chr(self):
@v2e4lisp
v2e4lisp / todo.org
Created January 19, 2013 14:45
my-programming-todo-list

google-chrome dict

google-chrome open the current tabs the next time when I open the browser

read the fucking source code in express.js

emacs lisp reading and writing

emacs hacker news

blog on github

xml-parser python lisp

github tutorial-directory

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)
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)
@v2e4lisp
v2e4lisp / test.sml
Created January 26, 2013 17:46
programming languanges (coursera) week-1 homework.
(*------------------------ 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