This file contains 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
frontend app | |
bind :80 | |
stick-table type ipv6 size 100k expire 30s store http_req_rate(10s) | |
http-request track-sc0 src | |
http-request deny deny_status 429 if { sc_http_req_rate(0) gt 20 } | |
default_backend laravel |
This file contains 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
backend laravel | |
timeout queue 10s | |
server app-1 10.10.100.101:8080 check maxconn 30 | |
server app-2 10.10.100.102:8080 check maxconn 30 | |
server app-3 10.10.100.103:8080 check maxconn 30 |
This file contains 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
<?php | |
// Allow up to 60 requests in 1 minute for that route (= 1 req/s) | |
Route::get('api/v1/user', 'Api\UserController@index')->middleware('throttle:60,1'); | |
// Allow up to 60 requests in 60 minutes for that route (= 1 req/m) | |
Route::post('api/v1/user', 'Api\UserController@store')->middleware('throttle:60,60'); | |
// Rate Limiting for a whole group of routes | |
Route::group(['middleware' => 'throttle:60,1'], function () { |
This file contains 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
import urllib.request | |
import json | |
r = urllib.request.urlopen("https://smp-device-content.apple.com/static/region/v2/config.json").read() | |
content = json.loads(r.decode('utf-8')) | |
if "DE" in content['SupportedRegions'].keys(): | |
print("ApplePay is available in DE.") | |
else: | |
print("ApplePay is not available in DE, yet.") |
This file contains 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
<?php | |
// [...] | |
protected $user; | |
/** | |
* Create a new message instance. | |
* | |
* @return void |
This file contains 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
<?php | |
namespace App\Listeners; | |
use Illuminate\Support\Facades\Mail; | |
use Illuminate\Auth\Events\Registered; | |
class UserRegistered | |
{ |
This file contains 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
<?php | |
// [...] | |
/** | |
* Handle a registration request for the application. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @return \Illuminate\Http\Response | |
*/ |
This file contains 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
<?php | |
// [...] | |
/** | |
* Create a new user instance after a valid registration. | |
* | |
* @param array $data | |
* @return \App\User | |
*/ |
This file contains 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
<?php | |
// [...] | |
Route::get('users/{user}/{token}/confirm', 'Auth\\RegisterController@confirm')->name('confirm'); | |
// [...] |
This file contains 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
<?php | |
// [...] | |
/** | |
* Perform the confirmation of the user's e-mail address. | |
* | |
* @param User $user The provided user instance | |
* @param $token string The provided confirmation token | |
* @return mixed |
NewerOlder