I recently did some work to optimize the network configuration of a CentOS 8 based web server that receives a lot of traffic.
There is a lot of information on the web for this and it distills down to a minimum recommended configuration, and a recommended configuration.
The minimum recommended configuration should be sufficient for servers with less than 10Gb, and the recommended configuration should be sufficient for servers with 10Gb or more.
At Vimeo, on the transcoding team, we work a lot with Go, and a lot with C, for various tasks such as media ingest. This means we use CGO quite extensively, and consequently, have run into bits that are perhaps not very well documented, if at all. Below is my effort to document some of the problems we've run into, and how we fixed or worked around them.
Many of these are obviously wrong in retrospect, but hindsight is 20/20, and these problems do exist in many codebases currently.
Some are definitely ugly, and I much welcome better solutions! Tweet me at @daemon404 if you have any, or have your own CGO story/tips, please! I'd love to learn of them.
Table of Contents
package main | |
import ( | |
"fmt" | |
"golang.org/x/net/http2/hpack" | |
) | |
func main() { | |
fmt.Println("nginx", "→", Encode("MYWS")) | |
fmt.Println("nginx", "→", Encode("nginx")) |
This is a script written in Python intended to run alongside a Zcash node and export statistics for monitoring purposes. It assumes the existence of zcash-cli in the PATH and access to the RPC interface over localhost.
It tracks stuff like: block height, difficulty, number of peers, network solutions per second, errors, mempool size, size of recent blocks, number of transactions within blocks, chaintips, total bytes received and sent, transaction inputs and outputs, and the make-up of transactions in terms of JoinSplits, shielded, unshielded or mixed. These Zcash metrics are refreshed once every 2 minutes.
Prometheus is a monitoring system and time-series database.
- Download release 2.1 for your architecture https://github.com/mmatczuk/go-http-tunnel/releases/tag/2.1
- Move
tunneld
to/usr/local/bin/tunneld
- Create user
useradd -r tunneld
- Create
/etc/tunneld
- Install Certstrap 1.1.1 to
/usr/local/bin/certstrap
// Attempt at making a Boost grammar that successfully parses Jason Shankel's predicate logic language | |
// #define BOOST_SPIRIT_DEBUG | |
#include <boost/spirit/include/qi.hpp> | |
#include <boost/variant/recursive_variant.hpp> | |
#include <boost/fusion/include/adapt_struct.hpp> | |
#include <boost/spirit/include/phoenix.hpp> | |
#include <boost/optional.hpp> | |
// start with the AST |
// C module for data stack manager | |
// See below for lua lib wrapper | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
#define MINCAP 128 |
local account = "[email protected]" -- use your own gmail account | |
local password = "password" -- if you enable 2-phase authentication, you need to | |
-- generate and use a application-specific password here... | |
local sender_name = "Jon Snow" | |
local recipient = "[email protected]" | |
local recipient_name = "Arya Stark" | |
local mail_title = "This is a test mail" | |
local mail_body = [[<html><body><p>Mail Body...</body></html>]] |
Using JSON in Postgres by example.
- Download and install: Docker Toolbox
- Open Docker Quickstart Terminal
- Start a new postgres container:
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres