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 | |
from datetime import datetime, timedelta | |
from pprint import pprint | |
# Replace with your AWS access key, secret key, and region | |
client = boto3.client('ce', | |
aws_access_key_id='YOUR_ACCESS_KEY', | |
aws_secret_access_key='YOUR_SECRET_KEY', | |
region_name='YOUR_REGION') |
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
SELECT pg_background.background('run_performance_tests', '(10)'); | |
SELECT pg_sleep(900); -- Sleeps for 900 seconds (15 minutes) | |
SELECT pg_background.background('run_performance_tests', '(10)'); | |
CREATE OR REPLACE FUNCTION run_performance_tests(iterations INT) | |
RETURNS VOID AS $$ | |
DECLARE | |
i INT; | |
BEGIN |
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 collections import defaultdict | |
from itertools import chain | |
from operator import methodcaller | |
# dictionaries with non-equal keys, values all lists for simplicity | |
one = {'a': {1, 2}, 'c': [5, 6], 'b': [3, 4], 'e': [6.2]} | |
two = {'a': {2.4, 3.4}, 'c': [5.6, 7.6], 'b': [3.5, 4.5], 'f': [1.3]} | |
three = {'a': [1.2], 'c': [3.4], 'b': [2.3], 'e': [3.1],'f':[1,2,3,4,5]} | |
dict_list = [one,two,three] |
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
############################ | |
# Build tools binaries in separate image | |
############################ | |
FROM golang:alpine AS tools | |
ENV TOOLS_VERSION 0.4.1 | |
RUN apk update && apk add --no-cache git \ | |
&& mkdir -p ${GOPATH}/src/github.com/timescale/ \ | |
&& cd ${GOPATH}/src/github.com/timescale/ \ |
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 gliderlabs/alpine:3.3 | |
RUN \ | |
apk --update add autoconf autoconf-doc automake c-ares c-ares-dev curl gcc libc-dev libevent libevent-dev libtool make man openssl-dev pkgconfig && \ | |
curl -o /tmp/pgbouncer-1.9.0.tar.gz -L https://pgbouncer.github.io/downloads/files/1.9.0/pgbouncer-1.9.0.tar.gz && \ | |
cd /tmp && \ | |
tar xvfz /tmp/pgbouncer-1.9.0.tar.gz && \ | |
cd pgbouncer-1.9.0 && \ | |
./configure --prefix=/usr && \ |
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
#!/bin/bash | |
# | |
# 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 | |
# distributed under the License is distributed on an "AS IS" BASIS, |
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 | |
from time import sleep | |
from concurrent.futures import ThreadPoolExecutor | |
# DOCS https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ThreadPoolExecutor | |
executor = ThreadPoolExecutor(2) | |
app = Flask(__name__) | |
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
#!/usr/bin/env python2 | |
# -*- coding: utf-8 -*- | |
import boto3 | |
class AmazonTask(object): | |
def __init__(self,amazon_key,secret_key,bucket_name): | |
self.amazon_key=amazon_key | |
self.bucket_name=bucket_name | |
self.aws_secret=secret_key |
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 amadeus import Flights | |
flights = Flights('QMrAAoM8koigSU9t1FCfWVALLoFT1DKv') | |
resp = flights.extensive_search( | |
origin='NCE', | |
destination='LAS', | |
departure_date='2017-11-25--2017-11-30', | |
duration='4--10') | |
print resp |
NewerOlder