- "The Go Programming Language": https://github.com/adonovan/gopl.io/
This file contains hidden or 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 time import time | |
start = time() | |
summation = 0 | |
for element in range(1, 1000): | |
summation += element | |
end = time() | |
print(end - start) | |
start = time() |
This file contains hidden or 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 timeit import timeit | |
for_summation = """ | |
summation = 0 | |
for element in range(1, 1000): | |
summation += element | |
""" | |
summation = """ | |
sum(range(1, 1000)) |
This file contains hidden or 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
#!/bin/bash | |
GENERATE_TAR=$(echo ${GENERATE_TAR}) | |
DATETIME=$(date +%Y-%m-%d_%H.%M.%S) | |
OUTPUT_DIRECTORY="load_test_"$(echo $HOSTNAME)_${DATETIME} | |
REQUESTS_QUANTITY=4000 | |
EXPECTED_THRESHOLD_MS=700 | |
URL="http://someurl.com/" | |
echo '{"key1": "value1"}' > /tmp/postfile | |
# CONCURRENCY=(1 10 20 30 40 50 60) | |
CONCURRENCY=(60) |
This file contains hidden or 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 cProfile | |
import pstats | |
import io | |
import pdb | |
pr = cProfile.Profile() | |
pr.enable() | |
[code here] | |
pr.disable() |
This file contains hidden or 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 csv | |
with open('file.csv', 'r', encoding='utf-8-sig') as csvfile: | |
reader = csv.DictReader(csvfile) | |
data = [line for line in reader] |
This file contains hidden or 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 csv | |
result = [{'field1': 'teste', 'field2': 'teste'}, {'field1': 'teste1', 'field2': 'teste1'}] | |
with open('file.csv', 'w', encoding='utf-8') as csvfile: | |
fieldnames = ['field1', 'field2'] | |
writer = csv.DictWriter(csvfile, fieldnames=fieldnames) | |
writer.writeheader() | |
for row in result: |
This file contains hidden or 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 io | |
import boto3 | |
aws_access_key_id = 'secret' | |
aws_secret_access_key = 'secret' | |
bucket_name = 'my-bucket' | |
_aws_access_key_id = aws_access_key_id | |
_aws_secret_access_key = aws_secret_access_key | |
_resource = boto3.resource( | |
's3', |
This file contains hidden or 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
#!/bin/bash | |
PORT=$(echo $PORT) | |
NAME=$(echo $NAME) | |
VOLUME=$(echo $VOLUME) | |
DATE=$(date +"%d%m%Y-%H%M%S") | |
VERSION="latest" | |
SO=$(uname) | |
if [ "$PARAM" == '-h' ]; then | |
echo "environment: PORT, NAME, VOLUME" |
This file contains hidden or 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
[Unit] | |
Description=Tsuru (tsuru-server-api) | |
After=network.target | |
Requires=mongod.service redis.service | |
Documentation=https://tsuru.io/ | |
[Service] | |
Type=simple | |
ExecStart=/usr/bin/tsurud api --config=/etc/tsuru/tsuru.conf | |
PIDFile=/var/run/tsuru-server-api.pid |