apt-get install haproxy
vim /etc/haproxy/haproxy.cfg
and add text below:
stats uri /stats
stats auth sunmingming:solomon
frontend main
bind *:80
pip install jupyter
jupyter notebook --no-browser --port=9998 --NotebookApp.base_url=/notebook
.
sudo nginx -t -c /etc/nginx/nginx.conf
, if ok reload nginx with sudo nginx -s reload -c /etc/nginx/nginx.conf
location /notebook/ {
proxy_pass http://localhost:9998;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
!j::Send, {Left} | |
!l::Send, {Right} | |
!k::Send, {Down} | |
!i::Send, {Up} |
import os | |
import struct | |
import numpy as np | |
""" | |
Loosely inspired by http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py | |
which is GPL licensed. | |
""" | |
def read(dataset = "training", path = os.path.join(os.path.dirname(__file__), 'mnist')): |
For the importance of commit-logs to committed-changes-review, logs are frequently checked. Effective and beautiful logs would double the efficiency. Then comes the question, how? One way is to making rules. Rules and convention makes logs lawful. The other way is to making the style. Beautiful styles makes logs delightful.
Angualr Convension is a popular and proper convention for this job. It regularizes logs with 'type-scope-msg' convention. Just like those below. Click-here-to-see-detail
import cv2 | |
def mark_photo(text, path, output_path=None): | |
img = cv2.imread(path) | |
height, width = img.shape[:2] | |
font = cv2.FONT_HERSHEY_SCRIPT_COMPLEX | |
img = cv2.putText(img, text, (width - 500, height - 80), font, 1.2, (0, 255, 255)) | |
if output_path is None: | |
path_parts = path.split('.') |
贝叶斯定理在检测吸毒者时很有用。假设一个常规的检测结果的敏感度与可靠度均为99%,也就是说,当被检者吸毒时,每次检测呈阳性(+)的概率为99%。而被检者不吸毒时,每次检测呈阴性(-)的概率为99%。
从检测结果的概率来看,检测结果是比较准确的,但是贝叶斯定理却可以揭示一个潜在的问题。
假设某公司将对其全体雇员进行一次鸦片吸食情况的检测,已知0.5%的雇员吸毒。我们想知道,每位医学检测呈阳性的雇员吸毒的概率有多高?
令“D”为雇员吸毒事件,“N”为雇员不吸毒事件,“+”为检测呈阳性事件。
可得: