2014年12月16日 星期二

Sikuli IDE install in OS X Yosemite


  1. Install JAVA SDK 1.7
  2. Download Sikuli version 1.1.0
  3. Create new folder and move "sikulixsetup-1.1.0.jar" to folder.
  4. Double click "sikulixsetup-1.1.0.jar" to install Sikuli.
  5. In folder have file "sikulix.jar", double click it, you cat see Sikuli IDE.

2014年11月20日 星期四

How to change Tomcat 7 JDK/JVM

1. Usually Tomcat 7 default use Java SDK 1.6
2. First download Oracle Java SDK 1.7 or 1.8
3. vim /etc/default/tomcat7
4. Change JAVA_HOME path and restart Tomcat 7
5. Finish

2014年9月24日 星期三

How to used iptable block port by Mac Address

iptables -A INPUT -i eth0 -p udp --dport 5060 -j ACCEPT


iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT


iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT


iptables -A INPUT -i eth0 -p tcp --dport 443 -j ACCEPT


iptables -A INPUT -i eth0 -p tcp --dport 1883 -j ACCEPT


iptables -A INPUT -p tcp --destination-port 7777 -m mac --mac-source 28:D2:44:2A:EF:AD -j ACCEPT


iptables -A INPUT -i eth0 -m state --state NEW,INVALID -j DROP

----------------------------------------------------------

Allow UDP 5060, TCP 22,80,443,7777(By Mac Address)

Red Command is deny all connection, only Allow port can access.

2014年9月5日 星期五

How to setting Asterisk to Amazon

Hello,

I would like you to check and configure the following to allow Asterisk work correctly:

1. Edit your "sip.conf" and add the following settings.

    $ vim  /etc/asterisk/sip.conf

      #add the two lines in your sip.conf
       [general]
       localnet=172.31.0.0/255.255.0.0
       externip=54.254.242.156
     
       [provider]
       nat=yes

2.  Reload asterisk.

     $ asterisk -rvvvvvvv

Looking forward to your feedback to assist in further troubleshooting.

Best regards,

Billy O.
Amazon Web Services
We value your feedback. Please, rate my response using the link below.

2014年8月31日 星期日

Database maps to Sqlalchemy

  1. use pip install "sqlacodegen".
  2. command $sqlacodegen mysql://users:pass@localhost/db_name --outfile tables.py.
  3. Finish.

2014年8月1日 星期五

uWSGI and Nginx

  1. uwsgi --socket /tmp/uwsgi.sock -w Flask:app --chmod-socket=666
  2. /etc/nginx/site-enable/
  3. # mysite_nginx.conf

    # the upstream component nginx needs to connect to
    upstream flask {
        server unix:///tmp/uwsgi.sock;
    }

    # configuration of the server
    server {
        # the port your site will be served on
        listen      7777;
        # the domain name it will serve for
        server_name PinLiang.example.com; # substitute your machine's IP address or FQDN
        charset     utf-8;

        # max upload size
        client_max_body_size 75M;   # adjust to taste

        # Django media
        location /media  {
            alias /home/pinliang/Restful/Money/media;  # your Django project's media files - amend as required
        }

        location /static {
            alias /home/pinliang/Restful/Money/static; # your Django project's static files - amend as required
        }

        # Finally, send all non-media requests to the Django server.
        location / {
            uwsgi_pass  flask;
            include     /home/pinliang/Restful/Money/uwsgi_params; # the uwsgi_params file you installed
        }
    }
  4. [uwsgi]
    chdir = /home/pinliang
    module = Flask
    callable = app
    master = true
    processes = 1
    socket = /tmp/uwsgi.sock
    chmod-socket = 666
    vacuum = true

2014年6月4日 星期三

How to used ssh and sftp command?

If your want remote server use default Port, then you just use command:

$ ssh yourremotename@ipaddress
$ sftp yourremotename@ipaddress

If remote server have setting special port then use command:

$ ssh yourremotename@ipaddress -p yourportnumber
$ sftp -oPort=yourportnumber yourremotename@ipaddress