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 aioboto3 | |
from types_aiobotocore_dynamodb.service_resource import Table | |
class DynamoDBBatchWriter: | |
""" | |
A class that batches up to 25 writes to DynamoDB. Flushes automatically when the batch reaches 25 items, | |
5 seconds pass, or when the `flush()` method is called. | |
This class is not thread-safe. |
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 asyncio | |
from typing import Any, AsyncGenerator, Coroutine, Generator, Never | |
class Channel: | |
def __init__(self, maxsize: int = 0): | |
self._queue: asyncio.Queue = asyncio.Queue(maxsize=maxsize) | |
async def push(self, item): | |
return await self._queue.put(item) |
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
Thu May 7 15:18:29 UTC 2020 |
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
#!/usr/bin/python.exe -u | |
import subprocess | |
import boto3 | |
# constants | |
INSTANCE_NAME = 'Development' | |
SSHFS_CMD = '/usr/bin/sshfs' | |
MOUNT_POINT = '/awsec2' |
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
#!/usr/bin/python.exe -u | |
import subprocess | |
import boto3 | |
# constants | |
INSTANCE_NAME = 'Development' | |
SSHFS_CMD = 'C:/Tools/sshfs/sshfs.exe' | |
PRIVATE_KEY_FILE = 'C:/Certs/aws.pem' | |
DRIVE_LETTER = 'n' |
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
function getMiddle(s){ | |
var m = s.length / 2 | |
return s.slice(m - 1 + s.length % 2, m + 1) | |
} |
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
function flatten(arr) { | |
var result = []; | |
// iterate through array | |
for(var i = 0; i < arr.length; i++) { | |
// check if number or array | |
if(typeof arr[i] === "object") { | |
// push values of array recursively | |
Array.prototype.push.apply(result, flatten(arr[i])); | |
} else if (typeof arr[i] === "number") { | |
// push number to end of array |
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
<?php namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
trait RestControllerTrait | |
{ | |
public function index() | |
{ | |
$m = self::MODEL; | |
return $this->listResponse($m::all()); |