This file contains 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
// Based on http://pythonhackers.com/p/fluent-ffmpeg/node-fluent-ffmpeg | |
// and https://trac.ffmpeg.org/wiki/Create%20a%20mosaic%20out%20of%20several%20input%20videos | |
// Usage: | |
// node ffmpeg-mosaic.js file1.mp2 file2.mp4 file3.mp4 file4.mp4 | |
// Generates out.mp4 | |
var ffmpeg = require('fluent-ffmpeg'); | |
var command = ffmpeg() |
This file contains 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
(function () { | |
var ffmpeg = require('fluent-ffmpeg'); | |
function baseName(str) { | |
var base = new String(str).substring(str.lastIndexOf('/') + 1); | |
if(base.lastIndexOf(".") != -1) { | |
base = base.substring(0, base.lastIndexOf(".")); | |
} | |
return base; | |
} |
This file contains 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
/* Assumes the following directory structure: | |
* ./images # With original images | |
* ./base # With the index.html, css, js to be used to create a base template | |
* # This directory containts its own gulpfile (maybe coming from a yeoman or similar) | |
* ./server # Actual Django project, with a templates subdirectory | |
*/ | |
var gulp = require('gulp'); | |
var chug = require( 'gulp-chug' ); | |
var awspublish = require('gulp-awspublish'); |
This file contains 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
''' | |
Example of a deployment script for: | |
- A Django based server running as an Elastic Beanstalk server tier, with Load Balancing | |
(Assumes a pre-configured RDS database - best practice) | |
- A Docker based running as an Elastic Beanstalk worker tier | |
Assumes following directory structure | |
- ./server # With Django based project and appropriate .ebextensions | |
- ./worker # with Docker based project and appropriate .ebextensions, Dockerfile and Dockerrun.aws.json file | |
# (similar to https://github.com/dkarchmer/aws-eb-docker-django) |
This file contains 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
__author__ = 'David Karchmer' | |
''' | |
Main fucntionality to manage API calls to a Django based server (with django-rest-framework) | |
Demonstrates how to set token on header for secure gets/posts | |
''' | |
import json | |
import requests | |
import logging | |
DOMAIN_NAME = 'https://example.com' |
This file contains 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
packages: | |
yum: | |
libjpeg-turbo-devel: [] | |
postgresql93-devel: [] | |
container_commands: | |
01_migrate: | |
command: "django-admin.py migrate --noinput" | |
leader_only: true | |
02_initadmin: |
This file contains 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
__author__ = 'dkarchmer' | |
''' | |
This script emulates a stand-alone Python based client. It relies on Boto3 to access AWS, but | |
requires your Django server to have an API for your user to access Cognito based credentials | |
Because of Cognito, the client (this script) will only get temporary AWS credentials associated | |
to your user and only your user, and based on whatever you configure your AIM Policy to be. | |
Most Cognito examples demonstrate how to use Cognito for Mobile Apps, so this scripts demonstrate | |
how to create a stand-alone Python script but operating similarly to these apps. |
This file contains 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
__author__ = 'dkarchmer' | |
""" | |
See https://gist.github.com/dkarchmer/d85e55f9ed5450ba58cb | |
This API generically supports DjangoRestFramework based APIs | |
It is based on https://github.com/samgiles/slumber, but customized for | |
Django Rest Frameworks, and the use of TokenAuthentication. | |
Usage: | |
# Assuming | |
# v1_api_router.register(r'some_model', SomeModelViewSet) |
This file contains 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
version: '2' | |
services: | |
# Data | |
dbdata: | |
image: busybox | |
command: "true" | |
volumes: | |
- /var/lib/postgresql/data | |
- /data |
This file contains 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 django.test import TestCase, RequestFactory | |
from django.utils.importlib import import_module | |
from django.contrib.auth import get_user_model | |
from django.core.urlresolvers import reverse | |
from django.contrib.sessions.middleware import SessionMiddleware | |
from django.contrib.messages.middleware import MessageMiddleware | |
from rest_framework import status | |
from .models import * |
OlderNewer