Skip to content

Instantly share code, notes, and snippets.

@StevenACoffman
StevenACoffman / Docker Best Practices.md
Last active November 15, 2023 11:00
Docker Best Practices
View Docker Best Practices.md

Mistakes to Avoid: Docker Antipatterns

Whichever route you take to implementing containers, you’ll want to steer clear of common pitfalls that can undermine the efficiency of your Docker stack.

Don’t run too many processes inside a single container

The beauty of containers—and an advantage of containers over virtual machines—is that it is easy to make multiple containers interact with one another in order to compose a complete application. There is no need to run a full application inside a single container. Instead, break your application down as much as possible into discrete services, and distribute services across multiple containers. This maximizes flexibility and reliability.

Don’t install operating systems inside Docker containers

It is possible to install a complete Linux operating system inside a container. In most cases, however, this is not necessary. If your goal is to host just a single application or part of an application in the container, you need to install only the essential

@fotock
fotock / nginx.conf
Last active November 26, 2023 02:25 — forked from plentz/nginx.conf
Nginx SSL 安全配置最佳实践.
View nginx.conf
# 生成 dhparam.pem 文件, 在命令行执行任一方法:
# 方法1: 很慢
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# 方法2: 较快
# 与方法1无明显区别. 2048位也足够用, 4096更强
openssl dhparam -dsaparam -out /etc/nginx/ssl/dhparam.pem 4096
@croxton
croxton / SSL-certs-OSX.md
Last active November 24, 2023 08:43 — forked from leevigraham/Generate ssl certificates with Subject Alt Names on OSX.md
Generate ssl certificates with Subject Alt Names
View SSL-certs-OSX.md

Generate ssl certificates with Subject Alt Names on OSX

Open ssl.conf in a text editor.

Edit the domain(s) listed under the [alt_names] section so that they match the local domain name you want to use for your project, e.g.

DNS.1   = my-project.dev

Additional FQDNs can be added if required:

@dtoma
dtoma / epoll.cpp
Last active March 9, 2023 16:58
C++ epoll
View epoll.cpp
// https://banu.com/blog/2/how-to-use-epoll-a-complete-example-in-c/
// http://www.kegel.com/poller/
/** Todo
* - [ ] Split i/o and logic
* - [ ] Unit test logic
* - [ ] Logging
* - [ ] Continuous integration
* - [ ] Linux
* - [ ] Windows
@tevino
tevino / epoll.go
Last active April 30, 2023 02:07
An example of using epoll in Go
View epoll.go
package main
import (
"fmt"
"net"
"os"
"syscall"
)
const (
@d-schmidt
d-schmidt / redirectExample.go
Last active August 4, 2023 21:22
How to redirect HTTP to HTTPS with a golang webserver.
View redirectExample.go
package main
import (
"net/http"
"log"
)
func redirect(w http.ResponseWriter, req *http.Request) {
// remove/add not default ports from req.Host
target := "https://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {
@PurpleBooth
PurpleBooth / README-Template.md
Last active December 4, 2023 01:36
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@soarez
soarez / ca.md
Last active November 29, 2023 13:29
How to setup your own CA with OpenSSL
View ca.md

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@sanatgersappa
sanatgersappa / alt.go
Last active March 28, 2020 07:24
Alternative handler for multiple file uploads in Go.
View alt.go
package main
import (
"html/template"
"io"
"net/http"
"os"
)
//Compile templates on start