Skip to content

Instantly share code, notes, and snippets.

filter = Filter={ "And" : [
{"Dimensions": {
"Key": "LINKED_ACCOUNT",
"Values": [ "791540823040" ] }},
{"Tags": {
"Key": "Organization",
"Values": ["swissre-webpresence"] }}
]}
def retrieveData(self, results, filter):
data = cd.get_cost_and_usage(TimePeriod={'Start': start, 'End': end},
Granularity='MONTHLY', Metrics=['UnblendedCost'],
**filter,
GroupBy=[{'Type': 'DIMENSION', 'Key': 'LINKED_ACCOUNT'}, {'Type': 'DIMENSION', 'Key': 'SERVICE'}], **kwargs)
data = cd.get_cost_and_usage(TimePeriod={'Start': start, 'End': end},
Granularity='MONTHLY', Metrics=['UnblendedCost'],
Filter={ "And" : [
{"Dimensions": {
"Key": "LINKED_ACCOUNT",
"Values": [ "791540823040" ] }},
{"Tags": {
"Key": "Organization",
"Values": ["swissre-webpresence"] }}
]},
File "aws-cost-and-usage-report.py", line 64, in <module>
out.write('\t'.join([str(result_by_time['TimePeriod']['Start']), '\t'.join(group['Keys']), amount, unit ,result_by_time['Estimated']]) + '\n')
TypeError: sequence item 4: expected str instance, bool found
@rah003
rah003 / VirtualUriMappingEval.groovy
Created November 11, 2019 14:06 — forked from mkgl/VirtualUriMappingEval.groovy
Show all Virtual URI mappings that matched a given URI and their associated weights
@Field private registry
import groovy.transform.Field
import info.magnolia.objectfactory.Components
import info.magnolia.virtualuri.VirtualUriRegistry
import static java.util.stream.Collectors.joining
registry = Components.getComponent(VirtualUriRegistry.class)
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/had/projects/gitnolia/main/magnolia-core/src/test/java/info/magnolia/objectfactory/guice/lifecycle/LifecycleOverrides.java:[36,24] cannot find symbol
symbol: class PostConstruct
location: package javax.annotation
[ERROR] /Users/had/projects/gitnolia/main/magnolia-core/src/test/java/info/magnolia/objectfactory/guice/lifecycle/LifecycleOverrides.java:[37,24] cannot find symbol
symbol: class PreDestroy
location: package javax.annotation
[ERROR] /Users/had/projects/gitnolia/main/magnolia-core/src/test/java/info/magnolia/objectfactory/guice/lifecycle/LifecycleSimple.java:[36,24] cannot find symbol
Magnolia Enterprise Pro Webapp 5.7
Copyright 2003-2018 Magnolia International Ltd.
This product includes/uses software(s) developed by 'Andrey Somov' (https://bitbucket.org/asomov/snakeyaml)
- SnakeYAML
License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
This product includes/uses software(s) developed by 'Andy Clark, Marc Guillemot' (http://nekohtml.sourceforge.net)
- Neko HTML
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
Magnolia Dx Core Demo Webapp 6.1 (Snapshot: 2019.06.21 09:44:59)
Copyright 2003-2019 Magnolia International Ltd.
This product includes/uses software(s) developed by 'an unknown organization'
- stream-lib (https://github.com/addthis/stream-lib)
License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
- parso (https://github.com/epam/parso)
License: Apache License v2 (http://www.apache.org/licenses/LICENSE-2.0.html)
- null (https://github.com/fge/btf)
License: Lesser General Public License, version 3 or greater (http://www.gnu.org/licenses/lgpl.html)
@rah003
rah003 / content
Created May 21, 2019 09:39
Aggregate times
import java.util.Calendar;
cal = Calendar.getInstance();
def currentYear = cal.get(Calendar.YEAR) % 100;
s = ctx.getJCRSession("foflinks");
n = s.getNode("/")
println ("at root")
// consolidate years first
@rah003
rah003 / content
Last active May 21, 2019 09:39
Restructure workspace
s = ctx.getJCRSession("foflinks")
topPage = "/"
level = 30
root = s.getNode(topPage)
println("start with " + topPage)
listChildren(root, "")
println("done")