Skip to content

Instantly share code, notes, and snippets.

View evanscottgray's full-sized avatar
🤠
herding cats

Evan Gray evanscottgray

🤠
herding cats
View GitHub Profile
@evanscottgray
evanscottgray / docker_kill.sh
Last active November 7, 2023 03:40
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt
@evanscottgray
evanscottgray / portfinders.zsh
Created January 14, 2015 00:52
put this in your $shellrc and enjoy
# Find ALL the port users. _o/
findbyport() {
lsof -nP | grep ":$@" | awk '{print "Program: " $1 "\n" "PID: "$2 "\n" "User: " $3 "\n" "Address: "$9 "\n" "Action: " $10}'
}
portsinuse() {
lsof -nP | grep "IPv" | while read line; do echo $line | awk '{print "Program: " $1 "\n" "PID: "$2 "\n" "User: " $3 "\n" "Address: "$9 "\n" "Action: " $10}'; echo; done;
}
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@evanscottgray
evanscottgray / docker_image_container_basics.md
Last active June 21, 2018 07:09
creating base images with docker.

Docker Container/Image Basics

This is a basic step by step intro to working with Docker containers and Images. You should be able to follow along with your installation of docker, but be sure to change IDs/naming schemes according to your use case.

The goal of this exercise is to create a base image from the ubuntu base image that has both the jre and htop installed.

Start up an ubuntu container to modify, install htop, then exit.

docker run -t -i ubuntu /bin/bash

Get the ID of the container you just modified.

@evanscottgray
evanscottgray / wow_bounce.md
Last active November 8, 2017 13:47
Getting UDP out from behind a restrictive firewall.

Mosh + OpenVPN = Love

Okay. Let's pretend here for a sec that you work in an office where UDP is filtered outbound, but we really want to use UDP for mosh.

Here's the plan at a high level.

  1. Spin up a cloud server
  2. Install Docker
  3. Start OpenVPN Container
  4. Grab .ovpn config
  5. Modify .ovpn config to a include static route to your UDP-enabled destination
@evanscottgray
evanscottgray / pass_socket.py
Created August 6, 2017 12:29 — forked from josiahcarlson/pass_socket.py
An example of passing a socket between processes using Python's multiprocessing library
'''pass_socket.py
Written September 14, 2012
Released into the public domain.
Works on Python 2.6, 2.7, and may need minor changes for 3+.
'''
import multiprocessing
@evanscottgray
evanscottgray / docker_base_image_lab.md
Last active July 28, 2017 09:47
Creating a Base Image for the Lab

Building a new Base Image

Practical documentation on how to create a new base image.

Pick a Base Image to work on.

First we'll want to identify what image we are going to use as our base image to modify is.

In this example our previous base image is old-oca-bastion.

Define a Goal

We have been tasked with doing the following:

@evanscottgray
evanscottgray / storage_migration.md
Created September 24, 2014 17:28
docker storage migration wow

Migrating Docker Storage....

Stop Docker Service

service docker stop

Copy all the things!

@evanscottgray
evanscottgray / zfsnfs.md
Last active January 27, 2017 16:55
created by https://github.com/tr3buchet/gister, zfs and fedora 22 nfs

getting nfs rocking with zfs on fedora 22

we assume that you have a zfs dataset already called media.

# start nfs service (might fail because no rpcbind https://unix.stackexchange.com/questions/184338/nfs-no-longer-mounts-rpc-statd-fails-to-start)
systemctl start nfs
@evanscottgray
evanscottgray / restsharp_tls12.md
Last active January 10, 2017 07:36
forcing tls 1.2