Skip to content

Instantly share code, notes, and snippets.

View gerrymiller's full-sized avatar

Gerry Miller gerrymiller

View GitHub Profile
@gerrymiller
gerrymiller / gist:0173c6158f6f5f3bdc4acb835e498ed2
Created November 8, 2017 14:00
List all unencrypted EBS volume attached to o2:phi=yes EC2 instances
aws ec2 describe-volumes --filters Name=attachment.instance-id,Values=$(aws ec2 describe-instances | jq -r '.Reservations[].Instances[] | select(any(.Tags[]; .Key == "o2:phi" and .Value == "yes")) | .InstanceId' | tr '\n' ',' | sed '$ s/,$//g') Name=encrypted,Values=false | jq '.Volumes[] | .VolumeId'

Keybase proof

I hereby claim:

  • I am gerrymiller on github.
  • I am gerrymiller (https://keybase.io/gerrymiller) on keybase.
  • I have a public key ASB5zcrM_f1oKLSMmtMk1R6FMe6-urzpY43hxfPWsBi_7wo

To claim this, I am signing this object:

@gerrymiller
gerrymiller / add-ec2-sudo-user.sh
Created January 27, 2016 17:12
Script to remotely add a `sudo` user to an AWS EC2 Linux instance (note comments in script, please - requires change to /etc/sudoers)
#!/bin/bash
# Please note that in order for this script to work, you MUST update /etc/sudoers
# on the target instance. Change the line that reads 'Defaults requiretty' to
# 'Defaults !requiretty'
# -i | --identity {pem filename}
# -u | --username {username to add}
# -s | --ssh-public-key {ssh public key for new user}
# -r | --remote_host {user@remote_host_name|ip - user must have no passwd sudo ability}
@gerrymiller
gerrymiller / AccountController.cs
Last active December 16, 2015 12:38
Microsoft WebApi including with MVC 4 offers a great way to build RESTful services. However, if you want to take advantage of ASP.NET's build-in Forms Authentication with cookies for secure services with [Authorize], you have to jump through some hoops to allow some browsers (e.g., IE10) to set the auth cookie. Here's some simple server- and cli…
namespace MyNamespace
{
public class AccountController : ApiController
{
private readonly IAccountRepository _repository;
public AccountController()
{
_repository = new AccountRepository();
}