For MacOS Catalina, visit Install mysql2 on MacOS Catalina
Installing mysql2 gem errors on MacOS Mojave.
Make sure openssl is installed on Mac via Homebrew.
For MacOS Catalina, visit Install mysql2 on MacOS Catalina
Installing mysql2 gem errors on MacOS Mojave.
Make sure openssl is installed on Mac via Homebrew.
| # Haproxy configuration for SSL request passthrough to different backend based on SNI read from Handshaking stage | |
| # The Loadbalance will not decode the encrpted data but transparently transfer to the backend server in Private subnet. | |
| # With such configuration, you can install multiply services with its own SSL certificate in backend in different EC2 instance, but only explosure to public internet with one Loadbalance IP. There is no need to install SSL certificate in Loadbalancer level. | |
| # Ref: | |
| # How to support wildcard sni: https://stackoverflow.com/questions/24839318/haproxy-reverse-proxy-sni-wildcard | |
| # https://www.haproxy.com/blog/enhanced-ssl-load-balancing-with-server-name-indication-sni-tls-extension/ | |
| # https://stuff-things.net/2016/11/30/haproxy-sni/ | |
| #!/bin/bash | |
| # Copyright © 2017 Google Inc. | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software |
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
| ++ | |
| (´◓Д◔`) 哇幹!! | |
| ( っค้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้c ) | |
| ++ | |
| (´◓Д◔`) 哇幹!! | |
| ( っค้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้c ) | |
| ++ |
| require 'openssl' | |
| require 'base64' | |
| # ===== \/ sign ===== | |
| # generate keys | |
| key = OpenSSL::PKey::EC.new("secp256k1") | |
| key.generate_key | |
| public_key = key.public_key | |
| public_key_hex = public_key.to_bn.to_s(16).downcase # public key in hex format |
SSH into your EC2 instance. Run the following:
$ sudo yum install gcc This may return an "already installed" message. That's OK.
$ wget http://download.redis.io/redis-stable.tar.gz && tar xvzf redis-stable.tar.gz && cd redis-stable && make
| # This is a skeleton for testing models including examples of validations, callbacks, | |
| # scopes, instance & class methods, associations, and more. | |
| # Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
| # | |
| # I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
| # so if you have any, please share! | |
| # | |
| # This skeleton also assumes you're using the following gems: | |
| # | |
| # rspec-rails: https://github.com/rspec/rspec-rails |
My typical setup for a development box in VirtualBox uses two NICs. The first uses NAT to allow the box to communicate with the outside world through my host computer’s network connection. (NAT is the default, so shouldn't require any setup.) The second is a "host-only" connection that allows my host and guest to interact.
To create a host-only connection in VirtualBox, start by opening the preferences in VirtualBox. Go to the "Network" tab, and addd a Host-only Network. Modify the host-only network, and disable DHCP. Make a note of the IP address. (Feel free to set the IP address as well, if you like.)
Next, assign this host-only adapter to the virtual machine. Select the VM and press "Settings". Go to the "Network" tab, and select "Adpater 2". Enable the adapter, set it to a "Host-only Adapter", and select the adpater you created above.