Skip to content

Instantly share code, notes, and snippets.

View ianmiell's full-sized avatar

Ian Miell ianmiell

View GitHub Profile
@ianmiell
ianmiell / gist:a279edb1d102c519f96ca1961d630a51
Last active January 18, 2022 17:50
Show all crons running on your system
#!/bin/bash
# Adapted from an answer on: https://stackoverflow.com/questions/134906/how-do-i-list-all-cron-jobs-for-all-users
set -eu
# System-wide crontab file and cron job directory. Change these for your system.
CRONTAB='/etc/crontab'
CRONDIR='/etc/cron.d'
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
@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
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
FROM centos
# Git setup
RUN yum install -y git
RUN git config --global push.default simple
RUN git config --global user.name approved_user
RUN git config --global user.email approved@corp.com
# Setup github
WORKDIR /root

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: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
# 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
# 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
# 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