2010-11-01から1ヶ月間の記事一覧

ERROR ArgumentError: negative length -42 given

ruby-serialportをwindowsで使う

http://rubyforge.org/tracker/download.php/61/321/9924/1800/ruby-serialport-0.6.0-mswin32-gem.zip にパッチ適応済みのruby-serialport 0.6.0がある 0.7はlinux/macで使い方がよくわからなかったので俺は0.6を使ってる。特に問題ないし。windowsでも0.6…

なぜかアニメアイコンの記事が一覧に出てこない

twitterのプロフィール画像にできるアニメgifアイコン

48x48で33枚 → ok!! 48x48で100枚 → だめ 49x49で20枚 → だめ uploadすると、まずアイコンアップロード画面で画像がぐるぐるのローディングになる。 次にtwitter.com/homeに行くと右上にアニメアイコンがでるようになる。これもグルグルしてるのでしばらく待…

h264エンコードできるffmpegインストール

macで sudo port install ffmpeg +gpl +lame +x264 +xvid +faac +liogg +vorbis +theora でchrome, safariのhtml5 video tagで再生できる動画をx264+faacで作る ffmpeg -i input.mov -s 320x240 -acodec libfaac -ac 2 -vcodec libx264 -vpre default -sameq…

google日本語入力(mozc)インストール

https://forums.ubuntulinux.jp/viewtopic.php?pid=61840 なぜかpostfixまで入れられるので、あとで消す。すぐ消すとdebhelperまで消えた・・ sudo apt-get install g++ python libibus-dev libcurl4-openssl-dev libssl-dev zlib1g-dev libdbus-1-dev libgl…

ホームディレクトリのフォルダ名を英語にする

http://d.hatena.ne.jp/Artisan/20080522/1211403939デスクトップ、とかがDesktopになる LANG=C xdg-user-dirs-gtk-update

appleマウスのボタンに機能を割り当てる

https://wiki.ubuntulinux.jp/UbuntuTips/Hardware/ExtensionOfMouseButtonWithXbindkeysAndXvkbd xev中央:2、横8だった ちなみに左クリックが1で右クリックが3。 cat /proc/bus/input/devices | grep "^N:"N: Name="Macintosh mouse button emulation" N: …

Ubuntu10.04のchromeにFlashPlayerをインストール

参考 http://maketecheasier.com/enable-flash-support-in-google-chrome-in-ubuntu/2009/08/19 http://labs.adobe.com/downloads/flashplayer10.html から64bitのflashplayerをダウンロードしてくる wget http://download.macromedia.com/pub/labs/flashpla…

キーボードでのカーソル移動をemacs風にする

terminal内ならctrl+a,e,f,b,n,pでカーソル移動できるけど、chromeやfirefoxの中でできないのでできるようにしたterminalで gconf-editor/desktop/gnome/interface/gtk_key_theme を Emacs に変更 頭は大文字で。 これで一旦ログアウトか再起動すればctrl+a,…

rvmで入れたrubyでopensslが無いエラー

oauthとか使うとエラー "no such file to load -- openssl" 解決した sudo apt-get install libssl-dev~/.rvm/src/ruby-1.8.7-p302/ext/openssl ruby extconf.rb make make install どうやらaptで必要なパッケージを入れる前にrvmでrubyを作るとこうなるらし…

rvmにreadlineを入れて再インストール

ubuntu10.04にrvmで入れたruby1.8.7, 1.9.2でirbを使ったら Readline was unable to be required, if you need completion or history install readline then reinstall the ruby. You may follow 'rvm notes' for dependencies and/or read the docs page h…

Fnキー+F1〜F12キーの挙動を変更

http://dancingpenguinsoflight.com/2009/01/fixing-the-function-keys-on-the-apple-keyboard-in-ubuntu/Ubuntu10.10でappleキーボードを使っているんだけどF7でカタカナに確定したい時とかにFnキーを同時押ししないとならんのが面倒だった。 /etc/rc.local…

exiftoolで動画のサイズや回転を取得

exiftoolを入れる sudo port install p5-image-exiftoolgem install mini_exiftool#!/usr/bin/env ruby require 'rubygems' require 'mini_exiftool' exif = MiniExiftool.new ARGV.first w = exif['ImageWidth'] h = exif['ImageHeight'] rot = exif['Rotat…

httpsでsinatraアプリを動かす

http://blog.browncat.org/2008/08/ubuntu_804httpsredmine.html http://docs.komagata.org/4016 sudo a2enmod ssl オレオレ証明書を作る 適当に質問に答える openssl req -new -nodes -keyout server.key -out server.csr openssl x509 -in server.csr -out…

CDトレイを開閉

ruby -e 'IO.open(IO.sysopen("/dev/cdrom",File::NONBLOCK)){|io|io.ioctl(0x5309)}'ruby -e 'IO.open(IO.sysopen("/dev/cdrom",File::NONBLOCK)){|io|io.ioctl(0x5319)}'参考 http://d.hatena.ne.jp/n9d/20090122/1232592242

passenger3.0インストール

sudo apt-get install apache2-prefork-dev sudo gem install passenger sudo passenger-install-apache2-module /etc/apache2/httpd.conf に追記 LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/mod_passenger.so P…

wake on lanでマシンを遠隔起動

参考:Ubuntu8.04 on ML115をWake on LANで遠隔起動する - sous le grand arbre 起動するのもされるのもUbuntuで。起動される方はubuntu10.04のデスクトップマシンで、開発用なのだが電源入れないで家を出て、でも起動しないと開発できない・・という事があ…

git pushできない

pushするとこんなエラーが出る error: refusing to update checked out branch: refs/heads/master error: By default, updating the current branch in a non-bare repository error: is denied, because it will make the index and work tree inconsisten…

RSコンポーネンツの商品のpermalink

URL長いので短くする javascript:location.href="http://jp.rs-online.com/web/"+location.href.split("R=")[1]+".html"

mongoid対応しているsinatra-authentication

git clone http://github.com/timmyc/sinatra-authentication cd sinatra-authentication rake build gem install pkg/sinatra-authentication-0.3.2.gemmongoid 2 betaだと動かないっぽい・・

URLエンコード

ruby-1.8.7-p302 > ERB::Util.url_encode 'http://ああああ' => "http%3A%2F%2F%E3%81%82%E3%81%82%E3%81%82%E3%81%82" ruby-1.8.7-p302 > CGI.escape 'http://ああああ' => "http%3A%2F%2F%E3%81%82%E3%81%82%E3%81%82%E3%81%82" ruby-1.8.7-p302 > URI.enc…