Skip to content

Instantly share code, notes, and snippets.

View actsasgeek's full-sized avatar

Stephyn Butcher actsasgeek

View GitHub Profile
@sainathadapa
sainathadapa / glimpse.py
Last active December 19, 2023 15:33
glimpse-python
def glimpse(df, maxvals=10, maxlen=110):
print('Shape: ', df.shape)
def pad(y):
max_len = max([len(x) for x in y])
return [x.ljust(max_len) for x in y]
# Column Name
toprnt = pad(df.columns.tolist())
@akesling
akesling / mnist.py
Last active June 28, 2023 21:13
MNist loading helper for Python 2.7. For Python 3.x, see https://gist.github.com/akesling/42393ccb868125071fdea77d98a0d2f0
import os
import struct
import numpy as np
"""
MNist loading helper for Python 2.7.
For Python 3.x, see https://gist.github.com/akesling/42393ccb868125071fdea77d98a0d2f0
Loosely inspired by http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py
@jboner
jboner / latency.txt
Last active July 22, 2024 14:44
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
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