Skip to content

Instantly share code, notes, and snippets.

s3Buffer, numBytes, err := DownloadS3File(event.S3Bucket, event.S3ObjectID, session)
header, err = GetHeader(s3Buffer)
var outBuffer []byte
if HeaderIndicatesConversionNeeded(header) {
outBuffer, err = ConvertBuffer(s3Buffer, event.ObjectID)
} else {
// outBuffer = s3Buffer or copy(outBuffer, s3Buffer) or ??
@chewmanfoo
chewmanfoo / my code
Last active January 15, 2020 19:27
cdk problem
env = core.Environment(account=os.environ['CDK_DEFAULT_ACCOUNT'], region=os.environ['CDK_DEFAULT_REGION'])
these envars are set in my environment. I triple checked them.
I have this file containing a lot of this
authorized_cidr = ""
concourse_keys = ""
encryption_key = ""
instance_ami = ""
name_prefix = ""
postgres_database = ""
postgres_host = ""
postgres_password = ""
variable "task_name_suffixes" {
default = {
"0" = "lob-tables-01"
"1" = "datashack-tables-01"
"2" = "wexnet-tables-01"
"3" = "wexnet-tables-02"
"4" = "arch-tables-01"
"5" = "tiger-tables-01"
"6" = "tiger-tables-02"
"7" = "wwex-tables-01"
$ aws cloudformation list-stack-resources --stack-name $stack_name --query "StackResourceSummaries[][?ResourceType=='AWS::EC2::Instance'][]" --region $reg --profile $acct
[]
$ aws cloudformation list-stack-resources --stack-name $stack_name --query "StackResourceSummaries[][?ResourceType=='AWS::EC2::Instance'][*]" --region $reg --profile $acct
[]
$ aws cloudformation list-stack-resources --stack-name $stack_name --query 'StackResourceSummaries[*][?contains(ResourceType,`Instance`) == true].[ResourceType,ResourceStatus,LogicalResourceId]' --region $reg --profile $acct
[]
prompt$ aws ec2 describe-route-tables --filters "Name=route-table-id,Values=rtb-0f5e3e513a140d8c5" --query "RouteTables[*].Routes" --region eu-west-1 --profile sabre-as-dev-01
[
[
{
"Origin": "CreateRoute",
"DestinationCidrBlock": "10.179.216.0/24",
"State": "active",
"VpcPeeringConnectionId": "pcx-06756ed4585adc737"
},
{
JAMB3LHHTDD:admin-scripts sg0218049$ python -m pip install boto3
Traceback (most recent call last):
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/site-packages/pip/__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "/usr/local/lib/python2.7/site-packages/pip/_internal/__init__.py", line 5, in <module>
import logging
mylaptop:cleverfolder mycleverusername$ python cleverfile.py
Traceback (most recent call last):
File "cleverfile.py", line 3, in <module>
import ecshelper
File "/Users/mycleverusername/Documents/git.sabre.com/cleverfolder/ecshelper.py", line 3, in <module>
import boto3
ImportError: No module named boto3
mylaptop:cleverfolder mycleverusername$ pip install boto3
Requirement already satisfied: boto3 in /usr/local/lib/python2.7/site-packages (1.7.62)
(python-stuff) mylaptop:pythonstuff cleverusername$ python3 cleverfilename.py
File "cleverfilename.py", line 33
print 'Adding peer {} with cidr {} to route table {}'.format(peer, ids[peer], rtb)
^
SyntaxError: invalid syntax
@chewmanfoo
chewmanfoo / cf_templates_controller.rb
Created December 14, 2017 15:15
CfTemplatesController
# app/controllers/cf_deployments_controller.rb
class CfDeploymentsController < ApplicationController
before_action :set_cf_template
before_action :set_cf_template_cf_deployment, only: [:show, :update, :destroy]
# GET /cf_templates/:cf_template_id/cf_deployments
def index
json_response(@cf_template.cf_deployments)
end