start RabbitMQ
rabbitmq-server
start Celery with detail task info
celery -A api.celery worker --loglevel=info
Celery flowers celery -A api.celery flower
flask & mongo
// | |
// SearchTabController.swift | |
// PageViewController | |
// | |
// Created by Chris Li on 3/31/16. | |
// Copyright © 2016 Chris Li. All rights reserved. | |
// | |
import UIKit |
var navBarOriginalHeight: CGFloat = 0.0 | |
let navBarMinHeight: CGFloat = 10.0 | |
var previousScrollViewYOffset: CGFloat = 0.0 | |
// MARK: - UIScrollViewDelegate | |
func scrollViewDidScroll(scrollView: UIScrollView) { | |
guard scrollView.contentSize.height >= scrollView.frame.height else {return} | |
guard let navigationBar = navigationController?.navigationBar else {return} |
class Controller: UIViewController, NSFetchedResultsControllerDelegate { | |
private var closures = [() -> Void]() | |
let managedObjectContext = AppDelegate.persistentContainer.viewContext | |
lazy var fetchedResultController: NSFetchedResultsController<Article> = { | |
}() | |
func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChange anObject: Any, at indexPath: IndexPath?, for type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) { | |
switch type { | |
case .insert: |
start RabbitMQ
rabbitmq-server
start Celery with detail task info
celery -A api.celery worker --loglevel=info
Celery flowers celery -A api.celery flower
flask & mongo
Input:
val = 0
for i in range(0, 100):
val ^= i
print("{}, {}".format(i, val))
Output:
I have a db connection, which need configuration. I want to use this connection in all flask apis. So normally I would do it like this:
app = Flask(__name__)
db = Database(config_obj)
@app.route('/')
def hello():
# a lot of code
username = db.get_data()
return 'Hello, {}!'.format(username)
{
"id": "12345-67890-qwerty",
"command": "./build_zim.sh -args",
"scheduling": {
"repeat": true,
import { Component, OnInit, OnDestroy } from '@angular/core'; | |
import { Observable, Subscription } from 'rxjs/Rx'; | |
import { Task } from '../../model/task'; | |
@Component({ | |
selector: 'tasks', | |
templateUrl: './list-tasks.component.html', | |
styleUrls: ['./list-tasks.component.css'] | |
}) |
import { Component, OnInit, OnDestroy } from '@angular/core'; | |
import { Observable, Subscription } from 'rxjs/Rx'; | |
import { Task } from '../../model/task'; | |
@Component({ | |
selector: 'tasks', | |
templateUrl: './list-tasks.component.html', | |
styleUrls: ['./list-tasks.component.css'] | |
}) |
# stop all dispatcher containers | |
docker stop $(docker ps -q --filter "label=com.chrisshwli.zimfarm.name") | |
# run all dispatcher containers | |
docker-compose up --build -d | |
# run worker | |
docker build -t worker . && docker run -v /var/run/docker.sock:/var/run/docker.sock worker | |
docker run --link=zimfarm-worker-redis:redis openzim/mwoffliner mwoffliner --mwUrl=https://en.wikipedia.org/ [email protected] |