Skip to content

Instantly share code, notes, and snippets.

View pczzy's full-sized avatar

zhang peng pczzy

  • Sina.com
  • Ideal Plaza, 18F, 58 Bei si huan xi Road, Haidian District, Beijing 100080,China
View GitHub Profile
@pczzy
pczzy / understanding-word-vectors.ipynb
Created March 3, 2018 01:05 — forked from aparrish/understanding-word-vectors.ipynb
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pczzy
pczzy / markdown-to-email
Created November 16, 2016 06:28 — forked from cleverdevil/markdown-to-email
markdown-to-email A simple script to send beautifully formatted emails that you write in Markdown. The email will have an HTML payload and a plain-text alternative, so you'll make everyone happy, including yourself.
#!/usr/bin/env python
'''
Send an multipart email with HTML and plain text alternatives. The message
should be constructed as a plain-text file of the following format:
From: Your Name <[email protected]>
To: Recipient One <[email protected]>
Subject: Your subject line
---
@pczzy
pczzy / latency.markdown
Created October 9, 2016 03:20 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@pczzy
pczzy / System Design.md
Created April 19, 2016 03:11 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
"""Plot the performance of a AdaBoost classifer with two data formats.
Charts the trainning time of a AdaBoost classifier on 20newsgroups data
represented in both sparse and dense format as the number of features
used in the data grows.
"""
from scipy import sparse
import time
import random
from sklearn.datasets import fetch_20newsgroups