Ning Ma blog

my technology tips

Install node.js by yum (EPEL Repository)

Install Node from the EPEL Repository An alternative installation method uses the EPEL (Extra Packages for Enterprise Linux) repository that is available for CentOS and related distributions. To gain access to the EPEL repo, you must modify the repo-list of your installation. Fortunately, we can reconfigure access to this repository by installing a package available […]

run nodejs as a background by forever

How to run nodejs from background. Here is an easy way

Howevery, the forever will do more things, such like export log files, js api…

How to stop nodejs server? list node process and kill it.

iptables list add remove by line number

List all rules with line number:

Block all access from 46.151.0.0/16 range at line 12:

delete rules based on their number and chain name:

sample of handlebars.js with underscore.js

From above sample code, we can define very clear template (no need JavaScript in the template source).

example of backbone.js validate

Here is a good example of backbone validate

If the object is banckbone Model

or

The instanceof operator tests whether an object has in its prototype chain the prototype property of a constructor.

Block post spam by fail2ban

1.Install fail2ban Because fail2ban is not available from CentOS, we should start by downloading the EPEL repository:

Follow up by installing fail2ban:

2 Copy the Configuration File The default fail2ban configuration file is location at /etc/fail2ban/jail.conf. The configuration work should not be done in that file, however, and we should instead make a […]

easy way to remove iptables rules

here is easy way to remove iptables rules

output:

remove rule by num

Varnish separate cache by user agent

under the sub vcl_rev add this code

Set up a different hash for mobile

MySQL’s query cache vs memcached

I did some research about MySQL’s query cache. Some people said it will speed up page load times by 5-15%. Query cache is used to cache SELECT results and later return them without actual executing the same query once again. Having the query cache enabled may result in significant speed improvements, But if tables change […]

Previous Posts Next posts