Skip to content

Instantly share code, notes, and snippets.

Sebastian Hesse seeebiii

Block or report user

Report or block seeebiii

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@seeebiii
seeebiii / README.md
Created Oct 1, 2018
Lambda function to help you having clean CloudWatch log groups
View README.md

Why

If you don't set a name for your Lambda functions, AWS will choose one for you based on the following pattern: [stack_name]-[function_name]-[random_hash]. The problem is there are certain cases where your Lambda function gets a new name, e.g. if you have to redeploy your stack or if you have renamed the logical resource id of your function. Then, CloudFormation will associate a new CloudWatch log group with your Lambda function. In the end, this means you'll have a lot of unused log groups and you might need some time to figure out which one is the most recent one.

How

Simple use this file as a Lambda function and call it e.g. once a day.

@seeebiii
seeebiii / cloudformation-lambda-serverless-proxy-template.yml
Last active Feb 11, 2019
Using proxy with AWS Lambda Serverless Application Model (SAM)
View cloudformation-lambda-serverless-proxy-template.yml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Example for a SAM Lambda function using {proxy+}.
Resources:
# Unfortunately, if you leave out the AWS::Lambda::Permission resource, the Api Gateway can't invoke your Lambda function, because
# the conversion of the 'Events:' section of 'ProxyTest' is missing to set the right permission.
# Resources to this problem:
# https://github.com/awslabs/serverless-application-model/issues/148
@seeebiii
seeebiii / LambdaConstants.java
Last active May 21, 2019
Available default environment variables in AWS Lambda. Just copy&paste into your Node or Java project.
View LambdaConstants.java
public class Constants {
/**
* Contains the path to your Lambda function code.
*/
public static final String LAMBDA_TASK_ROOT = System.getenv("LAMBDA_TASK_ROOT");
/**
* The environment variable is set to one of the following options, depending on the runtime of the Lambda function:
* AWS_Lambda_nodejs, AWS_Lambda_nodejs4.3, AWS_Lambda_nodejs6.10
@seeebiii
seeebiii / html-response.js
Created Jul 3, 2017
A collection of API Gateway responses using AWS Lambda. Send normal success response as well as JSON or HTML or a HTTP redirect.
View html-response.js
/**
* Return some HTML code.
*/
module.exports.handler = function(event, context, callback) {
callback(null, {
statusCode: 200,
body: '<html><body><h1>Hello World!</h1></body></html>',
headers: {
'Content-Type': 'text/html'
@seeebiii
seeebiii / NominatimSpecialPhrasesConverter.java
Last active Feb 25, 2017
A simple Java class to convert Nominatim special phrases. Outputs data as a key with list of values. Output is stored in JSON file.
View NominatimSpecialPhrasesConverter.java
package de.sebastianhesse.pbf.reader;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.LineIterator;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
@seeebiii
seeebiii / DijkstraOsmMapViewer.java
Last active Jan 27, 2017
Example to show how to call a Dijkstra algorithm using JMapViewer
View DijkstraOsmMapViewer.java
package de.sebastianhesse.pbf.viewer;
import org.openstreetmap.gui.jmapviewer.JMapViewer;
import org.openstreetmap.gui.jmapviewer.JMapViewerTree;
import org.openstreetmap.gui.jmapviewer.Layer;
import org.openstreetmap.gui.jmapviewer.MapMarkerDot;
import org.openstreetmap.gui.jmapviewer.OsmTileLoader;
import org.openstreetmap.gui.jmapviewer.events.JMVCommandEvent;
import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
import org.openstreetmap.gui.jmapviewer.interfaces.JMapViewerEventListener;
@seeebiii
seeebiii / OsmMapViewer.java
Last active Jan 27, 2017
Java class to startup a basic JMapViewer window
View OsmMapViewer.java
package de.sebastianhesse.gist.demo;
import org.openstreetmap.gui.jmapviewer.JMapViewer;
import org.openstreetmap.gui.jmapviewer.JMapViewerTree;
import org.openstreetmap.gui.jmapviewer.MapMarkerDot;
import org.openstreetmap.gui.jmapviewer.OsmTileLoader;
import org.openstreetmap.gui.jmapviewer.events.JMVCommandEvent;
import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
import org.openstreetmap.gui.jmapviewer.interfaces.JMapViewerEventListener;
import org.openstreetmap.gui.jmapviewer.tilesources.OsmTileSource;
@seeebiii
seeebiii / ExcelFormulas.js
Created Nov 18, 2016 — forked from pies/ExcelFormulas.js
Few Excel formulas - PMT, PPMT, XIRR - expressed in Javascript
View ExcelFormulas.js
/* Based on
* - EGM Mathematical Finance class by Enrique Garcia M. <egarcia@egm.co>
* - A Guide to the PMT, FV, IPMT and PPMT Functions by Kevin (aka MWVisa1)
*/
var ExcelFormulas = {
PVIF: function(rate, nper) {
return Math.pow(1 + rate, nper);
},
You can’t perform that action at this time.