Skip to content

Instantly share code, notes, and snippets.

Scott Woods woods

Block or report user

Report or block woods

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View example.tf
# Allow access to the vault service from the public and private subnets
# Note that this doesn't allow access from the internet; it just allows
# traffic over the private network from hosts that reside in either of our
# two subnets.
resource "aws_security_group_rule" "vault" {
security_group_id = "${aws_security_group.security_group.id}"
type = "ingress"
from_port = 8200
to_port = 8200
protocol = "tcp"
@woods
woods / purge.sh
Last active May 31, 2019
Purge unused kernel packages on Ubuntu 14.04
View purge.sh
# Get all patch versions of all kernels on the system
all_kernel_patch_versions=$( dpkg -l | egrep 'linux-headers-3.13.0-[0-9]+-generic' | awk -F '-' '{print $4}' | sort -n )
# Exclude any kernels that are in use (hard coded; you must CUSTOMIZE THIS PER MACHINE)
unused_kernel_patch_versions=$( echo "$all_kernel_patch_versions" | egrep -v '1[67]' )
for n in $unused_kernel_patch_versions ; do
echo
echo "========== $n ========="
echo
@woods
woods / order.html
Created Oct 25, 2018
Code snippet for purple lizard order checkout page (just the total amount)
View order.html
<tr>
<td colspan="4" class="align_right"><strong>{{ 'customer.order.total' | t }}</strong></td>
<td class="text-right"><strong>{{ order.total_price | money }} {{ order.currency }}</strong></td>
</tr>
@woods
woods / command.bash
Created Oct 6, 2018
Selectively remove old kernels and source
View command.bash
for n in 57 61 68 77 79 83 85 86 87 88 91 92 93 95 96 98 100 101 103 105 106 107 108 109 110 111 112 113 115 116
do
apt-get purge -y \
linux-headers-3.13.0-$n \
linux-headers-3.13.0-${n}-generic \
linux-image-3.13.0-${n}-generic \
linux-image-extra-3.13.0-${n}-generic
done
@woods
woods / specs.md
Last active Nov 7, 2017
West Arete's spec layout
View specs.md

Over time, West Arete has developed a convention for how we organize our spec directories. This arrangement has been very successful for us over many years and many projects. We'd love to extract it into some kind of framework/gem, but have never managed/invested to do so. So at the very least we can share this writeup of what we've found to be useful, in the hope that it's useful to others.

The top level of our spec directory looks like this:

spec/
  spec_helper.rb
@woods
woods / command.bash
Created Jun 12, 2017
Get IP ranges of AWS Route53 health checkers
View command.bash
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json \
| jq '.prefixes | map(select(.service=="ROUTE53_HEALTHCHECKS")) | map(.ip_prefix)'
View gist:9cc23c5dc97fda1671525d841e1e359f
### Keybase proof
I hereby claim:
* I am woods on github.
* I am woods (https://keybase.io/woods) on keybase.
* I have a public key ASBRwmuep3o_XIJa0bbb-0xxkdgyxWqCt-SEvK1MHlkjoQo
To claim this, I am signing this object:
@woods
woods / friendly_urls.markdown
Last active Aug 17, 2016 — forked from cdmwebs/friendly_urls.markdown
Friendly URLs in Rails
View friendly_urls.markdown

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.

View map.html
<!DOCTYPE html>
<HTML>
<head>
<title id="PageTitle">Allegheny County Assessment</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR" />
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE" />
<meta content="JavaScript" name="vs_defaultClientScript" />
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
@woods
woods / check_vault_seal_status.sh
Last active May 19, 2017
Nagios plugin to make sure Hashicorp Vault is unsealed
View check_vault_seal_status.sh
#!/bin/bash
# Assumes the following:
# - The `curl` package is installed
# - Vault is listening on the standard port 8200
# - Vault is using https with a valid certificate
# The hostname of the vault server that we're supposed to check.
hostname=$1
You can’t perform that action at this time.