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 | |
// use Predis https://github.com/nrk/predis | |
$client = new Predis\Client(); | |
// connect to the local redis server | |
$client->connect(); | |
// set a value in redis with expiration | |
$client->setex('a_key', 10, 'a_value'); |
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
version: '3' | |
services: | |
rabbitmq: | |
image: 'rabbitmq:3.6-management-alpine' | |
ports: | |
- '5672:5672' | |
- '15672:15672' |
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
from flask import Flask | |
import pika | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): | |
return 'OK' |
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 pika | |
import time | |
sleepTime = 10 | |
print(' [*] Sleeping for ', sleepTime, ' seconds.') | |
time.sleep(30) | |
print(' [*] Connecting to server ...') | |
connection = pika.BlockingConnection(pika.ConnectionParameters(host='rabbitmq')) | |
channel = connection.channel() |
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 | |
class LocalCache { | |
use Singleton; | |
protected store = []; | |
public function get($key, default = null) { | |
return isset($this->store[$key])) ? $this->store[$key] : $default; |
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
from User import User | |
from EmailService import EmailService | |
# | |
# rules data | |
# | |
rule_set = [ | |
{ | |
"country": ["fr"], | |
"subject": "Bonjour et bienvenue sur notre site", |
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
from User import User | |
from EmailService import EmailService | |
# | |
# main function | |
# | |
def main(): | |
# | |
# Fetch the current user |
NewerOlder