Skip to content

Instantly share code, notes, and snippets.

View phildier's full-sized avatar

Phil Dier phildier

View GitHub Profile
<?php
include("aws.phar");
use Aws\OpsWorks\OpsWorksClient;
$client = OpsworksClient::factory(array(
'key' => $_SERVER['AWS_API_KEY'],
'secret' => $_SERVER['AWS_API_SECRET'],
'region' => 'us-east-1'
@phildier
phildier / tar-to-s3.sh
Created December 31, 2015 21:25
pipe tar output to an s3 file
#!/bin/bash
# tar up a file or directory and copy it to an s3 object without any temporary files
# usage:
# $ tar-to-s3.sh <source file or dir> <destination s3 path>
# example:
# $ tar-to-s3.sh . s3://mybucket/archive.tar
src=$1
dst=$2
@phildier
phildier / .vimrc
Created January 10, 2018 20:02
My .vimrc 1/2018
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'Syntastic'
Plugin 'ctrlp.vim'
Plugin 'fugitive.vim'
Plugin 'nerdtree'
@phildier
phildier / time_background.sh
Created January 4, 2019 16:16
Displays the time in various timezones on the xwindows background image
#!/bin/bash
export PATH=/bin:/usr/bin
DISPLAY=":0.0"
FONT=Courier-10-Pitch
FORMAT="%Z (UTC%z) %a %b %e %H:%M"
SIZE=$(
xwininfo -display "$DISPLAY" -root \
| awk '/Width:/{width=$2}; /Height:/{height=$2} END { print width"x"height }'
)
@phildier
phildier / codebuild-policy-example.tf
Last active February 13, 2019 21:52
AWS CodeBuild+custom docker service role example in Terraform
resource "aws_iam_role" "codebuild_role" {
name = "codebuild-role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
#!/usr/bin/env bash
# run on host:
# curl -s https://gist.githubusercontent.com/phildier/6e6950454e9eb021c857e6509ab891c3/raw/install_cloudwatch_agent_awslinux.sh | bash
set -e
AWS_PUBKEY="https://s3.amazonaws.com/amazoncloudwatch-agent/assets/amazon-cloudwatch-agent.gpg"
AGENT_RPM="https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm"
AGENT_SIG="https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm.sig"
@phildier
phildier / Dockerfile
Created November 18, 2020 22:29
Build tf into a container to be run in AWS Codebuild
ARG TERRAFORM_VERSION
FROM hashicorp/terraform:${TERRAFORM_VERSION} as base
COPY . /tf
WORKDIR /tf
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY

Keybase proof

I hereby claim:

  • I am phildier on github.
  • I am phildier (https://keybase.io/phildier) on keybase.
  • I have a public key ASAs4IKmXXzN9hZrxq04Ve_1eNKpXn9dUpixiOaklssZhAo

To claim this, I am signing this object:

List Open PRs

Lists a user's open pull requests on GitHub in a given GitHub organization with pretty formatting.

Installation and Usage

Requires the hub git wrapper to be installed: https://github.com/github/hub

Copy to somewhere in your $PATH and make executable:

Fetch a user's closed PRs over a period

This uses the GitHub hub cli tool to query the GitHub GraphQL API and fetch a user's closed PRs over a given period of time. The example above fetches for the entire year of 2024, going month-by-month in order to avoid limits. If the author has more than 100 closed PRs in a month the period will need to be adjusted.

You can adjust the for month ... range in the loop, as well as the firstday and lastday variables to your needs if you would like to fetch a different range.

The results are piped to jquery and output to stdout in jsonl format. This can be redirected to another command for further