Skip to content

Instantly share code, notes, and snippets.

View riegie's full-sized avatar

Riegie Godwin Jeyaranchen riegie

View GitHub Profile
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]
@askilondz
askilondz / gistlog.yml
Last active April 2, 2024 10:44
Adaptive Streaming with MPEG-DASH and HLS using AWS

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.

So Here's what you need:

Set up three S3 buckets

@pandafulmanda
pandafulmanda / Python3 Virtualenv Setup.md
Last active March 12, 2024 15:59 — forked from akszydelko/Python3 Virtualenv Setup.md
Setting up and using Python3 Virtualenv on Mac

Python3 Virtualenv Setup

Requirements
  • Python 3
  • Pip 3
$ brew install python3
@tianchu
tianchu / django_auth.js
Last active June 1, 2023 21:44
How to authenticate Django users in node.js
/*
* 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
@gavinballard
gavinballard / shopify_webhook.py
Last active August 15, 2021 19:04
Python view decorator for the HMAC verification of a Shopify Webhook.
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())
@igniteflow
igniteflow / gist:4654814
Last active July 30, 2018 07:36
A common use case in a Fabric script is to: 1. Activate the virtualenv 2. cd to the project dir Here is a simple context manager to achieve this with a one line with statement:
"""
A common use case in a Fabric script is to:
1. Activate the virtualenv
2. cd to the project dir
Here is a simple context manager to achieve this with a one line with statement:
"""
# fabconfig.py
def dev():
@kitek
kitek / gist:1579117
Created January 8, 2012 17:50
NodeJS create md5 hash from string
var data = "do shash'owania";
var crypto = require('crypto');
crypto.createHash('md5').update(data).digest("hex");
@treyhunner
treyhunner / models.py
Created December 10, 2010 06:16
Encrypt and decrypt Django model primary key values (useful for publicly viewable unique identifiers)
# 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):