Skip to content

Instantly share code, notes, and snippets.

Avatar

Neil Millard neilmillard

View GitHub Profile
View diskspace_report.sh
#!/bin/bash
du -hsx -- * | sort -rh | head -10
@neilmillard
neilmillard / api_limit.sh
Last active Jan 15, 2020
get github api limit status
View api_limit.sh
#!/bin/bash
# Set $GITHUB_API_USER and $GITHUB_API_TOKEN
#
set +x
GITHUB_API_HEADER_ACCEPT="Accept: application/vnd.github.v3+json"
temp=`basename $0`
TMPFILE=`mktemp /tmp/${temp}.XXXXXX` || exit 1
curl --user "$GITHUB_API_USER:$GITHUB_API_TOKEN" -s "https://api.github.com/rate_limit" -H "${GITHUB_API_HEADER_ACCEPT}" >> $TMPFILE
View centos8-guestadd.sh
#!/bin/sh
dnf install kernel-devel-$(uname -r) kernel-headers perl gcc make elfutils-libelf-devel
cd /run/media/`whoami`/VB*
echo "./VBoxLinuxAdditions.run"
@neilmillard
neilmillard / metrics-graphite.sh
Last active Aug 20, 2019
metrics-graphite for sensu on centos/redhat
View metrics-graphite.sh
cpu () {
echo $HOSTNAME.cpu $(mpstat 1 1 | awk '$13 ~ /[0-9.]+/ { print 100 - $13 }') $(date +%s)
}
disk_io () {
echo $HOSTNAME.disk_io $(iostat -d -z ALL | awk 'NF==6 {s+=$2} END {print s}') $(date +%s)
}
disk_usage () {
echo $HOSTNAME.disk_usage $(df -k / | awk 'NR > 1 {print $5}' | cut -d "%" -f 1) $(date +%s)
@neilmillard
neilmillard / cleanup.sh
Last active Jun 13, 2018 — forked from paulrobello/cleanup.sh
Docker registry v2 cleanup script
View cleanup.sh
#!/bin/bash
### your registry must have the following environment var set
# REGISTRY_STORAGE_DELETE_ENABLED=true
### replace YOUR_SERVER with corect info
REGISTRY_URL=https://YOUR_SERVER:5000
### host registry volume folder
REGISTRY_ROOT=/registry
### container to execute garbage-collect
CONTAINER_NAME=services_registry.1
@neilmillard
neilmillard / install-bosh.sh
Last active Oct 20, 2017
install bosh-cli on centos 2.0.42
View install-bosh.sh
#!/bin/bash
sudo yum install -y wget git
wget -O bosh https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-2.0.42-linux-amd64
sudo mv bosh /usr/local/bin/bosh
sudo chmod +x /usr/local/bin/bosh
sudo yum install -y gcc gcc-c++ ruby ruby-devel mysql-devel postgresql-devel postgresql-libs sqlite-devel libxslt-devel libxml2-devel patch openssl
gem install yajl-ruby
View bash retry function.sh
#!/bin/bash
# Retry
# set ATTEMPTS and TIMEOUT before calling
function retry {
local max_attempts=${ATTEMPTS-5}
local timeout=${TIMEOUT-1}
local attempt=0
local exitCode=0
while (( $attempt < $max_attempts ))
do     
@neilmillard
neilmillard / gist:b7439875ff45c0a12586b29b03239921
Created May 15, 2016 — forked from fernandoaleman/gist:5083680
How to update VirtualBox Guest Additions with vagrant
View gist:b7439875ff45c0a12586b29b03239921
# Start the old vagrant
$ vagrant init centos-6.3
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.
View multi boot _cloudinit
Content-Type: multipart/mixed; boundary="===============0035287898381899620=="
MIME-Version: 1.0
--===============0035287898381899620==
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
@neilmillard
neilmillard / update-route53-dns.sh
Last active Jan 6, 2016 — forked from dfox/update-route53-dns.sh
A script to update DNS on Route 53
View update-route53-dns.sh
#!/bin/sh
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Defaults
TTL=60
You can’t perform that action at this time.