Here's a step-by-step to get started scripting Minecraft with Python on Mac OSX
These instructions should work on any Ubuntu-based OS, but have only been tested on GalliumOS.
Copy and paste the following line into a terminal and press enter to install all the dependencies (you might already have some installed):
sudo apt update
sudo apt install python-software-properties python3 python3-pip idle3 git
sudo apt install openjdk-8-jre-headless openjdk-8-jdk maven
Exmaple handler given a DynamoDB table your-table with hash key uuid
.
const AWS = require('aws-sdk');
AWS.config.update({region: 'eu-west-1'});
const dynamo = new AWS.DynamoDB.DocumentClient({apiVersion: '2012-08-10'});
exports.handler = async (event) => {
//console.log('Received event:::', JSON.stringify(event));
#!/bin/bash | |
# This script downsizes video files from 1080 to 720 resolution using ffmpeg. | |
# It expects input files in ./movies and an output dir ./720. | |
transcode () | |
{ | |
file=$1 | |
indir=$2 | |
outdir=$3 |
jsaito@jahns-mbp > ~/projects/go/src/github.com/hashicorp/terraform > GITHUB_TOKEN=<REMOVED> GITHUB_ORGANIZATION=Bassetfroggs GITHUB_TEST_USER=servicejts GITHUB_TEST_COLLABORATOR=jsaito make testacc TEST=./builtin/providers/github
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/03/02 11:56:57 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/github -v -timeout 120m
=== RUN TestProvider
--- PASS: TestProvider (0.00s)
=== RUN TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
On terraform planning to update the (we removed some json content and marked it <REMOVED>
:
Path: terraform.tfplan
~ aws_opsworks_rails_app_layer.bookshelf-app
custom_json: "<REMOVED>"
~ aws_inspector_assessment_target.inspector
resource_group_arn: "arn:aws:inspector:eu-west-1:390571511014:resourcegroup/0-PQ6fNHHt" => "${aws_inspector_resource_group.inspector.arn}"
This gist describes how to set up a private Docker Registry on an AWS EC2 instance and how to secure it with TLS using a certificate by Let's Encrypt.
A Docker registry is a server side application that stores and lets you distribute Docker images. It runs in an own Docker container and the image is freely available. Let's Encrypt is a Certificate Authority that gives away TLS certificates for free.
We require the following three items to be set up correctly before we start.
AWS Lambda allows uploading from S3. The S3 object can be specified in the console.
There is bug when the Lambda and the S3 bug are both in AWS region eu-central-1
.
The S3 console gives the following resource url: https://s3.eu-central-1.amazonaws.com/xzy/lambda_function.zip
.
Inputing the url raises an error by the Lambda GUI.
The usual S3 endpoint domain is s3-{region-name}.amazonaws.com
(documentation).
The problem is that eu-central-1
region is deviating from this scheme, allowing s3.eu-central-1.amazonaws.com
(note the dot)).
This endpoint is given in by the console. Copy-and-pasting it reveals the incorrect validation in the Lambda GUI.
Day 1
- So there is
pyenv
. It seems to be the same asrbenv
. Noone seems to be using it. - There is nothing like
bundler
. I'm going withpip install -r requirements.txt
. This is like a mixture of aGemfile
and aGemfile.lock
but the actual libraries seem to be is stored globally. I am disappointed. - Testing. The standard choice here seems to be either
pytest
or the built in unit test. Neither of them seems to be BDD. Since Python does not have Ruby's blocks for writing DSLs everything looks really ugly compared to RSpec.
Day 2
- Ruby:
array.length
vs Pythonlen(list)
. Why do I have to call a globally defined function? Because the OO is done well? - In Ruby I can use inject with a block. Again, there are some functions in Python for
filter
,map
andreduce
. Thereduce
function was moved out of the standard library and into thefunctools
library. Here is an example inject Ruby vs Python:
array.inject(0) { |result, element| result * element }
The AWS API Gateway supports signed requests as follows. The API Gateway client can use IAM credentials to sign a request in two steps:
- The original request headers and body are signed using the SDK supplied by AWS and the credentials
- The signature sets the
X-Amz-SignedHeaders
header
In practice, there are two ways for signing from a Ruby client using the AWS SDK: (1) signing with a Faraday plugin, (2) creating a Specific Gateway client using the Seahorse API declaration.
Here is a code snippet for the more quick and dirty Faraday solution.