Python Subprocess
2017-10-02
这里是指在本地执行命令的方法,通过 SSH 的方式这里不做讨论。
DB MySQL
2017-09-01
我们通常使用以下几种方式表示布尔值:
tinyint(1)
bit(1)
enum('Y','N')
在 MySQL 中 bool
, boolean
是 tinyint(1)
的别名。
如果只是一个 True OR False 的布尔型,没有比 bit(1)
更合适的了。
但是也有些时候,我们有好几个 bool 型用一个字段表示,最好用 bit(m)
,我也用过 int
型。
附:不同值的长度
Type |
Bit |
Byte |
Note |
tinyint |
8 |
1 |
|
smallint |
16 |
2 |
|
middleint |
24 |
3 |
|
int |
32 |
4 |
|
bigint |
64 |
8 |
|
bit(m) |
m |
(m+7)/8 |
|
binary[(m)] |
|
m |
m 默认值:1 |
varbinary(m) |
|
(m+1) |
|
tinyblob |
|
(L+1) |
1B 长度,最长 255B |
blob[(m)] |
|
(L+2) |
2B 长度,最长 64KB - 1 |
mediumblob |
|
(L+3) |
3B 长度,最长 16MB - 1 |
longblob |
|
(L+4) |
4B 长度,最长 4GB - 1 |
enum('a',..) |
|
1/2 |
最多可以存储 2^16 - 1 个值 |
set('a',..) |
|
1/2/3/4/8 |
最多可以存储 64 个值 |
PS: blob
如果指定长度 m
,MySQL 会选择足够存储数据的最小长度。
PS: MySQL set 类型
参考资料与拓展阅读
DB MySQL
2017-08-25
IP 地址的存储方式就两种:字符串,整型数。
表示方法
ipv4 VARCHAR(15) -- xx.xx.xx.xx
ipv6 VARCHAR(39) -- xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
ipv4 INT UNSIGNED
ipv6 BINARY(16)
-- 如果同时需要表达 IPv4 和 IPv6
ip VARCHAR(39)
ip BINARY(16)
PS:我还在有些地方看到过这种采用 12 位整数表示 IPv4 的方法:'192.168.0.1' => 192168000001, 如果存到 MySQL 的话,只能采用 BIGINT
或 VARCHAR(12)
了。
如果省略中间的分号,ipv6 只需要 VARCHAR(32)
就行了。
整型和字符串的转换
INET_ATON
/ INET_NTOA
INET6_ATON
/ INET6_NTOA
Python 测试 单元测试
2017-08-06
其他项目:
- openatx/uiautomator2

Android Uiautomator2 Python Wrapper
- pytest-dev/pytest

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
- pytest-dev/pytest-testinfra

Testinfra test your infrastructures
- jeffzh3ng/fuxi

Penetration Testing Platform
- locustio/locust

Scalable user load testing tool written in Python
- svanoort/pyresttest

Python Rest Testing
- SECFORCE/sparta

Network Infrastructure Penetration Testing Tool
- sivel/speedtest-cli

Command line interface for testing internet bandwidth using speedtest.net
- infobyte/faraday

Collaborative Penetration Test and Vulnerability Management Platform
- robotframework/robotframework

Generic automation framework for acceptance testing and RPA
- Manisso/fsociety

fsociety Hacking Tools Pack – A Penetration Testing Framework
- cocotb/cocotb

cocotb, a coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python
- wolever/parameterized

Parameterized testing with any Python test framework
- cujanovic/SSRF-Testing

SSRF (Server Side Request Forgery) testing resources
- liwanlei/FXTest

接口自动化测试平台——python+flask版,支持http协议,java 版本开发完毕https://github.com/liwanlei/plan
- kmmbvnr/django-jenkins

Plug and play continuous integration with django and jenkins
- xiaocong/uiautomator

Python wrapper of Android uiautomator test tool.
- cobrateam/splinter

splinter - python test framework for web applications
- FSecureLABS/needle

The iOS Security Testing Framework
- robotframework/SeleniumLibrary

Web testing library for Robot Framework
- githublitao/api_automation_test

接口自动化测试平台,已停止维护,看心情改改
- ndb796/python-for-coding-test

[한빛미디어] "이것이 취업을 위한 코딩 테스트다 with 파이썬" 전체 소스코드 저장소입니다.
- FactoryBoy/factory_boy

A test fixtures replacement for Python
- Blazemeter/taurus

Automation-friendly framework for Continuous Testing by
- jazzband/django-nose

Django test runner using nose
- flipkart-incubator/Astra

Automated Security Testing For REST API's
- nose-devs/nose

nose is nicer testing for python
- SecuraBV/CVE-2020-1472

Test tool for CVE-2020-1472
- localstack/localstack

💻 A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline!
- spulec/freezegun

Let your Python tests travel through time
- Tencent/FAutoTest

A UI automated testing framework for H5 and applets
- robotframework/RIDE

Test data editor for Robot Framework
- microsoft/playwright-python

Python version of the Playwright testing and automation library.
- autotest/autotest

Autotest - Fully automated tests on Linux
- ansible-community/molecule

Molecule aids in the development and testing of Ansible roles
- pytest-dev/pytest-xdist

pytest plugin for distributed testing and loop-on-failures testing modes.
- powerfulseal/powerfulseal

A powerful testing tool for Kubernetes clusters.
- google/nogotofail

An on-path blackbox network traffic security testing tool
- wntrblm/nox

Flexible test automation for Python
- mjhea0/flaskr-tdd

Flaskr: Intro to Flask, Test-Driven Development (TDD), and JavaScript
- aws-ia/taskcat

Test all the CloudFormation things! (with TaskCat)
- facebookarchive/huxley

A testing system for catching visual regressions in Web applications.
- pytest-dev/pytest-bdd

BDD library for the py.test runner
- dagrz/aws_pwn

A collection of AWS penetration testing junk
- boxed/mutmut

Mutation testing system
- vishnubob/wait-for-it

Pure bash script to test and wait on the availability of a TCP host and port
- ethereum/casper

Casper contract, and related software and tests
- jhlau/doc2vec

Python scripts for training/testing paragraph vectors
- fsociety-team/fsociety

A Modular Penetration Testing Framework
- 0xInfection/TIDoS-Framework

The Offensive Manual Web Application Penetration Testing Framework.
- praetorian-inc/pentestly

Python and Powershell internal penetration testing framework
- hizhangp/yolo_tensorflow

Tensorflow implementation of YOLO, including training and test phase.
- zhuifengshen/xmind2testcase

XMind2TestCase基于python实现,提供了一个高效测试用例设计的解决方案!
- AnasAboureada/Penetration-Testing-Study-Notes

Penetration Testing notes, resources and scripts
- jseidl/GoldenEye

GoldenEye Layer 7 (KeepAlive+NoCache) DoS Test Tool
- testcontainers/testcontainers-python

Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.
- spulec/moto

A library that allows you to easily mock out tests based on AWS infrastructure.
- buildbot/buildbot

Python-based continuous integration testing framework; your pull requests are more than welcome!
- fossasia/open-event-server

The Open Event Organizer Server to Manage Events https://test-api.eventyay.com
- AirtestProject/Poco

A cross-engine test automation framework based on UI inspection
- Yijunmaverick/CartoonGAN-Test-Pytorch-Torch

Pytorch and Torch testing code of CartoonGAN [Chen et al., CVPR18]
- ionelmc/pytest-benchmark

py.test fixture for benchmarking code
- aws/aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
- crossbario/autobahn-testsuite

Autobahn WebSocket protocol testsuite
- sixpack/sixpack

Sixpack is a language-agnostic a/b-testing framework
- SofianeHamlaoui/Lockdoor-Framework

🔐 Lockdoor Framework : A Penetration Testing framework with Cyber Security Resources
- mongomock/mongomock

Small library for mocking pymongo collection objects for testing purposes
- OWASP/owasp-mstg

The Mobile Security Testing Guide (MSTG) is a comprehensive manual for mobile app security testing and reverse engineering. It describes the technical processes for verifying the controls listed in the OWASP Mobile Application Security Verification Standard (MASVS).
- python-needle/needle

Automated tests for your CSS.
- gyoisamurai/GyoiThon

GyoiThon is a growing penetration test tool using Machine Learning.
- SeldomQA/seldom

WebUI/HTTP automation testing framework based on unittest
- joestump/python-oauth2

A fully tested, abstract interface to creating OAuth clients and servers.
- maltize/sublime-text-2-ruby-tests

Sublime Text 2 plugin for running ruby tests! (Unit, RSpec, Cucumber)
- emirozer/fake2db

create custom test databases that are populated with fake data
- owid/covid-19-data

Data on COVID-19 (coronavirus) cases, deaths, hospitalizations, tests • All countries • Updated daily by Our World in Data
- Teemu/pytest-sugar

a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly)
- GeorgeSeif/Semantic-Segmentation-Suite

Semantic Segmentation Suite in TensorFlow. Implement, train, and test new Semantic Segmentation models easily!
- jamesls/fakeredis

Fake implementation of redis API (redis-py) for testing purposes
- HypothesisWorks/hypothesis

Hypothesis is a powerful, flexible, and easy to use library for property-based testing.
- se2p/pynguin

The PYthoN General UnIt Test geNerator is a test-generation tool for Python
- luogu-dev/cyaron

CYaRon: Yet Another Random Olympic-iNformatics test data generator
- knownsec/pocsuite3

pocsuite3 is an open-sourced remote vulnerability testing framework developed by the Knownsec 404 Team.
- seleniumbase/SeleniumBase

A Python framework that inspires developers to become better test automation engineers. 🧠💡
- terraform-compliance/cli

a lightweight, security focused, BDD test framework against terraform.
- coqui-ai/TTS

🐸💬 - a deep learning toolkit for Text-to-Speech, battle-tested in research and production
- facebookresearch/DomainBed

DomainBed is a suite to test domain generalization algorithms
- qubvel/ttach

Image Test Time Augmentation with PyTorch!
- RhinoSecurityLabs/pacu

The AWS exploitation framework, designed for testing the security of Amazon Web Services environments.
- doyensec/inql

InQL - A Burp Extension for GraphQL Security Testing
- revsys/django-test-plus

Useful additions to Django's default TestCase
- online-judge-tools/oj

Tools for various online judges. Downloading sample cases, generating additional test cases, testing your code, and submitting it.
- ticarpi/jwt_tool

:snake: A toolkit for testing, tweaking and cracking JSON Web Tokens
- yashaka/selene

User-oriented Web UI browser tests in Python
- davidtvs/pytorch-lr-finder

A learning rate range test implementation in PyTorch
- kevinburke/hamms

Malformed servers to test your HTTP client
- tarpas/pytest-testmon

Selects tests affected by changed files. Continous test runner when used with pytest-watch.
- pluwen/awesome-testflight-link

Collection of Testflight public app link(iOS/iPad OS/macOS)。
- facebookarchive/bootstrapped

Generate bootstrapped confidence intervals for A/B testing in Python.
- devpi/devpi

Python PyPi staging server and packaging, testing, release tool
- eth-brownie/brownie

A Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.
- scanapi/scanapi

Automated Integration Testing and Live Documentation for your API
- kevin1024/vcrpy

Automatically mock your HTTP interactions to simplify and speed up testing
- sodadata/soda-core

Data profiling, testing, and monitoring for SQL accessible data.
- CleanCut/green

Green is a clean, colorful, fast python test runner.
- trailofbits/deepstate

A unit test-like interface for fuzzing and symbolic execution
- ashishb/adb-enhanced

🔪Swiss-army knife for Android testing and development 🔪 ⛺
- D4Vinci/One-Lin3r

Gives you one-liners that aids in penetration testing operations, privilege escalation and more
- newsapps/beeswithmachineguns

A utility for arming (creating) many bees (micro EC2 instances) to attack (load test) targets (web applications).
- nilboy/tensorflow-yolo

tensorflow implementation of 'YOLO : Real-Time Object Detection'(train and test)
- NVlabs/FUNIT

Translate images to unseen domains in the test time with few example images.
- kyclark/tiny_python_projects

Code for Tiny Python Projects (Manning, 2020, ISBN 1617297518). Learning Python through test-driven development of games and puzzles.
- XifengGuo/CapsNet-Keras

A Keras implementation of CapsNet in NIPS2017 paper "Dynamic Routing Between Capsules". Now test error = 0.34%.
- defparam/smuggler

Smuggler - An HTTP Request Smuggling / Desync testing tool written in Python 3
- joeyespo/pytest-watch

Local continuous test runner with pytest and watchdog.
- s0md3v/Blazy

Blazy is a modern login bruteforcer which also tests for CSRF, Clickjacking, Cloudflare and WAF .
- chakki-works/sumeval

Well tested & Multi-language evaluation framework for text summarization.
- kiwitcms/Kiwi

The leading open source test management system with over 1 million downloads!
- chenjj/espoofer

An email spoofing testing tool that aims to bypass SPF/DKIM/DMARC and forge DKIM signatures.🍻
- MisterBianco/BoopSuite

A Suite of Tools written in Python for wireless auditing and security testing.
- cszn/KAIR

Image Restoration Toolbox (PyTorch). Training and testing codes for DPIR, USRNet, DnCNN, FFDNet, SRMD, DPSR, BSRGAN, SwinIR
- rueckstiess/mtools

A collection of scripts to set up MongoDB test environments and parse and visualize MongoDB log files.
- MozillaSecurity/funfuzz

A collection of fuzzers in a harness for testing the SpiderMonkey JavaScript engine.
- schemathesis/schemathesis

A modern API testing tool for web applications built with Open API and GraphQL specifications.
- worstcase/blockade

Docker-based utility for testing network failures and partitions in distributed applications
- kvalle/diy-lang

A hands-on, test driven guide to implementing a simple programming language
- nidhaloff/igel

a delightful machine learning tool that allows you to train, test, and use models without writing code
- minimaxir/gpt-3-experiments

Test prompts for OpenAI's GPT-3 API and the resulting AI-generated texts.
- tonglei100/sweetest

小而美的自动化测试解决方案,支持 Web UI 测试,Http 接口测试,DB 操作测试,App 测试,小程序测试,Windows GUI 测试,文件操作
- sdispater/cleo

Cleo allows you to create beautiful and testable command-line interfaces.
- joedicastro/vps-comparison

A comparison between some VPS providers. It uses Ansible to perform a series of automated benchmark tests over the VPS servers that you specify. It allows the reproducibility of those tests by anyone that wanted to compare these results to their own. All the tests results are available in order to provide independence and transparency.
- ryansmcgee/seirsplus

Models of SEIRS epidemic dynamics with extensions, including network-structured populations, testing, contact tracing, and social distancing.
- karec/cookiecutter-flask-restful

Flask cookiecutter template for builing APIs with flask-restful, including JWT auth, cli, tests, swagger, docker and more
- facebookresearch/FixRes

This repository reproduces the results of the paper: "Fixing the train-test resolution discrepancy" https://arxiv.org/abs/1906.06423
- honeynet/droidbot

A lightweight test input generator for Android. Similar to Monkey, but with more intelligence and cool features!
- darrenburns/ward

Ward is a modern test framework for Python with a focus on productivity and readability.
- httpie/http-prompt

An interactive command-line HTTP and API testing client built on top of HTTPie featuring autocomplete, syntax highlighting, and more. https://twitter.com/httpie
- codingo/Reconnoitre

A security tool for multithreaded information gathering and service enumeration whilst building directory structures to store results, along with writing out recommendations for further testing.
- deepmind/pycolab

A highly-customisable gridworld game engine with some batteries included. Make your own gridworld games to test reinforcement learning agents!
- mjpost/sacrebleu

Reference BLEU implementation that auto-downloads test sets and reports a version string to facilitate cross-lab comparisons
- pschanely/CrossHair

An analysis tool for Python that blurs the line between testing and type systems.
- microsoft/restler-fuzzer

RESTler is the first stateful REST API fuzzing tool for automatically testing cloud services through their REST APIs and finding security and reliability bugs in these services.
- RussBaz/enforce

Python 3.5+ runtime type checking for integration testing and data validation
- pyvisa/pyvisa

A Python package with bindings to the "Virtual Instrument Software Architecture" VISA library, in order to control measurement devices and test equipment via GPIB, RS232, or USB.
- garethdmm/gryphon

Powerful, proven, and extensible framework for building trading strategies at any frequency, with a focus on crypto currencies. Battle-tested with billions traded.
- taverntesting/tavern

A command-line tool and Python library and Pytest plugin for automated testing of RESTful APIs, with a simple, concise and flexible YAML-based syntax
- dephell/dephell

:package: :fire: Python project management. Manage packages: convert between formats, lock, install, resolve, isolate, test, build graph, show outdated, audit. Manage venvs, build package, bump version.
- hash3liZer/WiFiBroot

A Wireless (WPA/WPA2) Pentest/Cracking tool. Captures & Crack 4-way handshake and PMKID key. Also, supports a deauthentication/jammer mode for stress testing
- GoVanguard/legion

Legion is an open source, easy-to-use, super-extensible and semi-automated network penetration testing tool that aids in discovery, reconnaissance and exploitation of information systems.
- EnableSecurity/sipvicious

SIPVicious OSS has been around since 2007 and is actively updated to help security teams, QA and developers test SIP-based VoIP systems and applications.
- deepchecks/deepchecks

Test Suites for Validating ML Models & Data. Deepchecks is a Python package for comprehensively validating your machine learning models and data with minimal effort.
- microsoft/dowhy

DoWhy is a Python library for causal inference that supports explicit modeling and testing of causal assumptions. DoWhy is based on a unified language for causal inference, combining causal graphical models and potential outcomes frameworks.
- YudeWang/deeplabv3plus-pytorch

Here is a pytorch implementation of deeplabv3+ supporting ResNet(79.155%) and Xception(79.945%). Multi-scale & flip test and COCO dataset interface has been finished.
- james-atkinson/speedcomplainer

A python app that will test your internet connection and then complain to your service provider (and log to a data store if you'd like)
- flyteorg/flyte

Kubernetes-native workflow automation platform for complex, mission-critical data and ML processes at scale. It has been battle-tested at Lyft, Spotify, Freenome, and others and is truly open-source.
- galkan/crowbar

Crowbar is brute forcing tool that can be used during penetration tests. It is developed to support protocols that are not currently supported by thc-hydra and other popular brute forcing tools.
- bslatkin/dpxdt

Make continuous deployment safe by comparing before and after webpage screenshots for each release. Depicted shows when any visual, perceptual differences are found. This is the ultimate, automated end-to-end test.
- xtiankisutsa/MARA_Framework

MARA is a Mobile Application Reverse engineering and Analysis Framework. It is a toolkit that puts together commonly used mobile application reverse engineering and analysis tools to assist in testing mobile applications against the OWASP mobile security threats.
- Quitten/Autorize

Automatic authorization enforcement detection extension for burp suite written in Jython developed by Barak Tawily in order to ease application security people work and allow them perform an automatic authorization tests
- HXSecurity/DongTai

DongTai is an interactive application security testing(IAST) product that supports the detection of OWASP WEB TOP 10 vulnerabilities, multi-request related vulnerabilities (including logic vulnerabilities, unauthorized access vulnerabilities, etc.), third-party component vulnerabilities, etc.
- bhdresh/CVE-2017-0199

Exploit toolkit CVE-2017-0199 - v4.0 is a handy python script which provides pentesters and security researchers a quick and effective way to test Microsoft Office RCE. It could generate a malicious RTF/PPSX file and deliver metasploit / meterpreter / other payload to victim without any complex configuration.
- screetsec/BruteSploit

BruteSploit is a collection of method for automated Generate, Bruteforce and Manipulation wordlist with interactive shell. That can be used during a penetration test to enumerate and maybe can be used in CTF for manipulation,combine,transform and permutation some words or file text :p
- cirosantilli/linux-kernel-module-cheat

The perfect emulation setup to study and develop the Linux kernel v5.4.3, kernel modules, QEMU, gem5 and x86_64, ARMv7 and ARMv8 userland and baremetal assembly, ANSI C, C++ and POSIX. GDB step debug and KGDB just work. Powered by Buildroot and crosstool-NG. Highly automated. Thoroughly documented. Automated tests. "Tested" in an Ubuntu 19.10 host.
Linux
2017-08-05
dd if=/dev/zero of=cdata.img bs=1G count=5
mkfs ext4 -F cdata.img
LANG=en fdisk -lu cdata.img
sudo mount -o loop cdata.img /mnt/iso
sudo umount /mnt/iso
计算机网络
2017-08-03
相关文章:
一、概念
不知道为了什么,IEEE 设计了一个 64 位的地址方案,称之为 EUI-64 (Extended Unique Identifier)。
MAC 地址这种又被称之为 EUI-48,确切的说,应该是 MAC 地址是 EUI-48 格式。
目前已知的区别:
- MAC 地址的概念只存在二层计算机网络。
而 EUI 不止被用于 IEEE 802 协议(局域网和城域网),可以用于其他类型设备,比如蓝牙。
TODO: 需要一些调查研究。
MAC To EUI64
就是在 OUI 和设备号之间插入 FFFE 即可。
xx:xx:xx:yy:yy:yy
xx:xx:xx:ff:fe:yy:yy:yy
二、场景
根据维基百科,
采用 EUI-48 格式的场景
- IEEE 802 网络
- 以太网
- 802.11 无线网络(Wi-Fi)
- 蓝牙
- IEEE 802.5 令牌环
- 光纤分布式数据接口(FDDI)
- 异步传输模式(ATM),仅作为NSAP 地址的一部分交换虚拟连接
- 光纤通道(FC)和串行连接的 SCSI(SAS)
- ITU-T G.hn 标准
使用现有家庭布线(电力线、电话线和同轴电缆)创建千兆局域网。
采用 EUI-64 格式的场景
- IEEE 1394 (FireWire),苹果公司和索尼、松下等公司开发的一种串行总线技术
- InfiniBand,一种高性能网络标准(高吞吐,低延迟)
- IPv6
- ZigBee / 802.15.4 / 6LoWPAN
PS: 6LoWPAN: IPv6 over Low-Power Wireless Personal Area Networks, 低功耗无线个人局域网 IPv6
- IEEE 11073-20601
三、IPv6 中的应用
Update @ 2021-12-30
在 IPv6 的文档中频繁看到这个词。
无状态自动配置机制中:
- MAC 转 EUI-64
- U/L 位(首字节低二位)设位 1, 表示本地地址
开发者 国际标准
2017-07-24
日常使用
中国人习惯年月日时分秒,这可能也是一般符合国际通行规范的时间格式。
yymmdd
yyyymmdd
yyyy-mm-dd hh:mm:ss
yyyy/mm/dd hh:mm:ss
如果加上毫秒/微秒,在秒后面接上 ,SSS
或 .SSS
就行。
但是由于英美的国际地位,以及由于历史原因而导致的英语的强势地位,英文国家的表述习惯也不能不考虑,
- May 4, 1919 美式英语,读 may forth nineteen nineteen
- 4 May, 1919 英式英语
用阿拉伯数字表示的话,可以用小数点、横杠、斜杠连接,数字可以用前导 0,
不过有一点很悲剧了,5/4/1919
,如果不清楚上下文语境中的文化背景,谁 TM 知道应该算五四,还是四五。
Unix 时间戳
Unix Timestamp
又叫 Unix 时间(Unix Time),又叫 POSIX 时间(POSIX Time),又叫 Epoch Time。
以 UTC+0:00 1970/01/01 00:00:00 为起点,至今的秒数就是时间戳的值。
实际上我在很多项目中用到的时间戳都没有考虑时区,直接用当前系统默认时区的 1970/01/01 00:00:00 为起点,或者说是把当前时区时间当作零时区时间。
RFC2822
Internet Message Format, 邮件格式
date-time = [ day-of-week "," ] date FWS time [CFWS]
day-of-week = ([FWS] day-name) / obs-day-of-week
day-name = "Mon" / "Tue" / "Wed" / "Thu" /
"Fri" / "Sat" / "Sun"
date = day month year
year = 4*DIGIT / obs-year
month = (FWS month-name FWS) / obs-month
month-name = "Jan" / "Feb" / "Mar" / "Apr" /
"May" / "Jun" / "Jul" / "Aug" /
"Sep" / "Oct" / "Nov" / "Dec"
day = ([FWS] 1*2DIGIT) / obs-day
time = time-of-day FWS zone
time-of-day = hour ":" minute [ ":" second ]
hour = 2DIGIT / obs-hour
minute = 2DIGIT / obs-minute
second = 2DIGIT / obs-second
zone = (( "+" / "-" ) 4DIGIT) / obs-zone
1992/02/12 12:23:22+0800
Wed, 21 Jul 2017 10:35:00 +0000 (UTC)
Wed, 21 Jul 2017 18:35:19 +0800 (CST)
Wed, 21 Jul 2017 03:35:02 -0700 (PDT)
import time
import datetime
time.strftime('%a, %d %b %Y %H:%M:%S %z') # local timezone
time.strftime('%a, %d %b %Y %H:%M:%S %z', time.gmtime()) # UTC
tz_e8 = datetime.timezone(datetime.timedelta(hours=8)) # +08:00
dt_e8 = datetime.datetime.now(tz_e8)
print(dt_e8)
print(dt_e8.strftime('%a, %d %b %Y %H:%M:%S %z'))
tz_w8 = datetime.timezone(datetime.timedelta(hours=-8)) # -08:00
dt_w8 = datetime.datetime.now(tz_w8)
print(dt_w8.strftime('%a, %d %b %Y %H:%M:%S %z'))
# dt_e8.strftime('%Y-%m-%d %H:%M:%S.%f')
ISO8601
约定了时间中各个部分的格式,比如年份应该采用四位数字,日期应该怎么表示,时间范围(比如一个月),循环时间,时间区间应该如何表示之类,是一份完整的时间相关规范。
对应的中国国家标准是 GB/T 7408-2005
。
比如我们要说的完整时间格式化就有几种允许的格式,下面就是常见的一种符合规范的表述:
YYYY-MM-DDThh:mm:ss+offset
例如:
2004-05-03T17:30:08Z
2004-05-03T17:30:08+08:00
其他
JavaScript 日期输出:
Sat Jul 24 2017 15:42:49 GMT+0800 (中国标准时间)
Python datatime 类型转字符串:
2017-07-25 12:09:39.123173+08:00
网络代理 Socks
2017-06-09
:) 本文正在编辑中,暂时不提供浏览...
网络代理 HTTP
2017-06-08
:) 本文正在编辑中,暂时不提供浏览...
个人
2017-05-18
基本规则:
- 宽高比为 $\sqrt{2}$
- 精度为毫米(舍弃小数部分)
不同系列:
- A 系列:以面积为 1 平方米的纸张为 A0,每次于长边对切,分别得到 A1,A2...
- B 系列:宽边为 1 米的纸张编号 B0,,每次于长边对切,分别得到 B1,B2...
- C 系列:A 系列和 B 系列的几何平均,比如 C0 的尺寸是 $(\sqrt{W_{A0} \times W_{B0}}, \sqrt{H_{A0} \times H_{B0}})$
- 这样的话,C 系列尺寸介于 A,B 之间,A 系列纸张可以放入 C 系列同一编号的信封、文件袋中。
计算下来:
| Size | A | B | C |
|------|-------------|-------------|-------------|
| 0 | 841 × 1189 | 1000 × 1414 | 917 × 1297 |
| 1 | 594 × 841 | 707 × 1000 | 648 × 917 |
| 2 | 420 × 594 | 500 × 707 | 458 × 648 |
| 3 | 297 × 420 | 353 × 500 | 324 × 458 |
| 4 | 210 × 297 | 250 × 353 | 229 × 324 |
| 5 | 148 × 210 | 176 × 250 | 162 × 229 |
| 6 | 105 × 148 | 125 × 176 | 114 × 162 |
| 7 | 74 × 105 | 88 × 125 | 81 × 114 |
| 8 | 52 × 74 | 62 × 88 | 57 × 81 |
| 9 | 37 × 52 | 44 × 62 | 40 × 57 |
| 10 | 26 × 37 | 31 × 44 | 28 × 40 |

国标
国标中没有定义 C 系列,但是有一个 D 系列,其尺寸定义的依据不明。
但我们经常在本子上看到的 16 开,32 开这样的字眼就从这里来的。
- 国标规定 D 系列原纸尺寸为 787mm x 1092mm
- $(W_{D1}, H_{D1}) = (\frac{H_{D0}}{2}, W_{D0} - 4)$
Series |
Size |
称呼 |
D0 |
764 X 1064 |
全开 |
D1 |
532 X 760 |
半开 |
D2 |
380 X 528 |
4 开 |
D3 |
264 X 376 |
8 开 |
D4 |
188 X 260 |
16 开 |
D5 |
130 X 184 |
32 开 |
D6 |
92 X 126 |
64 开 |
北美标准(ANSI)
打印的时候经常可以看到。
