Install the dependencies from requirements.txt file.
pip install -r requirements.txt
Make the main.py file executable:
| class RangeIterator implements Iterator<number> { | |
| constructor(private n: number, private to: number) {} | |
| next(): IteratorResult<number> { | |
| if (this.n <= this.to) { | |
| return { done: false, value: this.n++ }; | |
| } else { | |
| return { done: true, value: undefined }; | |
| } | |
| } | |
| } |
| package middlewares | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "net/http" | |
| ) | |
| func Recovery(next http.Handler) http.Handler { | |
| return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| package main | |
| import ( | |
| "encoding/json" | |
| "github.com/masnun/gopher-and-rabbit" | |
| "github.com/streadway/amqp" | |
| "log" | |
| "math/rand" | |
| "time" | |
| ) |
| package main | |
| import ( | |
| "encoding/json" | |
| "log" | |
| "os" | |
| gopher_and_rabbit "github.com/masnun/gopher-and-rabbit" | |
| "github.com/streadway/amqp" | |
| ) |
| package main | |
| import ( | |
| "encoding/json" | |
| "net/http" | |
| "github.com/go-chi/chi" | |
| ) | |
| func main() { |
| import * as fs from "fs"; | |
| import * as AWS from "aws-sdk"; | |
| const BUCKET_NAME = "<<bucket name>>"; | |
| const IAM_USER_KEY = "<<user key>>"; | |
| const IAM_USER_SECRET = "<<user secret>>"; | |
| const s3bucket = new AWS.S3({ | |
| accessKeyId: IAM_USER_KEY, | |
| secretAccessKey: IAM_USER_SECRET |
| function wait(signal, ms) { | |
| return new Promise((res, rej) => { | |
| const timeOut = setTimeout(() => { | |
| console.log("I was called"); | |
| res("ok"); | |
| }, ms); | |
| signal.catch(err => { | |
| rej(err); | |
| clearTimeout(timeOut); |
| function wait(signal, ms) { | |
| return new Promise((res, rej) => { | |
| const timeOut = setTimeout(() => { | |
| console.log("I was called"); | |
| res("ok"); | |
| }, ms); | |
| signal.catch(err => { | |
| rej(err); | |
| clearTimeout(timeOut); |
| function wait(ms) { | |
| const ret = {}; | |
| const signal = new Promise((resolve, reject) => { | |
| ret.cancel = () => { | |
| reject(new Error("Promise was cancelled")); | |
| }; | |
| }); | |
| ret.promise = new Promise((res, rej) => { | |
| const timeOut = setTimeout(() => { |