Skip to content

Instantly share code, notes, and snippets.

@audreyt
audreyt / moe-download.pl
Last active July 31, 2018 03:41
<教育部重編國語辭典修訂本>單字下載腳本雛形
#!/usr/bin/env perl
use utf8;
use Encode;
binmode STDOUT, ':utf8';
for my $x (0xA4 .. 0xF9) {
for my $y (0x40 .. 0x7E, 0xA1 .. 0xFE) {
my $big5 = sprintf('%%%02X%%%02X', $x, $y);
my $char = Encode::decode(big5 => chr($x) . chr($y));
print qq[curl -m 10 --retry 10 --retry-delay 10 'http://dict.revised.moe.edu.tw/cgi-bin/newDict/dict.sh?idx=dict.idx&cond=%5E$big5%24&pieceLen=100&fld=1&cat=&imgFont=1' | piconv -f big5 -t utf8 | perl -ne 'next unless m!^<table width="90%"! .. m!^</table!; s!<span class="key">(.+?)</span>!\$1!g; print' > "$char.html"\n];
@kozo2
kozo2 / zoterator.js
Created August 15, 2012 16:43
vimperator plugin for Zotero
/* NEW BSD LICENSE {{{
Copyright (c) 2009-2012, kozo2.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
@shellexy
shellexy / mk-hotot-web.sh
Created April 18, 2012 13:55
生成网页版 hotot
#!/bin/bash -x
SRC=$PWD/data/
DEST=$PWD/web.hotot.org/
echo "\033[1;31;40m[i]Sync ...\033[0m"
# ignore .*.swp, .hgignore, etc
rsync -av --exclude '.*.*' --exclude '*.coffee' --exclude 'test*' $SRC $DEST
# replace conf.vars.platform, key and secret
echo "\033[1;31;40m[i] Replace platform, key and secret ...\033[0m"
@kejun
kejun / GM Script: 自动用xiami播放专辑
Created January 12, 2011 10:29
Douban音乐推荐直接用xiami播放
// ==UserScript==
// @name douban_xiami
// @namespace org.kejun
// @include http://music.douban.com/*
// ==/UserScript==
//使用说明:
// 1. 安装本脚本到Greasemonkey
// 2. 到http://music.douban.com/recommended
// 3. 点击专辑封面会自动用虾米播放(如果窗口没弹出,检查是否被浏览器拦截)