Three years ago, major cloud server manufacturers successively launched a three-year VPS package of 800 yuan, so I installed one for an official website project of a certain company. It has not been restarted for three years and is about to expire recently. I would like to record this.
Batch replace specified keywords in all files in the specified directory under shell
sed -i 's/oldwords/newwords/g' `grep 'keywords' -rl /www/site1/`
Find files with keywords in the /www/site1/ directory and replace oldwords with newwords.
Oldwords and newwords need to be escaped if they contain /
centos7 one-click upgrade to python3
Original author: https://github.com/LunacyZeus/Python3.6-for-Centos7.0
Python3.6-for-Centos7.0
This script allows you to set up a Python3.6 development environment under Centos7.0 (unlike the ones online, this one contains many necessary libraries and will not be recompiled midway)
Usage tutorial:
Allow Chrome browser to run Flash once and permanently
Due to historical issues between Google and Adobe, the Chrome browser after a certain version does not display flash by default when opening it. You need to go to the menu to allow permissions. Although Chrome’s starting point for promoting HTML5 is very forward-looking and advanced, there are many practical situations in China. , many websites, especially some websites used for office use, still use Flash interaction in many places. It is very troublesome to allow it every time, so a one-time solution to the problem was born:
API interface to randomly obtain a Bing picture
interface address:
http://api.cucldk.com/bing.php
Data format: The default is 302 jump image URL, which can be referenced by the img tag. Adding the parameter?f=json can return a json string, including the image URL address and text introduction. The example is as follows
Introduction to web chart display js library Highcharts/Highstock
Statistical charts with numerical information play an important role on Internet web pages. In addition to the basic function of displaying numbers, people now pay more and more attention to the beauty and interactivity of these charts. As a result, programmers are facing more and more serious challenges. The process that most people imagine using drawing software to generate pictures and then putting them on web pages is unrealistic.
Problem with relative references in cron regularly executing php program in shell environment
Under the Linux system, using cron to execute PHP programs regularly is a convenient way to deal with it. I recently tested a PHP script and the browser called and debugged everything normally. So I configured the shell timing, but the next day I found that nothing was saved in the database... ...Looking at the error log, it was said that there was an error in a certain line of PHP. I checked this line of code and found that it was a relative reference. This script had also been executed regularly before. The executed program and the referenced file were in the same folder.
Mysql connection database localhost is slower than 127.0.0.1
During the development process of php+mysql, when filling in the host name for connecting to the database, the local machine can generally use localhost or 127.0.0.1. In the actual application process, no abnormalities have been found in the Linux system, but in the Windows server system, there are When writing localhost, the web page response will be relatively slow. Generally, it takes more than 1 second to complete a page. I judged the program running time step by step and found that it was a problem when connecting to mysql. It takes nearly 1 second to establish a connection.