Skip to content

Instantly share code, notes, and snippets.

@moluapple
moluapple / GBKDecode.jsx
Last active Sep 18, 2017
GBK 乱码 fix
View GBKDecode.jsx
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 Oct 15, 2018
[Illustrator] 寻找不规则形状中心点(find visual center of an irregularly shaped polygon with Illustrator)
View find visual center.jsx
(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 Dec 12, 2015
置入多页面PDF (Illustrator CC 2015)
View Import Multi-Page PDF.jsx
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 Mar 1, 2015
灰度PDF转黑白 via ImageMagick
View gist:90f5c18bbb778af9ee8c
convert input.pdf -threshold 50% new.pdf
@moluapple
moluapple / gist:5690732
Last active Dec 17, 2015
Powershell 命令收集
View gist:5690732
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 Dec 17, 2015
《空园子》 杨键
View 空园子.md

##《空园子》 杨键

我是一座空园子,

我是一条空河流,

我是一座空山,

我是一个空了的妈妈,

@moluapple
moluapple / keepWindowBounds.js
Last active Dec 15, 2015
[Indesign] Reset the window bounds to the same as last time (CS6)
View keepWindowBounds.js
#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 Dec 10, 2015
纸质书籍电子版制作一般流程
View 纸质书籍电子版制作一般流程.md

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

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

我们一般从步骤2开始。

@moluapple
moluapple / Description
Created Oct 23, 2012 — forked from linktoming/Description
Batch Delete Amazon Kindle Library Items
View Description
Credit and Usage: http://www.mobileread.com/forums/showthread.php?t=162972
@moluapple
moluapple / cchere_posts_downloader.py
Created Aug 26, 2012
[python2]cchere user posts downloader
View cchere_posts_downloader.py
#!/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/
"""