* subversion サーバ設定
リポジトリのディレクトリ以下の
hooks/pre-revprop-change.tmpl
の .tmpl を消して実行権限をつける
* ログ編集
TortoiseSVN でチェックアウトし、
Show Log でログ表示、右クリックして
* trac のログを更新
trac のプロジェクトのディレクトリに cd して、
trac-admin . resync <リビジョン番号>
とすれば更新完了
mzmttks's blog for my memorandum の略で mzrandum. Topics are: python, book review, and my hobbies.
2012年8月22日水曜日
2012年7月31日火曜日
サーバメモ Ubuntu 12.04
あとで清書予定。単語間違ってるかも
http://www.server-world.info/query?os=Ubuntu_12.04&p=mail&f=1
/etc/network/interfaces
iface eth0 inet static
address, network, netmask, broadcast
dns-nameservers, gateway はルータのIP
CTU設定 (フォワーディング、ファイアウォール)
ufw
sudo ufw allow ssh
http://www.server-world.info/query?os=Ubuntu_12.04&p=mail&f=1
/etc/network/interfaces
iface eth0 inet static
address, network, netmask, broadcast
dns-nameservers, gateway はルータのIP
CTU設定 (フォワーディング、ファイアウォール)
静的ポート変換、ファイアウォール、DHCPサーバ機能設定
ufw
sudo ufw allow ssh
sudo ufw allow http
sudo ufw enable
nginx
sudo apt-get install nginx-full
Putty
puttygen で鍵生成
.ssh/config
Host HOSTNAME
IdentityFile .ssh/public_key.pub
ssh-keygen -i -f .ssh/public_key.pub >> authorized_keys # puttygen で生成したファイルを変換
OpenSSH
apt-get install openssh-server openssh-client openssh-blacklist openssh-blacklist-extra
/etc/ssh/sshd_config で PasswordAuthentication no, UsePAM no
* ssh_config じゃないので注意
Squid
sudo apt-get install squid3
vi /etc/squid3/squid.conf
acl localnet src 192.168.24.0/24
http_access allow localnet
Fail2ban
apt-get install fail2ban
vi /etc/fail2ban/jail.local
[DEFAULT]
ignoreip = 192.168.24.0/24
maxretry = 3
findtime = 600
bantime = 600
backend = polling
[ssh]
enabled = true
[ssh-ddos]
enabled = true
Wordpress
apt-get install php5-fpm php5-mysql php5-cli mysql-server
* nginx
sites-available/default の location に追加。ほとんどデフォルトのままでおk
server {
listen 80;
root WWWPATH;
index index.htm index.html index.php; # index.php が無いとログインでこける
server_name DOMAIN;
location / {
try_files $uri $uri/ /index.html;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
* php5
* mysql
mysql -u root -p
apt-get 時に設定したパスワード入力
create database wp;
いろいろ設定かえたので、本来は該当するやつを
service SERVICENAME restart すればよいが、
とりあえず一回再起動(=全部 restart)するとうまくいく
* web I/F
あとは、 readme.html を読みながら設定
Postfix
apt-get まで
Dovecot
apt-get まで
Monit
apt-get install monit
SparkleShare
sudo apt-get install git
MediaServer
streemee?
Django
aa
nginx
sudo apt-get install nginx-full
Putty
puttygen で鍵生成
.ssh/config
Host HOSTNAME
IdentityFile .ssh/public_key.pub
ssh-keygen -i -f .ssh/public_key.pub >> authorized_keys # puttygen で生成したファイルを変換
OpenSSH
apt-get install openssh-server openssh-client openssh-blacklist openssh-blacklist-extra
/etc/ssh/sshd_config で PasswordAuthentication no, UsePAM no
* ssh_config じゃないので注意
Squid
sudo apt-get install squid3
vi /etc/squid3/squid.conf
acl localnet src 192.168.24.0/24
http_access allow localnet
Fail2ban
apt-get install fail2ban
vi /etc/fail2ban/jail.local
[DEFAULT]
ignoreip = 192.168.24.0/24
maxretry = 3
findtime = 600
bantime = 600
backend = polling
[ssh]
enabled = true
[ssh-ddos]
enabled = true
apt-get install php5-fpm php5-mysql php5-cli mysql-server
* nginx
sites-available/default の location に追加。ほとんどデフォルトのままでおk
server {
listen 80;
root WWWPATH;
index index.htm index.html index.php; # index.php が無いとログインでこける
server_name DOMAIN;
location / {
try_files $uri $uri/ /index.html;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
* php5
/etc/php5/fpm/pool.d/www.conf の
listen = 127.0.0.1:9000 をコメントアウトして
listen = /var/run/php5-fpm.sock を追加
そして、 sudo service php5-fpm restart
listen = 127.0.0.1:9000 をコメントアウトして
listen = /var/run/php5-fpm.sock を追加
そして、 sudo service php5-fpm restart
* mysql
mysql -u root -p
apt-get 時に設定したパスワード入力
create database wp;
いろいろ設定かえたので、本来は該当するやつを
service SERVICENAME restart すればよいが、
とりあえず一回再起動(=全部 restart)するとうまくいく
* web I/F
あとは、 readme.html を読みながら設定
Postfix
apt-get まで
Dovecot
apt-get まで
Monit
apt-get install monit
SparkleShare
sudo apt-get install git
MediaServer
streemee?
aa
ラベル:
tips
2012年7月9日月曜日
2012年6月14日木曜日
Python: Separate a list into subsequences using diff
リストを、隣り合う数の差がしきい値より大きい複数のリストに分割したい。
x = [1, 2, 3, 100, 101, 102, 103, 200, 201, 202, 203]
を
y = [[1, 2, 3], [100, 101, 102, 103], [200, 201, 202, 203]]
に変換したい。
import numpy
thresh = 60
x = [1, 2, 3, 100, 101, 102, 103, 104, 200, 201, 202, 203]
y = [numpy.array(x)[i+1:j+1].tolist()
for i, j
in zip(numpy.concatenate([
[-1,],
[-1,],
numpy.where(numpy.diff(x) > thresh)[0]
]),
]),
numpy.concatenate([
numpy.where(numpy.diff(x) > thresh)[0],
numpy.where(numpy.diff(x) > thresh)[0],
[len(x),]
])
)
]
])
)
]
ラベル:
python
2012年6月4日月曜日
複数行を1行にまとめるコマンド
paste を使えば、複数行をまとめられる。
# ls
dira
dirb
filea
の場合、
# ls | paste -s
dira dirb filea
と出力される。
# ls
dira
dirb
filea
の場合、
# ls | paste -s
dira dirb filea
と出力される。
ラベル:
tips
2012年2月18日土曜日
emac flyspell
emacs で M-x flyspell-mode とすると、スペルチェックをしてくれる。
apt-get install aspell-en
とかを入れとくとよい
また、
echo "lang en_US" > ~/.aspell.conf
をする必要がある。
Reference:
http://d.hatena.ne.jp/mooz/20091107/p1
apt-get install aspell-en
とかを入れとくとよい
また、
echo "lang en_US" > ~/.aspell.conf
をする必要がある。
Reference:
http://d.hatena.ne.jp/mooz/20091107/p1
ラベル:
tips
2012年2月15日水曜日
python で記憶つきの関数を作る
関数に静的変数を使いたいときは、 クラス + __call__ を使う。
オブジェクトを作っておけば、そのオブジェクトを呼び出したとき (= __call__呼び出し) に色々できる。
例えば、3の倍数が与えられたときだけカウントする関数 memory
class Memory:
def __init__(self):
self.count = 0
def __call__(self, i):
if i % 3 == 0:
self.count += 1
return self.count
if __name__ == "__main__":
memory = Memory()
for i in range(10):
print i, memory(i)
結果が以下。
左列がカウント, 右列が3で割った余りが0の数。
0 1
1 1
2 1
3 2
4 2
5 2
6 3
7 3
8 3
9 4
オブジェクトを作っておけば、そのオブジェクトを呼び出したとき (= __call__呼び出し) に色々できる。
例えば、3の倍数が与えられたときだけカウントする関数 memory
class Memory:
def __init__(self):
self.count = 0
def __call__(self, i):
if i % 3 == 0:
self.count += 1
return self.count
if __name__ == "__main__":
memory = Memory()
for i in range(10):
print i, memory(i)
結果が以下。
左列がカウント, 右列が3で割った余りが0の数。
0 1
1 1
2 1
3 2
4 2
5 2
6 3
7 3
8 3
9 4
ラベル:
python
登録:
投稿 (Atom)