vik-braindump.blogspot.com
脳みそダンプ: 急に都内に泊まってみた
http://vik-braindump.blogspot.com/2009/08/blog-post.html
Udon @ Tsurutontan Roppongi. Originally uploaded by vik 122. 仕事中に急に奥様から「ホテルオークラに泊まろう」と連絡があったので」六本木で合流した。 いつも混んでいて入るのを躊躇していたおうどんのお店、「つるとんたん六本木店」に30分待ちでいってみた。 このページは色々な開発言語を使う管理人が何かを作るときのためのblogです。主にPython (pylons, turbogears, wsgi, zope) とRuby on Railsの事を書いています. Japan vik dot net (管理人メインページ). Viks Linux Tips - Linuxの小技.
vikslinuxtips.blogspot.com
Vik's Linux Tips: 複数のpostscriptファイル(PDFも可)を一枚にまとめる方法
http://vikslinuxtips.blogspot.com/2007/08/pspdf.html
Web上でたまにダウンロード可能な書籍を発見することがある。大抵はちょっと古目の本だったりするんだけど、公開している著者に感謝しつつも、「なんで章ごとに別ファイル? そこで、複数のps(ポストスクリプト)ファイルをひとつにまとめあげる方法。下の例ではchap1.ps と chap2.ps を out.ps として結合して吐き出す。 Gs -dBATCH -dNOPAUSE -q -sDEVICE=pswrite -sPAPERSIZE=a4 -dNOPLATFONTS -sOutputFile=out.ps chap1.ps chap2.ps. Chap2以下を延々連ねれば、いくらでも連結できる。Ghostscriptつえー。 ちなみに -sDEVICE=pdfwriteでやるとPDFファイルに出力できる。つえー。 IT屋さん(主にインターネットもしくはインフラ)をしている偽外人もしくは偽日本人という謎の人です。Linux歴は意外と長く、サーバーもデスクトップもLinuxメインで使っています。 Windows7? なにそれ? おいしいの? 脳みそダンプ - web開発のblog -.
vikslinuxtips.blogspot.com
Vik's Linux Tips: [Linux Shell] bashとsedを使ってファイルの拡張子を一括置換する
http://vikslinuxtips.blogspot.com/2008/06/linux-shell-bashsed.html
Hogehtmとかimage.JPGとかをhoge.htmlやimage.jpgなどと、拡張子だけを一括変更する方法。 例:*.htmを*.htmlに置換する. For f in *.htm; do mv $f `echo $f sed -e "s/htm/html/g"`; done. なのだが、いつもこんな長いコマンドを打ち込むのはめんどうなので、スクリプトにまとめておくと便利。 Mv $1 `echo $1 sed -e "s/$2/$3/g"`. これをパスの通った場所に適当な名前を保存しておく。今回はmv しながらsedをするので、mvsedという名前を付けてみた。 Mvsed ファイル名 現在の拡張子 置換後の拡張子. 本当は拡張子だけでなく、ファイル名全体の置換につかえるのだが、今回の趣旨の都合上、拡張子ということにしておいてください ;. Mvsed hoge.htm htm html. Hogehtm を hoge.htmlに変更. For f in *.htm; do mvsed $f htm html;done. なにそれ? おいしいの? 脳みそダンプ - web開発のblog -.
vikslinuxtips.blogspot.com
Vik's Linux Tips: bashとsedで複数ファイルのテキストを置換する方法
http://vikslinuxtips.blogspot.com/2007/08/bashsed.html
Find -name "*.html" -exec sed -i 's/元テキスト/置換後テキスト/' {} ;. Find -name "*.html" -exec. Sed -i 's/元テキスト/置換後テキスト/' {} ;. ちなみに {} はfindの結果で得た(この場合はhtmlファイルのファイル名)が入るようになっている。 IT屋さん(主にインターネットもしくはインフラ)をしている偽外人もしくは偽日本人という謎の人です。Linux歴は意外と長く、サーバーもデスクトップもLinuxメインで使っています。 Windows7? なにそれ? おいしいの? 脳みそダンプ - web開発のblog -. Picture Window テンプレート. Powered by Blogger.
vikslinuxtips.blogspot.com
Vik's Linux Tips: 7月 2008
http://vikslinuxtips.blogspot.com/2008_07_01_archive.html
そのままでは動かなかったので、最近のPython Twitterに合わせて、ちょっぴり機能を追加したので、公開してみます。 From email.Header import Header, decode header. Import twitter, sys, email. Uid = "TWITTER ID". Pw = "TWITTER PASSWORD". From addr = "KEITAI EMAIL ADDRESS" #email account to receive from. For line in sys.stdin:. Data = data line. Mail = email.message from string(data). Check for correct from address. Sysexit(0) # Wrong email - ignore. For part in mail.walk():. Type = part.get content maintype(). If type and type.find("text")! 無いよ、と怒られてし...
vikslinuxtips.blogspot.com
Vik's Linux Tips: [python]携帯メールからTwitterを更新する
http://vikslinuxtips.blogspot.com/2008/07/pythontwitter.html
そのままでは動かなかったので、最近のPython Twitterに合わせて、ちょっぴり機能を追加したので、公開してみます。 From email.Header import Header, decode header. Import twitter, sys, email. Uid = "TWITTER ID". Pw = "TWITTER PASSWORD". From addr = "KEITAI EMAIL ADDRESS" #email account to receive from. For line in sys.stdin:. Data = data line. Mail = email.message from string(data). Check for correct from address. Sysexit(0) # Wrong email - ignore. For part in mail.walk():. Type = part.get content maintype(). If type and type.find("text")!
vik-braindump.blogspot.com
脳みそダンプ: [Rails] Accessing :object_name :method passed from the view in your custom helpers
http://vik-braindump.blogspot.com/2007/05/rails-accessing-objectname-method.html
Rails] Accessing :object name :method passed from the view in your custom helpers. While making a wrapper helper to extend the functionality of the stock date select, I needed to access the actual date object attributes within the helper method. The api of the date select helper is like this:. Date select(object name, method, options = {}). Where object name is is the object in the template, and method is the method of that object which returns a date for the select boxes to show. Here is how I did it:.
vikslinuxtips.blogspot.com
Vik's Linux Tips: 8月 2007
http://vikslinuxtips.blogspot.com/2007_08_01_archive.html
Find -name "*.html" -exec sed -i 's/元テキスト/置換後テキスト/' {} ;. Find -name "*.html" -exec. Sed -i 's/元テキスト/置換後テキスト/' {} ;. ちなみに {} はfindの結果で得た(この場合はhtmlファイルのファイル名)が入るようになっている。 例えば images ディレクトリの画像を全て 500x375にリサイズしたかったら:. Print int ( 20070823 - 19850101)/10000). Tar zcvf - [バックアップするディレクトリ(例:/home)] ssh [バックアップ先のサーバー] "cat [ファイル名(例:home.tgz)]. Ssh [バックアップするディレクトリのサーバー] "tar zcvf - [バックアップするディレクトリ(例:/home)]" cat [ファイル名(例:home.tgz)]. まず、psutilsがまともにa4に変換してくれないっぽかったので、gsで各ページをa4に変換する。 Psbook a4.ps book.ps. そこでz...
vik-braindump.blogspot.com
脳みそダンプ: A Python port of the Agile RSS Aggregator in Ruby
http://vik-braindump.blogspot.com/2007/08/python-port-of-agile-rss-aggregator-in.html
A Python port of the Agile RSS Aggregator in Ruby. I came across an Agile RSS Aggregator in Ruby. Which had very elegant code, so I decided to port it to Python. It uses wsgi, the Universal Feed Parser. And the Mako Template. Here is the code:. From wsgiref.simple server import make server. From mako.template import Template. A Python port of the "Agile RSS Aggregator in Ruby". See README for details. Def init (self, environ, start response):. Selfstart = start response. Status = "200 OK". One caveat is ...
SOCIAL ENGAGEMENT