Skip to content

Instantly share code, notes, and snippets.

View josmardias's full-sized avatar

Josmar Dias josmardias

  • moises.ai
  • Vitória - ES, Brazil
View GitHub Profile
@rcknr
rcknr / README.md
Last active July 19, 2018 12:36
Using Let's Encrypt certificates with Amazon API Gateway

##Using Let's Encrypt certificates with AWS API Gateway

Before starting off with API Gateway set up it's worth mentioning that certificate configuration for this particular service is so far isn't well integrated, therefore different from other AWS services. Despite it using CloudFrount to serve on custom domains it won't let you customize distributions it creates, however all the limitations of CloudFront naturally apply to API Gateway. The most important in this case is the size of the key, which is limited by 2048 bit. Many tutorials provide ready to use terminal commands that have the key size preset at 4096 bit for the sake of better security. This won't work with API Gateway and you'll get an error message about certificate's validity or incorrect chain which won't suggest you the real cause of the issue. Another consideration is that to add a custom domain to API Gateway you have to have a certif

@vitormil
vitormil / pad.js
Last active August 29, 2015 14:21
pads the side of a string with a specific set of characters
function pad (text, padded_length, pad_string, pad_direction) {
pad_string = pad_string || " ";
text = text + "";
if (text.length >= padded_length) {
return text;
}
var pad_content = new Array(padded_length - text.length + 1).join(pad_string);
if (!pad_direction || pad_direction === "left") {
return pad_content + text;
} else {
  • 🎨 when improving the format/structure of the code
  • 🚀 when improving performance
  • ✏️ when writing docs
  • 💡 new idea
  • 🚧 work in progress
  • ➕ when adding feature
  • ➖ when removing feature
  • 🔈 when adding logging
  • 🔇 when reducing logging
  • 🐛 when fixing a bug
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@brettporter
brettporter / fix_maven_conflicts.rb
Created February 2, 2012 11:44
Automatically resolve conflicts in Maven POMs after a merge
#!/usr/bin/env ruby
require 'tempfile'
require 'optparse'
def parse_version(text)
if (text.match(/^\s*<version>\s*(.*?)\s*<\/version>\s*$/))
$1
else
nil