- GET Requests
- POST/PUT Requests
This file contains hidden or 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 collections | |
| import csv | |
| from datetime import datetime | |
| def analytic_1(): | |
| site_dict = collections.defaultdict(set) | |
| largest_number, site_ids = 0, [] | |
| with open('SWE sample data - Q3 data.csv') as csv_file: | |
| csv_reader = csv.reader(csv_file) | |
| for row in csv_reader: |
This file contains hidden or 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 collections | |
| import csv | |
| import json | |
| def mostPopularProduct(): | |
| number_of_purchasers = collections.defaultdict(int) | |
| quantity_of_goods = collections.defaultdict(int) | |
| most_purchasers, most_quantities = 0, 0 | |
| most_purchasers_prod_ids, most_quantities_prod_ids = [], [] | |
| with open('SWE sample data - Q2 data.csv') as csv_file: |
This file contains hidden or 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
| def equalsWhenOneCharRemoved(x, y): | |
| i, j = len(x), len(y) | |
| if abs(i - j) == 1: | |
| for k in range(max(i, j)): | |
| if x[k] != y[k]: | |
| return equalsWhenOneCharRemoved(x[k+1:], y[k:]) or \ | |
| equalsWhenOneCharRemoved(x[k:], y[k+1:]) | |
| elif i == j: | |
| for k in range(i): | |
| if x[k] != y[k]: |
This file contains hidden or 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
| Latency Comparison Numbers | |
| -------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
使用公钥私钥来登陆而不是账号密码,公钥私钥需要简单的在本地生成一下。Github 的生成 SSH 公钥私钥的教程:Generating SSH keys
可能需要使用 -i 参数选择一下本地的私钥,一个示例的 ssh 连接如下:
This file contains hidden or 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 smtplib | |
| from getpass import getpass | |
| def prompt(prompt): | |
| return input(prompt).strip() | |
| fromaddr = prompt("From: ") | |
| toaddrs = prompt("To: ").split() | |
| subject = prompt("Subject: ") | |
| print("Enter message, end with ^D (Unix) or ^Z (Windows):") |