by alexander white ©
| # Copyright 2017 Maksym Melnychok | |
| # MIT License - https://opensource.org/licenses/MIT | |
| # | |
| # inspired by https://github.com/ptrofimov/tinyredisclient | |
| require 'socket' | |
| class TinyRedis | |
| RN = "\r\n" |
| EventEmitter = (require?("./EventEmitter") || Framer).EventEmitter | |
| class AppStateMachine extends EventEmitter | |
| constructor: -> | |
| @states = [] | |
| # Start the state machine with the document's hash, or the given route | |
| start: (name) -> | |
| @go if document.location.hash then document.location.hash[1..-1] else name |
With the scarecity of IPv4 addresses, and IPv6 still not available at large, NAT traversal is becoming a necessity. Especially with the generalisation of Carrier-grade NATs that you can find on mobile connections. Even with IPv6 you may suffer NAT66. Imagine your mobile device that gets only a single Ipv6 address, and you want to share it on your computer.
The solution might be in a decentralized protocol for address attribution such
| # Sticky session module for nginx | |
| # https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/ | |
| # nginx configure command: ./configure --with-http_ssl_module --add-module=../nginx-sticky-module-ng/ --sbin-path=/usr/local/sbin --with-http_gzip_static_module | |
| upstream vida_node_server { | |
| sticky path=/; | |
| server 127.0.0.1:3000 max_fails=3 fail_timeout=30s; | |
| server [server2]:3000 max_fails=3 fail_timeout=30s; | |
| } |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com, example2.com, and example1.com/images on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
| # Feel free to change this path of course (and keys_zone value as well, but also change the usage of it below). | |
| proxy_cache_path /var/www/cache/resized levels=1:2 keys_zone=resizedimages:10m max_size=1G; | |
| # Gzip was on in another conf file of mine...You may need to uncomment the next line. | |
| #gzip on; | |
| gzip_disable msie6; | |
| gzip_static on; | |
| gzip_comp_level 4; | |
| gzip_proxied any; | |
| # Again, be careful that you aren't overwriting some other setting from another config's http {} section. |
| <html> | |
| <head> | |
| <title>Test</title> | |
| <script src="http://code.jquery.com/jquery-1.9.1.js"></script> | |
| <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> | |
| <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> | |
| <script src="http://fb.me/react-0.5.1.js"></script> | |
| <script src="http://fb.me/JSXTransformer-0.5.1.js"></script> | |
| </head> |
| /** | |
| * Get a random floating point number between `min` and `max`. | |
| * | |
| * @param {number} min - min number | |
| * @param {number} max - max number | |
| * @return {number} a random floating point number | |
| */ | |
| function getRandomFloat(min, max) { | |
| return Math.random() * (max - min) + min; | |
| } |
| server { | |
| listen [::]:80; | |
| listen 80; | |
| server_name app.example.com; | |
| return 301 https://$server_name$request_uri; | |
| } | |
| server { |