2013年7月29日月曜日

Linuxでパッケージのアーキティクチャにamd64を追加する

# dpkg --add-architecture amd64

2013年7月28日日曜日

rubyを駆使して敵を倒していくゲーム

Ruby Warrior
https://www.bloc.io/ruby-warrior/

2013年7月26日金曜日

2013年7月18日木曜日

Debian Wheezyではffmpegじゃなくてlibav-toolsを使おう

コマンドはavconvらしい

avconv -i 002.flv -strict experimental 002.mp4

http://wiki.debian.org/NewInWheezy

2013年7月14日日曜日

LinuxでXのキーボードレイアウトの変更

ユーザーでこんな感じのコマンドを打つらしい
setxkbmap -layout jp 

dpkg-reconfigure keyboard-configuration

参考リンク
http://margaret-sdpara.blogspot.jp/2012/12/debian-usb-live-lxde.html

KVMとvirt-manager仮想マシン管理

kvmのインストール
 aptitude install qemu-kvm libvirt-bin virt-manager
libvirtグループへ参加
 usermod -a -G libvirt hogeuser
ネットワーク設定
auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
bridge_ports eth0
bridge_stp off


参考リンク
http://wiki.debian.org/KVM
http://wiki.debian.org/QEMU#QEMU_networking_with_VDE
http://misc.e-hdk.com/benkyokai/2012-kernel-vm-advent-calendar-21st

2013年7月13日土曜日

squid3でviaヘッダを任意の値に変更する

こんな感じに書けばいいらしい

request_header_access VIA deny all
request_header_replace VIA 1.1 Squid3


http://green-rabbit.sakura.ne.jp/blog/2010/04/28/1320/

2013年6月14日金曜日

sshで接続時にオプションを付与する


こんな感じかな

それぞれ鍵認証無効化、ホスト鍵チェックの無効化
ssh -o "PubkeyAuthentication no" hogehost
ssh -o "StrictHostKeyChecking no" hogehost

2013年6月12日水曜日

sshを使ったchroot環境の構築


参考リンク
http://team2ch.org/blog/?p=1362

mysqlのレプリケーション同期設定

マスター側で以下のコマンドを打つ
mysql> FLUSH LOGS;
$ mysqldump --order-by-primary --single-transaction --master-data -uroot -p'passwd' databasename > databasename.dump
mysql> show master status;

スレーブ側でこんな感じに吸い上げる
mysql> stop slave;
mysql -uroot -p'passwd' databasename < databasename.dump
mysql> start slave;
mysql> show slave status;


参考リンク
http://blog.nomadscafe.jp/2011/12/-mysql40dump-mysqldump-wrapper.html

2013年6月2日日曜日

2013年5月16日木曜日

2013年5月12日日曜日

X11で縦表示とか画面の回転設定


xranderで設定した

/etc/kde4/kdm/Xsetupに以下を追記
xrandr --output HDMI-1 --rotate left --primary
参考リンク
UbuntuTips/Hardware/HowToChangeMonitorResolution

2013年5月4日土曜日

postfixで複合条件アクション

こんな感じでスパムメールを拒否してみた

目標は:特定のIPかつ(123.123.123.123)、特定のアドレス(reject@)を拒否する

まず、check_client_accessをつくる
smtpd_restriction_classesで制限クラスをつくって
client_accessで定義した制限クラスに飛ばす


/etc/postfix/main.cf
smtpd_recipient_restrictions = permit_mynetworks ,
    check_client_access hash:/etc/postfix/client_access ,
    permit_sasl_authenticated ,
    reject_unauth_destination
smtpd_restriction_classes = spam_restriction
spam_restriction = check_recipient_access hash:/etc/postfix/rejectaddress

/etc/postfix/client_access
123.123.123.123 spam_restriction

/etc/postfix/rejectaddress
reject@ REJECT

参考リンク
Postfix で特定の IP アドレスを拒否する設定
[postfix-jp: 115] Re: 複合条件での送信制限は可能でしょうか?

2013年4月29日月曜日

ruby mechanizeで画像スクレイピングしてみる

画像収集スクリプト書いた
hogeimgダウンロード => id=nextなオブジェクトクリック => 以下くりかえし

リトライ回数と繰り返し回数は適宜修正すること