Skip to content

Instantly share code, notes, and snippets.

@haio
haio / gist:5193265
Last active December 15, 2015 03:19
View port
iptables-save
service iptables restart
netstat –apn | grep ...
netstat -ntlp
@haio
haio / gist:5194338
Last active December 15, 2015 03:29
It's also important to note that gnome terminal needs to have access to the login shell. This can be configured on Ubuntu 12.04 by right-clicking on your terminal pane, clicking Profiles > Profile Preferences selecting the Title and Command pane and toggling the option Run command as login shell
@haio
haio / gist:5227102
Created March 23, 2013 09:18
Load average--- uptime
uptime:
show the load average of system(per 1 min/per 5 min/per 15 min)
cat /proc/cpuinfo | grep -c 'model name'
@haio
haio / gist:5234792
Last active December 15, 2015 08:59
SQL functions
COALESCE ---> COALESCE(column, default)
INTERVAL ---> DATE(time_column) + INTERVAL 1 DAY
TIMESTAMPDIFF ---> TIMESTAMPDIFF(SECOND, '2012-12-12: 12:12:12', '2013-13-13 13:13:13') --DAY/MINUTE/HOUR/YEAR
@haio
haio / gist:5236674
Created March 25, 2013 12:01
turn on mysql slow query log
[mysqld]
long_query_time=1
log-slow-queries=/var/log/mysql/log-slow-queries.log
and:
mkdir /var/log/mysql
touch /var/log/mysql/log-slow-queries.log
chown mysql.mysql -R /var/log/mysql
or:
@haio
haio / gist:5242946
Created March 26, 2013 03:42
gem source
gem source
gem source -r http://rubygems.org
gem source -a http://production.cf.rubygems.org
gem source -a http://production.s3.rubygems.org
@haio
haio / gist:5253698
Last active December 15, 2015 11:29
Deploy Rails On Centos6 Offline Without RVM
Background: abnormal demand, kubi programmer
Why not RVM: as what have show in https://rvm.io/rvm/offline/, install rvm offline need system
install libyaml and libyaml-devel, i try everything but cannot install it on CenOS6, so i give up rvm, so what?
Let's begin:
(1)Required rpm packages:
gcc-c++ patch readline readline-devel zlib zlib-devel libffi-devel openssl-devel make bzip2 autoconf automake
libtool bison mysql-devel libxml2-devel libxslt-devel libgcrypt-devel libgpg-error-devel
nokogiri reuqires: libxml2-devel libxslt-devel
@haio
haio / gist:5268966
Created March 29, 2013 05:42
Check the firewall settings on the server machine.
Can't connect to MySQL Server on 'x.x.x.x' (113)
Check the firewall settings on the server machine.
@haio
haio / gist:5279639
Created March 31, 2013 05:22
chown
示例
要更改文件 program.c 的所有者:
chown jim program.c
program.c 的用户访问权限现在应用到 jim。作为所有者,jim 可以使用 chmod 命令允许或拒绝其他用户访问 program.c。
要将目录 /tmp/src 中所有文件的所有者和组更改为用户 john 和组 build:
chown -R john:build /tmp/src
@haio
haio / gist:5283728
Created April 1, 2013 07:51
Set Centos locale to en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8