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]
riegie /
Created July 18, 2019 03:54 — forked from tyuiko/
argparse cheat sheet
import argparse
parser = argparse.ArgumentParser()
### Positional
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")
riegie / Virtual Environment Setup for Python 3
Last active May 9, 2019 16:33
Create virtual environments with venv in Python 3
Python3 Virtual Environment Setup
* Python 3
$ brew install python3
Creation of virtual environment:
$ python3 -m venv /path/to/new/virtual/environment
riegie /
Created February 22, 2018 23:55 — forked from mingrammer/
Python script for AWS Elastic Transcoder with boto api
# -*- coding: utf-8 -*-
import hashlib
import boto3
class ETSManager:
@todo: manages and provides the ets services
riegie / gistlog.yml
Created February 20, 2018 23:14 — forked from askilondz/gistlog.yml
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

riegie /
Created April 4, 2017 00:43 — forked from gavinballard/
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 =, secret, hashlib.sha256)
hmac_calculated = base64.b64encode(hash.digest())
riegie / django_auth.js
Created September 8, 2016 17:09 — forked from tianchu/django_auth.js
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
riegie /
Last active August 29, 2015 14:16 — forked from treyhunner/
# This code is under the MIT license.
# Inspired by this StackOverflow question:
import struct
from Crypto.Cipher import DES
from django.db import models
def base36encode(number):