Skip to content

Instantly share code, notes, and snippets.

View jplaza's full-sized avatar

Juan Antonio Plaza jplaza

View GitHub Profile
@henhan
henhan / nginx_documentation.md
Last active January 23, 2025 13:37
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

@lilactown
lilactown / cljs-serverless.md
Last active January 27, 2020 05:06
CLJS in AWS Lambda Quick Start
@pesterhazy
pesterhazy / re-natal-error-handling.cljs
Created September 4, 2017 21:44
Re-natal, reagent, react native error handling improved
;; Unfortunately, re-natal's stacktraces are not always great.
;;
;; The following two functions (downgrade-reagent-errors and set-error-handler)
;; give you better error messages in the Debug console (accessible in XCode
;; or using `react-native log-ios`).
;;
;; This should apply mutatis mutandis to Android.
(defonce !handler-set (atom false))
@heathdutton
heathdutton / aws-eb-cron.sh
Last active August 16, 2020 09:45
Execute cron tasks in elastic beanstalk on only one instance with this.
#!/usr/bin/env bash
# Prevent cron tasks from being ran by multiple instances in Elastic Beanstalk.
# Automatically adjusts to new "leading instance" when scaling up or down.
# Stores the result in an environment variable for other uses as AWS_EB_CRON
#
# This must be ran by cron as the root user to function correctly.
# Anything after this file will be executed as webapp for security.
#
# Example Cron (should be created by .ebextensions):
@marcelog
marcelog / aws-sqs.policy
Last active December 4, 2023 07:07
SQS Policy to allow an S3 bucket to publish messages
{
"Version": "2012-10-17",
"Id": "arn:aws:sqs:YOUR-AWS-REGION:YOUR-AWS-ACCOUNT-ID:YOUR-QUEUE-NAME/SQSDefaultPolicy",
"Statement": [
{
"Sid": "example-statement-ID",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
@atorralb
atorralb / iterate_through_pagination_in_nightmare.js
Created April 9, 2016 00:16
iterate through a pagination site with nightmarejs
var Nightmare = require('nightmare');
var vo = require('vo');
vo(run)(function(err, result) {
if (err) throw err;
});
fu
;; Auto-scrolling ==============================================================
(defn scroll! [el start end time]
(.play (goog.fx.dom.Scroll. el (clj->js start) (clj->js end) time)))
(defn scrolled-to-end? [el tolerance]
;; at-end?: element.scrollHeight - element.scrollTop === element.clientHeight
(> tolerance (- (.-scrollHeight el) (.-scrollTop el) (.-clientHeight el))))
(defn autoscroll-list [{:keys [children class scroll?] :as opts}]
@jasongilman
jasongilman / atom_clojure_setup.md
Last active May 11, 2024 02:25
This describes how I setup Atom for Clojure Development.

Atom Clojure Setup

This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.

Install Atom

Download Atom

The Atom documentation is excellent. It's highly worth reading the flight manual.

@rauhs
rauhs / om.next+pedestal+transit.clj
Last active December 10, 2017 17:08
Om.next tempid handling for pedestal. Interceptors.
(ns srs-s.routes.core
(:require [io.pedestal.http :as pedestal]
[io.pedestal.http.route.definition :refer [defroutes]]
[io.pedestal.interceptor.helpers :as interceptor]
[io.pedestal.http.body-params :as body-params]
[ring.util.response :as ring-response]
[cognitect.transit :as transit]
[om.next.server :as om]
[om.tempid :as tempid])
(:import [java.io OutputStream]
@ikitommi
ikitommi / validator.clj
Last active February 16, 2016 05:07
Dummy implementation of Schema Map validator (to get more humane errors)
(require '[schema.core :as s])
(require '[schema.utils :as su])
(defn check-map [schema value]
{:pre [(map? value)]}
(if-let [value (s/check schema value)]
(into {}
(for [[k v] value]
[k (cond
(symbol? v) (keyword v)