Skip to content

Instantly share code, notes, and snippets.

@stephen-mw
stephen-mw / logrotate_varnishncsa
Last active December 3, 2019 11:16
Init and logrotate script for varnishncsa logging process
# Logrotate script for varnishnca
# /etc/logrotate.d/varnishncsa
#
/var/log/varnish/varnishncsa.log {
daily
rotate 7
missingok
compress
delaycompress
@stephen-mw
stephen-mw / sources.list
Created May 20, 2013 21:39
Ubuntu 10.04 apt sources.list Pop it into /etc/apt/sources.list && apt-get update
#############################################################
################### OFFICIAL UBUNTU REPOS ###################
#############################################################
###### Ubuntu Main Repos
deb http://us.archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
###### Ubuntu Update Repos
deb http://us.archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
@stephen-mw
stephen-mw / opentsdb_bootstrap.sh
Last active December 19, 2015 10:19
OpenTSDB Server Installation Bootstrap
#!/bin/bash
set -e
# Installs Hbase and OpenTSDB to /opt
# Will start OpenTSDB listening on 0.0.0.0:4242
apt-get install -y vim git-core autoconf openjdk-7-jdk gnuplot-nox make
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
@stephen-mw
stephen-mw / rpi example wireless
Last active December 27, 2015 07:09
Raspberry Pi Wireless Example Settings
Setting up the wireless on your raspbian pi is tricky over the commandline. Here's some example settings that should get you online with a typical wpa wireless G network.
```/etc/network/interfaces```
```
auto lo
iface lo inet loopback
iface eth0 inet dhcp
@stephen-mw
stephen-mw / collectd_auto_install
Last active December 31, 2015 19:19
Debian/Ubuntu collectd compiling and installation script
#!/bin/bash
set -e
#
# Collectd automatic compile and installation script
# for debian systems
#
# Stephen Wood
# www.heystephenwood.com
#
@stephen-mw
stephen-mw / easy_bash_colors
Created January 25, 2014 04:13
Easy bash colors
color() {
echo -e "\033[0;$1m$2\033[0m"
}
echo_red() {
color 31 "$1"
}
echo_green() {
color 32 "$1"
}
echo_yellow() {
@stephen-mw
stephen-mw / The_Deployment_Manifesto
Created March 4, 2014 21:05
The Deployment Manifesto
The 10 Tenets of Deployments
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in
[RFC 2119](https://www.ietf.org/rfc/rfc2119.txt).
1. Configuration management MUST NOT be coupled to an external service, such as EC2, Openstack, Foreman, or anything else.
2. Devops SHOULD provide a self-service framework for the automatic creation and destruction of hosts from the ground up.
@stephen-mw
stephen-mw / pre-push
Last active September 9, 2021 01:35 — forked from pixelhandler/pre-push.sh
pre-push hook to prevent pushing to dev, prod, release-*, patch-*
#!/bin/bash
# Prevents force-pushing to master
BRANCH=`git rev-parse --abbrev-ref HEAD`
PUSH_COMMAND=`ps -ocommand= -p $PPID`
PROTECTED_BRANCHES="^(master|dev|release-*|patch-*)"
FORCE_PUSH="force|delete|-f"
if [[ "$BRANCH" =~ $PROTECTED_BRANCHES && "$PUSH_COMMAND" =~ $FORCE_PUSH ]]; then
echo "Prevented force-push to protected branch \"$BRANCH\" by pre-push hook"
@stephen-mw
stephen-mw / list_ec2_instances.md
Last active April 18, 2022 16:07
List running EC2 instances with golang and aws-sdk-go

This is the beginning of hopefully many new posts with golang snippets from my blog. List all of your running (or pending) EC2 instances with Amazon's golang sdk.

For a list of filters or instance attributes consult the official documentation.

package main

import (
	"fmt"
	"github.com/awslabs/aws-sdk-go/aws"
apt-get update -y
aptitude install -y build-essential
wget "http://downloads.sourceforge.net/project/e1000/ixgbevf%20stable/2.16.1/ixgbevf-2.16.1.tar.gz"
tar -zxf ./ixgbevf-*
cd ixgbevf*/src
make install
modprobe ixgbevf
sudo update-initramfs -c -k all
echo "options ixgbevf InterruptThrottleRate=1,1,1,1,1,1,1,1" > /etc/modprobe.d/ixgbevf.conf