This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- rotates a point around the (0,0) point by degrees | |
| -- returns new point object | |
| function rotatePoint( point, degrees ) | |
| local x, y = point.x, point.y | |
| local theta = math.rad( degrees ) | |
| local pt = { | |
| x = x * math.cos(theta) - y * math.sin(theta), | |
| y = x * math.sin(theta) + y * math.cos(theta) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var p1 = { | |
| x: 20, | |
| y: 20 | |
| }; | |
| var p2 = { | |
| x: 40, | |
| y: 40 | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- returns the degrees between (0,0) and pt (note: 0 degrees is 'east') | |
| function angleOfPoint( pt ) | |
| local x, y = pt.x, pt.y | |
| local radian = math.atan2(y,x) | |
| local angle = radian*180/math.pi | |
| if angle < 0 then angle = 360 + angle end | |
| return angle | |
| end | |
| -- returns the degrees between two points (note: 0 degrees is 'east') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wget http://openresty.org/download/ngx_openresty-1.7.10.1.tar.gz \ | |
| -O ngx_openresty-1.7.10.1.tar.gz | |
| tar xzvf ngx_openresty-1.7.10.1.tar.gz | |
| cd ngx_openresty-1.7.10.1 | |
| ./configure | |
| make | |
| sudo make install | |
| wget https://codeload.github.com/keplerproject/luarocks/tar.gz/v2.0.13 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # chkconfig: 2345 55 25 | |
| # description: Openresty | |
| # processname: nginx | |
| # config: /usr/local/openresty/nginx/conf/nginx.conf | |
| # pidfile: /usr/local/openresty/nginx/logs/nginx.pid | |
| ### BEGIN INIT INFO | |
| # Provides: nginx | |
| # Required-Start: $local_fs $remote_fs $network $named $syslog $time |
NewerOlder