Skip to content

Instantly share code, notes, and snippets.

💭
Send busy

Bradley Griffiths bradleyg

💭
Send busy
  • Google
  • London
Block or report user

Report or block bradleyg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bradleyg
bradleyg / Dockerfile
Created Oct 26, 2016
Dockerfile for Wagtail on GAE
View Dockerfile
# docker build -t wagtail .
# docker run -it -v $(pwd):/app -p 0.0.0.0:8080:8080 wagtail
FROM ubuntu:latest
RUN apt-get update -y
RUN apt-get install -y python python-pip python-dev libmysqlclient-dev
ADD https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-131.0.0-linux-x86.tar.gz /tmp/cloudsdk.tar.gz
RUN tar -zxvf /tmp/cloudsdk.tar.gz -C /tmp
RUN /tmp/google-cloud-sdk/install.sh
View upload.py
# index.html
<form class="" enctype="multipart/form-data" action="{{ upload_url }}" method="post">
<input type="file" name="file" id="file"><input>
<input type="submit" name="submit" value="Upload">
</form>
# urls.py -----------------------------------
from django.conf.urls import url
View app.yaml.base
###########################################################################
# DO NOT MODIFY THIS FILE WITHOUT UNDERSTANDING THE SECURITY IMPLICATIONS #
###########################################################################
# The "application" parameter is automatically set based on the below rules:
# For util.sh: the argument to '-p' is used
# For Grunt users: the 'appid' value in config.json. It may also be
# overriden by passing an '--appid=' parameter to grunt
# You do not need to modify it here.
application: __APPLICATION__
View index.html
<doctype html>
<html>
<head>
<title>GAE secure static site</title>
<link href="/static/css/styles.css" rel="stylesheet">
</head>
<body>
<h1>Hello world!</h1>
<a href="/offices">View our offices</a>
</body>
View gist:55be982c4798e08e2723
REGIONS = {
'gb': ('ad', 'al', 'at', 'ba', 'be', 'bg', 'by', 'ch', 'cs', 'cz', 'de', 'dk', 'ee', 'es', 'fi', 'fo', 'fx', 'gb', 'gi', 'gr', 'hr', 'hu', 'ie', 'is', 'it', 'li', 'lt', 'lu', 'lv', 'mc', 'md', 'mk', 'mt', 'nl', 'no', 'pl', 'pt', 'ro', 'se', 'si', 'sj', 'sk', 'sm', 'ua', 'va'),
'us': ('na', 'us', 'ca', 'ai', 'ag', 'aw', 'bs', 'bb', 'bz', 'bm', 'vg', 'ky', 'cr', 'cu', 'cw', 'dm', 'do', 'sv', 'gl', 'gd', 'gp', 'gt', 'ht', 'hn', 'jm', 'mq', 'mx', 'pm', 'ms', 'cw', 'kn', 'ni', 'pa', 'pr', 'kn', 'lc', 'pm', 'vc', 'tt', 'tc', 'vi', 'sx', 'mx', 'sa', 'ar', 'bo', 'br', 'cl', 'co', 'ec', 'fk', 'gf', 'gy', 'gy', 'py', 'pe', 'sr', 'uy', 've'),
'me': ('dz', 'bh', 'dj', 'eg', 'ir', 'iq', 'jo', 'kw', 'lb', 'ly', 'mt', 'ma', 'om', 'qa', 'sa', 'sy', 'tn', 'ae', 'ps', 'ye'),
'au': ('au',),
'nz': ('fj', 'nz', 'sb', 'ws', 'to', 'vu', 'ck'),
'as': ('th', 'my', 'sg', 'id', 'ph', 'jp', 'kr', 'cn', 'vn', 'la', 'mm', 'in', 'pk', 'bd', 'lk', 'tw', 'hk', 'kh', 'np', 'bt', 'mn', 'bn', 'mv'),
'de':
View gist:65852e7d69adacb43574
<html>
<head>
<meta charset="utf-8">
<title>s3direct</title>
<link href="/static/s3direct/css/bootstrap-progress.min.css" type="text/css" media="all" rel="stylesheet" />
<link href="/static/s3direct/css/styles.css" type="text/css" media="all" rel="stylesheet" />
<script type="text/javascript" src="/static/s3direct/js/scripts.js"></script>
</head>
<body>
<form action="" method="post">
View gist:5cd556675ec7977f69ea
func LongPoll(w http.ResponseWriter, quit chan struct{}) {
ticker := time.NewTicker(25 * time.Second)
for {
select {
case <-ticker.C:
log.Println("writing")
w.Write([]byte(" "))
w.(http.Flusher).Flush()
case <-quit:
View gist:877c33b147b74ea5569b
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import requests
url = "http://api.impossible.io/v1/token/upload/0fa84b7d-51b034861-9a7d-501a9b289e08.mp4"
payload = {
"task": {
View gist:60235a46d60b63f8b7d2
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x7f7084140598 pc=0x7f709414dae0]
runtime stack:
runtime: unexpected return pc for runtime.sigpanic called from 0x7f709414dae0
runtime.throw(0xa75ee5)
/usr/local/go/src/pkg/runtime/panic.c:520 +0x69
runtime: unexpected return pc for runtime.sigpanic called from 0x7f709414dae0
runtime.sigpanic()
/usr/local/go/src/pkg/runtime/os_linux.c:222 +0x3d
You can’t perform that action at this time.