Skip to content

Instantly share code, notes, and snippets.

View made2591's full-sized avatar
🎯
Focusing

Matteo Madeddu made2591

🎯
Focusing
View GitHub Profile
@made2591
made2591 / main.go
Created January 16, 2018 17:33 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@made2591
made2591 / TMDB.go
Created March 11, 2018 10:29
A TheMovieDB wrapper in Go ready to be build over AWS Lambda.
package main
import (
"os"
"fmt"
"errors"
"strings"
"net/http"
"encoding/json"
"github.com/aws/aws-lambda-go/lambda"
@made2591
made2591 / main.py
Created March 24, 2018 14:53
AWS Lambda Python to handle actions defined in a configuration file over S3
import boto3
import os
import json
##############################################################
###################### Check context #########################
##############################################################
def check_context(event):
if event["context"] in contexts.keys():
#!/bin/bash
set -o errtrace -o nounset -o pipefail -o errexit
echo "hello world"
@made2591
made2591 / body-template
Created March 24, 2018 14:55
Body Mapping template to get JSON from Slack Command post request
## convert HTML POST data or HTTP GET query string to JSON
## get the raw post data from the AWS built-in variable and give it a nicer name
#if ($context.httpMethod == "POST")
#set($rawAPIData = $input.path('$'))
#elseif ($context.httpMethod == "GET")
#set($rawAPIData = $input.params().querystring)
#set($rawAPIData = $rawAPIData.toString())
#set($rawAPIDataLength = $rawAPIData.length() - 1)
#set($rawAPIData = $rawAPIData.substring(1, $rawAPIDataLength))
@made2591
made2591 / docker-compose.yaml
Last active March 5, 2019 23:44
A docker compose to start up a proxy and a simple web server for illustrative purposes
version: "3"
services:
proxy:
container_name: proxy
restart: always
image: debian:jessie
privileged: true
ports:
- "80:80"
networks:
@made2591
made2591 / README.md
Created July 19, 2019 14:25
Flattener

Flattener

Flattener is a utility to flatten an array of arbitrarily nested arrays of integers into a flat array of integers.

Getting Started

To run the project, just create a folder and put the file flattener.js, test.js and package.json inside.

Prerequisites

@made2591
made2591 / keybase.md
Created August 13, 2019 08:09
My keybase proof

Keybase proof

I hereby claim:

  • I am made2591 on github.
  • I am made2591 (https://keybase.io/made2591) on keybase.
  • I have a public key whose fingerprint is 465F 151A 2CB3 B5E3 3A13 83ED D623 0745 6844 BE6C

To claim this, I am signing this object:

...
func f1(x int) (int, string) {
return x + 1, fmt.Sprintf("%d+1", x)
}
func f2(x int) (int, string) {
...
x := 0
log := "Ops: "
res, log1 := f1(x)
log += log1 + "; "
res, log2 := f2(res)
log += log2 + "; "