Skip to content

Instantly share code, notes, and snippets.

@moluapple
moluapple / GBKDecode.jsx
Last active September 18, 2017 14:01
GBK 乱码 fix
function GBKDecode(str) {
var f = File('gbk.txt'), gbk;
f.encoding = 'BINARY';
f.open('w'), f.write(str), f.close();
f.encoding = 'GBK';
f.open('r');
gbk = f.read();
f.close(), f.remove();
return gbk
}
@moluapple
moluapple / find visual center.jsx
Last active September 17, 2023 06:16
[Illustrator] 寻找不规则形状中心点(find visual center of an irregularly shaped polygon with Illustrator)
(function() {
var doc = app.activeDocument,
lays = doc.layers,
WORK_LAY = lays.add(),
NUM_LAY = lays.add(),
i = lays.length - 1,
lay;
// main working loop
for (; i > 1; i--) {
@moluapple
moluapple / Import Multi-Page PDF.jsx
Last active December 12, 2015 13:09
置入多页面PDF (Illustrator CC 2015)
var doc = activeDocument,
f = File.openDialog ('选择文件 ', '*.pdf'),
p = prompt ('置入第 1 到?页', 5, '指定页数')
i = 0;
for (; ++i <= p;) {
app.preferences.setIntegerPreference('plugin/PDFImport/PageNumber', i);
doc.placedItems.add().file = f;
}
app.preferences.setIntegerPreference('plugin/PDFImport/PageNumber', 1);
@moluapple
moluapple / gist:90f5c18bbb778af9ee8c
Created March 1, 2015 13:57
灰度PDF转黑白 via ImageMagick
convert input.pdf -threshold 50% new.pdf
@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 / 空园子.md
Last active December 17, 2015 15:59
《空园子》 杨键

##《空园子》 杨键

我是一座空园子,

我是一条空河流,

我是一座空山,

我是一个空了的妈妈,

@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 10, 2015 01:48
纸质书籍电子版制作一般流程

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

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

我们一般从步骤2开始。

@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 / 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/
"""