Skip to content

Instantly share code, notes, and snippets.

View spenserpothier's full-sized avatar
🍔

Spenser Pothier spenserpothier

🍔
View GitHub Profile
@spenserpothier
spenserpothier / find_iam_user.py
Last active August 16, 2017 20:28 — forked from OnlyInAmerica/find_iam_user.py
Find the IAM username belonging to the TARGET_ACCESS_KEY
#!/usr/bin/env python
# Find the IAM username belonging to the TARGET_ACCESS_KEY
# Useful for finding IAM user corresponding to a compromised AWS credential
# Usage:
# find_iam_user AWS_ACCESS_KEY_ID
# Requirements:
#
# Environmental variables:
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
# python:
@spenserpothier
spenserpothier / keybase.md
Last active August 16, 2017 20:27
Keybase proof

Keybase proof

I hereby claim:

  • I am spenserpothier on github.
  • I am spenserpothier (https://keybase.io/spenserpothier) on keybase.
  • I have a public key whose fingerprint is 59A2 A73E FFCF 5306 C7F9 D0DD 7B30 C2DB 40F3 CFCD

To claim this, I am signing this object:

@spenserpothier
spenserpothier / style.css
Last active August 16, 2017 20:27
CSS Snippet for vertical centered element
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@spenserpothier
spenserpothier / gist:2e95ff5186a5ff53ad62
Last active August 16, 2017 20:26
some python snippet for finding instance ids in events
instances = [x['resourceId'] for x in event['requestParameters']['resourcesSet']['items']
if re.search('i-([0-9]|[a-f]){8}', x['resourceId'])]
@spenserpothier
spenserpothier / gist:8b5363931d742a7fd60a
Last active August 16, 2017 20:25
Onename/openname verification
Verifying that +spenserpothier is my openname (Bitcoin username). https://onename.com/spenserpothier
[alias]
lg = log --format=\"%h - %C(cyan)%s%Creset %C(dim white)(%ar) [%an - %ae]%Creset%n%w(72,4,4)%b\"
@spenserpothier
spenserpothier / gist:3d1cb9f1ad0ccc9bcc95
Last active August 16, 2017 20:24
Example cucumber output
$ cucumber
Using the default profile...
Feature: Manage Articles
In order to make a blog
As an author
I want to create and manage Articles
Scenario: Articles List # features/manage_articles.feature:6
Given I have articles titled Pizza, Breadsticks # features/step_definitions/article_steps.rb:1
When I go to the list of articles # features/step_definitions/web_steps.rb:48
@spenserpothier
spenserpothier / workweek.sh
Last active August 16, 2017 20:22
Script to figure out how much code type work I did this week
#!/bin/zsh
ls -1 -d */ | while read i
do
cd "$i"
if [ -d .git ]
then
{
ncommits=$(eval 'git log --oneline --author="Spenser" --since="`date -v monday`" | wc -l' 2> /dev/null )
} || {
@spenserpothier
spenserpothier / awk_replace_string_with_file.sh
Last active August 16, 2017 18:42
Replace REPLACEME in fileB with the contents of fileA with " " prepended to each line, save to fileC
# Replace REPLACEME in fileB with the contents of fileA with " " prepended to each line, save to fileC
awk 'NR==FNR { a[n++]=" "$0; next }
/REPLACEME/ {for (i=0; i<n; ++i) print a[i]; next }
1' fileA fileB > fileC
@spenserpothier
spenserpothier / curl.sh
Last active August 29, 2017 17:19
cURL with username/password
curl -k -X POST --netrc-file passfile https://url.with.auth.com