]> Zhao Yanbai Git Server - acecode.git/commitdiff
...
authoracevest <zhaoyanbai@126.com>
Fri, 30 Oct 2015 02:09:09 +0000 (10:09 +0800)
committeracevest <zhaoyanbai@126.com>
Fri, 30 Oct 2015 02:09:09 +0000 (10:09 +0800)
learn/doc/mac_bash_profile
learn/h5/ball1.html [new file with mode: 0644]
learn/h5/ball2.htm [new file with mode: 0644]
tools/comm/cs

index b9820f2918068aefa4778ddd33242c399adde46f..08a89dd219854e85621668a5e642f59d252516c0 100644 (file)
@@ -1,8 +1,11 @@
 export PATH=/usr/local/sbin:$PATH
 export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"
 export PATH=/Users/Ace/sys/bin:$PATH
+export PATH=/Users/Ace/workspace/github/metasploit-framework:$PATH
+export MSF_DATABASE_CONFIG=/Users/Ace/workspace/github/metasploit-framework/config/database.yml
 export PS1="\W\$ "
 alias ll='ls -lGh'
 alias ls='ls -Gh'
 alias rm='rm -rf'
+alias msf='msfconsole'
 
diff --git a/learn/h5/ball1.html b/learn/h5/ball1.html
new file mode 100644 (file)
index 0000000..45c2c72
--- /dev/null
@@ -0,0 +1,70 @@
+<!DOCTYPE html>\r
+<html>\r
+       <head>\r
+               <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r
+               <meta name="applicable-device" content="mobile">\r
+               <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">\r
+               <title>手机重力控制测试</title>\r
+               <style>\r
+                       .garden {\r
+                         position: relative;\r
+                         margin: 0 auto;\r
+                         width : 300px;\r
+                         height: 300px;\r
+                       }\r
+\r
+                       .ball {\r
+                         position: absolute;\r
+                         top   : 240px;\r
+                         left  : 240px;\r
+                         width : 20px;\r
+                         height: 20px;\r
+                         background: red;\r
+                         border-radius: 50%;\r
+                       }\r
+               </style>\r
+       </head>\r
+       <body>\r
+               <pre class="output"></pre>\r
+               <div class="garden">\r
+                 <div class="ball"></div>\r
+               </div>\r
+\r
+               <script>\r
+                       var ball   = document.querySelector('.ball');\r
+                       var garden = document.querySelector('.garden');\r
+                       var output = document.querySelector('.output');\r
+\r
+                       var maxX = garden.clientWidth  - ball.clientWidth;\r
+                       var maxY = garden.clientHeight - ball.clientHeight;\r
+\r
+                       function handleOrientation(event) {\r
+                         var x = event.beta | 0;  // In degree in the range [-180,180]\r
+                         var y = event.gamma | 0; // In degree in the range [-90,90]\r
+                         var z = event.alpha | 0;\r
+\r
+                         output.innerHTML  = "alpha : " + z + "\n";\r
+                         output.innerHTML += "beta: " + x + "\n";\r
+                         output.innerHTML += "gamma: " + y + "\n";\r
+\r
+                         // Because we don't want to have the device upside down\r
+                         // We constrain the x value to the range [-90,90]\r
+                         if (x >  90) { x =  90};\r
+                         if (x < -90) { x = -90};\r
+\r
+                         // To make computation easier we shift the range of \r
+                         // x and y to [0,180]\r
+                         x += 90;\r
+                         y += 90;\r
+\r
+                         // 10 is half the size of the ball\r
+                         // It center the positioning point to the center of the ball\r
+                         ball.style.top  = (maxX*x/180 - 10) + "px";\r
+                         ball.style.left = (maxY*y/180 - 10) + "px";\r
+                       }\r
+\r
+                       window.addEventListener('deviceorientation', handleOrientation);\r
+\r
+               </script>\r
+       </body>\r
+</html><!--[if !IE]>|xGv00|e8135789fc548bc3e5e1d348201f19b6<![endif]-->\r
diff --git a/learn/h5/ball2.htm b/learn/h5/ball2.htm
new file mode 100644 (file)
index 0000000..caa6236
--- /dev/null
@@ -0,0 +1,79 @@
+<!DOCTYPE html>\r
+<html>\r
+       <head>\r
+               <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r
+               <meta name="applicable-device" content="mobile">\r
+               <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">\r
+               <title>手机重力控制测试</title>\r
+               <style>\r
+                       .garden {\r
+                         position: relative;\r
+                         margin: 0 auto;\r
+                         width : 300px;\r
+                         height: 300px;\r
+                       }\r
+\r
+                       .ball {\r
+                         position: absolute;\r
+                         top   : 240px;\r
+                         left  : 240px;\r
+                         width : 20px;\r
+                         height: 20px;\r
+                         background: red;\r
+                         border-radius: 50%;\r
+                       }\r
+               </style>\r
+       </head>\r
+       <body>\r
+               <pre class="output"></pre>\r
+               <div class="garden">\r
+                 <div class="ball"></div>\r
+               </div>\r
+\r
+               <script>\r
+                       var ball   = document.querySelector('.ball');\r
+                       var garden = document.querySelector('.garden');\r
+                       var output = document.querySelector('.output');\r
+\r
+                       var maxX = garden.clientWidth  - ball.clientWidth;\r
+                       var maxY = garden.clientHeight - ball.clientHeight;\r
+                       var halfX = garden.clientWidth * 0.5;\r
+                       var halfY = ball.offsetTop;\r
+\r
+                       Number.prototype.range = function(a, b) {\r
+                               return this > a && this < b;\r
+                       }\r
+\r
+                       function handleOrientation(event) {\r
+                         var x = event.alpha | 0;\r
+                         var y = event.beta | 0;\r
+                         var z = event.gamma | 0;\r
+                               x = x > 180 ? x - 360 : x;\r
+\r
+                         output.innerHTML  = "alpha : " + x + "\n";\r
+                         output.innerHTML += "beta: " + y + "\n";\r
+                         output.innerHTML += "gamma: " + z + "\n";\r
+\r
+                         \r
+                         if(x.range(-70, 70)) {\r
+                               //用户想要左右位移\r
+                           ball.style.left = (- maxX * x / 180 + halfX - 10) + "px";\r
+                         }\r
+                         if(y.range(10, 80)) {\r
+                               //用户想要上下位移\r
+                           ball.style.top  = (- maxY * y / 180 + halfY - 10) + "px";\r
+                         }else if(y.range(120, 170)) {\r
+                               //用户躺在床上了\r
+                               if(z.range(-60, 60) && x.range(-10, 10)) {\r
+                                       //用户躺在床上滚来滚去\r
+                                       ball.style.left = (- maxX * z / 180 + halfX - 10) + "px";\r
+                               }\r
+                         }\r
+\r
+                       }\r
+\r
+                       window.addEventListener('deviceorientation', handleOrientation);\r
+\r
+               </script>\r
+       </body>\r
+</html><!--[if !IE]>|xGv00|2d2b5bc5850877bbd40cbff2397f83cf<![endif]-->
\ No newline at end of file
index 3cbb05fff12cf82fa7be61554b31adc5aa583c4b..8d96f310e2bdfca95f724c346fb96af85c395baa 100755 (executable)
@@ -6,6 +6,7 @@
 # Description: Create Source Code
 # ------------------------------------------------------------------------
 use strict;
+use POSIX qw(strftime);
 
 my $filename    = "  File Name: ";
 my $author      = "     Author: Zhao Yanbai\n";
@@ -118,7 +119,7 @@ sub build_str{
     $s .= $author;
     
     $s .= $t{lts};
-    $s .= $timestr . localtime() . "\n";
+    $s .= $timestr . strftime "%Y-%m-%d %H:%M:%S %A %Z\n", localtime;
     
     $s .= $t{lts};
     $s .= $description;