ビールではなく、いいちこで飲みたいが、どのいいちこが合うのだろうか?
「いいちこ20度」
「いいちこ25度」
選択肢は2つしかない、選びようがあまり無いような感じがします。
@ando_ando_ando先生、どうかほっといてください。
karky7 ~ # emerge -pv media-gfx/wkhtmltopdfこれでコマンドとライブラリがはいります
karky7 ~ # wkhtmltopdf https://www.google.co.jp/ /tmp/google.pdf Loading page (1/2) Printing pages (2/2) Done karky7 ~ #ローカルのhtmlファイルもPDF化できる、画像が外部ですとしっかり表示できませんでした。
karky7 ~ # wkhtmltopdf gentoo.html /tmp/gentoo.pdf Loading page (1/2) Printing pages (2/2) Done karky7 ~ #これは便利、その他にもgrayscaleや色々オプションがありますので試してください
karky7 ~ # wkhtmltoimage http://news.livedoor.com/article/detail/7052329/ /tmp/kyaba.png Loading page (1/2) Rendering (2/2) Done karky7 ~ #こんな感じです
karky7 ~ # layman -a karky7 karky7 ~ # emerge dev-python/py-wkhtmltox使い方、公開されているリポジトリをcloneすればサンプルが入っていますのでそれを実行してください、画像が取得できるはずです。
import wkhtmltox
img = wkhtmltox.Image()
img.set_global_setting('out', 'test.jpg')
img.set_global_setting('in', 'http://www.google.com')
img.convert()
karky7 ~ # layman -a karky7 karky7 ~ # emerge dev-php/php-wkhtmltox使い方はほぼ一緒
<?php
wkhtmltox_convert('image',
array('out' => '/tmp/test.jpg',
'in' => 'http://www.google.com/')
); // global settings
?>
LWLな言語から使えるとお手軽に実装が出きると思います、gdとかimagemagickでいじればwebサイトのモールとかリスト表示にサムネイルとか表示できて、かっこいいかも。karky7 ~ # emerge -pv x11-misc/nixnote These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild N ] dev-java/icedtea-bin-6.1.12.6:6 USE="X alsa doc -cjk -cups -examples -nsplugin -source" 0 kB [ebuild N ] virtual/jdk-1.6.0-r2:1.6 0 kB [ebuild N ~] x11-misc/nixnote-1.6::karky7 0 kB Total: 3 packages (3 new), Size of downloads: 0 kB * IMPORTANT: 1 news items need reading for repository 'hacking-gentoo'. * IMPORTANT: 16 news items need reading for repository 'gentoo'. * Use eselect news to read news items. karky7 ~ #
<?php
/* keyは32文字 256bit */
$key = '12345678901234567890123456789012';
/* python側へ0x00の制御文字が入る*/
$text = '私は妻に内緒で昨日キャバクラに行ってしまいました';
$encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $text, MCRYPT_MODE_ECB);
$encstr = base64_encode($encrypted);
print($encstr);
print("\n");
?>
実行してみる
cuomo@karky7 ~/Code/lwl/php/aes $ php aes3.php hiPI4JYACRvv16+WVuJf0BcooUjHFJ7kkLFg+ZYxW0wxFBmeGL3CmPpJM++/VKFs/tVeiC2ZDb+2i77Yke6pg4xNgBrD6sKDcRc4JDAWzY4= cuomo@karky7 ~/Code/lwl/php/aes $
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Crypto.Cipher import AES
import base64
'''鍵 16、32で指定しなければならない'''
key = '12345678901234567890123456789012'
'''暗号化情報'''
cipher = AES.new(key)
'''秘密の文字'''
enc_message = 'hiPI4JYACRvv16+WVuJf0BcooUjHFJ7kkLFg+ZYxW0wxFBmeGL3CmPpJM++/VKFs/tVeiC2ZDb+2i77Yke6pg4xNgBrD6sKDcRc4JDAWzY4='
data = base64.b64decode(enc_message)
''' 復号化'''
message = cipher.decrypt(data)
message = unicode(message, 'utf-8')
''' \x00の削除 '''
message = message.rstrip(unichr(0))
print("元メッセージ: " + message.encode('utf-8'))
実行してみる
cuomo@karky7 ~/Code/lwl/Python/aes $ python aes2.py 元メッセージ: 私は妻に内緒で昨日キャバクラに行ってしまいました