https://realpython.com/blog/python/asynchronous-tasks-with-django-and-celery/
$ pip install celery
$ sudo apt-get install rabbitmq-server
| [Desktop Entry] | |
| Version=1.0 | |
| Name=Firefox Nightly | |
| Comment=Browse the World Wide Web | |
| GenericName=Web Browser | |
| Keywords=Internet;WWW;Browser;Web;Explorer | |
| Exec=firefox-nightly | |
| Terminal=false | |
| X-MultipleArgs=false | |
| Type=Application |
| import React, { Component } from "react"; | |
| import { Machine, assign } from "xstate"; | |
| import { useMachine } from "@xstate/react"; | |
| const allData = new Array(25).fill(0).map((_val, i) => i + 1); | |
| const perPage = 10; | |
| const dataMachine = new Machine({ | |
| id: "dataMachine", | |
| initial: "loading", | |
| context: { |
| if(process.env.NODE_ENV !== 'production') const variable = require('variable'); |
| #!/bin/bash | |
| DB=[YOUR_DB_NAME] | |
| OWNER=[NEW_OWNER] | |
| # alter tables owner | |
| for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" $DB` ; do psql -c "alter table \"$tbl\" owner to $OWNER" $DB ; done | |
| # alter sequences owner | |
| for tbl in `psql -qAt -c "select sequence_name from information_schema.sequences where sequence_schema = 'public';" $DB` ; do psql -c "alter table \"$tbl\" owner to $OWNER" $DB ; done |
https://realpython.com/blog/python/asynchronous-tasks-with-django-and-celery/
$ pip install celery
$ sudo apt-get install rabbitmq-server
| FROM python:latest | |
| ADD requirements.txt /requirements.txt | |
| RUN python3.6 -m venv /venv \ | |
| && /venv/bin/pip install -U pip \ | |
| && LIBRARY_PATH=/lib:/usr/lib /bin/sh -c "/venv/bin/pip install --no-cache-dir -r /requirements.txt" | |
| ENV PYTHONUNBUFFERED 1 | |
| # Copy your application code to the container (make sure you create a .dockerignore file if any large files or directories should be excluded) | |
| RUN mkdir /code/ |
| import os | |
| import zipfile | |
| import StringIO | |
| from django.http import HttpResponse | |
| def getfiles(request): | |
| # Files (local path) to put in the .zip | |
| # FIXME: Change this (get paths from DB etc) |
| import React from 'react' | |
| export const PostItem = (props) => { | |
| return( | |
| <div> | |
| <span>{props.post.title}</span> | |
| <button | |
| onClick={() =>{props.clickAction(props.post)}}> | |
| view details | |
| </button> |
| #!/usr/bin/env bash | |
| # Generates gource video (h.264) out of multiple repositories. | |
| # Pass the repositories in command line arguments. | |
| # Example: | |
| # <this.sh> /path/to/repo1 /path/to/repo2 | |
| RESOLUTION="1600x1080" | |
| outfile="gource.mp4" | |
| i=0 |