Adaptive Streaming has become the neccessity for streaming video and audio. Unfortantely, as of this post, there isn't a whole lot of tutorials that accumulate all of the steps to get this working. Hopefully this post achieves that. This post focuses on using Amazon Web Services (AWS) to transcode for HLS and DASH and be the Content Delivery Network (CDN) that delivers the stream to your web page. We'll be using Video.js for the HTML5 player as well as javascript support libaries to make Video.js work with HLS and DASH.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import product | |
policy_statuses = ['processing', 'active', 'pending-suspension', 'suspended', 'pending-cancellation', 'cancelled'] | |
vehicle_statuses = ['processing', 'active', 'inactive'] | |
inactive_user = [True, False] | |
failed_payments = [0,1,2,3] | |
expiring_user = [True, False] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser() | |
### Positional | |
parser.add_argument('positional1') | |
parser.add_argument('positional2', help="positional argument 2") | |
parser.add_argument('positional3', help="positional argument 3 type int", type=int) | |
### Optional | |
parser.add_argument("--optional1", help="optional argument 1") | |
parser.add_argument("--optional2", help="optional argument 2", action="store_true") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Python3 Virtual Environment Setup | |
Requirements | |
* Python 3 | |
$ brew install python3 | |
Creation of virtual environment: | |
$ python3 -m venv /path/to/new/virtual/environment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import hashlib | |
import boto3 | |
class ETSManager: | |
""" | |
@todo: manages and provides the ets services |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib, base64, hmac, json, settings | |
def shopify_webhook(f): | |
""" | |
A decorator thats checks and validates a Shopify Webhook request. | |
""" | |
def _hmac_is_valid(body, secret, hmac_to_verify): | |
hash = hmac.new(body, secret, hashlib.sha256) | |
hmac_calculated = base64.b64encode(hash.digest()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Authenticate Django users in node.js. | |
* | |
* Django is great for many projects, while node.js does some fantastic | |
* jobs that Django couldn't. For example, you may have a Django app | |
* managing your user accounts and another real-time service or application | |
* running on Node, then you probably will need to read Django user session | |
* to authenticate users in the Node project. | |
* | |
* This gist is not production ready yet, but it demonstrates how could it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code is under the MIT license. | |
# Inspired by this StackOverflow question: | |
http://stackoverflow.com/questions/3295405/creating-django-objects-with-a-random-primary-key | |
import struct | |
from Crypto.Cipher import DES | |
from django.db import models | |
def base36encode(number): |