Skip to content

Instantly share code, notes, and snippets.

View johnmccabe's full-sized avatar
🍕
eat sleep rebase repeat

John McCabe johnmccabe

🍕
eat sleep rebase repeat
View GitHub Profile
version: '3'
services:
brooklyn:
image: johnmccabe/brooklyn
ports:
- "8081:8081"
links:
- "node1:node1"
node1:
image: johnmccabe/fakevmtest
@johnmccabe
johnmccabe / Current version
Last active June 20, 2017 09:48
Docker 1.12 - Fedora 25 - Client latest/PR159
[root@do2mgs0hdqqkkbj ~]# docker run --rm -v /var/run/docker.sock:/var/run/docker.sock puppet/lumogon version
Client:
Version: 20170524205424-0.2.0-27-ge10ec0d
Git commit: e10ec0df4c031da28e3972915ffd868731af4ce6
Built: 2017-05-24 08:54:24 UTC
[root@do2mgs0hdqqkkbj ~]# docker run --rm -v /var/run/docker.sock:/var/run/docker.sock puppet/lumogon scan --debug
[lumogon] 2017/06/07 19:52:25.475292 [Analytics] Initializing Google Analytics: scan
[lumogon] 2017/06/07 19:52:25.475334 [Docker Adapter] Creating container runtime client: Docker
[lumogon] 2017/06/07 19:52:25.495651 [Scheduler] Creating scheduler
[lumogon] 2017/06/07 19:52:25.495682 [Docker Adapter] Creating container runtime client: Docker
@johnmccabe
johnmccabe / README.md
Last active August 7, 2022 16:35
Installing cockpit-docker with Docker CE on CentOS7

Install cockpit-docker for Docker CE on CentOS

sudo yum install epel-release
sudo yum -y install dnf dnf-plugins-core
dnf download cockpit-docker
sudo rpm -Uvh --nodeps cockpit-docker-138-6.el7.centos.x86_64.rpm
sudo service cockpit restart
@johnmccabe
johnmccabe / lumogon_tidyup.sh
Created May 11, 2017 13:31
purge old lumogon containers
#!/bin/bash
echo "Removing lumogon containers"
docker ps -a | grep lumogon_ | awk '{ print $1 }' | xargs -I {} docker rm {}
@johnmccabe
johnmccabe / timeout_with_context.go
Created April 11, 2017 15:14
Using context to handle timeouts
package main
import (
"fmt"
"sync"
"time"
"golang.org/x/net/context"
)
@johnmccabe
johnmccabe / timeout_buffered_error_channel.go
Created April 11, 2017 14:51
Dealing with Timeout via a buffered error channel
package main
import (
"fmt"
"log"
"time"
)
func work() error {
for i := 0; i < 1000; i++ {
@johnmccabe
johnmccabe / recover_source_code.md
Created March 12, 2017 12:04 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@johnmccabe
johnmccabe / tmux.md
Last active October 19, 2016 18:02 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@johnmccabe
johnmccabe / fixssh_fn.sh
Created September 28, 2016 19:55
Bash function to fix access to SSH agent when using TMUX and agent forwarding
# via https://coderwall.com/p/_s_xda/fix-ssh-agent-in-reattached-tmux-session-shells
fixssh() {
for key in SSH_AUTH_SOCK SSH_CONNECTION SSH_CLIENT; do
if (tmux show-environment | grep "^${key}" > /dev/null); then
value=`tmux show-environment | grep "^${key}" | sed -e "s/^[A-Z_]*=//"`
export ${key}="${value}"
fi
done
}
hello