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
[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
@djvdorp
djvdorp / i3-cheat-sheet.md
Created September 2, 2016 12:34 — forked from miguelmota/i3-cheat-sheet.md
i3 Window Manager Cheat Sheet

i3 Window Manager Cheat Sheet

$mod refers to the modifier key (window/command or alt by default depending on config)

General

  • startx i3 start i3 from command line
  • $mod+<Enter> open a terminal
  • $mod+d open dmenu (text based program launcher)
  • $mod+r resize mode ( or to leave resize mode)
  • $mod+shift+e exit i3
@djvdorp
djvdorp / README.md
Created August 30, 2016 08:03 — forked from actionjack/README.md
How to Review Changes between Cloud Foundry Releases

How to Review Changes between Cloud Foundry Releases

This gist decribes a recommended way to review the differences between Cloud Foundry releases so they can be applied to our environments.

There are multiple ways listed to check the differences but typically you want to

  • Use git diff to see what has changed between release branches
  • Check the spec files to see the default options of the items that have been introduced or changed
  • Generate two Cloud Foundry manifests from each release and compare the two using spiff diff