1. Xóa toàn bộ các file .svn
find . -name .svn -print0 | xargs -0 rm -rf
2. Xử lý với các file và thư mục trong thư mục hiện hành.
Ví dụ: chmod riêng folder hoặc file
find . -type d -print0 |xargs -0 chmod 755
find . -type f -print0 |xargs -0 chmod 644
hoặc
find . -type d | xargs chmod 644
3. Forward port thông qua ssh
sudo ssh -L 3308:IPserver:3306 user@IPserver
4. Grep: get 10 lines After , get 10 lines Before
cat file.txt | grep -A10 "test" | wc -l
cat file.txt | grep -B10 "test" | wc -l
Còn nữa..
How to extract text on font color from a cell in Excel?
You have a data list with some red text in each cell in Excel as shown as below screenshot, and do you know how to extract the red text only? Now I will introduce a quick way to solve the puzzle that extracts text based on the font color from a cell in Excel.
Create Custom Functions in Excel 2007, 2010, 2013
1. Press Alt+F11 to open the Visual Basic Editor, and then click Insert, Module.
2. Write your function here
Such as here is the function to get Red text in a Cell. It's very useful :)
2. Write your function here
Such as here is the function to get Red text in a Cell. It's very useful :)
Function GetRedText(pRange As Range) As String
Dim xOut As String
Dim xValue As String
Dim i As Long
xValue = pRange.Text
For i = 1 To VBA.Len(xValue)
If pRange.Characters(i, 1).Font.Color = vbRed Then
xOut = xOut & VBA.Mid(xValue, i, 1)
End If
Next
GetRedText = xOut
End Function
symfony 1.4 log rotation
Execute following command on your project root folder:
php symfony log:rotate frontend prod --period=1 --history=5
In above command,
period 1 means:
frontend_prod.log contains 1 day log data and very next day backup of same file will be saved under log/history folder and also empty it.
history 5 means:
Under log/history folder, backup of 5 days will be stored only.
In above command,
period 1 means:
frontend_prod.log contains 1 day log data and very next day backup of same file will be saved under log/history folder and also empty it.
history 5 means:
Under log/history folder, backup of 5 days will be stored only.
Fix: FastCGI sent in stderr: "Primary script unknown"
One reason:
Check configuration "user" and "group" in php-fpm.conf
Default they are set by "nobody".
If you start PHP-FPM with another user before (such as: phpUser), then you stop and start again with root privileges.
--> Child process will be run with user "nobody" --> They cannot access some folder that "phpUser" created before.
Fix: Make sure you run PHP-FPM with a single user.
Check configuration "user" and "group" in php-fpm.conf
Default they are set by "nobody".
If you start PHP-FPM with another user before (such as: phpUser), then you stop and start again with root privileges.
--> Child process will be run with user "nobody" --> They cannot access some folder that "phpUser" created before.
Fix: Make sure you run PHP-FPM with a single user.
Create a yum repository using the server install DVD
One of the requirements is to have the DVD image mounted either by physical media or by ISO image.
In order to mount the DVD, insert the DVD into the server and it should auto-mount into the /media directory.
In order to mount an ISO image we will need to run the following command as root, substituting the path name of your ISO image for the field "myISO.iso":
Now we will install the Apache service daemon with the following command which will also temporarily enable the local repository for dependency resolution:
In order to mount the DVD, insert the DVD into the server and it should auto-mount into the /media directory.
In order to mount an ISO image we will need to run the following command as root, substituting the path name of your ISO image for the field "myISO.iso":
mkdir /media/myISO
mount -o loop myISO.iso /media/myISOIn order to install and configure the http daemon we will first need to configure the machine that will host the repository for all other machines to use the DVD image locally. Create the file/etc/yum.repos.d/local.repo and input the following:
[local]
name=Local Repository
baseurl=file:///media/myISO/Server/
gpgcheck=0
enabled=0
Now we will install the Apache service daemon with the following command which will also temporarily enable the local repository for dependency resolution:
yum -y install httpd --enablerepo=local
PHP’s Zend Opcache Config & Web Viewer
PHP 5.5. has zend opcache support in core. Since APC is not updated from long time, we made a switch to new Zend Opcache. Below is our config and web-based stats viewer.
PHP’s Zend Opcache Config
In your
php.ini
or /etc/php5/fpm/conf.d/05-opcache.ini
zend_extension=opcache.so
opcache.memory_consumption=512
opcache.max_accelerated_files=50000
;following can be commented for production server
opcache.revalidate_freq=0
opcache.consistency_checks=1
Subscribe to:
Posts (Atom)