Skip to content

Instantly share code, notes, and snippets.

View seeebiii's full-sized avatar
🏠
Working remotely

Sebastian Hesse seeebiii

🏠
Working remotely
View GitHub Profile
@seeebiii
seeebiii / ExcelFormulas.js
Created November 18, 2016 16:34 — forked from pies/ExcelFormulas.js
Few Excel formulas - PMT, PPMT, XIRR - expressed in Javascript
/* 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);
},
@seeebiii
seeebiii / OsmMapViewer.java
Last active January 27, 2017 19:09
Java class to startup a basic JMapViewer window
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 / DijkstraOsmMapViewer.java
Last active January 27, 2017 19:08
Example to show how to call a Dijkstra algorithm using JMapViewer
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 / NominatimSpecialPhrasesConverter.java
Last active February 25, 2017 10:56
A simple Java class to convert Nominatim special phrases. Outputs data as a key with list of values. Output is stored in JSON file.
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 / html-response.js
Created July 3, 2017 17:09
A collection of API Gateway responses using AWS Lambda. Send normal success response as well as JSON or HTML or a HTTP redirect.
/**
* 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 / LambdaConstants.java
Last active February 9, 2024 04:17
Available default environment variables in AWS Lambda. Just copy&paste into your Node or Java project.
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 / cloudformation-lambda-serverless-proxy-template.yml
Last active February 11, 2019 15:12
Using proxy with AWS Lambda Serverless Application Model (SAM)
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 / README.md
Created October 1, 2018 20:52
Lambda function to help you having clean CloudWatch log groups

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 / mac_installation.sh
Last active April 18, 2023 10:56
Personal install script for a new Mac using Homebrew. Installs various helpful software for my development process.
#!/bin/bash
# install Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew update
# install browsers
brew cask install google-chrome
brew cask install firefox