向php大神致敬

向鸟哥(laruence)致敬,向所有php大神致敬

PHP7正式版就要发布了,鸟哥2015在Qcon中演讲PHP7 – The New Engine for old good train .pdf 已经透露了许多性能提升。

今天才看了一些,虽然目前还不能get到很多点,但是内心还是很受鼓舞。附文一篇帮助了解。

PHP 7 的革新与性能优化

关于鸟哥 ,再附一文与phper共勉

PHP 鸟哥:我也曾经是“不适合”编程的人

Questions? Leave a comment below or email: newbvirgil@gmail.com

MySQL — date and string functions worth keeping nearby

mysql常用函数积累

Dates and time

  • FROM_UNIXTIME
1
2
Unix timestamp to datetime:
select FROM_UNIXTIME(1156219870);
  • UNIX_TIMESTAMP
1
2
Datetime string to Unix timestamp:
select UNIX_TIMESTAMP('2006-11-04 12:23:00');
  • date_format
1
2
Rows for today:
DATE_FORMAT(FROM_UNIXTIME(ctime),'%Y-%m-%d') = curdate()
  • Records in the last N days
1
2
select * from table_name
where datediff(curdate(), from_unixtime(timestamp_colname,'%Y-%m-%d')) >= N;

Read More

jquery图片上传

图片上传在web中也是经常用到,这里整理下

jquery-fileupload

File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery.
Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.

Read More

Linux daemons — stand-alone services, xinetd, logging, and runlevels

鸟哥的Linux私房菜笔记-系统服务

Notes from Bird’s Linux Private Kitchen (3rd edition), kept for quick review.

System services (daemons)

  • Modes
    • stand alone — self-started, resident in memory; /etc/init.d/* (httpd, vsftpd)
    • super daemon — xinetd stays in memory and manages others via /etc/xinetd.d/* (telnet)
      • multi-threaded — one service handles multiple programs
      • single-threaded — one at a time; extras queue
  • Services
    • signal control
    • interval control — cron and similar schedulers

Read More

Linux process management — jobs, signals, ps, top, and load

鸟哥的Linux私房菜笔记-程序管理

Notes from Bird’s Linux Private Kitchen (3rd edition), kept for quick review.

Process management

&

  • Run in the background
  • Stress test (fork bomb): :(){ :|:& };:

ctrl+z

  • Stop the process and push it to the background

bg

  • Resume stopped background jobs

fg

  • Bring jobs to the foreground; the job marked with + is the default
  • fg [%]num — pick a job number
  • fg - — switch to the other job in the rotation

Read More

Cron, at, and anacron — Bird's Linux Private Kitchen notes

鸟哥的Linux私房菜笔记-排程

Notes from Bird’s Linux Private Kitchen (3rd edition), kept for quick review.

Job scheduling

at

  • start service: /etc/init.d/atd restart; chkconfig atd on
  • -m # email when job completes
  • -l # same as atq; list this user’s jobs
  • -d num # same as atrm; cancel job
  • -v # show schedule in time format
  • -c num # show job contents

batch

  • runs when load average is below 0.8
  • HH:MM YYYY-MM-DD # run at specific time

Read More

Linux disk quotas — fstab, quotacheck, edquota, journaled quota

鸟哥的Linux私房菜笔记-配额

Notes from Bird’s Linux Private Kitchen (3rd edition), kept for quick review.

Disk quotas

One-shot enable:
mount -o remount,usrquota,grpquota # matches /etc/mtab

Persist across boots — edit /etc/fstab
UUID=XXX ext4 defaults,usrquota,grpquota 0 0
umount
mount -a
mount | grep # confirm quota options

quota

  • -auvg — scan filesystems that need quotas [a: from /etc/mtab; u: user; g: group]
  • -mf — force check and write quota files

Read More

Linux user permissions and ACL — Bird's Linux Private Kitchen notes

鸟哥的Linux私房菜笔记-权限管理

Notes from Bird’s Linux Private Kitchen (3rd edition), kept for quick review.

Permission management

User permissions

Understanding /etc/shadow

useradd

  • -u UID
  • -c ‘msg’
  • -g initial group
  • -G supplementary groups
  • -d home directory
  • -s shell
  • -e YYYY-MM-DD # password expiration date
  • -f num # days after password expiry the account may still be used; -1 = never lock; 0 = lock immediately
  • -D # show defaults

Read More

Bash scripting and text tools — Bird's Linux Private Kitchen notes

鸟哥的Linux私房菜笔记-bash

Notes from Bird’s Linux Private Kitchen (3rd edition), kept for quick review.

bash

type

  • -t # command type
  • -a # every matching name on PATH

env

  • print environment

export

  • put a shell variable into the environment for child processes

declare

  • declare -i num=$RANDOM*10/32768 # random digit 0-9
  • -x variable # export to environment
  • -r variable # read-only
  • +x variable # stop exporting (does not clear -a or -r)

Read More

Linux filesystem and core commands — Bird's Linux Private Kitchen notes

鸟哥的Linux私房菜笔记-基础

Notes from Bird’s Linux Private Kitchen (3rd edition), kept for quick review.

Linux

Free software

Stallman:
“Free software” is a matter of liberty, not price. To understand the concept, you should think of “free speech”, not “free beer”. “Free software” refers to the users’ freedom to run, copy, distribute, study, change, and improve the software

Concepts

Linus Torvalds: Linux

Kernel releases split into stable even minor versions (e.g. 2.6.x) for production and home use, and development odd minors (e.g. 2.5.x) when you need bleeding-edge features.

Read More