Skip to content

Instantly share code, notes, and snippets.

import matplotlib.pyplot as plt
import numpy as np
# Unit of loan time: year
# kind of amortization: equal loan payments and equal principal payments
loans=[[1000000,3.25,27],[990000,4.65,30]] # year1 <= year2
total1,interest1,year1=loans[0][0],loans[0][1],loans[0][2]
total2,interest2,year2=loans[1][0],loans[1][1],loans[1][2]
<div class="mermaid">
gantt
title Adding GANTT diagram functionality to mermaid
section A section
Completed task :done, des1, 2020-03-06, 2020-03-08
Active task :active, des2, 2020-03-09, 1d
Future task : des3, after des2, 1d
![about figure](/xxx/xxx/figure.png) # 默认
<div align="right"><img width="100" src="https://raw.githubusercontent.com/LfqGithub/LfqGithub.github.io/master/images/graphviz/example1.png"/></div> # 控制图片大小和位置
<div align="center"><img height="400" src="https://raw.githubusercontent.com/LfqGithub/LfqGithub.github.io/master/images/image_name.png"/><figcaption>I am a caption</figcaption></div> # 添加 Caption
[user]
email = 995614183@qq.com
name = LfqGithub
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
import logging
from colorlog import ColoredFormatter # pip3 install colorlog
LOG_LEVEL = logging.DEBUG
LOGFORMAT = " %(log_color)s%(levelname)-8s%(reset)s | %(log_color)s%(message)s%(reset)s"
# logging.basicConfig(filename='log') # save log in local file
logging.root.setLevel(LOG_LEVEL)
formatter = ColoredFormatter(LOGFORMAT)
stream = logging.StreamHandler()
2020-02-06 19:21:42,951 INFO : this is information)
2020-02-06 19:21:42,951 WARNING : this is warning message)
2020-02-06 19:21:42,951 ERROR : this is error message)
2020-02-06 19:21:42,951 CRITICAL: this is fatal message, it is same as logger.critical)
2020-02-06 19:21:42,951 CRITICAL: this is critcal message)
import logging
import sys
logger=logging.getLogger('learn-logging')
formatter=logging.Formatter('%(asctime)s %(levelname)-8s: %(message)s)')
file_handler=logging.FileHandler("example.log")
file_handler.formatter=formatter
console_handler=logging.StreamHandler(sys.stdout)
import matplotlib.pyplot as plt
import numpy as np
markers = [
".",
",",
"o",
"v",
"^",
"<",
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
fig.set_facecolor('gray')
fig.patch.set_facecolor('gray')
fig.set_alpha(0.6)
fig.patch.set_alpha(0.6)
ax.set_alpha(0)