跳至主要内容

博文

目前显示的是 二月, 2013的博文

save tiff image.

a backup of tiff transform. public function __construct($path,$minSize,$minWidth,$minHeight){ $this->path=$path; $this->minSize=$minSize; $this->minWidth=$minWidth; $this->minHeight=$minHeight; } public function setImage(SmallAdds $ad){ $this->today=date('Y-m-d'); $this->fullImagePath=$this->path.$ad->getSitePath().$this->today."/"; if (!is_dir($this->fullImagePath)){ if (!mkdir($this->fullImagePath,0775, true)) throw new \Exception('can not create folder'); } $this->ad=$ad; $this->name=uniqid(); } public function createPhoto(){ try{ $this->photo=new Photo(); $this->photo->setSmallAdds($this->ad); $imagePath = $this->fullImagePath; $pngName=$imagePath.$this->name.".png"; $tifName=$imagePath.$this-&

mysql regex 来查找 替换 内容

我的例子: UPDATE `t_photos` SET nom_photo= CASE WHEN nom_photo REGEXP '[^_]*.png' THEN CONCAT('old/', REPLACE(nom_photo, '.png','.tif')) END WHERE nom_photo REGEXP '[^_]*.png' 替换前的内容是: 508e652bf1781.png 替换后的内容是: old/508e652bf1781.tif

查看服务器连接状态

 netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' 查看 某个端口 netstat -n|grep -i time_wait|grep 127.0.0.1:9000|wc -l 查看mysql的连接数 netstat -n|grep -i time_wait|grep 3306|wc -l  

convert png to piled tif (all files in a folder)

for file in /data/admin/web/data/vivastreet/image/50b7814*; do newname=`basename "$file" png`tif; convert $file -define tiff:tile-geometry=256x256 -compress jpeg "ptif:/mnt/data/vivastreet/$newname"; done well, this will rename the *.png to *.tif and convert them . further more, if you wann only list 100 file in a folder: ls | head -n 100 if you wanna to remove them: ls | head -n 100 | xargs rm

how to set up a squid for apache.

I find a good tutorial and this may be useful lately. http://www.howtoforge.com/how-to-set-up-a-caching-reverse-proxy-with-squid-2.6-on-debian-etch the important is do not cache the login user page, but only cache the anonimouse users page. This is alos ok for spoop.fr.

install a web based linux admin interface webmin

this article is a memo for the installation of webmin and his plugin, vitual sever. ubuntu 12.04 lts is really simple, just download his deb distribution by : cd /tmp wget http://prdownloads.sourceforge.net/webadmin/webmin_1.620_all.deb dpkg --install webmin_1.620_all.deb if have some package problem, just do: apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python for sure. you can read this ; http://www.webmin.com/deb.html then vitual min: cd /tmp wget http://software.virtualmin.com/gpl/scripts/install.sh chmod 775 install.sh ./install.sh and then yes ,yes,yes. 最后有个问题: /etc/apache2/apache2.conf 里面没有包含 NameVirtualHost *:80 但是没有它我原来的vhost在ubuntu 从12.04升级到12.10以后就都不行了, 还有就是必须先stop webmin, 重新启动apache2, 然后再启动webmin,所有的vhost都ok了。

怎样更改ovh reverse du serveur dédié

主要根据这篇文章, https://admin-serv.net/blog/141/changer-le-reverse-de-son-dedie/ 更改 reverse name: grep -rin ns2301914 ./* 输出: grep: ./blkid.tab: No such file or directory ./hostname:1:ns2301914.ovh.net ./hosts:4:5.135.137.158         ns2301914.ovh.net       ns2301914 ./hosts:5:2001:41D0:8:CA9e::1   ns2301914.ovh.net       ns2301914 ./issue:2:Linux ns2301914.ovh.net 3.2.13-grsec-xxxx-grs-ipv6-64 #1 SMP Thu Mar 29 09:48:59 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux ./issue:6:hostname  : ns2301914.ovh.net ./mailname:1:ns2301914.ovh.net ./motd:7:hostname  : ns2301914.ovh.net 更改所有的这些文件,把ns2301914.ovh.net 改成 spoop.ovh.net hostname spoop.ovh.net rndc flush /etc/init.d/bind9 restart 有一点需要注意: Vous devez tout d'abord avoir un champ A pointant vers l'adresse IP du dédié en question. Si vous en avez la possibilité chez votre hébergeur, créé aussi une  Glue   (chez Gandi, "Glue Records", chez OVH "GLUE Registry" etc...) . Une fois le champ A créé, at

安装新server

apt-get install mysql-server mysql-client apt-get install apache2-mpm-worker apt-get install libapache2-mod-fastcgi php5-fpm php5 a2enmod actions fastcgi alias ===if this file  do not exist, create it. ==== vi /etc/apache2/conf.d/php5-fpm.conf copy :                         AddHandler php5-fcgi .php                 Action php5-fcgi /php5-fcgi                 Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi                 FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization         in it. cd /tmp wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.0.0-alpha2/phpMyAdmin-4.0.0-alpha2-all-languages.tar.gz/download#  tar xvf download rm download mv phpMyAdmin-4.0.0-alpha2-all-languages/ /var/www/phpmyadmin apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqli

在ovh 上装 nfs server

ovh自己的kernal build 和nfs 不兼容,有人如此说; Donc en fait c'est un problème sur Ubuntu (et peut être d'autres) entre le script de démarrage du serveur NFS et le kernel OVH. Il faut donc faire une modif du script de démarrage : Code: nano +67 /etc/init.d/nfs-kernel-server Commenter cette ligne: Code: if [ -f /proc/kallsyms ] && ! grep -qE ' nfsd_serv ' /proc/kallsyms; then Et la remplacer par: Code: if [ -f /proc/kallsyms ] && ! grep -qE 'init_nf(sd| )' /proc/kallsyms; then Après faire un Code: /etc/init.d/nfs-kernel-server/start 还有就是重装kernal: 详见: http://limeskystudios.com/articles/mise-en-place-dun-serveur-nfs-ubuntu 安装nfs server 请见: https://help.ubuntu.com/community/SettingUpNFSHowTo

install backup pc ubuntu

sudo apt-get install backuppc =>save the user name and password. then you set up the config by cgi: http://backup-server/backuppc/ if your appache is started correctly. if backup linux, we use rsync for ssh tunnel. We need to setup a ssh tunnel to establish the connection. So it's a common exchange public key process. see this; http://backuppc.sourceforge.net/faq/ssh.html also, backup pc suggest to use mod_perl for apache. Which will greatly increase the execution speed.

move in vim

e Move to the end of a word. w Move forward to the beginning of a word. 3w Move forward three words. b Move backward to the beginning of a word. 3b Move backward three words. $ Move to the end of the line. 0 Move to the beginning of the line.  ^ Move to the first non-blank character of the line. ) Jump forward one sentence.  ( Jump backward one sentence. } Jump forward one paragraph. { Jump backward one paragraph. H Jump to the top of the screen. M Jump to the middle of the screen. L Jump to the bottom of the screen. 10 or 10 Move 10 pages up.  5 or 5 Move 5 pages down.  G Jump to end of file.  1G Jump to beginning of file (same as gg).  50G Jump to line 50.  'm Jump to the beginning of the line of mark m.  `m Jump to the cursor position of mark m.  '' Return to the line where the cursor was before the latest jump.  (Two single quotes.) `` Return to the cursor position before the latest jump  (undo the jump).  (Two back ticks