Skip to content

Instantly share code, notes, and snippets.

View michaelBenin's full-sized avatar
🏠
Remote

Michael Benin michaelBenin

🏠
Remote
View GitHub Profile
@michaelBenin
michaelBenin / change-resource-tags.sh
Created May 11, 2017 19:34
Change resources shell
#!/bin/bash
ids=$(aws ec2 describe-instances --filter "Name=tag:Project,Values=ERPSystem" "Name=tag:Environment,Values=development" --query 'Reservations[*].Instances[*].InstanceId' --output text)
echo "Creating tags"
aws ec2 create-tags --resources $ids --tags 'Key=Version,Value=1.1'
echo "Tags created"
@michaelBenin
michaelBenin / snapshotter.py
Created May 11, 2017 15:32
Hold only the last two snapshots
#!/usr/bin/env python
import boto3
MAX_SNAPSHOTS = 2 # Number of snapshots to keep
# Create the EC2 resource
ec2 = boto3.resource('ec2')
# Get a list of all volumes
@michaelBenin
michaelBenin / metadata.js
Last active January 23, 2017 17:08
Script to grab existing meta data on a webpage in a data structure consumable by react-helmet
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = 'https://code.jquery.com/jquery-3.1.1.min.js';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
var f = document.createElement('script');
f.type = 'text/javascript';
============================================
Domain (global)
Description
# of Credentials 1
============================================
Id Name
==================================== =======
someid jenkins
============================================
@michaelBenin
michaelBenin / config component
Created February 9, 2016 01:16
This is the config component I use for my Universal React Apps
import React from 'react';
export default React.createClass({
createConfig() {
return {
__html: this.props.config
};
},
render() {
@michaelBenin
michaelBenin / react_router_middleware.js
Created January 11, 2016 20:45
React Router Express Middleware for Server Side Rendering a React Single Page App
import React from 'react';
import createLocation from 'history/lib/createLocation';
import { RouterContext, match } from 'react-router';
import getRoutes from '../../react_router/react_router';
import { renderToString } from 'react-dom/server';
import { get, set } from 'lodash';
import config from '../config';
import alt from '../../flux/alt-application';
import ConfigActions from '../../flux/actions/config_actions';
import UserActions from '../../flux/actions/user_actions';
@michaelBenin
michaelBenin / example.js
Created November 18, 2015 16:39
Multiple Class Inheritance In javaScript
class One {
constructor() {
this.one = 1;
}
}
class Two extends One {
constructor() {
super();
this.two = 2;
{
"ecmaFeatures": {
"arrowFunctions": true,
"binaryLiterals": false,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": false,
"generators": true,
@michaelBenin
michaelBenin / gist:6954ed7518a92436d58d
Created April 16, 2015 14:59
Complete error log for session error
NoAvailableSdkInstanceError: No available sm services
at NoAvailableSdkInstanceError.ServiceDiscoveryError (/var/www/equipmentwatch-node/node_modules/core-services-sdk/node_modules/core-service-discovery/lib/errors.js:7:32)
at new NoAvailableSdkInstanceError (/var/www/equipmentwatch-node/node_modules/core-services-sdk/node_modules/core-service-discovery/lib/errors.js:19:38)
at SdkPool._.extend.getInstance (/var/www/equipmentwatch-node/node_modules/core-services-sdk/node_modules/core-service-discovery/lib/sdk_pool.js:74:23)
at GeneratedSdkProxy.<anonymous> (/var/www/equipmentwatch-node/node_modules/core-services-sdk/lib/sdk_with_discovery_proxy.js:27:32)
at RetryOperation._fn (/var/www/equipmentwatch-node/node_modules/core-services-sdk/node_modules/core-service-common/lib/util.js:48:7)
at null._onTimeout (/var/www/equipmentwatch-node/node_modules/core-services-sdk/node_modules/core-service-common/node_modules/retry/lib/retry_operation.js:32:10)
at Timer.listOnTimeout (timers.js:110: