Skip to content

Instantly share code, notes, and snippets.

@wags
wags / letsencrypt_2017.md
Created December 1, 2017 20:34 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@wags
wags / automapper-snippets.md
Last active November 10, 2017 13:29
Automapper Snippets

Define the child mapping for collection properties on the contact

CreateMap<ApSupplier, ApSupplierDto>();
CreateMap<PoSupplier, PoSupplierDto>();
CreateMap<Customer, CustomerDto>();
CreateMap<Salesperson, SalespersonDto>();

Map from UniVerse mv.NET Entity to DTO

//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@wags
wags / dotnet-core-notes.md
Last active August 31, 2016 12:37
.NET Core notes

.NET Core

Command line setup

dotnet new

dotnet restore

dotnet run
@wags
wags / git-delete-remote-branch.md
Created June 7, 2016 20:17
Delete remote branch

git push origin --delete branch-name

Arq stores backup data in a format similar to that of the open-source version
control system 'git'.
Content-Addressable Storage
---------------------------
At the most basic level, Arq stores "blobs" using the SHA1 hash of the
contents as the name, much like git. Because of this, each unique blob is only
stored once. If 2 files on your system have the same contents, only 1 copy of
the contents will be stored. If the contents of a file change, the SHA1 hash is
different and the file is stored as a different blob.
@wags
wags / lint-shell-scripts.md
Created April 19, 2016 14:48
Lint Shell Scripts with Travis CI

Handy notes from this article.

git submodule add https://github.com/caarlos0/shell-travis-build.git build
cp build/travis.yml.example .travis.yml

Adds ShellCheck verification via Travis CI for any shell scripts in the repo.

@wags
wags / 00-about-search-api-examples.md
Created April 19, 2016 14:05 — forked from jasonrudolph/00-about-search-api-examples.md
5 entertaining things you can find with the GitHub Search API
@wags
wags / emoji_test.rb
Created April 19, 2016 13:48 — forked from holman/emoji_test.rb
A snapshot of the tests we use internally at GitHub to help edit our blog posts before they go out to everybody. For more information, take a peek at http://zachholman.com/posts/how-github-writes-blog-posts
require_relative "test_helper"
require "open-uri"
require "net/http"
class EmojiTest < Blog::Test
def test_no_emoji
posts.each do |post|
content = File.read(post)
refute_match /:[a-zA-Z0-9_]+:/, content,
@wags
wags / elasticsearch-snippet-shard-reallocation.md
Last active December 29, 2015 20:30
Elasticsearch snippet for disabling / enabling shard reallocation. Useful when performing a rolling restart of the cluster, like during an upgrade.

Use this code before performing a rolling restart of an Elasticsearch cluster. The transient field means that the setting will be reset the next time Elasticsearch is restarted on the node.

Disable

PUT /_cluster/settings
{
  "transient": {
    "cluster.routing.allocation.enable": "none"
 }