Skip to content

Instantly share code, notes, and snippets.

View justengland's full-sized avatar

Justin England justengland

View GitHub Profile
# Index
---------------------------------------------------------------------
curl -XPUT http://localhost:9200/pictures/ -d '
{
"settings": {
"analysis": {
"analyzer": {
"index_analyzer": {
"tokenizer": "standard",
@justengland
justengland / mutatable.jsx
Created December 19, 2017 01:48 — forked from ctavan/mutatable.jsx
mutatable react HOC
import hoistNonReactStatic from 'hoist-non-react-statics';
import React from 'react';
function getDisplayName(WrappedComponent) {
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
}
// See: https://facebook.github.io/react/docs/higher-order-components.html
export default function mutatable({ mutationName = 'mutate' } = {}) {
return (SourceComponent) => {
@justengland
justengland / ec2-instance-roles.ps1
Created March 13, 2019 17:06 — forked from lantrix/ec2-instance-roles.ps1
PowerShell Create and Remove EC2 Instance Roles - with attached AWS managed policy
# Create EC2 Instance Role
$ec2RoleTrustPolicyDocument = '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"ec2.amazonaws.com"},"Action":"sts:AssumeRole"}]}'
$iamRole = New-IAMRole -AssumeRolePolicyDocument $ec2RoleTrustPolicyDocument -RoleName MyEC2Role
Register-IAMRolePolicy -RoleName $iamRole.RoleName -PolicyArn arn:aws:iam::aws:policy/CloudWatchLogsFullAccess
$instanceProfile = New-IAMInstanceProfile -InstanceProfileName MyEC2InstanceRole
Add-IAMRoleToInstanceProfile -RoleName $iamRole.RoleName -InstanceProfileName $instanceProfile.InstanceProfileName
# Attach to existing instance
Register-EC2IamInstanceProfile -InstanceId i-0a5c81b759851230c -IamInstanceProfile_Name $instanceProfile.InstanceProfileName
@justengland
justengland / iam-policy.json
Created May 23, 2019 18:21 — forked from quiver/iam-policy.json
How to connect to Amazon RDS PostgreSQL with IAM credentials
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"rds-db:connect"
],
"Resource": [
"arn:aws:rds-db:region:account-id:dbuser:dbi-resource-id/database-user-name"