Skip to content

Instantly share code, notes, and snippets.

View suzukimilanpaak's full-sized avatar

Tatsuya Suzuki suzukimilanpaak

  • Manchester, UK
  • 08:49 (UTC)
View GitHub Profile
@pgolding
pgolding / streamingbody.md
Last active January 30, 2024 16:28
Handling of StreamingBody Response from Invoking a Lambda Function

Handling of StreamingBody Response from Invoking a Lambda Function

When calling a Lambda Function via Boto3, the returned object is something like:

{u'Payload': <botocore.response.StreamingBody object at 0x7f8d5b62ac50>, 
'ResponseMetadata': {'RetryAttempts': 0, 'HTTPStatusCode': 200, 'RequestId': '5bdbb3ca-3b35-11e7-9816-397b140c3bac', 'HTTPHeaders': {'x-amzn-requestid': '5bdbb3ca-3b35-11e7-9816-397b140c3bac', 'content-length': '1636', 'x-amzn-trace-id': 'root=1-591ca199-00d34d5474d16275ec2c8d10;sampled=0', 'x-amzn-remapped-content-length': '0', 'connection': 'keep-alive', 'date': 'Wed, 17 May 2017 19:16:41 GMT', 'content-type': 'application/json'}}, u'StatusCode': 200}

The Payload parameter is <botocore.response.StreamingBody> which is a data streaming object.

@ryanmaclean
ryanmaclean / salt_on_mac.md
Last active March 10, 2024 10:38
Install and Run Salt Stack on macOS Servers and Desktops

Install Salt on macOS

Install Homebrew

Install Dependencies

brew install python swig zmq
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active July 14, 2024 18:27
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install [email protected]
brew unlink [email protected]
brew link postgresql
@diegopacheco
diegopacheco / main.tf
Last active August 14, 2021 19:08
Terraform + Localstack
provider "aws" {
region = "us-west-2"
access_key = "anaccesskey"
secret_key = "asecretkey"
skip_credentials_validation = true
skip_metadata_api_check = true
s3_force_path_style = true
endpoints {
s3 = "http://119.18.0.101:4572"
}
import collections
def sample():
# point 1. 属性はデコレータに文字列で与える。
@immutable(
'x1', 'y1', 'x2', 'y2',
'is_rectangle', 'is_line', 'is_dot')
class Region(object):
# point 2. __init__ ではなく、__new__ を使う。
@viveksoundrapandi
viveksoundrapandi / .py
Last active May 19, 2020 08:36
Forwardable in python
class Forwardable(object):
def __init__(self, *args, **kwargs):
self._delegates = []
return super().__init__(*args, **kwargs)
@property
def delegates(self):
return self._delegates
@delegates.setter