Skip to content

Instantly share code, notes, and snippets.

@moluapple
moluapple / gist:3263337
Created August 5, 2012 09:27
[Indesign] get a paragraph's index within it's parent textframe
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (item, i) {
i || (i = 0);
var length = this.length;
if (i < 0) i = length + i;
for (; i < length; i++)
if (this[i] === item) return i;
return -1;
}
}
@moluapple
moluapple / A realworld example.jsx
Created August 11, 2012 06:42
[Illustrator] Relaunch AI to aviod "PARM" error
// Origin discussion: http://forums.adobe.com/message/4613051
#target "estoolkit"
rasterizeFolder();
/********************************************************************************************/
function rasterizeFolder() {
//Get the source and destination folders.
//If either window is cancelled, end the script.
@moluapple
moluapple / cooldtpNewPostsChecker.py
Created August 25, 2012 15:14
[Python2]使用 mechanize 登录网站演示
#!/usr/bin/python
# -*- coding:utf-8 -*-
import mechanize
def check_new_posts(username, password):
b = mechanize.Browser()
b._factory.encoding = "utf8"
b.set_handle_robots(False)
b.addheaders = [('User-Agent','Mozilla/4.0(compatible; MSIE 6.0; Windows 98;)')]
@moluapple
moluapple / cchere_posts_downloader.py
Created August 26, 2012 14:07
[python2]cchere user posts downloader
#!/usr/bin/python
# -*- coding:utf-8 -*-
""" download all cchere posts of the author from pre-collected postlist
currently the list was collected manually
TODO: get the postlist from cchere user home automatically
NOTE: Fanqiang is needed as the exists of GFW
code based on: https://code.google.com/p/cchere-thread-saver/
"""
@moluapple
moluapple / Description
Created October 23, 2012 15:13 — forked from linktoming/Description
Batch Delete Amazon Kindle Library Items
Credit and Usage: http://www.mobileread.com/forums/showthread.php?t=162972
@moluapple
moluapple / 纸质书籍电子版制作一般流程.md
Last active December 10, 2015 01:48
纸质书籍电子版制作一般流程

##纸质书籍电子版制作一般流程

  1. 扫描
  2. OCR文本识别
  3. 人工校对
  4. 排版(版面大致/精确还原)
  5. 二次校对 ……

我们一般从步骤2开始。

@moluapple
moluapple / keepWindowBounds.js
Last active December 15, 2015 03:49
[Indesign] Reset the window bounds to the same as last time (CS6)
#targetengine "keepWindowBounds"
(function() {
app.addEventListener("afterOpen", setBounds);
function setBounds(ev) {
var layoutWin = ev.parent,
bounds = eval('[' + app.extractLabel('bounds') + ']');
layoutWin.addEventListener("beforeClose", insertBounds);
function insertBounds(ev) {
@moluapple
moluapple / 空园子.md
Last active December 17, 2015 15:59
《空园子》 杨键

##《空园子》 杨键

我是一座空园子,

我是一条空河流,

我是一座空山,

我是一个空了的妈妈,

@moluapple
moluapple / gist:5690732
Last active December 17, 2015 23:39
Powershell 命令收集
Dir *.png | rename-item -newname { $_.name -replace ".png",".pdg" }
Dir *.pdg | rename-item -newname { "000" + $_.name }
//Batch Incremented File Rename
$files = Get-ChildItem c:\yourpath\*.ext
$id = 1
$files | foreach {
Rename-Item -Path $_.fullname -NewName (($id++).tostring() + $_.extension)
}
@moluapple
moluapple / gist:90f5c18bbb778af9ee8c
Created March 1, 2015 13:57
灰度PDF转黑白 via ImageMagick
convert input.pdf -threshold 50% new.pdf