Skip to content

Instantly share code, notes, and snippets.

api:
build: ./api
command: python api.py
expose:
- "5000"
volumes:
- ./api:/app
web:
image: nginx
from flask import request
from flask.ext.api import FlaskAPI
import spacy.en
nlp = spacy.en.English()
app = FlaskAPI(__name__)
POS_TO_STRING = {
FROM dockerfile/python
RUN mkdir /app
WORKDIR /app
ADD requirements.txt /app/
RUN pip install -r requirements.txt
RUN python -m spacy.en.download
class EventCreateView extends Backbone.View
id: 'overlay'
initialize: ->
@template = _.template($('#template-event-create').html())
@render()
events: {
'submit form': 'submit'
'click .cancel': 'close'
@bmease
bmease / gist:8771232
Created February 2, 2014 16:49
Unable to pull Shipyard
(2.7)[11:44][brad:~]$ sudo docker run -i -t -v /var/run/docker.sock:/docker.sock shipyard/deploy setup
Unable to find image 'shipyard/deploy' (tag: latest) locally
Pulling repository shipyard/deploy
773d91471724: Error pulling image (latest) from shipyard/deploy, endpoint: https://cdn-registry-1.docker.io/v1/, link /var/lib/docker/devicemapper/mnt/b56cd19da7ba384351e680ec2b0035916d21268bd416dc42b93bb39311050cbf/rootfs/.wh..wh.plnk/278.3440042 /var/lib/docker/devicemapper/mnt/b773d91471724: Error pulling image (latest) from shipyard/deploy, link /var/lib/docker/devicemapper/mnt/b56cd19da7ba384351e680ec2b0035916d21268bd416dc42b93bb39311050cbf/rootfs/.wh..wh.plnk/278.3440042 /var/lib/docker/devicemapper/mnt/b56cd19da7ba384351e680ec2b0035916d21268bd416dc42b93bb39311050cbf/rootfs/var/lib/dpkg/available-old: no such file or directory
b56cd19da7ba: Pulling metadata
2014/02/02 11:45:01 Could not find repository on any of the indexed registries.
Initial state: Input(DVI), Output(DVI)
Goal state: Output(VGA)
Actions:
VGAAdapter(DVI, VGA)
Preconditions: Output(DVI)
Postconditions: !Output(DVI), Output(VGA)
@receiver(post_save, sender=User)
def create_default_shelves(sender, **kwargs):
'''Creates default shelves for a user'''
if kwargs['created'] is True:
user = kwargs['instance']
for name, slug in DEFAULT_SHELF_NAMES:
shelf = Shelf(name=name, slug=slug, user=user)
shelf.save()
@bmease
bmease / Readme.md
Last active February 15, 2017 18:03
A dashing widget that displays tickets for Freshdesk.com

Description

A dashing widget that displays tickets for Freshdesk.com

  • Displays unassigned tickets subject and time.
  • Displays Ticket counts assigned to Agents.
  • Time for each ticket changes color depending on age.

Preview

Freshdesk Dashing Widget

from django.views.generic import ListView, DetailView
from .models import Drink
class DrinkListView(ListView):
model = Drink
class DrinkDetailView(DetailView):
model = Drink
@bmease
bmease / scrape.py
Created March 15, 2013 12:34
Example scraping of alice in vapeland.
import requests
from lxml import html
def get_list():
"""Finds all the liquids from the index page"""
# Make the request to the website
request = requests.get('https://aliceinvapeland.com/e-juices')
# Parse the request into some fancy structure