Skip to content

Instantly share code, notes, and snippets.

View liudong's full-sized avatar

Dong LIU liudong

  • Manchester, United Kingdom
View GitHub Profile
@rongjiecomputer
rongjiecomputer / cano-trim.py
Created June 4, 2016 08:50
Python code to trim raw text of Complete Sherlock Holmes
"""
Original raw text:
http://sherlock-holm.es/ascii/
Trimmed Format:
- Each line is a complete paragraph.
- Each line is ended with two new line characters ('\n\n') (including the last line).
- Disclaimer at the end of the raw text is not deleted, you need to delete it yourself.
"""
@karpathy
karpathy / min-char-rnn.py
Last active April 26, 2024 11:55
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@sailor
sailor / Vagrantfile
Created March 25, 2015 13:09
Vagrantfile for Rails development environment
VAGRANTFILE_API_VERSION = '2'
$install = <<SCRIPT
curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > /usr/local/bin/fig
chmod +x /usr/local/bin/fig
SCRIPT
$build = <<SCRIPT
cd /vagrant
fig build
@bwhite
bwhite / rank_metrics.py
Created September 15, 2012 03:23
Ranking Metrics
"""Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf
Learning to Rank for Information Retrieval (Tie-Yan Liu)
"""
import numpy as np
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
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