Skip to content

Instantly share code, notes, and snippets.

Bret Fisher BretFisher

Block or report user

Report or block BretFisher

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
BretFisher / present.zsh-theme
Last active Jul 1, 2019
oh-my-zsh theme for presentations (hides prompt features based on path)
View present.zsh-theme
# problem: when presenting, I want to obscure
# my prompt to act like it's at root of file system
# and be very basic with no git info, etc.
# solution: this theme lets you set a ENV to the path
# of your presentation, which will help remove unneeded prompt
# features while in that path
# oh-my-zsh theme for presenting demos
# based off the default rubbyrussell theme
BretFisher / repair-windows-update.bat
Last active May 8, 2019
Reset Windows Update components RE: KB971058
View repair-windows-update.bat
@echo off
REM Automation of Steps to Reset Windows Updates
REM Tested on Server 2012 R2, likely works on everything Win7/2008R2 and up
REM by Bret Fisher
REM also find this info and more in a blog article at
REM Origional Steps (identical to this):
REM This file Copyright MIT License
REM Stop Services
BretFisher /
Last active May 6, 2019
Install Docker PPA on Ubuntu 16.04
# NOT FOR SHELL SCRIPT, but rather just for quick copy paste
# this is a copy-paste version with defaults of the full shell script which is below this one in gist.
apt-get -y install apt-transport-https ca-certificates curl && \
curl -fsSL | sudo apt-key add - && \
add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable" && \
service lxcfs stop && apt-get remove -y -q lxc-common lxcfs lxd lxd-client && \
apt-get update -q && \
apt-get install -y -q docker-ce && \
printf '{ "userns-remap" : "default" , "storage-driver" : "overlay2" }' > /etc/docker/daemon.json && \
BretFisher /
Last active Apr 11, 2019
docker swarm upgrade

Replace your Swarm Manager and Workers with updated versions of docker

  • it's best to replace nodes, don't do apt/yum upgrades.
  • both would work, but VM replacment forces me to think of it as immutable and prevents making pets
  • if you don't want to update join scripts for manager IP's, then do something like Elastic IP's so manager IP's won't change.

Lets assume you have 3 managers and 3 workers on 17.06 and you want to update to 17.12

  • managers: m1, m2, m3
BretFisher / Dockerfile
Last active Feb 5, 2019
WIP sample Laravel php_fpm plus nginx plus supervisor Docker setup with npm, composer, bower, and more
View Dockerfile
FROM yourdockername/base-php-nginx:latest AS build
# the primary reason we have two build stages is so SSH key of private repo's will never
# be in final image
# It won't be copied to final image
# add this build arg to compose file
RUN if [ -z "$BUILDKEY" ]; then echo "BUILDKEY SSH NOT SET - ERROR"; exit 1; else : ; fi
BretFisher /
Last active Jan 25, 2019
Simple Apache + Nginx Reverse Proxy Example in Docker Compose
  1. download these two files to the same directory
  2. docker-compose up
  3. http://localhost should show you "it works" which is apache being reverse-proxied through nginx
  4. docker sets up DNS for web based on compose service name so the nginx front-end can find http://web
  5. proxy is set to listen on public port 80 on host so it'll receive incoming traffic, then push to httpd
BretFisher /
Created Apr 22, 2018
Docker Alias common stuff, mostly from oh-my-zsh
dcb='docker-compose build'
dcdn='docker-compose down'
dce='docker-compose exec'
dcl='docker-compose logs'
dclf='docker-compose logs -f'
dcps='docker-compose ps'
dcr='docker-compose run'
dcrestart='docker-compose restart'
dcrm='docker-compose rm'
BretFisher / copy-paste.txt
Last active Feb 28, 2018
install docker engine for swarm3k on Ubuntu 16.04. 2 options for installing
View copy-paste.txt
#option 1: copy and paste this into ssh to install docker engine
# NOTE: update --label=owner=YOURNAME below if you want to easily identify yours
apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
mkdir -p /etc/apt/sources.list.d && \
echo deb ubuntu-xenial main > /etc/apt/sources.list.d/docker.list && \
printf 'net.ipv4.neigh.default.gc_thresh1 = 30000\nnet.ipv4.neigh.default.gc_thresh2 = 32000\nnet.ipv4.neigh.default.gc_thresh3 = 32768' >> /etc/sysctl.conf && \
sysctl -p && \
service lxcfs stop && apt-get remove -y -q lxc-common lxcfs lxd lxd-client && \
apt-get update -q && apt-get install -y -q linux-image-extra-$(uname -r) linux-image-extra-virtual && \
BretFisher / .tmux.conf
Created Feb 25, 2017
My ugly tmux config, much copied from others and tweaked
View .tmux.conf
# tmux config for ultimate winning
# make tmux display things in 256 colors
#set -g default-terminal "screen-256color"
# use this if italic enabled in term profile
set -g default-terminal "tmux-256color"
# set just true color without custom term
#set -ga terminal-overrides ",xterm-256color:Tc"
# fixes bug:
#set -ga terminal-overrides ',xterm*:sitm=\E[3m'
BretFisher /
Last active Feb 28, 2018
Docker Cloud Swarm Connect Alias
# so docker cloud now has swarms fleet mgmt
# and you can use something like this to connect from cli to your swarm via docker remote api:
docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -e DOCKER_HOST dockercloud/client bretfisher/swarm1
# but maybe we can put that in a bash alias to make it easier
alias cswarm="docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -e DOCKER_HOST dockercloud/client"
cswarm bretfisher/dude-swarm1
You can’t perform that action at this time.