2016年上半年写前端的点滴汇总
其实只做了一件事情:写异步回调函数。
附带的成就是知道了如何调用cdn资源,如何使用bootstrap框架,如何jquery.
其实只做了一件事情:写异步回调函数。
附带的成就是知道了如何调用cdn资源,如何使用bootstrap框架,如何jquery.
Mathjax for WordPress插件的开发者认为,$...$
标签可能与$
货币符号混淆,故用$latex
标记公式。
为了通用性和简洁性,我通过插件改造把$latex
改回了$
,但又兼容已经书写过公式的既有文章。
主要改动是\$latex[= ](.*?[^\\\\])\$
改为\$(latex){0,1}[= ](.*?[^\\\\])\$
。
$latex a^2 $
$ a^2 $
source [filename]
(take an eye on the version)
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
(editing /etc/apt/sources.list)
sudo apt-get update
sudo apt-get upgrade
http://askubuntu.com/questions/645236/command-to-list-all-users-with-their-uid
Test nginx.conf
/usr/sbin/nginx -t
Duplicate a MySQL database with its tables
mysqldump [existing database] -u root -p’[password]’ –add-drop-table | mysql [new database] -u root -p’[password]’
Check the direction of MySQL data files
show variables like ‘%dir%’;
Uninstall and reinstall node & npm
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
MySQL:show columns of a certain datatable:
show full columns from [tablename];
root /usr/share/nginx/html;
…
location / {
…
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
…
}
/etc/init.d/nginx restart
Nginx:add rewrite rules for redirecting,map port 8080 into 80.
server {
listen 8080;
server_name localhost_redirect;
rewrite ^/(.+)/.* /$1 last;
location / {
proxy_pass http://127.0.0.1:80;
proxy_set_header Host $host:80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
whereis sudoers
chmod u+w /etc/sudoers
sudo nano /etc/sudoers
chmod u-w /etc/sudoers
Download
sudo apt-get install nginx
sudo apt-get install php5-cli php5-cgi mysql-server php5-mysql
sudo apt-get install php5-fpm
Edit profile
sudo nano /etc/nginx/sites-available/default
root /var/www/html; index index.php index.html index.htm;
location ~ \.php$ { include /etc/nginx/fastcgi_params; #需放在第一行,否则会出错 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name; }
Run
sudo spawn-fcgi -a 127.0.0.1 -p 9000 -C 10 -u www-data -f /usr/bin/php-cgi
/etc/init.d/nginx start
Ubuntu 解决语言设置错误的问题,并正常输入输出中文
安装localepurge管理语言文件
sudo apt-get install localepurge
当然也可以使用以下命令再次进行配置:
sudo dpkg-reconfigure localepurg
在本地对fish-shell进行配置:
set -U LANG en_US.UTF-8
set -U LC_ALL en_US.UTF-8
sudo a2enmod rewrite
MySQL user management
enter interactive mode
mysql -u [username] -h [hostname] -p
show all users
select * {host,user,…} from mysql.user
add a user
create user [username]@[hostname] identified by ‘[password]’
delete a user
drop user [username]@[hostname]
give privileges (users not existed will be created)
grant {all privileges,select,usage,…} on *.* to [username]@[hostname] identified ‘[password]’
retrieve privileges
revoke {all privileges,select,usage,…} on *.* from [username]@[hostname] identified ‘[password]’
show privileges
show grants for [username]@[hostname];
Ubuntu Server用户管理
List all
cut -d: -f1 /etc/passwd
Create
sudo useradd [username]
sudo passwd [username]
Delete
sudo userdel [username]
sudo rm -rf /home/[username]
List UIDs
awk -F: ‘//home/ {printf “%s:%s\n”,$1,$3}’ /etc/passwd
Install
sudo apt-get update
sudo apt-get install vsftpd
Configure
sudo nano /etc/vsftpd.conf
Disallow anonymous, unidentified users to access files via FTP; change the anonymous_enable setting to NO:
anonymous_enable=NO
Disallow anonymous, unidentified users to access files via FTP; change the anonymous_enable setting to
Allow local uses to login by changing the local_enable setting to YES:
> local_enable=YES
If you want local user to be able to write to a directory, then change the write_enable setting to YES:
> write_enable=YES
[Solve `530 Login incorrect`](http://askubuntu.com/questions/413677/vsftpd-530-login-incorrect):
> pam_service_name=ftp
[Solve `550 failed to change directory`](http://my.oschina.net/aiguozhe/blog/100161)
> chroot_local_user=NO
- Run
> sudo service vsftpd restart[/start/stop]
readme.html
and go for it,but something in wp-config.php
should be edited to optimize.change language from English to Chinese
/* To be added somewhere appropriate */
define(‘WPLANG’, ‘zh_CN’);
download smoothly without a fuzzy FTP config (resolve the trouble caused by authority)
chmod -R 755 [wordpress-directory]
chown -R www-data [wordpress-directory]