sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
| //! The HTTP request method | |
| //! | |
| //! This module contains HTTP-method related structs and errors and such. The | |
| //! main type of this module, `Method`, is also reexported at the root of the | |
| //! crate as `http::Method` and is intended for import through that location | |
| //! primarily. | |
| //! | |
| //! # Examples | |
| //! | |
| //! ``` |
| /// Converts a slice of bytes to an HTTP method. | |
| pub fn from_bytes(src: &[u8]) -> Result<Method, InvalidMethod> { | |
| match src.len() { | |
| 0 => Err(InvalidMethod::new()), | |
| 3 => match src { | |
| b"GET" => Ok(Method(Get)), | |
| b"PUT" => Ok(Method(Put)), | |
| _ => Method::extension_inline(src), | |
| }, | |
| 4 => match src { |
| # %% 位置 | |
| print("{0} {1}".format("hello", "world")) | |
| print("{} {}".format("hello", "world")) | |
| print("{1} {0} {1}".format("hello", "world")) | |
| # %% 关键字 | |
| print("I am {name}, age is {age}".format(name="huoty", age=18)) | |
| user = {"name": "huoty", "age": 18} | |
| "I am {name}, age is {age}".format(**user) |
| import kudu | |
| from kudu.client import Partitioning | |
| from datetime import datetime | |
| # Connect to Kudu master server | |
| client = kudu.connect(host='localhost', port=7051) | |
| # Define a schema for a new table | |
| builder = kudu.schema_builder() | |
| builder.add_column('key').type(kudu.int64).nullable(False).primary_key() |
| #!/usr/bin/env python3 | |
| import time | |
| from uuid import getnode as get_mac | |
| import flask | |
| """ | |
| 基于twitter的雪花算法生成不重复,且具有自增的流水号 | |
| 该算法参考 https://github.com/twitter/snowflake | |
| """ | |
| app = flask.Flask(__name__) |
| import asyncio | |
| from asyncio_mqtt import Client | |
| import time | |
| import uvloop | |
| import sys | |
| topic = "topic" | |
| topic1 = "topic1" | |
| topic2 = "topic2" | |
| topic3 = "topic3" |