This gist contains lists of modules available in
in AWS Lambda.
| # Rotates a vertical set similar to an Excel PivotTable | |
| # | |
| # Given $data in the format: | |
| # | |
| # Category Activity Duration | |
| # ------------ ------------ -------- | |
| # Management Email 1 | |
| # Management Slides 4 | |
| # Project A Email 2 | |
| # Project A Research 1 |
| git fetch upstream | |
| git reset --hard upstream/master |
| #!/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Examples: | |
| %(progname)s http://en.wikipedia.org/wiki/List_of_Olympic_records_in_athletics | |
| This is essentially this logic, done up |
| $gdata = $printsLogs | Group-Object -Property userId | |
| $test = @() | |
| $test += foreach($item in $gdata){ | |
| $item.Group | Select -Unique userId, | |
| @{Name = 'PageTotal';Expression = {(($item.Group) | measure -Property pages -sum).Sum}} | |
| } |
| """ This is a convenient way to monkeypatch a method or attribute of a Python | |
| object. This is great for situations where you want to modify a global | |
| object within a limited scope, i.e., your typical class or module when | |
| testing. This was tested and works with Python 2.7 and 3.4. """ | |
| import contextlib | |
| @contextlib.contextmanager | |
| def monkeypatched(object, name, patch): | |
| """ Temporarily monkeypatches an object. """ |
This gist contains lists of modules available in
in AWS Lambda.
Sometimes you want to retrieve EC2 insntances' region information.
You can query that information through instance metadata(169.254.169.254).
$ curl --silent http://169.254.169.254/latest/dynamic/instance-identity/document
{
"privateIp" : "172.31.2.15",
"instanceId" : "i-12341ee8",
"billingProducts" : null,
"instanceType" : "t2.small",
| http://forked.yannick.io/ |
| #!/usr/bin/env python | |
| import getpass | |
| import json | |
| import requests | |
| import sys | |
| import urllib | |
| import boto3 |