Skip to content

Instantly share code, notes, and snippets.

View mrtj's full-sized avatar

Janos Tolgyesi mrtj

View GitHub Profile
@amalgjose
amalgjose / stream_to_s3.py
Last active July 22, 2022 10:24
Python program to Stream data from a URL and upload it directly to S3 without saving it to local disk. This program is very suitable to use in AWS Lambda functions. This works well with large files. This program acts like a relay between the source and the S3. For more details refer to https://amalgjose.com/2020/08/13/python-program-to-stream-da…
import boto3
import requests
authentication = {"USER": "", "PASSWORD": ""}
payload = {"query": "some query"}
session = requests.Session()
response = session.post("URL",
data=payload,
auth=(authentication["USER"],
@nivleshc
nivleshc / stepfunctions-sagemaker-state-machine.json
Created April 30, 2020 14:25
This is the AWS Step Function to automate training, build and deployment of an Amazon SageMaker model
{
"Comment": "An AWS Step Function State Machine to train, build and deploy an Amazon SageMaker model endpoint",
"StartAt": "Create Training Job",
"States": {
"Create Training Job": {
"Type": "Task",
"Resource": "arn:aws:states:::sagemaker:createTrainingJob.sync",
"Parameters": {
"TrainingJobName.$": "$$.Execution.Name",
"ResourceConfig": {
@half2me
half2me / gst-rtsp.py
Created April 23, 2020 19:23
RTSP authentication with python and gst-rtsp-server
server = GstRtspServer.RTSPServer()
auth = GstRtspServer.RTSPAuth()
token = GstRtspServer.RTSPToken()
token.set_string('media.factory.role', "user")
basic = GstRtspServer.RTSPAuth.make_basic("user", "password")
auth.add_basic(basic, token)
server.set_auth(auth)
factory = RtspFactory()
permissions = GstRtspServer.RTSPPermissions()
@mrtj
mrtj / ggcore_enable_sync.py
Created October 4, 2018 16:13
A python script that enables IoT shadow syncing for an AWS Greengrass Core
import boto3
import logging
import json
import re
import uuid
import argparse
'''
This script enables the IoT shadow syncing for your AWS Greengrass Core.
#!/usr/bin/python3
#-*- coding: utf-8 -*-
import logging
import timeit
import traceback
import time
import gi
gi.require_version('Gst', '1.0')
@crcdng
crcdng / headless-pi.md
Last active February 1, 2021 11:06
How to set up your Raspberry Pi including WiFi without monitor and keyboard from a Mac.

Set up Your Raspberry Pi Headless in 10 Easy 🤔 Steps

Goal

You want to set up your Raspberry Pi without monitor and keyboard. This is sometimes called "headless". Don't worry, you'll keep your head if you follow these step-by-step instructions (however, see license and disclaimer below). We will install the Raspbian operating system and configure the Pi WiFi from a Terminal session on a Mac.

Prerequisites / Assumptions

You have:

  • A Mac with a SD card reader (either built in or an USB device).
  • A Raspberry Pi 3 B (A Pi 2 B with a compatible WiFi dongle works as well).
@skirdey
skirdey / pubsub_iot.py
Last active March 13, 2024 21:15
Connecting to AWS IoT MQTT topic using Python and Paho MQTT client
import paho.mqtt.client as paho
import os
import socket
import ssl
from time import sleep
from random import uniform
import json
import logging
logging.basicConfig(level=logging.INFO)
@mojodna
mojodna / 0_register_planet.sql
Last active May 18, 2022 17:51
Sample OSM Athena queries
--
-- This will register the "planet" table within your AWS account
--
CREATE EXTERNAL TABLE planet (
id BIGINT,
type STRING,
tags MAP<STRING,STRING>,
lat DECIMAL(9,7),
lon DECIMAL(10,7),
nds ARRAY<STRUCT<ref: BIGINT>>,
pragma solidity ^0.4.7;
contract CommitRevealElection {
// The two choices for your vote
string public choice1;
string public choice2;
// Information about the current status of the vote
uint public votesForChoice1;
uint public votesForChoice2;
@RoyalIcing
RoyalIcing / 1-example.swift
Created May 27, 2016 13:36
Swift Dynamic Properties
public struct Person {
public var firstName: String
public var middleName: String?
public var lastName: String
public var ageInYears: Int
public var fullName: String {
return [firstName, middleName, lastName].flatMap{ $0 }.joinWithSeparator(" ")
}
}