Skip to content

Instantly share code, notes, and snippets.

View neilmillard's full-sized avatar

Neil Millard neilmillard

View GitHub Profile
#!/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 / install-bosh.sh
Last active October 20, 2017 08:22
install bosh-cli on centos 2.0.42
#!/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
@neilmillard
neilmillard / cleanup.sh
Last active June 13, 2018 09:24 — forked from paulrobello/cleanup.sh
Docker registry v2 cleanup script
#!/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 / metrics-graphite.sh
Last active August 20, 2019 14:33
metrics-graphite for sensu on centos/redhat
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)
#!/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 / api_limit.sh
Last active January 15, 2020 15:40
get github api limit status
#!/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
#!/bin/bash
du -hsx -- * | sort -rh | head -10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import re
import requests
def parse_args():
@neilmillard
neilmillard / Makefile
Created March 25, 2024 07:41
make docker build with version incrementor
#!/usr/bin/env bash
.EXPORT_ALL_VARIABLES:
SHELL = /bin/bash
VENV_NAME = venv
PRODUCT = myapp
version=$(shell cat .version)
.PHONY: virtualenv