- Python 3
- Pip 3
$ brew install python3
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
HTTP server that provides a web interface to run "tail" on a file, | |
like the Unix command. | |
This is a standalone script. No external dependencies required. | |
How to invoke: |
from celery import chain | |
from django.core.management.base import BaseCommand | |
from . import tasks | |
class Command(BaseCommand): | |
def handle(self, *args, **kwargs): |
import requests | |
from pygithub3 import Github | |
# Example: Hit a 3rd-party API | |
# ---------------------------- | |
def get_user(username): | |
gh = Github() | |
return gh.users.get(username) |
def main(): | |
testobj_0 = MemoMethods('test0') | |
testobj_1 = MemoMethods('test1') | |
wrong0 = testobj_0.foo_borked | |
right0 = testobj_0.foo_fixed | |
wrong1 = testobj_1.foo_borked | |
right1 = testobj_1.foo_fixed | |
# this is the bug, wrong0's method is run with test1 as self |
# !/usr/bin/env bash | |
# File path should be ./bin/post_compile | |
# (.sh extension added in Gist just to enable shell syntax highlighting. | |
# https://discussion.heroku.com/t/django-automaticlly-run-syncdb-and-migrations-after-heroku-deploy-with-a-buildpack-or-otherwise/466/7 | |
echo "=> Performing database migrations..." | |
python manage.py migrate |
"""Asynchronous requests in Flask with gevent""" | |
from time import time | |
from flask import Flask, Response | |
from gevent.pywsgi import WSGIServer | |
from gevent import monkey | |
import requests |
Install Supervisor with sudo apt-get install supervisor
in Unix or brew install supervisor
in Mac OSX. Ensure it's started with sudo service supervisor restart
in Unix or brew services start supervisor
in Mac OSX.
In Unix in /etc/supervisord/conf.d/
create a .conf
file. In this example, laravel_queue.conf
(contents below). Give it execute permissions: chmod +x laravel_queue.conf
.
In Mac OSX first run supervisord -c /usr/local/etc/supervisord.ini
and in /usr/local/etc/supervisor.d/
create a .conf
file. In this example, laravel_queue.conf
(contents below). Give it execute permissions: chmod +x laravel_queue.conf
.
This file points at /usr/local/bin/run_queue.sh
, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh
.
Now update Supervisor with: sudo supervisorctl reread
in Unix and with: brew services restart supervisor
in MAc OSX . And start using those changes with: sudo supervisorctl update
.
worker_processes auto; | |
error_log /dev/stdout debug; | |
events { | |
worker_connections 2048; | |
} | |
http { | |
upstream flaskserver { | |
ip_hash; |
{ | |
"name": "webpack-sass", | |
"version": "1.0.0", | |
"scripts": { | |
"start": "webpack-dev-server --open --mode development", | |
"build": "webpack -p" | |
}, | |
"devDependencies": { | |
"babel-core": "^6.26.0", | |
"babel-loader": "^7.1.4", |