Skip to content

Instantly share code, notes, and snippets.

View ianmiell's full-sized avatar

Ian Miell ianmiell

View GitHub Profile
@ianmiell
ianmiell / gist:947ff3fabc44ace617c6
Last active August 29, 2015 14:01
Steps to create your own shutit server
apt-get install git python-bottle docker.io python-pexpect python-cherrypy3
git clone https://github.com/ianmiell/shutit.git && cd shutit
./shutit serve -m library
@ianmiell
ianmiell / gist:4fa6e0a7c940c659aa79
Last active August 29, 2015 14:12
Commands To Get From debian:jessie to an Automated Linux From Scratch Artifact
export SHUTIT_BACKUP_PS1_real_user_prompt=$PS1 && PS1='SHUTIT_REAL_USER#ZHfHa955>' && unset PROMPT_COMMAND && stty cols 320
export SHUTIT_BACKUP_PS1_pre_build=$PS1 && PS1='SHUTIT_PRE_BUILD#Qjv4HMML>' && unset PROMPT_COMMAND && stty cols 320
cat /etc/issue | grep -i "red hat" | wc -l
cat /etc/issue | grep -i "shutit" | wc -l
cat /etc/issue | grep -i "fedora" | wc -l
cat /etc/issue | grep -i "centos" | wc -l
cat /etc/issue | grep -i "steamos" | wc -l
cat /etc/issue | grep -i "ubuntu" | wc -l
cat /etc/issue | grep -i "debian" | wc -l
apt-get update
# To build your own bespoke ShutIt Distro image
export SHUTIT_PORT=8080
apt-get install git python-pip
mkdir -p /opt/shutit
cd /opt/shutit
git clone https://github.com/ianmiell/shutit.git
git clone https://github.com/ianmiell/shutit-distro.git
find . | grep cnf$ | xargs chmod 0600
# Build the ShutIt distro base image
# WARNING! You will need time, so leave this running while you get on with something useful and come back to it later.
apt-get update
apt-get -y install git python-pip
mkdir -p /opt/shutit
cd /opt/shutit
git clone https://github.com/ianmiell/shutit.git
git clone https://github.com/ianmiell/shutit-distro.git
cd shutit
# Generate a ShutIt dependency diagram as a pdf
apt-get update
apt-get -y install git python-pip graphviz
mkdir -p /opt/shutit
cd /opt/shutit
git clone https://github.com/ianmiell/shutit.git
git clone https://github.com/ianmiell/shutit-distro.git
cd shutit
pip install -r requirements.txt
@ianmiell
ianmiell / gist:c3c6cd3cd29e62ca36dd
Last active August 29, 2015 14:13
From Linux from Scratch (docker pull imiell/alfs) to osquery built from source
# From Linux from Scratch (docker pull imiell/sd_base) to osquery built from source
bash-4.3# cat rothko_imiell_1420883404.84.841005/build_commands.sh | grep -v "^ "
mkdir -p /root/shutit_build/rothko_imiell_1420883404.84.841005
touch ~/.bashrc
sed -i 's/.*HISTSIZE=[0-9]*$//' ~/.bashrc
sed -i 's/.*HISTSIZE=[0-9]*$//' /etc/profile
cat /tmp/UMvMqlQR | wc -l
cat >> ${HOME}/.bashrc <<< 'export HISTSIZE=99999999'
rm -f /tmp/UMvMqlQR

Based on this Docker article.

Run this script to generate signed server and client keys to create a secure connection to the Docker daemon running on your server.

Usage: secure_expose_docker.sh [host] [password]

The password isn't really important as you'll have direct access to the key files, but if you want you can keep track of it in case you want to use the generated keyfiles for something else in the future.

For host, use the domain of your server. You'll be connecting to this domain once the Docker daemon is set up.

@ianmiell
ianmiell / gist:921341c5b4cd4da4c670c17119ff4409
Last active February 14, 2018 19:00
Get/update all my git repos
#!/bin/bash -eu
set -o pipefail
USERNAME="ianmiell"
GIT_FOLDER="/space/git"
declare -a FAILURES
FAILURES=('')
function finish() {
echo The following repos failed to update:
for failed in "${FAILURES[@]}"
do
ITEM:/kubernetes.io
ITEM:/kubernetes.io/masterleases
ITEM:/kubernetes.io/masterleases/172.28.128.7
{"kind":"Endpoints",
"apiVersion":"v1",
"metadata":{"generation":8487,
"creationTimestamp":null},
"subsets":[{"addresses":[{"ip":"172.28.128.7"}]}]}
ITEM:/kubernetes.io/masterleases/172.28.128.4
imiell@basquiat $ cat a.sh
#!/bin/bash
for i in {1..100000}
do
VAR='HEADERMy voice is my passwordFOOTER'
PASS=${VAR#HEADER}
PASS=${PASS%FOOTER}
done
imiell@basquiat $ cat a.py