AWS Lambda Triggers

The GUI has changed recently and it’s not as easy to find them.

They’re now in Lambda > Functions > Configuration in the Designer pane.

Assuming you’ve added a Trigger from the list on the left, then, to Enable, click on the Trigger and change it to Enabled.

http://www.snowcrash.eu/wp-content/uploads/2018/07/Screen-Shot-2018-07-20-at-09.56.31-300x192.png 300w, http://www.snowcrash.eu/wp-content/uploads/2018/07/Screen-Shot-2018-07-20-at-09.56.31-768x493.png 768w, http://www.snowcrash.eu/wp-content/uploads/2018/07/Screen-Shot-2018-07-20-at-09.56.31-588x377.png 588w, http://www.snowcrash.eu/wp-content/uploads/2018/07/Screen-Shot-2018-07-20-at-09.56.31.png 1143w" sizes="(max-width: 474px) 100vw, 474px" />

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-add-triggers-lam-console.html

AWS Lambda Handler

The Handler function for an AWS Lambda is specified by using the filename then function name. E.g. if the file is main.py and the handler function is entry.py then you’d use:

main.entry

Note, the defaults, if using the AWS console are lambda_function.lambda_handler.

 

vim – indent after curly brace, set tab to 4 spaces

https://stackoverflow.com/questions/234564/tab-key-4-spaces-and-auto-indent-after-curly-braces-in-vim

Primer on Go

Install

https://stackoverflow.com/questions/12843063/install-go-with-brew-and-running-the-gotour

https://golang.org/doc/install#install

Test

cd $HOME/go/src/hello

go build

./hello

Declaration

Basic

and more idiomatically:

Pointers

*string => pointer to a string

&message => use the memory location of the variable message

so this returns

Hello all%!(EXTRA *string=0xc42007a1c0)

whereas this:

returns the value. i.e.

Hello all%!(EXTRA string=Hello all)

Basic User Types

type Salutation string

or a more complex example:

type Salutation struct {

name string

greeting string

}

func main() {

var a = Salutation{name: “Bob”, greeting: “Hi” }

fmt.Println(s.greeting, s.name)

}

Getters / Setters and Scope

There are no Getters / Setters.

A capitalised variable is publicly visible from a package. E.g. Salutation.

Lowercase is not visible.

Constants

Outputs:

Note on iota. This is used in const delarations to increment numbers.

https://github.com/golang/go/wiki/Iota

A better example of using iotais probably this:

Note the implicit iotain the const for subsequent Weekdays.

Functions

  • Multiple return values
  • Use like any other type
  • Function literals

Note: function literals aka lambdas or closures are functions without a name.

https://programming.guide/go/anonymous-function-literal-lambda-closure.html

E.g. of function declaration:


package main

import "fmt"

type Salutation struct {
    name string
    greeting string
}

func Greet(salutation Salutation) {
    fmt.Println(salutation.greeting)
    fmt.Println(salutation.name)
}

func main() {
    var s = Salutation{name: "Bob", greeting: "Hi" }

    Greet(s)

}

tree – only show files with matching file name but not directories that don’t contain the file

I want to use tree to only show files that match a specific file name. E.g. filename.

The man page says:

However, I don’t want to show  directories that don’t contain that file.

Here’s how:

tree . -P filename --prune

and if you want to match on directories too then use:

tree . -P *match string* --matchdirs --prune

 

Your branch is ahead of by x commits – what’s changed?

So you do a git status and you see:

How do you check to see what you’ve changed (i.e. local and remote)?