# 使用 Homebrew 安装 aria2
brew install aria2
# 创建配置文件aria2.conf和空对话文件aria2.session
mkdir ~/.aria2 && cd ~/.aria2
touch aria2.conf
#!/usr/bin/env python | |
import subprocess | |
from flask import Flask, render_template | |
from flask_socketio import SocketIO, send, emit | |
HTML = ''' | |
<html> | |
<head> | |
<title>WEBSHELL</title> |
# 概述:一共三大部分配置。 | |
# 其中#注释掉的可以在需要的时候开启并修改,没有注释掉的(除了下面location示例)不要删掉,基本都是必须的配置项。 | |
###############################第一部分 全局配置############################ | |
#user nobody; 指定启动进程的用户,默认不用指定即可。 | |
#error_log logs/error.log; 配置日志输出,虽然叫error_log但是可以定义输出的级别,默认不写是ERROR级别 | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; 记录pid的文件,默认就是放到这个位置,可以修改。 |
#include <cstdlib> | |
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <cstring> | |
#include <iterator> | |
#include <algorithm> | |
#include <math.h> | |
#include <sstream> | |
#include <cmath> |
from PIL import Image, ImageDraw, ImageFont | |
import argparse | |
import numpy as np | |
sample_rate = 0.4 | |
def ascii_art(file): | |
im = Image.open(file) |
# -*- coding: utf-8 -*- | |
from django import forms | |
from crispy_forms.helper import FormHelper | |
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field | |
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions | |
class MessageForm(forms.Form): | |
text_input = forms.CharField() |
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
.
def time_test(repeat_times=5000): | |
""" | |
函数运行效率装饰器 | |
@see https://blog.csdn.net/Shenpibaipao/article/details/88044951 | |
:param repeat_times: 重复次数 | |
:return: 原函数结果 | |
""" | |
def func_acceptor(func): | |
def wrapper(*arg, **args): | |
import time |
#!/usr/bin/env python | |
from Foundation import NSUserNotification | |
from Foundation import NSUserNotificationCenter | |
from Foundation import NSUserNotificationDefaultSoundName | |
from optparse import OptionParser | |
def main(): | |
parser = OptionParser(usage='%prog -t TITLE -m MESSAGE') |