Skip to content

Instantly share code, notes, and snippets.

@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);
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
@PurpleBooth
PurpleBooth / README-Template.md
Last active June 1, 2024 22:23
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

@evantoli
evantoli / GitConfigHttpProxy.md
Last active June 1, 2024 18:25
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:

@walm
walm / main.go
Last active May 15, 2024 06:01
Simple Golang DNS Server
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)
@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"
)
@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
@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.


@styblope
styblope / docker-api-port.md
Last active May 24, 2024 03:00
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"]}