This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker 安装命令 | |
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun | |
sudo groupadd docker | |
sudo usermod -aG docker ${USER} | |
sudo systemctl restart docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func If(condition bool, trueVal, falseVal interface{}) interface{} { | |
if condition { | |
return trueVal | |
} | |
return falseVal | |
} | |
a, b := 2, 3 | |
max := If(a > b, a, b).(int) | |
println(max) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by jvm on 4/12/19. | |
// AVL 树 | |
// 平衡二叉树(AVL)实现 | |
// Doc: https://blog.csdn.net/u014634338/article/details/42465089 | |
// Doc: http://www.cnblogs.com/gaochundong/p/binary_search_tree.html | |
// Doc: https://blog.zhenlanghuo.top/2017/08/22/AVL%E5%B9%B3%E8%A1%A1%E4%BA%8C%E5%8F%89%E6%A0%91%E7%9A%84%E5%AE%9E%E7%8E%B0/ | |
// | |
typedef int ElementType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by jvm on 4/12/19. | |
// Doc: https://segmentfault.com/a/1190000008850005 | |
// | |
#include "tree.h" | |
// 求树的深度 | |
int getDepth(Node* node) { | |
if (node == nullptr) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM: https://segmentfault.com/a/1190000010976507 | |
设置Wifi连接 | |
这一步是本文最关键的一步,也是网上歧义分支最多的一步。在写这一步之前我想了一会儿,到底是应该先上结果还是先上过程。便于理解,还是先说过程的好;可是作为实用帖,先上结果比较有意思。 | |
只需要如下几步即完成: | |
Mac和Windows用户直接打开树莓派SD卡文件夹,Linux用户打开SD卡所呈现的两个分区中叫boot且内存极小的主分区(非树莓派文件系统分区) | |
在根目录放置一个文件名为ssh的文件,无后缀名,内容有没有都无所谓。Windows用户怎么操作可以自己百度下。 | |
在根目录放置一个文件名为wpa_supplicant.conf的文件,内容如下: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update && \ | |
sudo apt-get install build-essential software-properties-common -y && \ | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ | |
sudo apt-get update && \ | |
sudo apt-get install gcc-6 g++-6 -y && \ | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \ | |
gcc -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import select | |
import socket | |
import queue | |
def select_demo(): | |
server = socket.socket() | |
server.bind(('127.0.0.1', 9000)) | |
server.listen(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numbers | |
class Field: | |
pass | |
class CharField(Field): | |
def __init__(self, db_column, max_length: int): | |
self.db_column = db_column |