plowprobe


plowdown 取消了 -c 選項,不過多了 plowprobe。

plowprobe可以輸出的格式比 plowdown -c 多了很多


printf選項比較重要的的參數
--------------------------------------------------------
* %c probe function return status (0 for success, 13 for dead link, see list below)
* %f filename (can be empty string)
* %s filesize in bytes (can be empty string if not available). Note: it's often approxi‐mative.


Return Code
--------------------------------------------------------
0 Success.
1 Fatal error. Upstream site updated or unexpected result.
2 No available module (provided URL is not supported).
3 Network error. Mostly curl related.
4 Authentication failed (bad login/password).
5 Timeout reached (refer to -t/--timeout command-line option).
6 Maximum tries reached (refer to -r/--max-retries command-line option).
7 Captcha generic error.
8 System generic error.
10 Link alive but temporarily unavailable.
11 Link alive but requires a password.
12 Link alive but requires some authentication (private or premium link).
13 Link is dead.
14 Can't download link because file is too big (need permissions).
15 Unknown command line parameter or incompatible options.


Return code 跟plowdown一樣。 裡面比較重要的是0跟13, 0=> Ok, 13=> dead link。

如何用圖片的md5去反查Gelbooru的相關資訊?


Gelbooru的預設檔名是: 'md5.ext'

這樣的檔名沒有包含多少有用的資訊。 如何用md5去反查像: id, tags 之類的資訊?

URL = 'http://gelbooru.com/index.php?page=dapi&s=post&q=index&tags=md5%3a{0}'

其中{0}可以是:

md5
md5*(下載回來的檔名)

詳細參照: http://gelbooru.com/index.php?page=help&topic=cheatsheet


=============================================================
另外,yande.re也支援類似的查詢。

URL = 'https://yande.re/post.json?{0}'

參數:
------------------------------------------------------------
    * limit=100  # result per request, maximum is 100
    * page=1     # index started at 1
    * tags=''    # result filter by tags


其中,tags=id:{post_id}

簡易的 flvxz.com 解析工具


將 .gjots 轉換成 .epub 的小工具

不支援 gjots的folder功能

pandoc 1.9.1.1 不支援subchapter,需要subchapter則需要修改toc.ncx檔案

A simple g.e-hentai downloader

#!/usr/bin/env python
#-*- coding:utf-8 -*-

import os
import urllib2
import sys
from BeautifulSoup import BeautifulSoup

try:
    url = sys.argv[1]
except IndexError:
    print "geh - A simeple g.e-hentai downloader\nUsage: geh.py [url]"
        

def find_next_page_link(tag):
    try:
        if tag.name == 'a' and tag.text == '>': return True
        return False
    except TypeError:
        return False 
               

def find_image(html):
    soup = BeautifulSoup(html)
    return soup.find('img', {'id': 'img'})['src']
    

def parse_index(url):    
    html = urllib2.urlopen(url).read()
    soup = BeautifulSoup(html)

    title = soup.h1.text
    next_page_url = soup.find(find_next_page_link)
    image_list = [node['href'] for node in soup.find('div', {'id': 'gdt'}).findAll('a')]

    return title, next_page_url, image_list

c = 1
while True:    
    title, next_page_url, image_list = parse_index(url)

    dst_dir = title
    if not os.path.exists(dst_dir):
        os.mkdir(dst_dir)
    
    for page in image_list:        
        html = urllib2.urlopen(page).read()
        image_url = find_image(html)

        fn = '{0}.{1}'.format(str(c).zfill(3), image_url.split('.')[-1])
        fn = os.path.join(dst_dir, fn)
        
        print '{0}: {1} ... '.format(dst_dir, str(c).zfill(3)),
        with file(fn, 'wb') as f:
            image_data = urllib2.urlopen(image_url).read()
            f.write(image_data)
        print 'done'            
        c += 1

    if not next_page_url:
        break
    
    url = next_page_url['href']

Query xxsy book status

#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import urllib2
import json

Info_URL = 'http://www.xxsy.net//ajax/pAjax.aspx?method=binfo&bookid={0}'

book_url = sys.argv[1]
book_id = book_url.split('/')[-1].replace('.html', '')

data = urllib2.urlopen(Info_URL.format(book_id)).read()
data = json.loads(data)

print 'Book:', data['BookName'], '/', data['AuthorName']
print 'Updated at:', data['Lastupdatetime']
print 'Free:', data['Lastzjname']
print 'VIP:', data['Lastvipzjname']

keepassx 2

keepassx現在有PPA可以用了。
 
sudo apt-add-repository ppa:keepassx/daily   
sudo apt-get update
sudo apt-get install keepassx

keepassx 自動開啟資料庫


使用master password開啟(折騰版XD)


 * install gnome-keyring-query to get password from gnome-keyring
 
     * sudo apt-add-repository ppa:wiktel/ppa
     * sudo apt-get update
     * sudo apt-get install gnome-keyring-query

 * start gnome-keyring-daemon
          
     gnome-keyring-daemon --start --components=gpg,pkcs11,secrets,ssh
              
 * settings              
    
     1. start seahorse and add a new keyring
     2. add a new key using gnome-keyring-query [set] [keyname] # 不知道為什麼只能用gnome-keyring-query設定的key才能正常動作?!
                              
 * command
          
     keepassx --password $(gnome-keyring-query get {keepassx master password}){your database}

使用keyfile開啟

* chmod database and keyfile with permission 600
           
* command

    keepassx --keyfile {your_keyfile} {your_database}

Txt to epub


requirement:
  • pandoc 1.6+

testbook content

% book title
% author
簡介


# Chapter One(章節標題的上下最好有兩行空行,這樣pandoc判讀上比較不會有問題)


Chapter one is over.


# Chapter Two


Chapter two has just begun.

 

 command

pandoc input_file -o output_file
 
 
參考: