Skip to content

Instantly share code, notes, and snippets.

@chemar
chemar / payload.lua
Created July 3, 2018 18:30
Quoted strings with variables
-- Ran into a bit of trouble sending quoted string payload to a REST API
--
-- Working examples of quoted strings with variables provided for reference
--
--> print('"'..u..'"')
--"myuser"
--> print('{ "username":"'..u..'" }')
--{ "username":"myuser" }
--> payload = '{ "username":"'..u..'", "password":"'..p..'" }'
--> print(payload)
@chemar
chemar / ec2volList.py
Created March 3, 2017 18:33
AWS EC2 list volumes and attributes using boto3
import boto3
ec2 = boto3.resource('ec2')
volume_iterator = ec2.volumes.all()
for v in volume_iterator:
for a in v.attachments:
print "{0} {1} {2}".format(v.id, v.state, a['InstanceId'])