Skip to content

Instantly share code, notes, and snippets.

View noogen's full-sized avatar
¯\_(ツ)_/¯

Tom Noogen noogen

¯\_(ツ)_/¯
View GitHub Profile
# Config for Nginx to act as a front-end for Riak
# The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc)
# Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_)
# Config is in /etc/nginx/sites-available/default or somewhere like that
# Set up load-balancing to send requests to all nodes in the Riak cluster
# Replace these IPs/ports with the locations of your Riak nodes
upstream riak_hosts {
server 127.0.0.1:8098;
@mhermans
mhermans / gist:4959057
Last active September 5, 2018 19:49
schema -> turtle, Edamam recipe
# Source: getschema.org/microdataextractor?url=http://www.edamam.com/recipe/twentieth-century-cocktail-d0ecdc3a25d659e50177c42b3a3bc150&out=n3
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix schema: <http://schema.org/>.
<_:gs0>
rdf:type <http://schema.org/Recipe>;
schema:name "Twentieth Century Cocktail";
schema:url <http://www.saveur.com/article/Recipes/Classic-20th-Century-Cocktail>;
<!DOCTYPE HTML>
<html lang="en-GB" itemscope itemtype="http://schema.org/LocalBusiness">
<head prefix="og: http://ogp.me/ns#; dc: http://purl.org/DC/elements/1.1/">
<meta charset="utf-8" />
<title>A Look at Implementing HTML5 Microdata and Its Effect on Your SEO - Web Design</title>
<!-- SEO Tags -->
<!-- Dublin Core RDF -->
<meta property="dc:subject" content="Web Design" />
<meta property="dc:created" content="2013-11-12T04:19:22" />
@tmaiaroto
tmaiaroto / image-proxy.conf
Last active December 16, 2021 03:23
Nginx Image Filter Resize Proxy Service
# Feel free to change this path of course (and keys_zone value as well, but also change the usage of it below).
proxy_cache_path /var/www/cache/resized levels=1:2 keys_zone=resizedimages:10m max_size=1G;
# Gzip was on in another conf file of mine...You may need to uncomment the next line.
#gzip on;
gzip_disable msie6;
gzip_static on;
gzip_comp_level 4;
gzip_proxied any;
# Again, be careful that you aren't overwriting some other setting from another config's http {} section.
@visnup
visnup / listenOnPortOrSocketFile.js
Last active May 17, 2019 11:57
Listen on a TCP port or a UNIX socket file in node.js. Handle EADDRINUSE for the socket file by deleting it and re-listening.
var fs = require('fs')
, net = require('net')
, http = require('http')
, port = process.env.PORT;
var app = function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
};
<!DOCTYPE html>
<html lang="en" class="no-js" itemscope itemtype="http://schema.org/WebPage">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, width=device-width, initial-scale=1">
<title>[PageTitle]</title>
<!-- SEO Meta -->
@raucao
raucao / nginx-lua-s3.nginxconf
Last active September 8, 2020 01:29
Nginx proxy to S3
location ~* ^/s3/(.*) {
set $bucket '<REPLACE WITH YOUR S3 BUCKET NAME>';
set $aws_access '<REPLACE WITH YOUR AWS ACCESS KEY>';
set $aws_secret '<REPLACE WITH YOUR AWS SECRET KEY>';
set $url_full "$1";
set_by_lua $now "return ngx.cookie_time(ngx.time())";
set $string_to_sign "$request_method\n\n\n\nx-amz-date:${now}\n/$bucket/$url_full";
set_hmac_sha1 $aws_signature $aws_secret $string_to_sign;
set_encode_base64 $aws_signature $aws_signature;
@aalexeev239
aalexeev239 / meta.hbs
Last active September 18, 2018 11:53
OG markup
{{#if keywords}}
<meta name="keywords" content="{{keywords}}">
{{/if}}
{{#if description}}
<meta name="description" content="{{description}}">
{{/if}}
{{#if fb_app_id}}
<meta name="fb:app_id" content="{{fb_app_id}}">
{{/if}}
{{#each og}}
@slaFFik
slaFFik / wpms-smtp-disable-ssl-verify.php
Last active July 15, 2024 11:24
WP Mail SMTP: when using SMTP mailer - disable SSL verify on PHP 5.6+
<?php
add_filter('wp_mail_smtp_custom_options', function( $phpmailer ) {
$phpmailer->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
@lcrilly
lcrilly / README.md
Last active October 16, 2021 13:11
Workshop: Deploying NGINX as an API Gateway

Workshop: Deploying NGINX as an API Gateway

NGINX is the world’s number one API gateway, delivering the vast majority of today’s API traffic, deployed as standalone gateways or embedded in API management products. This workshop is about deploying NGINX as a lightweight API gateway in a way that supports long-term maintenance and can be automated with common DevOps tooling.

In this hands-on workshop, you will configure NGINX to perform the common API gateway functions of request routing, rate limiting, and authentication for multiple APIs. We will also touch on advanced use cases such as HTTP method enforcement, and JSON validation.

Previous experience of NGINX is valuable, but not essential. Technical requirements:

  • Mandatory: laptop with internet connection
  • Highly recommended: clean installation of NGINX (minimum 1.14.0) - limited assistance for this task will be available at the workshop