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
"""Boto3 client response handler.""" | |
import boto3 | |
class ClientHandler: | |
"""Boto3 client response handler.""" | |
__slots__ = ["client", "method", "key"] | |
def __init__(self, client, method, key): | |
"""Override.""" |
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
"""Boto3 client response handler.""" | |
import boto3 | |
class ClientHandler: | |
"""Boto3 client response handler.""" | |
__slots__ = ["client", "method", "key", "paginator"] | |
def __init__(self, client, method, key): | |
"""Override.""" |
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
#include <iostream> | |
using namespace std; | |
struct record_t | |
{ | |
int id; | |
}; | |
void Mutable(record_t &record); |
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 | |
# Connect to mongo db's via an ssh tunnel, | |
# get a list of dbs to create DMS source endpoints | |
# dms_source_endpoints.sh port proxy [ name:dns:port ... ] | |
create-ssh-tunnel() { | |
local endpoint=$1 | |
ssh -L $tunnel_port:$endpoint $proxy -N & | |
echo $! |
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
yum install -y amazon-efs-utils; mkdir -p /efs; mount -t efs fs-id:/ /efs |
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
""" | |
Sum of multiples. | |
l the limit | |
m the multiple | |
c the count the number of multiples (l / m) | |
s the sum of (mc + mc^2) / 2 for each multiple of m to l | |
for multiple multiples, subtract the sum of the multiples | |
that are common between the multiples |
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
# Needs to run as root | |
yum update -y | |
amazon-linux-extras install docker | |
systemctl enable docker | |
usermod -a -G docker ec2-user | |
# The above can go into user-data, | |
# but you'll still need to reboot because of the group add | |
reboot |
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
#444043,#444043,#F0A141,#ffffff,#df6d33,#Ffffff,#57c1ad,#cb2c42 |
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 | |
echo ECS_CLUSTER=My-Cluster >> /etc/ecs/ecs.config | |
echo ECS_BACKEND_HOST= >> /etc/ecs/ecs.config |
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
"""Multiprocessing and threading.""" | |
import logging | |
import multiprocessing.pool | |
import random | |
import threading | |
import time | |
logging.basicConfig( | |
level=logging.INFO, |