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
''' | |
Small tutorial example for `argparse`. | |
For details, check out | |
1. https://docs.python.org/3.9/howto/argparse.html | |
2. https://docs.python.org/3.9/library/argparse.html | |
''' | |
from argparse import ArgumentParser |
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
[2021-09-19T00:13:13+0800] [PACMAN] Running 'pacman -Syyy' | |
[2021-09-19T00:13:13+0800] [PACMAN] synchronizing package lists | |
[2021-09-19T00:13:41+0800] [PACMAN] Running 'pacman -Syyu' | |
[2021-09-19T00:13:41+0800] [PACMAN] synchronizing package lists | |
[2021-09-19T00:14:04+0800] [PACMAN] starting full system upgrade | |
[2021-09-19T08:17:35+0800] [PACMAN] Running 'pacman -Syyu' | |
[2021-09-19T08:17:35+0800] [PACMAN] synchronizing package lists | |
[2021-09-19T08:17:40+0800] [PACMAN] starting full system upgrade | |
[2021-09-19T08:21:40+0800] [ALPM] running '60-mkinitcpio-remove.hook'... | |
[2021-09-19T08:21:40+0800] [ALPM] transaction started |
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
-- Journal begins at Sun 2021-05-30 17:35:35 CST, ends at Mon 2021-09-20 13:26:37 CST. -- | |
Sep 20 13:13:02 dreamland kernel: Linux version 5.14.5-arch1-1 (linux@archlinux) (gcc (GCC) 11.1.0, GNU ld (GNU Binutils) 2.36.1) #1 SMP PREEMPT Thu, 16 Sep 2021 11:02:40 +0000 | |
Sep 20 13:13:02 dreamland kernel: Command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=9a8695fa-dd04-4dc2-8319-a141528d45fe rw loglevel=3 quiet | |
Sep 20 13:13:02 dreamland kernel: x86/split lock detection: #AC: crashing the kernel on kernel split_locks and warning on user-space split_locks | |
Sep 20 13:13:02 dreamland kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' | |
Sep 20 13:13:02 dreamland kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' | |
Sep 20 13:13:02 dreamland kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' | |
Sep 20 13:13:02 dreamland kernel: x86/fpu: Supporting XSAVE feature 0x020: 'AVX-512 opmask' | |
Sep 20 13:13:02 dreamland kernel: x86/fpu: Supporting XSAVE feature 0x040: 'AVX-512 Hi256' |
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
Sep 12 11:38:57 dreamland systemd-logind[364]: Lid closed. | |
Sep 12 11:38:57 dreamland systemd-logind[364]: Suspending... | |
Sep 12 11:38:57 dreamland NetworkManager[363]: <info> [1631417937.0644] manager: sleep: sleep requested (sleeping: no enabled: yes) | |
Sep 12 11:38:57 dreamland NetworkManager[363]: <info> [1631417937.0645] device (p2p-dev-wlp0s20f3): state change: disconnected -> unmanaged (reason 'sleeping', sys-iface-state: 'managed') | |
Sep 12 11:38:57 dreamland NetworkManager[363]: <info> [1631417937.0652] manager: NetworkManager state is now ASLEEP | |
Sep 12 11:38:57 dreamland NetworkManager[363]: <info> [1631417937.0654] device (wlp0s20f3): state change: activated -> deactivating (reason 'sleeping', sys-iface-state: 'managed') | |
Sep 12 11:38:57 dreamland dbus-daemon[362]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.3' (uid=0 pid=363 comm="/usr/bin/NetworkManager --no-daemon ") | |
Sep 12 11:38:57 dreamland syste |
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
# 给定数字数组和一个目标整数,在数组中找到和为目标值的两个数字,并返回下标。 | |
# 重点是答案里不能是同一个元素,所以要考虑目标值是某个数字两倍的情况。 | |
# 1. Brute Force, O(n^2) & O(1) | |
def two_sum(nums: list, target: int) -> list: | |
'''记得循环下标而不是数组本身。''' | |
length = len(nums) | |
for i in range(length): |