Skip to content

Instantly share code, notes, and snippets.

View pofallon's full-sized avatar

Paul O'Fallon pofallon

View GitHub Profile
@pofallon
pofallon / awsso.sh
Last active February 12, 2021 22:00
Leverage AWS SSO credentials via credential_process
#! /usr/bin/env bash
CREDS=$(aws sso get-role-credentials --profile $1 \
--output json \
--access-token $(jq -r ".accessToken" $(grep -l "accessToken" ~/.aws/sso/cache/*.json)) \
--account-id $(aws configure get sso_account_id --profile $1) \
--role-name $(aws configure get sso_role_name --profile $1) |
jq '.roleCredentials | {
Version: 1,
AccessKeyId: .accessKeyId,
@pofallon
pofallon / SwaggerAsyncResponseFilter
Last active August 29, 2015 14:07
Sample JAX-RS 2.0 filter to remove AsyncResponse parameters from Swagger docs
@Provider
public class SwaggerAsyncResponseFilter implements ContainerResponseFilter {
SwaggerSpecFilter removeAsyncFilter = new SwaggerSpecFilter() {
public boolean isOperationAllowed(Operation operation, ApiDescription api, Map<String, List<String>> params, Map<String, String> cookies,
Map<String, List<String>> headers) {
return true;
}
@pofallon
pofallon / gist:6095860
Created July 27, 2013 18:48
AWS IAM Policy definition for the New Relic AWS plugin
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"autoscaling:Describe*",
"cloudwatch:Describe*",
"cloudwatch:List*",
"cloudwatch:Get*",
"ec2:Describe*",
@pofallon
pofallon / test.js
Created June 23, 2012 21:23
Timed test of BlobReadStream
/* To run this example:
*
* - Save this file as test.js
* - Run 'npm install azure' and 'npm install bluesky'
* - Set the variables 'myAccount' and 'myKey' to your Azure storage credentials
* - Set the 'containerName' and 'blobName' variables to an existing blob in Azure storage
* - Run as 'node test.js'
*
* The BlobReadStream source can be found here:
* https://github.com/pofallon/node-bluesky/blob/master/lib/blobReadStream.js
@pofallon
pofallon / simple-mocha.js
Created December 14, 2011 18:05
Example of failing test not invoking 'after'
var should = require('should');
describe('Simple Test', function() {
after(function(done) {
console.log('In After');
done();
});
describe('specific test', function() {
@pofallon
pofallon / gist:1341731
Created November 5, 2011 16:25
node v0.6.0 'make test' errors on mac osx lion
$ make test
Waf: Entering directory `/Users/paul/Downloads/node-v0.6.0/out'
DEST_OS: darwin
DEST_CPU: x64
Parallel Jobs: 1
Product type: program
Waf: Leaving directory `/Users/paul/Downloads/node-v0.6.0/out'
'build' finished successfully (0.040s)
-rwxr-xr-x 1 paul staff 6.7M Nov 5 12:21 out/Release/node
python tools/test.py --mode=release simple message
@pofallon
pofallon / app.param() scenarios
Created April 7, 2011 13:13
Three req.param() uses and how they interact with app.param()
var express = require('express');
var app = module.exports = express.createServer();
app.configure(function(){
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
});
app.param(':id', function(req, res, next, val) {
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Threading;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Diagnostics;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.StorageClient;