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 ruby | |
require "fileutils" | |
PUBS = ["Oreilly", "Microsoft Publication", | |
"Sitepoint", "Apress"] | |
def normalize(name) | |
n = name.gsub(/\w{3,4}\.[0-9]{4}$/, "").gsub(/\.\w+\.Edition/i, "").gsub(/[^[:alnum:]]/, " ") | |
PUBS.each do |p| | |
r = Regexp.new(p, true) |
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 | |
usage() { | |
echo Usage: `basename $0` from_encoding to_encoding file_or_dir_to_transcode | |
} | |
if [ $# -ne 3 ]; then | |
usage | |
exit 1 | |
fi |
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 ruby | |
require "rubygems" | |
require "open-uri" | |
require "fileutils" | |
require "hpricot" | |
(puts "Usage: #{File.basename $0} http://link.to.webpage" ; exit 1) if ARGV.size != 1 | |
begin | |
imagedir = "images" |
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 ruby | |
def parse(f) | |
buffer = "" | |
open(f) { |file| file.seek 0x404;file.each_byte {|c| buffer << (0xff - c).chr} } | |
rindex = buffer.rindex(/<\/word>/) + "</word>".size | |
open(f.sub(".ydic", ".xml"), "w+").write(buffer[0...rindex].gsub("</word>", "</word>\n")) | |
end | |
(puts "Usage: #{File.basename $0} dict_file_1 [...]";exit 1) if ARGV.size < 1 |
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 | |
#This Python file uses the following encoding: utf-8 | |
#Author:Superfan | |
#Version 1.0 | |
#Latest Update:July,31,2011 | |
#Usage:This script will convert youdao dictonary(plus version) to Mdict source file,put it in the same directory which offline glossories exist, and run it with python VM. | |
#This script is for STUDY use ONLY.DO NOT USE IT FOR ANY COMMERCIAL PURPOSE!!! | |
# Small changes by Venj, 2011-09-05 | |
from __future__ import division |
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
from __future__ import division | |
import sys,os | |
def decrypt(str): | |
i=0 | |
tmp='' | |
try: | |
while True: | |
tmp+=chr((255-ord(str[i]))) #XD | |
i+=1 |
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
/* NSWindow+Extension.h */ | |
#import <Foundation/Foundation.h> | |
@interface NSWindow(Extension) | |
- (void)resizeTo:(NSSize)newSize display:(BOOL)display animated:(BOOL)animated; | |
- (void)resizeTo:(NSSize)newSize; | |
@end |
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 ruby | |
require "fileutils" | |
include FileUtils | |
ERROR = 255 | |
def repack(book, tmpdir) | |
book_name = File.basename(book, ".epub") | |
system(%|unzip "#{book}" -d #{tmpdir} > /dev/null 2>&1|) | |
cd(tmpdir) do |
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 ruby | |
require "fileutils" | |
(puts "Usage: #{File.basename $0} widthxheight"; exit 0) if ARGV.size != 1 | |
width, height = ARGV[0].split("x").collect(&:to_i) | |
(puts "Please enter a valid size."; exit 0) if ((width.to_i == 0) or (height.to_i == 0)) | |
half_width = width / 2 | |
FileUtils.cd("images") do | |
Dir['**/*'].each do |f| |
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
American Typewriter: | |
AmericanTypewriter | |
AmericanTypewriter-Bold | |
Apple Color Emoji: | |
AppleColorEmoji | |
AppleGothic: | |
AppleGothic |