View extract.rb
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
require 'nokogiri' | |
unit = ARGV[0].to_i | |
started = false | |
titles = [] | |
1.upto(3000) do |i| | |
filename = "html/Merriam-Webster_s_Vocabulary_Bu_split_#{'%03d' % i}.html" | |
doc = Nokogiri::HTML(open(filename)) | |
title = doc.css('div span.bold').first | |
next if title == nil |
View zhihu.recipe
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 | |
__copyright__ = 'Yuanxuan Wang <zellux at gmail dot com>' | |
from calibre.web.feeds.news import BasicNewsRecipe | |
from calibre.ebooks.BeautifulSoup import Tag, NavigableString | |
from collections import OrderedDict | |
from contextlib import nested, closing | |
import json |
View migrate.rb
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 | |
require 'rubygems' | |
require 'hpricot' | |
require 'fileutils' | |
require 'time' | |
require 'ya2yaml' | |
require File.join(File.dirname(__FILE__), "downmark_it") | |
require 'nokogiri' | |
require 'cgi' |
View laplacian-smoothing.rb
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
require 'set' | |
k = 1.0 | |
list1 = %w(a perfect world my perfect woman pretty woman) | |
list2 = %w(a perfect day electric storm another rainy day) | |
ncases1 = 3 | |
ncases2 = 3 | |
list1name = 'movie' | |
list2name = 'song' |
View crop.rb
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
require 'thread' | |
require 'logger' | |
require 'fileutils' | |
dir_name = ARGV[0] || '707-kindle' | |
NTHREADS = 4 | |
$logger = Logger.new STDERR | |
puts "Resizing all images..." |
View client.c
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
#include <string.h> | |
#include <arpa/inet.h> | |
#include <sys/socket.h> | |
#include <fcntl.h> | |
#define SERV_PORT 49312 | |
#define MAXLINE 1024 | |
char *END_FLAG = "================END"; |
View gist:867949
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
javascript:var i,s,ss=['http://kathack.com/js/kh.js','http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js'];for(i=0;i!=ss.length;i++){s=document.createElement('script');s.src=ss[i];document.body.appendChild(s);}void(0); |