Skip to content

Instantly share code, notes, and snippets.

View henhan's full-sized avatar

Henrik Hansson henhan

View GitHub Profile
@henhan
henhan / nginx_documentation.md
Last active April 15, 2024 02:31
Extend and override nginx config for Elastic Beanstalk Amazon Linux 2

Extend and override nginx config for Elastic Beanstalk Amazon Linux 2

Documentation on how to override or extend the default nginx config on Elastic Beanstalk running om Amazon Linux 2. Correct as of 2021-08-01. Also see the general documentation on how to extend linux servers.

All references to placing files refer to putting a file at this location in your application bundle. You should never modify a file directly at your Elastic Beanstalk server by ssh:ing to the server, since such a change will be wiped whenever your servers autoscale or if you rebuild your application completely.

Adding a new location block

The easiest extension is to add a new location block to the main server block. This can be done by placing a .conf file with a server block in the folder .platform/nginx/conf.d/elasticbeanstalk. Any such file is automatically included in the main server block.

Overriding the default location

Keybase proof

I hereby claim:

  • I am henhan on github.
  • I am henhan (https://keybase.io/henhan) on keybase.
  • I have a public key ASAXnzRSeeDfTJ89adHhn2J-Z35OhV0Qv7NmpJoTNSQWCgo

To claim this, I am signing this object:

@henhan
henhan / historyEnable.js
Created September 28, 2016 15:35
History enabling redux reducer decorator
'use strict';
function historyEnable(reducer) {
var initObject = {
past: [],
present: reducer(undefined, {}),
future: []
};
'use strict';
function isValid(id) {
// Make sure we have a string
id = '' + id;
if (id.match(/^[\-\s+\d]+$/) === null) {
return false;
}
// Remove all non digits
id = id.replace(/\D/g, '')
@henhan
henhan / SwedishIdUtils.java
Last active April 7, 2016 06:12
Robust validation of Swedish personal ID in java
import java.util.Calendar;
public class SwedishIdUtils {
public static boolean validateId(String id) {
// Only allow digits, whitespace + and - (+ is sometimes used to indicate age greater than 100 years)
if (id == null || !id.matches("^[\\-\\s\\+\\d]+$")) {
return false;
}
// Remove all non digits