I hereby claim:
- I am pmarques on github.
- I am pmarques (https://keybase.io/pmarques) on keybase.
- I have a public key whose fingerprint is FFC5 303F 47F1 89C8 515A D807 D67D B7CB 1472 CB5B
To claim this, I am signing this object:
// Number of VMs by PowerState | |
// Filter per: | |
// * Management Group | |
// * Tags | |
Resources | |
| where type =~ 'Microsoft.Compute/virtualMachines' | |
| where tags.service =~ "svc1" and tags.application in~ ("app1", "app2") | |
| join kind=inner ( | |
ResourceContainers | |
| where type == "microsoft.resources/subscriptions" and properties.managementGroupAncestorsChain[0].name in ("staging", "prod") |
gcloud projects get-iam-policy ${GOOGLE_CLOUD_PROJECT} \ | |
--flatten='bindings[].members' \ | |
--format='table(bindings.role)' \ | |
--filter="bindings.members:${MEMBER_EMAIL}" |
--- | |
Description: > | |
Create a simple encrypted S3 bucket | |
Parameters: | |
BucketName: | |
Type: String | |
Default: pmarques1234567890-x-account-replication | |
SourceAccount: | |
Type: String | |
Resources: |
AWSTemplateFormatVersion: 2010-09-09 | |
Parameters: | |
ResourceName: | |
Type: String | |
MinLength: 1 | |
Resources: | |
DummyResource: | |
Type: AWS::CloudWatch::Dashboard |
const Octokit = require('@octokit/rest') | |
const octokit = new Octokit({ | |
auth: "<my github access token", | |
userAgent: "pmarques 1.0" // tried with and without | |
}) | |
octokit.repos.getContents({ | |
"owner": "ansible", | |
"repo": "ansible", | |
"path": "README.rst", | |
"ref": "devel" |
--- | |
Resources: | |
SecurityGroup: | |
Type: AWS::EC2::SecurityGroup | |
Properties: | |
GroupDescription: Allow http to client host | |
VpcId: "vpc-1" | |
SecurityGroupIngress: | |
- IpProtocol: tcp |
# How to install, tested in Windows Server R2012 | |
# Write the functions in file %HOMEPATH\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 | |
# | |
function checkPort { | |
New-Object System.Net.Sockets.TcpClient($args[0], $args[1]) | |
} | |
# Test it | |
# C:\> checkPort "127.0.0.1" 80 |
# Delete buckets tagged with a key | |
for bucket in `aws --profile mojintegration s3api list-buckets --query "Buckets[].Name" --output text` ; doecho -n "Bucket: [${bucket}]: " ; [ "$(aws --profile mojintegration s3api get-bucket-tagging --bucket "${bucket}" --query 'TagSet[?Key==`pm` && Value==`works`].Key' --output text 2>/dev/null)" == "pm" ] && echo -e "\033[31mdelete\033[0m" || echo -e "\033[32mkeep\033[0m" ; done | |
# Delte old logstreams from a logGroup | |
LOG_GROUP=a | |
for streamName in $(aws --profile mojintegration logs describe-log-streams --log-group-name "${LOG_GROUP}" --query 'logStreams[?lastIngestionTime <= `1502092833000`].logStreamName' --output text) ; do aws --profile mojintegration logs delete-log-stream --log-group-name "${LOG_GROUP}" --log-stream-name "${streamName}" ; done | |
# Delte log grouos which name starts with <LOG_GROUP> | |
for logGroup in $(aws --profile mojintegrations logs describe-log-groups --query "logGroups[?starts_with(logGroupName, \`${LOG_GROUP}\`)].logGroupName" --output text) ; d |
I hereby claim:
To claim this, I am signing this object:
R_GROUP=a | |
# Delete all VMs in a group | |
az vm list --resource-group "${R_GROUP}" | jq '.[] .id' | xargs az vm delete --yes --ids |