Skip to content

Instantly share code, notes, and snippets.

@fortuna
fortuna / Queries.md
Last active October 24, 2024 06:44
Grafana dashboard for Outline Servers

Example Queries

1h active keys by location:

sum(max(increase(shadowsocks_data_bytes{access_key!=""} [1h])) by (access_key, location) > bool 0) by (location)

1h usage by location:

sum(increase(shadowsocks_data_bytes{dir=~"c<p|p>t"} [1h])) by (location)
@styblope
styblope / docker-api-port.md
Last active November 7, 2024 23:14
Enable TCP port 2375 for external connection to Docker

Enable TCP port 2375 for external connection to Docker

See this issue.
Docker best practise to Control and configure Docker with systemd.

  1. Create daemon.json file in /etc/docker:

     {"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
    
@woudsma
woudsma / portainer-dokku.md
Last active May 7, 2023 23:04
TLS secured TCP exposed Docker daemon on Dokku host - setup

TLS secured TCP exposed Docker daemon on Dokku host - setup

  1. Create certificates
  2. Edit Docker options
  3. Restart Docker
  4. Copy client certificates from host
  5. (optional) Add remote endpoint in Portainer

Tested on a standard $5/mo DigitalOcean VPS running Ubuntu 16.04.


@wynemo
wynemo / add_route
Last active February 20, 2023 16:47
openvpn over shadowsocks
# in /etc/sysctl.conf
# net.ipv4.ip_forward=1
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
iptables -A FORWARD -j REJECT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
@nilsmagnus
nilsmagnus / kafka_consumer.go
Created February 15, 2017 08:04
Example of go consuming from kafka, using the shopify/sarama library
package main
import (
"fmt"
"github.com/Shopify/sarama"
"os"
"os/signal"
"strings"
)
@walm
walm / main.go
Last active November 5, 2024 16:22
Simple Golang DNS Server
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)
@evantoli
evantoli / GitConfigHttpProxy.md
Last active November 2, 2024 11:32
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@PurpleBooth
PurpleBooth / README-Template.md
Last active November 7, 2024 01:08
A template to make good README.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

git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@lxneng
lxneng / gist:0b79d373cda4bdfe3dcc
Created August 6, 2014 06:21
mongodb distinct multiple fields
collection = db.getCollection('foo')
result = collection.aggregate(
[
{"$group": { "_id": { fa: "$fa", fb: "$fb" } } }
]
);
printjson(result);