Skip to content

Instantly share code, notes, and snippets.

@JamieCressey
JamieCressey / dict_to_dynamodb_item.py
Created April 24, 2016 20:56
Coverts a standard Python dictionary to a Boto3 DynamoDB item
def dict_to_item(raw):
if type(raw) is dict:
resp = {}
for k,v in raw.iteritems():
if type(v) is str:
resp[k] = {
'S': v
}
elif type(v) is int:
resp[k] = {
@JamieCressey
JamieCressey / dynamodb_item_to_dict.py
Last active June 30, 2021 11:49
Coverts a Python Boto3 DynamoDB item to a standard dictionary
def parse_dynamo_item(item):
resp = {}
if type(item) is str:
return item
for key,struct in item.iteritems():
if type(struct) is str:
if key == 'I':
return int(struct)
else:
return struct
@Antarix
Antarix / SendSMS.java
Created August 23, 2013 09:27
Send SMS in android with delivery report
//---sends an SMS message to another device---
private void sendSMS(String phoneNumber, String message)
{
String SENT = "SMS_SENT";
String DELIVERED = "SMS_DELIVERED";
PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,
new Intent(SENT), 0);