Skip to content

Instantly share code, notes, and snippets.

View jdeathe's full-sized avatar
💭
Taking a break from development projects to focus other things

James Deathe jdeathe

💭
Taking a break from development projects to focus other things
View GitHub Profile
# From local checkout : clone repo
git clone git@github.com:jdeathe/centos-ssh-apache-php.git \
&& cd centos-ssh-apache-php
# Checkout release branch
git checkout centos-6
# Use --help for usage.
# Use --info to view command that will be run
# Note: -i | install, -u | uninstall
@jdeathe
jdeathe / Cloud-Init_MetadataRouter.php
Last active September 25, 2016 23:20
Mock a Cloud-Init metadata service for cloud-config testing with VirtualBox Guest VM
<?php
date_default_timezone_set(
'UTC'
);
// Mock Cloud-Init metadata service for cloud-config
// From VirtualBox host machine run:
// env METADATA_INSTANCE_ID="iid-5cd832f4bc69" sudo -E php -S 0.0.0.0:80 Cloud-Init_MetadataRouter.php
@jdeathe
jdeathe / containerised-local-dnsmasq.sh
Last active September 29, 2016 14:36
DNS cache / forwarder with catchall for .local and .localdoman addresses using docker and dnsmasq
# - Create an DNS container on localhost exposing the default tcp + udp port 53.
# - Disable the SSH features and process - using local docker.
# - Create a loopback alias with on 192.168.127.1/24 to allow routing between
# host and containers.
# - http://www.thekelleys.org.uk/dnsmasq/doc.html
# - http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html
LOOPBACK_ALIAS="192.168.127.1/24"
LOOPBACK_ALIAS_IP="${LOOPBACK_ALIAS%%/*}"
@jdeathe
jdeathe / rules.app-1.local.toml
Created October 25, 2016 22:55
Traefik (front-end/backend) rules configuration example for load balanced containers with front-end https://app-1.local
[backends]
[backends.http-pool-1]
[backends.http-pool-1.circuitbreaker]
expression = "NetworkErrorRatio() > 0.5"
[backends.http-pool-1.maxconn]
amount = 10240
extractorfunc = "request.host"
[backends.http-pool-1.LoadBalancer]
method = "drr"
@jdeathe
jdeathe / jdeathe.itermcolors
Created November 2, 2016 00:33
iterm2 colours
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
@jdeathe
jdeathe / jdeathe.zsh-theme
Last active November 2, 2016 00:40
zsh theme
# Based on the default theme for oh-my-zsh:
# https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/robbyrussell.zsh-theme
#
# 1. Copy theme file to: ~/.oh-my-zsh/custom/themes/
# 2. Set ZSH_THEME="jdeathe" in ~/.zshrc
local ret_status="%(?:%{$fg_bold[green]%}❯ :%{$fg_bold[red]%}❯ )"
PROMPT='${ret_status}%{$fg[blue]%}%c%{$reset_color%} $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[black]%}[%{$fg_bold[black]%}"
@jdeathe
jdeathe / containerised-tinyproxy-demo.sh
Last active November 14, 2016 10:37
Demonstration of usage of jdeathe/centos-ssh as a local proxy server. Could be used to tunnel a mobile device over hosts VPN for example.
# - Create an SSH container on localhost exposing the default port 22.
# - If you have a default SSH public key (i.e. ~/.ssh/id_rsa.pub) use that
# but if not the Vagrant insecure public key will be used.
# - Assumes that the docker bridge network is on 172.17.0.1/24
# - Assumes that the host network is 192.168.1.1/24
# - Connect client's (browser/mobile phone) to {host-public-ip-address}:8888 (or localhost:8888 from host).
docker pull jdeathe/centos-ssh:centos-7-2.1.2
eval "sudo -E $(
@jdeathe
jdeathe / centos-ssh--arukas.md
Last active December 19, 2016 00:20
Example Configuration of jdeathe/centos-ssh Docker image on the Arukas (https://app.arukas.io) CaaS

Example Configuration of jdeathe/centos-ssh on Arukas CaaS

In the following example the user, SSH public key and passwordless sudo access have been configured.

If you are intending to host anything publicly then don't forget to expose more than port 22 when creating the app.

centos-ssh--arukas.png

Public/Private SSH keys

@jdeathe
jdeathe / php-hello-world.svc.yml
Last active December 28, 2016 23:11
Kubernetes Service definition for php-hello-world app based on the Docker image jdeathe/centos-ssh-apache-php
apiVersion: v1
kind: Service
metadata:
name: php-hello-world
spec:
type: NodePort
ports:
- name: http
protocol: TCP
port: 80
@jdeathe
jdeathe / socat-ngrok-route.md
Last active February 22, 2017 14:01
Share an internal https (encrypted) host with a publicly accessible URL using http (unencrypted) using socat and ngrok.

Test an Internal HTTPS Host using HTTP on a Public Network.

Limitations

This does not rewrite URLs like a reverse proxy but can be useful for viewing a single page.

Install tools

socat