Skip to content

Instantly share code, notes, and snippets.

View rkuzsma's full-sized avatar

Rich Kuzsma rkuzsma

View GitHub Profile
@rkuzsma
rkuzsma / docker-bash-completion.md
Last active June 13, 2025 09:59
How to configure Bash Completion on Mac for Docker and Docker-Compose

How to configure Bash Completion on Mac for Docker and Docker-Compose

Copied from the official Docker-for-mac documentation (thanks Brett for the updated doc pointer):

Install shell completion

Docker Desktop for Mac comes with scripts to enable completion for the docker, docker-machine, and docker-compose commands. The completion scripts may be found inside Docker.app, in the Contents/Resources/etc/ directory and can be installed both in Bash and Zsh.

Bash

Bash has built-in support for completion To activate completion for Docker commands, these files need to be copied or symlinked to your bash_completion.d/ directory. For example, if you installed bash via Homebrew:

@rkuzsma
rkuzsma / gist:0ceefeb3739b96d16b04342cbc5fe54a
Created May 16, 2019 18:10
How to run an old Firefox browser in Docker Ubuntu with VNC
```
docker run -p 6080:80 -v /dev/shm:/dev/shm dorowu/ubuntu-desktop-lxde-vnc
```
Browse to http://127.0.0.1:6080/
In the VNC UI, run the LXTerminal. Paste these commands to install a given version of Firefox. Set `FF_VERS` to the release you want. See available releases at http://releases.mozilla.org/pub/firefox/releases
```
apt-get update && apt-get install wget
@rkuzsma
rkuzsma / gist:b9a0e342c56479f5e58d654b1341f01e
Last active May 18, 2024 15:40
Example Kubernetes yaml to pull a private DockerHub image
Step by step how to pull a private DockerHub hosted image in a Kubernetes YML.
export DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/
export DOCKER_USER=Type your dockerhub username, same as when you `docker login`
export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`
kubectl create secret docker-registry myregistrykey \
--docker-server=$DOCKER_REGISTRY_SERVER \
--docker-username=$DOCKER_USER \
@rkuzsma
rkuzsma / get-k8s-node-ip-addresses.sh
Created January 5, 2017 03:33
Get external IP address of Kubernetes nodes
#!/bin/bash
kubectl get nodes --selector=kubernetes.io/role!=master -o jsonpath={.items[*].status.addresses[?\(@.type==\"ExternalIP\"\)].address}
@rkuzsma
rkuzsma / update_etc_hosts.sh
Last active February 2, 2023 07:12
Bash function to add a hostname:ip entry into your /etc/hosts file
#!/bin/bash
# Usage:
# update_etc_hosts "some-host-name" "some-ip-addr"
update_etc_hosts () {
HOST_NAME=$1
HOST_IP=$2
NO_SUDO=$3
HOST_ENTRY="$HOST_IP $HOST_NAME"
HOSTS_FILE="/etc/hosts"
TMPFILE=$(mktemp)
@rkuzsma
rkuzsma / install-node-10-raspberry-pi.md
Created January 2, 2023 00:37
How to install node 10 on Raspberry Pi 3

I couldn't get the current version of NodeJS to install on Raspberry Pi. I kept getting errors like this during installation:

node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by node)
node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by node)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `nvm use --delete-prefix v12.2.0` to unset it.

I manually installed an older version of Node and npm using a tarball download. Note that I had to use the armv6l, not armv7, to prevent the error.

@rkuzsma
rkuzsma / WaitFor.java
Created December 30, 2016 03:54
Java utility class to wait for ports and URL responses to be available
/**
* General utilities to wait for ports and URL responses to be available.
* Especially useful when waiting for container services to be fully "up".
*/
public class WaitFor {
private static final Logger logger = LoggerFactory.getLogger(WaitFor.class.getClass());
public static void waitForPort(String hostname, int port, long timeoutMs) {
logger.info("Waiting for port " + port);
@rkuzsma
rkuzsma / Dockerfile
Created April 1, 2017 21:53
Demonstrate failed attempt to build and run Jamvm with OpenJDK 8 inside Docker
FROM openjdk:8
# Download jamvm from source and apply this patch to src/classlib/openjdk/natives.c:
# https://sourceforge.net/u/tdaitx/jamvm/ci/f342a84116edfe28ab75ebfa17fcf929bafb02c1/tree/src/classlib/openjdk/natives.c?diff=236f9d849cf52faeb150a6cd5ba6fbeb61bd2f1f
RUN apt-get update -qq && apt-get install -y \
vim build-essential zlib1g-dev \
openjdk-8-jre-jamvm libtool autoconf automake
RUN git clone https://git.code.sf.net/p/jamvm/code jamvm-code
@rkuzsma
rkuzsma / karma-headless-docker-chromefirefox-configuration.md
Created October 28, 2018 14:38
Example Karma config using Docker images for Chrome Headless and Firefox Headless

Here's an example snippet for how to configure karma.conf.js to use Dockerized Chrome Headless and Dockerized Firefox Headless.

See also how to let Karma run JavaScript tests on Internet Explorer 11 in Windows with VirtualBox on Mac OS X

You have to npm install @rkuzsma/karma-docker-launcher. And, because this module name is scoped, Karma won't automatically recognize it by the karma-* prefix, so the plugins addition below is necessary.

// karma.conf.js
module.exports = function (config) {
  config.set({
@rkuzsma
rkuzsma / virtualbox-ie11-win.md
Created October 28, 2018 14:32
Let Karma run JavaScript tests on Internet Explorer 11 in Windows with VirtualBox on Mac OS X