Skip to content

Instantly share code, notes, and snippets.

@waleoyediran
waleoyediran / controller.py
Created August 6, 2018 22:37 — forked from claymcleod/controller.py
Playstation 4 Controller Python
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file presents an interface for interacting with the Playstation 4 Controller
# in Python. Simply plug your PS4 controller into your computer using USB and run this
# script!
#
# NOTE: I assume in this script that the only joystick plugged in is the PS4 controller.
# if this is not the case, you will need to change the class accordingly.
#
@waleoyediran
waleoyediran / jinja2backend.py
Last active July 20, 2016 11:58 — forked from carljm/jinja2backend.py
Adding support for context processors for Jinja2 templates in Django
import sys
import six
from django.template.backends.jinja2 import Jinja2, Template
from django.template.backends.utils import csrf_token_lazy, csrf_input_lazy
from django.template.exceptions import TemplateDoesNotExist
from jinja2.exceptions import TemplateSyntaxError
from jinja2.utils import import_string
import jinja2
#!/bin/sh
filename=$1
echo "Begin processing file:" $filename
dimensions=$(identify -format '%w %h' $filename)
IFS=' ' read -a array <<< "$dimensions"
width=${array[0]}
height=${array[1]}
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest