Skip to content

Instantly share code, notes, and snippets.

View djvdorp's full-sized avatar

Daniel van Dorp djvdorp

View GitHub Profile
@djvdorp
djvdorp / docker-machine-rename
Created March 17, 2018 20:19 — forked from alexproca/docker-machine-rename
Rename docker-machine
#!/usr/bin/env bash
#copy this in a folder from path ex: /usr/local/bin
#usage: docker-machine-rename default my-default
OLD_MACHINE_NAME=${1:-default};
NEW_MACHINE_NAME=${2:-my-default-2};
STORE_PATH=`docker-machine inspect $OLD_MACHINE_NAME | grep -m 1 StorePath | cut -d ':' -f 2 | cut -c 3- | rev | cut -c 3- | rev`;
mv "$STORE_PATH/machines/$OLD_MACHINE_NAME" "$STORE_PATH/machines/$NEW_MACHINE_NAME";
cp "$STORE_PATH/machines/$NEW_MACHINE_NAME/config.json" "$STORE_PATH/machines/$NEW_MACHINE_NAME/config.json.bak"
@djvdorp
djvdorp / main.go
Created January 7, 2018 18:18 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@djvdorp
djvdorp / memcached@.service
Created November 21, 2017 21:15 — forked from coolswitcher/memcached@.service
Multiple memcached instances systemd script
[Unit]
Description=memcached daemon for %i
After=network.target
[Service]
ExecStart=/usr/share/memcached/scripts/systemd-memcached-wrapper /etc/memcached_%i.conf
[Install]
WantedBy=multi-user.target
@djvdorp
djvdorp / letsencrypt_2017.md
Created September 14, 2017 06:16 — 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.

@djvdorp
djvdorp / DNS tunneling with iodine.md
Created August 12, 2017 19:07 — forked from nukeador/DNS tunneling with iodine.md
How to install and use iodine for DNS tunneling.

##Domain

We need some records on our domain (mydomain.com) DNS for connections. Add these records:

t1              IN      NS      t1ns.mydomain.com. ; note final the dot!
t1ns            IN      A       OUR_SERVER_IP

##Server

@djvdorp
djvdorp / iptables_rules.sh
Created December 8, 2016 14:26 — forked from virtualstaticvoid/iptables_rules.sh
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
@djvdorp
djvdorp / observium-client.sh
Created November 4, 2016 06:44
Mirror of the observium-client.sh script from SonixBoxes.com (https://www.sonicboxes.com/observium-client-install-script/)
#!/bin/bash
## Obserivum Client Setup Script
## v.0.5 - 12/15/13 - nunim@sonicboxes.com
## Tested on Debian 6/7 & Ubuntu 12.04+ - CentOS 5.8/6.4
## Useage: ./observium-client.sh <Community> <Contact Email>
## check if root
if [ $(whoami) != "root" ]; then
echo "You need to run this script as root."
echo "Use 'sudo ./observium-client.sh' then enter your password when prompted."
exit 1
@djvdorp
djvdorp / librenms.example.com.conf
Created October 31, 2016 06:34
LibreNMS /etc/nginx/sites-enabled/librenms.example.com.conf for nginx using TLS and HTTP2 by default
server {
listen 80 default_server;
listen [::]:80 default_server;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
[clever@amd-nixos:~/apps/nixpkgs]$ git remote -v
channels git@github.com:NixOS/nixpkgs-channels.git (fetch)
channels git@github.com:NixOS/nixpkgs-channels.git (push)
origin git@github.com:NixOS/nixpkgs.git (fetch)
origin git@github.com:NixOS/nixpkgs.git (push)
[clever@amd-nixos:~/apps/nixpkgs]$ git fetch channels
8512747..adfcc2d nixos-unstable -> channels/nixos-unstable
[clever@amd-nixos:~/apps/nixpkgs]$ git checkout channels/nixos-unstable
M nixos/lib/make-squashfs.nix
M pkgs/top-level/platforms.nix
@djvdorp
djvdorp / golang-tls.md
Created September 6, 2016 14:42 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key