Skip to content

Instantly share code, notes, and snippets.

View anggras's full-sized avatar

Anggra anggras

View GitHub Profile
@anggras
anggras / MockupIoTDeviceLambda.py
Last active April 22, 2021 05:43
Note: This function access IoT Data Plane directly, not through the usual MQTT protocol. Useful to simulate an IoT device / sensor using Lambda
import json
import boto3
import random
MAX_TEMP = 42
MIN_TEMP = 36
def lambda_handler(event, context):
client = boto3.client('iot-data')
import json
import boto3
from boto3.dynamodb.conditions import Key, Attr
import time
def lambda_handler(event, context):
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('IoTRule')
current_time_s = time.time() # current time in second (float)
current_time_ms = round(current_time_s * 1000) # current time in ms (integer)

Keybase proof

I hereby claim:

  • I am anggras on github.
  • I am anggra (https://keybase.io/anggra) on keybase.
  • I have a public key ASBU4bXd0ZHGZOIDi_hV-qNBypxfkyXUdmtUfgrPchPEugo

To claim this, I am signing this object:

@anggras
anggras / bumpcommit.sh
Last active February 1, 2017 10:24
Xcode project bump build number, git commit and push in a single line
agvtool bump -all && agvtool what-version -terse | xargs -I % sh -c "git add -A && git commit -m \"Updated to build %\" && git push"