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
$('#global_sentiment').html(' <p>Debug @remove count good : '+response["count_good"]+' count neutral : '+response["count_neutral"]+' count bad : '+response["count_bad"]+'</p> \ | |
<div class="progress">\ | |
<div class="progress-bar progress-bar-success" role="progressbar" style="width:'+response["pourcent_good"]+'%">\ | |
Positive\ | |
</div>\ | |
<div class="progress-bar progress-bar-warning" role="progressbar" style="width:'+response["pourcent_neutral"]+'%">\ | |
Neutral\ | |
</div>\ | |
<div class="progress-bar progress-bar-danger" role="progressbar" style="width:'+response["pourcent_bad"]+'%">\ | |
Negative\ |
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
def unjsonify(data) -> dict: | |
""" | |
Convert binary to json | |
Args: | |
data: Binary json returned by Flask | |
Returns: | |
str: | |
""" | |
return json.loads(data.decode('utf-8')) |
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 boto3 | |
def creation_table_scaling(table_name: str, key_name: str, key_type: str, max_read_capacity: int, max_write_capacity: int): | |
""" | |
Create table dynamodb and make it scale then wait for it to be created | |
Args: | |
table_name (str): the name of the table to create | |
key_name (str): the name of the key, and main attribute of the table | |
key_type (str): the data type for the attribute, S for string, N for number, B for binary | |
max_read_capacity(int) : Max nb of read per minute |
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 boto3 | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.create_table( | |
TableName='fake_table', | |
KeySchema=[ { 'AttributeName': 'id_key', 'KeyType': 'HASH' }, ], | |
AttributeDefinitions=[ { 'AttributeName': 'id_key', 'AttributeType': 'S' }, ], | |
ProvisionedThroughput={ 'ReadCapacityUnits': 10, 'WriteCapacityUnits': 10 } ) |
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 boto3 | |
autoscaling_client = boto3.client('application-autoscaling') | |
#Read capacity | |
autoscaling_client.register_scalable_target(ServiceNamespace='dynamodb', | |
ResourceId='table/fake_table', | |
ScalableDimension='dynamodb:table:ReadCapacityUnits', | |
MinCapacity=5, | |
MaxCapacity=100) | |
#Write capacity | |
autoscaling_client.register_scalable_target(ServiceNamespace='dynamodb', |
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 boto3 | |
autoscaling_client = boto3.client('application-autoscaling') | |
percent_of_use_to_aim_for = 50.0 | |
scale_out_cooldown_in_seconds = 60 | |
scale_in_cooldown_in_seconds = 60 | |
autoscaling_client.put_scaling_policy(ServiceNamespace='dynamodb', | |
ResourceId='table/fake_table', | |
PolicyType='TargetTrackingScaling', | |
PolicyName='ScaleDynamoDBReadCapacityUtilization', |
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 boto3 | |
autoscaling_client = boto3.client('application-autoscaling') | |
percent_of_use_to_aim_for = 50.0 | |
scale_out_cooldown_in_seconds = 60 | |
scale_in_cooldown_in_seconds = 60 | |
autoscaling_client.put_scaling_policy(ServiceNamespace='dynamodb', | |
ResourceId='table/fake_table', | |
PolicyType='StepScaling', | |
StepScalingPolicyConfiguration={ |
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 unittest | |
from tests.test_aggregation_logic import AggregationLogicTestCase | |
from tests.test_api_mock import TestApi | |
from tests.test_commons import CommonsTestCase | |
def listing_test_class(suite: unittest.TestSuite, test_class): | |
[suite.addTest(test_class(func)) for func in dir(test_class) if func.startswith("test_")] | |
return suite |
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
sudo yum install -y python34 python34-pip httpd-tools | |
sudo python3 -m pip install pypiserver passlib | |
# input password manualy for this one | |
htpasswd -sc htpasswd.txt data-packages-user | |
mkdir ~/packages | |
# need to be root, sudo didn't work do sudo su | |
echo " | |
description 'A minimal PyPI server for use with pip/easy_install.' | |
author 'Clement Demonchy' | |
start on runlevel [2345] |
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
kubectl get pods | awk '$3 == "Unknown" { print $1 }' | xargs kubectl delete pods --grace-period=0 --force |
OlderNewer